Package org.eclipse.ui

Examples of org.eclipse.ui.IPersistableElement


    boolean restore = preferences.getBoolean(DefaultPreferences.REOPEN_BROWSER_TABS);
    if (!restore)
      return null;

    return new IPersistableElement() {
      public String getFactoryId() {
        return FACTORY_ID;
      }

      public void saveState(IMemento memento) {
View Full Code Here


  public IPersistableElement getPersistable() {
    boolean restore = Platform.getPreferencesService().getBoolean(RESTORE_QUALIFIER, RESTORE_KEY, true, null);
    if (!restore)
      return null;

    return new IPersistableElement() {
      public String getFactoryId() {
        return FACTORY_ID;
      }

      public void saveState(IMemento memento) {
View Full Code Here

  public IPersistableElement getPersistable() {
    boolean restore = Platform.getPreferencesService().getBoolean(RESTORE_QUALIFIER, RESTORE_KEY, true, null);
    if (!restore)
      return null;

    return new IPersistableElement() {
      public String getFactoryId() {
        return FACTORY_ID;
      }

      public void saveState(IMemento memento) {
View Full Code Here

        //write the information needed to recreate the editor input
        if (editorInputData.input != null) {
            // Capture the editor information
            XMLMemento memento = XMLMemento.createWriteRoot("IEditorInput");//$NON-NLS-1$

            IPersistableElement element = editorInputData.input
                    .getPersistable();
            if (element != null) {
                //get the IEditorInput to save its state
                element.saveState(memento);

                //convert memento to String
                StringWriter writer = new StringWriter();
                memento.save(writer);
                writer.close();

                //write the factor ID and state information
                dataOut.writeUTF(element.getFactoryId());
                dataOut.writeUTF(writer.toString());
            }
        }
    }
View Full Code Here

   * @param list the working sets to save
   * @since 3.2
   */
  private void saveWorkingSetState(IMemento memento, List list) {
    for (Iterator i = list.iterator(); i.hasNext();) {
            IPersistableElement persistable = (IWorkingSet) i.next();
            IMemento workingSetMemento = memento
                    .createChild(IWorkbenchConstants.TAG_WORKING_SET);
            workingSetMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID,
                    persistable.getFactoryId());
            persistable.saveState(workingSetMemento);
        }
  }
View Full Code Here

        this.memento = memento;
    }

    boolean isPersistable() {
        if (editorInput != null) {
            IPersistableElement persistable = editorInput.getPersistable();
            return persistable != null;
        }
        return memento != null;
    }
View Full Code Here

    void handlePartClosed() {
        if (!isPersistable()) {
      return;
    }
        if (memento == null) {
            IPersistableElement persistable = editorInput.getPersistable();
            memento = XMLMemento
                    .createWriteRoot(IWorkbenchConstants.TAG_EDITOR);
            memento.putString(IWorkbenchConstants.TAG_ID, editorID);
            memento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable
                    .getFactoryId());
            persistable.saveState(memento);
        }
        editorID = null;
        editorInput = null;
    }
View Full Code Here

        memento = null;
    }

    void saveState(IMemento mem) {
        if (editorInput != null) {
            IPersistableElement persistable = editorInput.getPersistable();
            mem.putString(IWorkbenchConstants.TAG_ID, editorID);
            mem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable
                    .getFactoryId());
            persistable.saveState(mem);
        } else if (memento != null) {
            mem.putMemento(memento);
        }
    }
View Full Code Here

    }
   
    public String getFactoryId() {
        IEditorPart editor = getEditor(false);
        if (editor != null) {
            IPersistableElement persistable = editor.getEditorInput()
                    .getPersistable();
            if (persistable != null) {
        return persistable.getFactoryId();
      }
            return null;
        }
        return factoryId;
    }
View Full Code Here

      memento.putString(IWorkbenchConstants.TAG_LABEL, getLabel());
      memento.putString(IWorkbenchConstants.TAG_EDIT_PAGE_ID, editPageId);
      Iterator iterator = elements.iterator();
      while (iterator.hasNext()) {
        IAdaptable adaptable = (IAdaptable) iterator.next();
        IPersistableElement persistable = (IPersistableElement) Util
            .getAdapter(adaptable, IPersistableElement.class);
        if (persistable != null) {
          IMemento itemMemento = memento
              .createChild(IWorkbenchConstants.TAG_ITEM);

          itemMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID,
              persistable.getFactoryId());
          persistable.saveState(itemMemento);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IPersistableElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.