コード例 #1
0
  // 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);
    }
  }
コード例 #2
0
  // 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());
    }
  }