Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorReference


    }
    List result = new ArrayList();
    ArrayList othersList = new ArrayList(Arrays.asList(page
        .getEditorReferences()));
    if (!othersList.isEmpty()) {
      IEditorReference active = page.getActiveEditorReference();
      if (active != null) {
        othersList.remove(active);
        ArrayList activeList = new ArrayList(1);
        activeList.add(active);
        findEditors(activeList, input, editorId, matchFlags, result);
View Full Code Here


    }

    // Phase 2: check materialized editors (without their own matching
    // strategy)
    for (Iterator i = editorList.iterator(); i.hasNext();) {
      IEditorReference editor = (IEditorReference) i.next();
      IEditorPart part = (IEditorPart) editor.getPart(false);
      if (part != null) {
        i.remove(); // We're handling this one here, so remove it from
        // the list.
        if (part.getEditorInput() != null
            && part.getEditorInput().equals(input)) {
          result.add(editor);
        }
      }
    }

    // Phase 3: check unmaterialized editors for input equality,
    // delaying plug-in activation further by only restoring the editor
    // input
    // if the editor reference's factory id and name match.
    String name = input.getName();
    IPersistableElement persistable = input.getPersistable();
    if (name == null || persistable == null) {
      return;
    }
    String id = persistable.getFactoryId();
    if (id == null) {
      return;
    }
    for (Iterator i = editorList.iterator(); i.hasNext();) {
      EditorReference editor = (EditorReference) i.next();
      if (name.equals(editor.getName())
          && id.equals(editor.getFactoryId())) {
        IEditorInput restoredInput;
        try {
          restoredInput = editor.getEditorInput();
          if (Util.equals(restoredInput, input)) {
            result.add(editor);
          }
        } catch (PartInitException e1) {
          WorkbenchPlugin.log(e1);
View Full Code Here

  /*
   * See IWorkbenchPage#getFocusEditor
   */
  public IEditorPart getVisibleEditor() {
    IEditorReference ref = editorPresentation.getVisibleEditor();
    if (ref == null) {
      return null;
    }
    return (IEditorPart) ref.getPart(true);
  }
View Full Code Here

   * Answer true if save is needed in any one of the editors.
   */
  public boolean isSaveAllNeeded() {
    IEditorReference[] editors = page.getEditorReferences();
    for (int i = 0; i < editors.length; i++) {
      IEditorReference ed = editors[i];
      if (ed.isDirty()) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_unknownEditorIDMessage,
          editorId));
    }

    IEditorReference result = openEditorFromDescriptor(desc, input, editorState);
    return result;
  }
View Full Code Here

  /*
   * Open a new editor
   */
  public IEditorReference openEditorFromDescriptor(EditorDescriptor desc,
      IEditorInput input, IMemento editorState) throws PartInitException {
    IEditorReference result = null;
    if (desc.isInternal()) {
      result = reuseInternalEditor(desc, input);
      if (result == null) {
        result = new EditorReference(this, input, desc, editorState);
      }
View Full Code Here

    String[] editorArray = input.getEditors();
    IEditorInput[] inputArray = input.getInput();

    // find all descriptors
    EditorDescriptor[] descArray = new EditorDescriptor[editorArray.length];
    IEditorReference refArray[] = new IEditorReference[editorArray.length];
    IEditorPart partArray[] = new IEditorPart[editorArray.length];

    IEditorRegistry reg = getEditorRegistry();
    for (int i = 0; i < editorArray.length; i++) {
      EditorDescriptor innerDesc = (EditorDescriptor) reg
View Full Code Here

      IEditorInput input) throws PartInitException {

    Assert.isNotNull(desc, "descriptor must not be null"); //$NON-NLS-1$
    Assert.isNotNull(input, "input must not be null"); //$NON-NLS-1$

    IEditorReference reusableEditorRef = findReusableEditor(desc);
    if (reusableEditorRef != null) {
      return ((TabBehaviour) Tweaklets.get(TabBehaviour.KEY))
          .reuseInternalEditor(page, this, editorPresentation, desc,
              input, reusableEditorRef);
    }
View Full Code Here

    final MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID,
        IStatus.OK,
        WorkbenchMessages.EditorManager_problemsRestoringEditors, null);
    final String activeWorkbookID[] = new String[1];
    final ArrayList visibleEditors = new ArrayList(5);
    final IEditorReference activeEditor[] = new IEditorReference[1];

    IMemento areaMem = memento.getChild(IWorkbenchConstants.TAG_AREA);
    if (areaMem != null) {
      result.add(editorPresentation.restoreState(areaMem));
      activeWorkbookID[0] = areaMem
View Full Code Here

      // Use the list of editors found in EditorStack; fix for 24091
      EditorPane editorPanes[] = workbook.getEditors();

      for (int i = 0; i < editorPanes.length; i++) {
        // Save each open editor.
        IEditorReference editorReference = editorPanes[i]
            .getEditorReference();
        EditorReference e = (EditorReference) editorReference;
        final IEditorPart editor = editorReference.getEditor(false);
        if (editor == null) {
          if (e.getMemento() != null) {
            IMemento editorMem = memento
                .createChild(IWorkbenchConstants.TAG_EDITOR);
            editorMem.putMemento(e.getMemento());
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorReference

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.