X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=org.argeo.suite.ui%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fui%2FSuiteUi.java;h=d93c3a8b38eb54de555474f13853e6d72646b28b;hp=cad5a9b994e093dce57c08c18dc147e630f54686;hb=377d822958ec57c8fe39716d8af129c3ff258eaf;hpb=25ed06d42600a81063515220c51ac2d93fefa27a diff --git a/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java b/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java index cad5a9b..d93c3a8 100644 --- a/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java +++ b/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java @@ -90,15 +90,16 @@ class SuiteUi extends Composite { private Composite getLayer(String id, Node context) { if (!layers.containsKey(id)) - throw new IllegalArgumentException("No layer " + id + " is available."); + return null; if (!workAreas.containsKey(id)) initLayer(id, layers.get(id), context); return workAreas.get(id); } Composite switchToLayer(String layerId, Node context) { + Composite current = null; if (currentLayerId != null) { - Composite current = getCurrentWorkArea(); + current = getCurrentWorkArea(); if (currentLayerId.equals(layerId)) return current; } @@ -107,16 +108,20 @@ class SuiteUi extends Composite { context = userDir; } Composite toShow = getLayer(layerId, context); - currentLayerId = layerId; - if (!isDisposed()) - getDisplay().syncExec(() -> { - if (!toShow.isDisposed()) - toShow.moveAbove(null); - else - log.warn("Cannot show work area because it is disposed."); - dynamicArea.layout(true, true); - }); - return toShow; + if (toShow != null) { + currentLayerId = layerId; + if (!isDisposed()) + getDisplay().syncExec(() -> { + if (!toShow.isDisposed()) + toShow.moveAbove(null); + else + log.warn("Cannot show work area because it is disposed."); + dynamicArea.layout(true, true); + }); + return toShow; + } else { + return current; + } } Composite switchToLayer(SuiteLayer layer, Node context) {