Examples of IUndoContext


Examples of org.eclipse.core.commands.operations.IUndoContext

    // no approval is required if we can ascertain that the operation did
    // not originate
    // in our context.
    if (uiInfo != null) {
      IUndoContext originatingContext = (IUndoContext) Util.getAdapter(uiInfo,
          IUndoContext.class);
      if (originatingContext != null
          && !(originatingContext.matches(context))) {
        return false;
      }
    }

    return true;
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

        // 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();
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

   * Subclasses may override or extend.</p>
   *
   * @since 3.1
   */
  protected void createUndoRedoActions() {
    IUndoContext undoContext= getUndoContext();
    if (undoContext != null) {
      // Use actions provided by global undo/redo
     
      // Create the undo action
      OperationHistoryActionHandler undoAction= new UndoActionHandler(getEditorSite(), undoContext);
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

    IWorkbench workbench = getSite().getWorkbenchWindow().getWorkbench();
    IOperationHistory operationHistory = workbench.getOperationSupport().getOperationHistory();
   
    //System.out.println("Action executed under context: " + undoContext.getLabel());
   
    IUndoContext undoContext = getUndoContext(); // workbench.getOperationSupport().getUndoContext();
    operation.addContext(undoContext);
    try {
      operationHistory.execute(operation, null, null);
    } catch (ExecutionException e1) {
      e1.printStackTrace();
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

  /*
   * @see org.eclipse.jface.text.IDocumentUndoManager#transferUndoHistory(IDocumentUndoManager)
   */
  public void transferUndoHistory(IDocumentUndoManager manager) {
    IUndoContext oldUndoContext= manager.getUndoContext();
    // Get the history for the old undo context.
    IUndoableOperation [] operations= OperationHistoryFactory.getOperationHistory().getUndoHistory(oldUndoContext);
    for (int i= 0; i < operations.length; i++) {
      // First replace the undo context
      IUndoableOperation op= operations[i];
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

        // 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();
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

   * Subclasses may override or extend.</p>
   *
   * @since 3.1
   */
  protected void createUndoRedoActions() {
    IUndoContext undoContext= getUndoContext();
    if (undoContext != null) {
      // Use actions provided by global undo/redo

      // Create the undo action
      OperationHistoryActionHandler undoAction= new UndoActionHandler(getEditorSite(), undoContext);
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), new GlobalDeleteActionHandler());

    // For the normal resource undo/redo actions to be active, so that files
    // deleted via the "Delete" action in the staging view can be restored.
    IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
    undoRedoActionGroup = new UndoRedoActionGroup(getViewSite(), workspaceContext, true);
    undoRedoActionGroup.fillActionBars(actionBars);

    actionBars.updateActionBars();
  }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

  public void historyNotification(OperationHistoryEvent event) {
    // This method updates the enablement of all content operations
    // when the undo history changes. It could be localized to UNDO and
    // REDO.
    IUndoContext context = getUndoContext();
    if (context != null && event.getOperation().hasContext(context)) {
      Display.getDefault().asyncExec(new Runnable() {
        public void run() {
          updateContentDependantActions();
        }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoContext

   *            the view part that owns this action group
   */
  public RefactorActionGroup(IViewPart part) {
    this(part.getSite(), part.getSite().getKeyBindingService());

    IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin
        .getWorkspace().getAdapter(IUndoContext.class);
    fUndoRedoActionGroup = new UndoRedoActionGroup(part.getViewSite(),
        workspaceContext, true);
  }
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.