diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java
index b93c12e41d..df1d5d2957 100644
--- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java
+++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java
@@ -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.");
diff --git a/core/ui/src/main/java/org/phoebus/ui/application/PhoebusApplication.java b/core/ui/src/main/java/org/phoebus/ui/application/PhoebusApplication.java
index 79c84e8372..e069b81637 100644
--- a/core/ui/src/main/java/org/phoebus/ui/application/PhoebusApplication.java
+++ b/core/ui/src/main/java/org/phoebus/ui/application/PhoebusApplication.java
@@ -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();
@@ -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 null if none found
*/
- private MementoTree loadDefaultMemento(final JobMonitor monitor)
+ private MementoTree loadDefaultMemento(final List 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() - 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);