// Initialise Workbench state to that of the provided perspective private void initialisePerspective(final PerspectiveDefinition perspective) { panelManager.setPerspective(perspective); Set<PartDefinition> parts = panelManager.getRoot().getParts(); for (PartDefinition part : parts) { final PlaceRequest place = clonePlaceAndMergeParameters(part.getPlace()); part.setPlace(place); placeManager.goTo(part, panelManager.getRoot()); } buildPerspective(panelManager.getRoot()); onOpen(); }
// Save the current state of the Workbench private void saveState() { onClose(); final PerspectiveDefinition perspective = panelManager.getPerspective(); if (perspective == null) { // On startup the Workbench has not been set to contain a perspective loadState(); } else if (perspective.isTransient()) { // Transient Perspectives are not saved placeManager.closeAllPlaces(); loadState(); } else { // Save first, then close all places before loading persisted state wbServices .call( new RemoteCallback<Void>() { @Override public void callback(Void response) { placeManager.closeAllPlaces(); loadState(); } }) .save(perspective); } }
private void buildPerspective(final PanelDefinition panel) { for (PanelDefinition child : panel.getChildren()) { final PanelDefinition target = panelManager.addWorkbenchPanel(panel, child, child.getPosition()); addChildren(target); } }