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;
}
context = userDir;
}
Composite toShow = getLayer(layerId, context);
- currentLayerId = layerId;
- if (!isDisposed())
- getDisplay().syncExec(() -> {
- if (!toShow.isDisposed())
+ if (toShow != null) {
+ currentLayerId = layerId;
+ if (!isDisposed()) {
+// getDisplay().syncExec(() -> {
+ if (!toShow.isDisposed()) {
toShow.moveAbove(null);
- else
+ } else {
log.warn("Cannot show work area because it is disposed.");
+ toShow = initLayer(layerId, layers.get(layerId), context);
+ toShow.moveAbove(null);
+ }
dynamicArea.layout(true, true);
- });
- return toShow;
+// });
+ }
+ return toShow;
+ } else {
+ return current;
+ }
}
Composite switchToLayer(SuiteLayer layer, Node context) {