Examples of SaveablesLifecycleEvent


Examples of org.eclipse.ui.SaveablesLifecycleEvent

   
    if (input == null) {
      close(isSaveOnCloseNeeded());
     
      if (fSavable != null) {
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_CLOSE,  getSaveables(), false));
        fSavable.disconnectEditor();
        fSavable= null;
      }
     
    } else {
      boolean mustSendLifeCycleEvent= false;
      if (fSavable != null) {
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_CLOSE,  getSaveables(), false));
        fSavable.disconnectEditor();
        fSavable= null;
        mustSendLifeCycleEvent= true;
      }

      IEditorInput oldInput= getEditorInput();
      if (oldInput != null)
        getDocumentProvider().disconnect(oldInput);

      super.setInput(input);

      updateDocumentProvider(input);

      IDocumentProvider provider= getDocumentProvider();
      if (provider == null) {
        IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, EditorMessages.Editor_error_no_provider, null);
        throw new CoreException(s);
      }

      provider.connect(input);

      initializeTitle(input);

      if (fSourceViewer != null) {
        initializeSourceViewer(input);

        // Reset the undo context for the undo and redo action handlers
        IAction undoAction= getAction(ITextEditorActionConstants.UNDO);
        IAction redoAction= getAction(ITextEditorActionConstants.REDO);
        boolean areOperationActionHandlersInstalled= undoAction instanceof OperationHistoryActionHandler && redoAction instanceof OperationHistoryActionHandler;
        IUndoContext undoContext= getUndoContext();
        if (undoContext != null && areOperationActionHandlersInstalled) {
          ((OperationHistoryActionHandler)undoAction).setContext(undoContext);
          ((OperationHistoryActionHandler)redoAction).setContext(undoContext);
        } else {
          createUndoRedoActions();
        }
      }

      if (fIsOverwriting)
        toggleOverwriteMode();
      setInsertMode((InsertMode) getLegalInsertModes().get(0));
      updateCaret();

      updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);

      if (fSelectionListener != null)
        fSelectionListener.setDocument(getDocumentProvider().getDocument(input));
     
      IVerticalRuler ruler= getVerticalRuler();
      if (ruler instanceof CompositeRuler)
        updateContributedRulerColumns((CompositeRuler) ruler);
     
      // Send savable life-cycle if needed.
      if (mustSendLifeCycleEvent && listener != null)
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_OPEN, getSaveables(), false));
     
    }
   
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

      break;
    case SaveablesLifecycleEvent.POST_CLOSE:
      removeModels(event.getSource(), modelArray);
      break;
    case SaveablesLifecycleEvent.DIRTY_CHANGED:
      fireModelLifecycleEvent(new SaveablesLifecycleEvent(this, event
          .getEventType(), event.getSaveables(), false));
      break;
    }
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

      if (removeModel(source, model)) {
        removed.add(model);
      }
    }
    if (removed.size() > 0) {
      fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
          SaveablesLifecycleEvent.POST_OPEN, (Saveable[]) removed
              .toArray(new Saveable[removed.size()]), false));
    }
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

      if (addModel(source, model)) {
        added.add(model);
      }
    }
    if (added.size() > 0) {
      fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
          SaveablesLifecycleEvent.POST_OPEN, (Saveable[]) added
              .toArray(new Saveable[added.size()]), false));
    }
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

          }
        }
      }
    }
    if (removed.size() > 0) {
      fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
          SaveablesLifecycleEvent.POST_CLOSE, (Saveable[]) removed
              .toArray(new Saveable[removed.size()]), false));
    }
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

   * @param actualPart
   */
  public void dirtyChanged(IWorkbenchPart part) {
    Saveable[] saveables = getSaveables(part);
    if (saveables.length > 0) {
      fireModelLifecycleEvent(new SaveablesLifecycleEvent(this,
          SaveablesLifecycleEvent.DIRTY_CHANGED, saveables, false));
    }
  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

    if (input == null) {
      close(isSaveOnCloseNeeded());

      if (fSavable != null) {
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_CLOSE,  getSaveables(), false));
        fSavable.disconnectEditor();
        fSavable= null;
      }

    } else {
      boolean mustSendLifeCycleEvent= false;
      if (fSavable != null) {
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_CLOSE,  getSaveables(), false));
        fSavable.disconnectEditor();
        fSavable= null;
        mustSendLifeCycleEvent= true;
      }

      IEditorInput oldInput= getEditorInput();
      if (oldInput != null)
        getDocumentProvider().disconnect(oldInput);

      super.setInput(input);

      updateDocumentProvider(input);

      IDocumentProvider provider= getDocumentProvider();
      if (provider == null) {
        IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, EditorMessages.Editor_error_no_provider, null);
        throw new CoreException(s);
      }

      provider.connect(input);

      initializeTitle(input);

      if (fSourceViewer != null) {
        initializeSourceViewer(input);

        // Reset the undo context for the undo and redo action handlers
        IAction undoAction= getAction(ITextEditorActionConstants.UNDO);
        IAction redoAction= getAction(ITextEditorActionConstants.REDO);
        boolean areOperationActionHandlersInstalled= undoAction instanceof OperationHistoryActionHandler && redoAction instanceof OperationHistoryActionHandler;
        IUndoContext undoContext= getUndoContext();
        if (undoContext != null && areOperationActionHandlersInstalled) {
          ((OperationHistoryActionHandler)undoAction).setContext(undoContext);
          ((OperationHistoryActionHandler)redoAction).setContext(undoContext);
        } else {
          createUndoRedoActions();
        }
      }

      if (fIsOverwriting)
        toggleOverwriteMode();
      setInsertMode((InsertMode) getLegalInsertModes().get(0));
      updateCaret();

      updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);

      if (fSelectionListener != null)
        fSelectionListener.setDocument(getDocumentProvider().getDocument(input));

      IVerticalRuler ruler= getVerticalRuler();
      if (ruler instanceof CompositeRuler)
        updateContributedRulerColumns((CompositeRuler) ruler);

      // Send savable life-cycle if needed.
      if (mustSendLifeCycleEvent && listener != null)
        listener.handleLifecycleEvent(new SaveablesLifecycleEvent(this,  SaveablesLifecycleEvent.POST_OPEN, getSaveables(), false));

    }

  }
View Full Code Here

Examples of org.eclipse.ui.SaveablesLifecycleEvent

      if (part != null) {
        ISaveablesLifecycleListener lifecycleListener = getSaveablesLifecycleListener(part);
        // Remove this saveable from the lifecycle listener
        if (!init)
          lifecycleListener
              .handleLifecycleEvent(new SaveablesLifecycleEvent(
                  part, SaveablesLifecycleEvent.POST_CLOSE,
                  new Saveable[] { this }, false));
        // Now fix the hashing so it uses the connected document
        initializeHashing();
        // Finally, add this saveable back to the listener
        lifecycleListener
            .handleLifecycleEvent(new SaveablesLifecycleEvent(part,
                SaveablesLifecycleEvent.POST_OPEN,
                new Saveable[] { this }, false));
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.