Skip to content

Commit 3ad242e

Browse files
authored
Merge pull request #3461 from ControlSystemStudio/CSSTUDIO-3270
CSSTUDIO-3270 Add Layout: Move existing instance of DisplayRuntime to the layout that is added.
2 parents 921b287 + 2cc9eff commit 3ad242e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

core/ui/src/main/java/org/phoebus/ui/internal/MementoHelper.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,27 @@ private static void restoreApplication(final MementoTree item_memento, final Doc
299299
{
300300
DockPane.setActiveDockPane(pane);
301301
final AppInstance instance;
302-
if (app instanceof AppResourceDescriptor)
302+
if (app.getName().equals("display_runtime")) {
303+
String input = item_memento.getString(INPUT_URI).orElse(null);
304+
if (input != null) {
305+
URI inputURI = URI.create(input);
306+
DockItemWithInput existing = DockStage.getDockItemWithInput("display_runtime", inputURI);
307+
308+
if (existing != null) {
309+
instance = existing.getApplication();
310+
existing.getDockPane().getTabs().remove(existing);
311+
pane.getTabs().add(existing);
312+
existing.select();
313+
}
314+
else {
315+
instance = ((AppResourceDescriptor) app).create(inputURI);
316+
}
317+
}
318+
else {
319+
instance = app.create();
320+
}
321+
}
322+
else if (app instanceof AppResourceDescriptor)
303323
{
304324
final AppResourceDescriptor app_res = (AppResourceDescriptor) app;
305325
final String input = item_memento.getString(INPUT_URI).orElse(null);

0 commit comments

Comments
 (0)