return new StructureCommand(
"load FILES \"" + Platform.escapeBackslashes(file) + "\"");
}
+ @Override
+ public StructureCommandI restoreSession(String filePath)
+ {
+ return new StructureCommand(
+ "restore STATE \"" + Platform.escapeBackslashes(filePath) + "\"");
+ }
/**
* Obsolete method, only referenced from
{
return null;
}
+
+ @Override
+ public StructureCommandI restoreSession(String filePath)
+ {
+ return loadFile(filePath);
+ }
}
* @return
*/
StructureCommandI openSession(String filepath);
+
+ /**
+ * Returns command to restore a previously saved version of an existing structure viewer session file.
+ * Default implementation calls 'openSession'
+ * @param filePath
+ * @return
+ */
+ StructureCommandI restoreSession(String filePath);
+
/**
* Returns a command to ask the viewer to close down
return f;
}
+
+ /**
+ * Use restoreSession when you want to restore a previously saved sesssion to
+ * the running viewer instance.
+ *
+ * @param absolutePath
+ */
+ public void restoreSession(String absolutePath)
+ {
+ String prefix = getViewerType().toString();
+ try {
+
+ StructureCommandI cmd = commandGenerator.restoreSession(absolutePath);
+ if (cmd != null)
+ {
+ executeCommand(cmd, false);
+ }
+ } catch (Throwable e)
+ {
+ Console.error(String.format("Error restoring %s session: %s", prefix,
+ e.toString()));
+ }
+
+ }
+
/**
* Saves the structure viewer session to the given file
*