// Load the persisted state of the Workbench or use the default Perspective definition if no saved // state found private void loadState() { // Call OnStartup before getting the Perspective definition in case any setup is required by // @WorkbenchPerspective's onStartup(place); final PerspectiveDefinition perspective = getPerspective(); if (perspective.isTransient()) { // Transient Perspectives are not saved and hence cannot be loaded initialisePerspective(perspective); } else { wbServices .call( new RemoteCallback<PerspectiveDefinition>() { @Override public void callback(PerspectiveDefinition response) { if (response == null) { initialisePerspective(perspective); } else { initialisePerspective(response); } } }) .load(perspective.getName()); } }
@Test public void checkPerspectiveDefinition() { final ServerManagementPerspective perspective = new ServerManagementPerspective(); final PerspectiveDefinition definition = perspective.buildPerspective(); assertNotNull(definition); assertEquals("ServerManagementPerspective", definition.getName()); assertEquals( SimpleWorkbenchPanelPresenter.class.getName(), definition.getRoot().getPanelType()); assertEquals(1, definition.getRoot().getParts().size()); final PartDefinition partDefinition = definition.getRoot().getParts().iterator().next(); assertTrue(partDefinition.getPlace() instanceof DefaultPlaceRequest); assertEquals("ServerManagementBrowser", partDefinition.getPlace().getIdentifier()); }