Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ private static void help()
System.out.println("-server port - Create instance server on given TCP port");
System.out.println("-app probe - Launch an application with input arguments");
System.out.println("-resource /tmp/example.plt - Open an application configuration file with the default application");
System.out.println("-layout /path/to/Example.memento - Start with the specified saved layout instead of the default 'memento'");
System.out.println("-main org.package.Main - Run alternate application Main");
System.out.println();
System.out.println("In 'server' mode, first instance opens UI.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private void backgroundStartup(final JobMonitor monitor, final Splash splash) th

// Load saved state (slow file access) off UI thread, allocating 30% to that
monitor.beginTask(Messages.MonitorTaskSave);
final MementoTree memento = loadDefaultMemento(new SubJobMonitor(monitor, 30));
final MementoTree memento = loadDefaultMemento(getParameters().getRaw(), new SubJobMonitor(monitor, 30));

// Trigger initialization of authentication service
AuthorizationService.init();
Expand Down Expand Up @@ -964,15 +964,24 @@ private void replaceLayout(final MementoTree memento)
});
}

/** @param monitor {@link JobMonitor}
/** @param parameters Command line parameters that may contain '-layout /path/to/Example.memento'
* @param monitor {@link JobMonitor}
* @return Memento for previously persisted state or <code>null</code> if none found
*/
private MementoTree loadDefaultMemento(final JobMonitor monitor)
private MementoTree loadDefaultMemento(final List<String> parameters, final JobMonitor monitor)
{
monitor.beginTask(Messages.MonitorTaskPers, 1);
final File memfile = XMLMementoTree.getDefaultFile();
File memfile = XMLMementoTree.getDefaultFile();
try
{
for (int i=0; i<parameters.size(); ++i)
if ("-layout".equals(parameters.get(i)))
{
if (i >= parameters.size() - 1)
throw new Exception("Missing /path/to/Example.memento for -layout option");
memfile = new File(parameters.get(i+1));
break;
}
if (memfile.canRead())
{
logger.log(Level.INFO, "Loading state from " + memfile);
Expand Down