コード例 #1
0
ファイル: EditorHistoryItem.java プロジェクト: oaperez/rap
  /** Restores the object state from the memento. */
  public IStatus restoreState() {
    Assert.isTrue(!isRestored());

    IStatus result = Status.OK_STATUS;
    IMemento memento = this.memento;
    this.memento = null;

    String factoryId = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
    if (factoryId == null) {
      WorkbenchPlugin.log("Unable to restore mru list - no input factory ID."); // $NON-NLS-1$
      return result;
    }
    IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryId);
    if (factory == null) {
      return result;
    }
    IMemento persistableMemento = memento.getChild(IWorkbenchConstants.TAG_PERSISTABLE);
    if (persistableMemento == null) {
      WorkbenchPlugin.log(
          "Unable to restore mru list - no input element state: " + factoryId); // $NON-NLS-1$
      return result;
    }
    IAdaptable adaptable = factory.createElement(persistableMemento);
    if (adaptable == null || (adaptable instanceof IEditorInput) == false) {
      return result;
    }
    input = (IEditorInput) adaptable;
    // Get the editor descriptor.
    String editorId = memento.getString(IWorkbenchConstants.TAG_ID);
    if (editorId != null) {
      IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
      descriptor = registry.findEditor(editorId);
    }
    return result;
  }
コード例 #2
0
  public final void dispose() {

    if (isDisposed()) {
      return;
    }

    // Store the current title, tooltip, etc. so that anyone that they can be returned to
    // anyone that held on to the disposed reference.
    partName = getPartName();
    contentDescription = getContentDescription();
    tooltip = getTitleToolTip();
    title = getTitle();

    if (state == STATE_CREATION_IN_PROGRESS) {
      IStatus result =
          WorkbenchPlugin.getStatus(
              new PartInitException(
                  NLS.bind(
                      "Warning: Blocked recursive attempt by part {0} to dispose itself during creation", //$NON-NLS-1$
                      getId())));
      WorkbenchPlugin.log(result);
      return;
    }

    doDisposeNestedParts();

    // Disposing the pane disposes the part's widgets. The part's widgets need to be disposed before
    // the part itself.
    if (pane != null) {
      // Remove the dispose listener since this is the correct place for the widgets to get disposed
      Control targetControl = getPane().getControl();
      if (targetControl != null) {
        targetControl.removeDisposeListener(prematureDisposeListener);
      }
      pane.dispose();
    }

    doDisposePart();

    if (pane != null) {
      pane.removeContributions();
    }

    clearListenerList(internalPropChangeListeners);
    clearListenerList(partChangeListeners);
    Image oldImage = image;
    ImageDescriptor oldDescriptor = imageDescriptor;
    image = null;

    state = STATE_DISPOSED;
    imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    defaultImageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    immediateFirePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
    clearListenerList(propChangeListeners);

    if (oldImage != null) {
      JFaceResources.getResources().destroy(oldDescriptor);
    }
  }
コード例 #3
0
  public final IWorkbenchPart getPart(boolean restore) {
    if (isDisposed()) {
      return null;
    }

    if (part == null && restore) {

      if (state == STATE_CREATION_IN_PROGRESS) {
        IStatus result =
            WorkbenchPlugin.getStatus(
                new PartInitException(
                    NLS.bind(
                        "Warning: Detected recursive attempt by part {0} to create itself (this is probably, but not necessarily, a bug)", //$NON-NLS-1$
                        getId())));
        WorkbenchPlugin.log(result);
        return null;
      }

      try {
        state = STATE_CREATION_IN_PROGRESS;

        IWorkbenchPart newPart = createPart();
        if (newPart != null) {
          part = newPart;
          // Add a dispose listener to the part. This dispose listener does nothing but log an
          // exception
          // if the part's widgets get disposed unexpectedly. The workbench part reference is the
          // only
          // object that should dispose this control, and it will remove the listener before it does
          // so.
          getPane().getControl().addDisposeListener(prematureDisposeListener);
          part.addPropertyListener(propertyChangeListener);
          if (part instanceof IWorkbenchPart3) {
            ((IWorkbenchPart3) part).addPartPropertyListener(partPropertyChangeListener);
          }

          refreshFromPart();
          releaseReferences();

          fireInternalPropertyChange(INTERNAL_PROPERTY_OPENED);

          ISizeProvider sizeProvider = (ISizeProvider) Util.getAdapter(part, ISizeProvider.class);
          if (sizeProvider != null) {
            // If this part has a preferred size, indicate that the preferred size may have changed
            // at this point
            if (sizeProvider.getSizeFlags(true) != 0 || sizeProvider.getSizeFlags(false) != 0) {
              fireInternalPropertyChange(IWorkbenchPartConstants.PROP_PREFERRED_SIZE);
            }
          }
        }
      } finally {
        state = STATE_CREATED;
      }
    }

    return part;
  }
コード例 #4
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
   */
  public void init(IViewSite site, IMemento memento) throws PartInitException {
    super.init(site);
    Workbench workbench = (Workbench) site.getWorkbenchWindow().getWorkbench();
    try {
      introPart = workbench.getWorkbenchIntroManager().createNewIntroPart();
      // reset the part name of this view to be that of the intro title
      setPartName(introPart.getTitle());
      introPart.addPropertyListener(
          new IPropertyListener() {
            public void propertyChanged(Object source, int propId) {
              firePropertyChange(propId);
            }
          });
      introSite = new ViewIntroAdapterSite(site, workbench.getIntroDescriptor());
      introPart.init(introSite, memento);

    } catch (CoreException e) {
      WorkbenchPlugin.log(
          IntroMessages.Intro_could_not_create_proxy,
          new Status(
              IStatus.ERROR,
              WorkbenchPlugin.PI_WORKBENCH,
              IStatus.ERROR,
              IntroMessages.Intro_could_not_create_proxy,
              e));
    }
  }
コード例 #5
0
  /**
   * Return the working set descriptor for this working set.
   *
   * @param defaultId the default working set type ID to use if this set has no defined type
   * @return the descriptor for this working set or <code>null</code> if it cannot be determined
   * @since 3.3
   */
  private WorkingSetDescriptor getDescriptor(String defaultId) {
    WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
    String id = getId();
    if (id == null) id = defaultId;
    if (id == null) return null;

    return registry.getWorkingSetDescriptor(id);
  }
コード例 #6
0
  public void registerAction(IAction action) {
    if (disposed) {
      return;
    }

    if (action instanceof CommandLegacyActionWrapper) {
      // this is a registration of a fake action for an already
      // registered handler
      WorkbenchPlugin.log(
          "Cannot register a CommandLegacyActionWrapper back into the system"); //$NON-NLS-1$
      return;
    }

    if (action instanceof CommandAction) {
      // we unfortunately had to allow these out into the wild, but they
      // still must not feed back into the system
      return;
    }

    unregisterAction(action);
    String commandId = action.getActionDefinitionId();
    if (commandId != null) {
      /*
       * If I have a parent and I'm active, de-activate myself while
       * making changes.
       */
      boolean active = false;
      if ((parent != null) && (parent.activeService == this)) {
        active = true;
        parent.deactivateNestedService();
      }

      // Create the new submission
      IHandler handler = new ActionHandler(action);
      HandlerSubmission handlerSubmission =
          new HandlerSubmission(
              null,
              workbenchPartSite.getShell(),
              workbenchPartSite,
              commandId,
              handler,
              Priority.MEDIUM);
      handlerSubmissionsByCommandId.put(commandId, handlerSubmission);

      // Either submit the new handler myself, or simply re-activate.
      if (parent != null) {
        if (active) {
          parent.activateNestedService(this);
        }
      } else {
        PlatformUI.getWorkbench().getCommandSupport().addHandlerSubmission(handlerSubmission);
      }
    }
  }
コード例 #7
0
  /** Recreates the working set elements from the persistence memento. */
  void restoreWorkingSet() {
    IMemento[] itemMementos = workingSetMemento.getChildren(IWorkbenchConstants.TAG_ITEM);
    final Set items = new HashSet();
    for (int i = 0; i < itemMementos.length; i++) {
      final IMemento itemMemento = itemMementos[i];
      final String factoryID = itemMemento.getString(IWorkbenchConstants.TAG_FACTORY_ID);

      if (factoryID == null) {
        WorkbenchPlugin.log("Unable to restore working set item - no factory ID."); // $NON-NLS-1$
        continue;
      }
      final IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
      if (factory == null) {
        WorkbenchPlugin.log(
            "Unable to restore working set item - cannot instantiate factory: "
                + factoryID); //$NON-NLS-1$
        continue;
      }
      SafeRunner.run(
          new SafeRunnable(
              "Unable to restore working set item - exception while invoking factory: "
                  + factoryID) { //$NON-NLS-1$

            public void run() throws Exception {
              IAdaptable item = factory.createElement(itemMemento);
              if (item == null) {
                if (Policy.DEBUG_WORKING_SETS)
                  WorkbenchPlugin.log(
                      "Unable to restore working set item - cannot instantiate item: "
                          + factoryID); //$NON-NLS-1$

              } else items.add(item);
            }
          });
    }
    internalSetElements((IAdaptable[]) items.toArray(new IAdaptable[items.size()]));
  }
コード例 #8
0
  boolean persist() {
    XMLMemento persistedState = (XMLMemento) getEditorState();
    if (persistedState == null) return false;

    StringWriter writer = new StringWriter();
    try {
      persistedState.save(writer);
      getModel().getPersistedState().put(MEMENTO_KEY, writer.toString());
    } catch (IOException e) {
      WorkbenchPlugin.log(e);
      return false;
    }

    return true;
  }
コード例 #9
0
 protected void doDisposePart() {
   if (part != null) {
     fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
     // Don't let exceptions in client code bring us down. Log them and continue.
     try {
       part.removePropertyListener(propertyChangeListener);
       if (part instanceof IWorkbenchPart3) {
         ((IWorkbenchPart3) part).removePartPropertyListener(partPropertyChangeListener);
       }
       part.dispose();
     } catch (Exception e) {
       WorkbenchPlugin.log(e);
     }
     part = null;
   }
 }
コード例 #10
0
 /** Returns the view descriptors to show in the dialog. */
 private IViewDescriptor[] getViewDescriptors(IWorkbenchPart sourcePart) {
   String srcId = sourcePart.getSite().getId();
   ArrayList ids = getShowInPartIds(sourcePart);
   ArrayList descs = new ArrayList();
   IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
   for (Iterator i = ids.iterator(); i.hasNext(); ) {
     String id = (String) i.next();
     if (!id.equals(srcId)) {
       IViewDescriptor desc = reg.find(id);
       if (desc != null) {
         descs.add(desc);
       }
     }
   }
   return (IViewDescriptor[]) descs.toArray(new IViewDescriptor[descs.size()]);
 }
コード例 #11
0
  IMemento getEditorState() {
    IEditorPart editor = getEditor(false);

    // If the editor hasn't been rendered yet then see if we can grab the
    // info from the model
    if (editor == null && getModel() != null) {
      String savedState = getModel().getPersistedState().get(MEMENTO_KEY);
      if (savedState != null) {
        StringReader sr = new StringReader(savedState);
        try {
          XMLMemento memento = XMLMemento.createReadRoot(sr);
          return memento;
        } catch (WorkbenchException e) {
          WorkbenchPlugin.log(e);
          return null;
        }
      }
      return null;
    }

    IEditorInput input = editor.getEditorInput();
    if (input == null) {
      return null;
    }

    IPersistableElement persistable = input.getPersistable();
    if (persistable == null) {
      return null;
    }

    XMLMemento root = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITOR);
    root.putString(IWorkbenchConstants.TAG_ID, descriptor.getId());

    IMemento inputMem = root.createChild(IWorkbenchConstants.TAG_INPUT);
    inputMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
    persistable.saveState(inputMem);

    if (editor instanceof IPersistableEditor) {
      IMemento editorStateMem = root.createChild(IWorkbenchConstants.TAG_EDITOR_STATE);
      ((IPersistableEditor) editor).saveState(editorStateMem);
    }

    return root;
  }
コード例 #12
0
  public void unregisterAction(IAction action) {
    if (disposed) {
      return;
    }

    if (action instanceof CommandLegacyActionWrapper) {
      // this is a registration of a fake action for an already
      // registered handler
      WorkbenchPlugin.log(
          "Cannot unregister a CommandLegacyActionWrapper out of the system"); //$NON-NLS-1$
      return;
    }

    String commandId = action.getActionDefinitionId();

    if (commandId != null) {
      // Deactivate this service while making changes.
      boolean active = false;
      if ((parent != null) && (parent.activeService == this)) {
        active = true;
        parent.deactivateNestedService();
      }

      // Remove the current submission, if any.
      HandlerSubmission handlerSubmission =
          (HandlerSubmission) handlerSubmissionsByCommandId.remove(commandId);

      /*
       * Either activate this service again, or remove the submission
       * myself.
       */
      if (parent != null) {
        if (active) {
          parent.activateNestedService(this);
        }
      } else {
        if (handlerSubmission != null) {
          PlatformUI.getWorkbench().getCommandSupport().removeHandlerSubmission(handlerSubmission);
          handlerSubmission.getHandler().dispose();
        }
      }
    }
  }
コード例 #13
0
  public EditorReference(
      IEclipseContext windowContext,
      IWorkbenchPage page,
      MPart part,
      IEditorInput input,
      EditorDescriptor descriptor,
      IMemento editorState) {
    super(windowContext, page, part);
    this.input = input;
    this.descriptor = descriptor;
    this.editorState = editorState;

    if (descriptor == null) {
      try {
        String memento = getModel().getPersistedState().get(MEMENTO_KEY);
        if (memento == null) {
          descriptorId = EditorRegistry.EMPTY_EDITOR_ID;
        } else {
          XMLMemento createReadRoot = XMLMemento.createReadRoot(new StringReader(memento));
          IEditorRegistry registry =
              getPage().getWorkbenchWindow().getWorkbench().getEditorRegistry();
          descriptorId = createReadRoot.getString(IWorkbenchConstants.TAG_ID);
          this.descriptor = (EditorDescriptor) registry.findEditor(descriptorId);

          boolean pinnedVal =
              "true"
                  .equals(createReadRoot.getString(IWorkbenchConstants.TAG_PINNED)); // $NON-NLS-1$
          setPinned(pinnedVal);

          String ttip = createReadRoot.getString(IWorkbenchConstants.TAG_TOOLTIP);
          part.getTransientData().put(IPresentationEngine.OVERRIDE_TITLE_TOOL_TIP_KEY, ttip);
        }
      } catch (WorkbenchException e) {
        WorkbenchPlugin.log(e);
      }
    } else {
      descriptorId = this.descriptor.getId();
    }
  }
コード例 #14
0
  public EditorReference(
      IEclipseContext windowContext,
      IWorkbenchPage page,
      MPart part,
      IEditorInput input,
      EditorDescriptor descriptor,
      IMemento editorState) {
    super(windowContext, page, part);
    this.input = input;
    this.descriptor = descriptor;
    this.editorState = editorState;

    if (descriptor == null) {
      try {
        String memento = getModel().getPersistedState().get(MEMENTO_KEY);
        if (memento == null) {
          descriptorId = EditorRegistry.EMPTY_EDITOR_ID;
        } else {
          XMLMemento createReadRoot = XMLMemento.createReadRoot(new StringReader(memento));
          IEditorRegistry registry =
              getPage().getWorkbenchWindow().getWorkbench().getEditorRegistry();
          descriptorId = createReadRoot.getString(IWorkbenchConstants.TAG_ID);
          this.descriptor = (EditorDescriptor) registry.findEditor(descriptorId);
        }

        if (this.descriptor == null) {
          setImageDescriptor(ImageDescriptor.getMissingImageDescriptor());
        } else {
          setImageDescriptor(this.descriptor.getImageDescriptor());
        }
      } catch (WorkbenchException e) {
        WorkbenchPlugin.log(e);
      }
    } else {
      descriptorId = this.descriptor.getId();
      setImageDescriptor(this.descriptor.getImageDescriptor());
    }
  }
コード例 #15
0
  public void initializeDefaultPreferences() {
    IScopeContext context = new DefaultScope();
    IEclipsePreferences node =
        context.getNode(WorkbenchPlugin.getDefault().getBundle().getSymbolicName());

    node.putBoolean(IPreferenceConstants.SHOULD_PROMPT_FOR_ENABLEMENT, true);

    node.putBoolean(IPreferenceConstants.EDITORLIST_PULLDOWN_ACTIVE, false);
    node.putBoolean(IPreferenceConstants.EDITORLIST_DISPLAY_FULL_NAME, false);
    node.putBoolean(IPreferenceConstants.STICKY_CYCLE, false);
    node.putBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false);
    node.putBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS, true);
    node.putInt(IPreferenceConstants.REUSE_EDITORS, 8);
    node.putBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK, false);
    node.putBoolean(IPreferenceConstants.SELECT_ON_HOVER, false);
    node.putBoolean(IPreferenceConstants.OPEN_AFTER_DELAY, false);
    node.putInt(IPreferenceConstants.RECENT_FILES, 4);

    node.putInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION, SWT.TOP);
    node.putInt(IWorkbenchPreferenceConstants.EDITOR_TAB_POSITION, SWT.TOP);

    node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, true);
    node.putBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE, false);

    node.putBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, true);

    node.putInt(IPreferenceConstants.EDITOR_TAB_WIDTH, 3); // high
    node.putInt(IPreferenceConstants.OPEN_VIEW_MODE, IPreferenceConstants.OVM_EMBED);
    node.putInt(IPreferenceConstants.OPEN_PERSP_MODE, IPreferenceConstants.OPM_ACTIVE_PAGE);
    node.put(IPreferenceConstants.ENABLED_DECORATORS, ""); // $NON-NLS-1$
    node.putInt(
        IPreferenceConstants.EDITORLIST_SELECTION_SCOPE,
        IPreferenceConstants.EDITORLIST_SET_PAGE_SCOPE); // Current
    // Window
    node.putInt(
        IPreferenceConstants.EDITORLIST_SORT_CRITERIA,
        IPreferenceConstants.EDITORLIST_NAME_SORT); // Name Sort
    node.putBoolean(IPreferenceConstants.COLOR_ICONS, true);
    node.putInt(IPreferenceConstants.KEYS_PREFERENCE_SELECTED_TAB, 0);
    node.putBoolean(IPreferenceConstants.MULTI_KEY_ASSIST, true);
    node.putInt(IPreferenceConstants.MULTI_KEY_ASSIST_TIME, 1000);

    // Temporary option to enable wizard for project capability
    node.putBoolean("ENABLE_CONFIGURABLE_PROJECT_WIZARD", false); // $NON-NLS-1$
    // Temporary option to enable single click
    node.putInt("SINGLE_CLICK_METHOD", OpenStrategy.DOUBLE_CLICK); // $NON-NLS-1$
    // Temporary option to enable cool bars
    node.putBoolean("ENABLE_COOL_BARS", true); // $NON-NLS-1$
    // Temporary option to enable new menu organization
    node.putBoolean("ENABLE_NEW_MENUS", true); // $NON-NLS-1$
    // Temporary option to turn off the dialog font
    node.putBoolean("DISABLE_DIALOG_FONT", false); // $NON-NLS-1$

    // Heap status preferences
    node.putBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR, false);
    node.putInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 500);
    node.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, false);
    node.putBoolean(IPreferenceConstants.OVERRIDE_PRESENTATION, false);

    IEclipsePreferences rootNode =
        (IEclipsePreferences)
            Platform.getPreferencesService().getRootNode().node(InstanceScope.SCOPE);

    final String workbenchName = WorkbenchPlugin.getDefault().getBundle().getSymbolicName();
    try {
      if (rootNode.nodeExists(workbenchName)) {
        ((IEclipsePreferences) rootNode.node(workbenchName))
            .addPreferenceChangeListener(PlatformUIPreferenceListener.getSingleton());
      }
    } catch (BackingStoreException e) {
      IStatus status =
          new Status(
              IStatus.ERROR,
              WorkbenchPlugin.getDefault().getBundle().getSymbolicName(),
              IStatus.ERROR,
              e.getLocalizedMessage(),
              e);
      WorkbenchPlugin.getDefault().getLog().log(status);
    }
  }
コード例 #16
0
 private static boolean useIPersistableEditor() {
   IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
   return store.getBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS);
 }
コード例 #17
0
 public void widgetDisposed(DisposeEvent e) {
   WorkbenchPlugin.log(
       new RuntimeException(
           "Widget disposed too early for part " //$NON-NLS-1$
               + getId()));
 }
コード例 #18
0
  IMemento getEditorState() {
    IEditorPart editor = getEditor(false);

    // If the editor hasn't been rendered yet then see if we can grab the
    // info from the model
    if (editor == null && getModel() != null) {
      String savedState = getModel().getPersistedState().get(MEMENTO_KEY);
      if (savedState != null) {
        StringReader sr = new StringReader(savedState);
        try {
          XMLMemento memento = XMLMemento.createReadRoot(sr);
          return memento;
        } catch (WorkbenchException e) {
          WorkbenchPlugin.log(e);
          return null;
        }
      }
      return null;
    }

    IEditorInput input = editor.getEditorInput();
    if (input == null) {
      return null;
    }

    IPersistableElement persistable = input.getPersistable();
    if (persistable == null) {
      return null;
    }

    XMLMemento editorMem = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITOR);
    editorMem.putString(IWorkbenchConstants.TAG_ID, descriptor.getId());
    editorMem.putString(IWorkbenchConstants.TAG_TITLE, getTitle());
    editorMem.putString(IWorkbenchConstants.TAG_NAME, getName());
    editorMem.putString(IWorkbenchConstants.TAG_ID, getId());
    editorMem.putString(IWorkbenchConstants.TAG_TOOLTIP, getTitleToolTip());
    editorMem.putString(IWorkbenchConstants.TAG_PART_NAME, getPartName());

    if (editor instanceof IWorkbenchPart3) {
      Map properties = ((IWorkbenchPart3) editor).getPartProperties();
      if (!properties.isEmpty()) {
        IMemento propBag = editorMem.createChild(IWorkbenchConstants.TAG_PROPERTIES);
        Iterator i = properties.entrySet().iterator();
        while (i.hasNext()) {
          Map.Entry entry = (Map.Entry) i.next();
          IMemento p =
              propBag.createChild(IWorkbenchConstants.TAG_PROPERTY, (String) entry.getKey());
          p.putTextData((String) entry.getValue());
        }
      }
    }

    if (isPinned()) {
      editorMem.putString(IWorkbenchConstants.TAG_PINNED, "true"); // $NON-NLS-1$
    }

    IMemento inputMem = editorMem.createChild(IWorkbenchConstants.TAG_INPUT);
    inputMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
    persistable.saveState(inputMem);

    if (editor instanceof IPersistableEditor) {
      IMemento editorStateMem = editorMem.createChild(IWorkbenchConstants.TAG_EDITOR_STATE);
      ((IPersistableEditor) editor).saveState(editorStateMem);
    }

    return editorMem;
  }