@Override protected IUndoContext getUndoContext() { ObjectUndoContext context= new ObjectUndoContext(new Object(), "All Markers Context"); //$NON-NLS-1$ context.addMatch(WorkspaceUndoUtil.getBookmarksUndoContext()); context.addMatch(WorkspaceUndoUtil.getTasksUndoContext()); context.addMatch(WorkspaceUndoUtil.getProblemsUndoContext()); return context; }
/** * The string representation of this operation. Used for debugging purposes only. * This string should not be shown to an end user. * * @return The string representation. */ @Override public String toString() { return getLabel(); }
@Override public boolean matches(IUndoContext context) { // Check first for explicit matches that have been assigned. if (children.contains(context)) { return true; } // Contexts for equal objects are considered matching if (context instanceof ObjectUndoContext && getObject() != null) { return getObject().equals(((ObjectUndoContext)context).getObject()); } // Use the normal matching implementation return super.matches(context); }
/** * Returns the undo context for workbench operations. * The workbench configures an undo context with the appropriate policies * for the workbench undo model. * * @return the workbench operation context. * @since 3.1 */ @Override public IUndoContext getUndoContext() { if (undoContext == null) { undoContext = new ObjectUndoContext(PlatformUI.getWorkbench(), "Workbench Context"); //$NON-NLS-1$ } return undoContext; }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
public void stop(BundleContext context) throws Exception { if (fRefactoringUndoContext != null) { IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).removeMatch(fRefactoringUndoContext); } } if (fgUndoManager != null) fgUndoManager.shutdown(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.disconnect(); if (fRefactoringHistoryListener != null) service.removeHistoryListener(fRefactoringHistoryListener); RefactoringContributionManager.getInstance().disconnect(); super.stop(context); }
/** * * Create a DocumentUndoManager for the given document. * * @param document the document whose undo history is being managed. */ public DocumentUndoManager(IDocument document) { super(); Assert.isNotNull(document); fDocument= document; fHistory= OperationHistoryFactory.getOperationHistory(); fUndoContext= new ObjectUndoContext(fDocument); fConnected= new ArrayList<>(); fDocumentUndoListeners= new ListenerList<>(ListenerList.IDENTITY); }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
@Override public void stop(BundleContext context) throws Exception { if (fRefactoringUndoContext != null) { IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).removeMatch(fRefactoringUndoContext); } } if (fgUndoManager != null) fgUndoManager.shutdown(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.disconnect(); if (fRefactoringHistoryListener != null) service.removeHistoryListener(fRefactoringHistoryListener); RefactoringContributionManager.getInstance().disconnect(); super.stop(context); }
/** * Return the undo context that should be used for operations involving breakpoints. * * @return the undo context for breakpoints * @since 3.7 */ public static synchronized IUndoContext getBreakpointsUndoContext() { if (fgBreakpointsUndoContext == null) { fgBreakpointsUndoContext= new ObjectUndoContext(new Object(), "Breakpoints Context"); //$NON-NLS-1$ fgBreakpointsUndoContext.addMatch(WorkspaceUndoUtil.getWorkspaceUndoContext()); } return fgBreakpointsUndoContext; }
/** * * Create a DocumentUndoManager for the given document. * * @param document the document whose undo history is being managed. */ public DocumentUndoManager(IDocument document) { super(); Assert.isNotNull(document); fDocument= document; fHistory= OperationHistoryFactory.getOperationHistory(); fUndoContext= new ObjectUndoContext(fDocument); fConnected= new ArrayList<>(); fDocumentUndoListeners= new ListenerList<>(ListenerList.IDENTITY); }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
/** * The string representation of this operation. Used for debugging purposes only. * This string should not be shown to an end user. * * @return The string representation. */ @Override public String toString() { return getLabel(); }
@Override public boolean matches(IUndoContext context) { // Check first for explicit matches that have been assigned. if (children.contains(context)) { return true; } // Contexts for equal objects are considered matching if (context instanceof ObjectUndoContext && getObject() != null) { return getObject().equals(((ObjectUndoContext)context).getObject()); } // Use the normal matching implementation return super.matches(context); }
@Override public void stop(BundleContext context) throws Exception { if (fRefactoringUndoContext != null) { IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).removeMatch(fRefactoringUndoContext); } } if (fgUndoManager != null) fgUndoManager.shutdown(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.disconnect(); if (fRefactoringHistoryListener != null) service.removeHistoryListener(fRefactoringHistoryListener); RefactoringContributionManager.getInstance().disconnect(); super.stop(context); }
/** * Return the undo context that should be used for operations involving * tasks. * * @return the tasks undo context */ public static IUndoContext getTasksUndoContext() { if (tasksUndoContext == null) { tasksUndoContext = new ObjectUndoContext(new Object(), "Tasks Context"); //$NON-NLS-1$ tasksUndoContext.addMatch(getWorkspaceUndoContext()); } return tasksUndoContext; }
@Override public void connect(ITextViewer textViewer) { if (!isConnected() && textViewer != null) { fTextViewer= textViewer; fTextBuffer= new StringBuilder(); fPreservedTextBuffer= new StringBuilder(); if (fUndoContext == null) fUndoContext= new ObjectUndoContext(this); fHistory.setLimit(fUndoContext, fUndoLevel); initializeCommandStack(); // open up the current command fCurrent= new TextCommand(fUndoContext); fPreviousDelete= new TextCommand(fUndoContext); addListeners(); } }
/** * The string representation of this operation. Used for debugging purposes only. * This string should not be shown to an end user. * * @return The string representation. */ @Override public String toString() { return getLabel(); }
@Override public boolean matches(IUndoContext context) { // Check first for explicit matches that have been assigned. if (children.contains(context)) { return true; } // Contexts for equal objects are considered matching if (context instanceof ObjectUndoContext && getObject() != null) { return getObject().equals(((ObjectUndoContext)context).getObject()); } // Use the normal matching implementation return super.matches(context); }
/** * Return the undo context that should be used for operations involving * bookmarks. * * @return the bookmarks undo context */ public static IUndoContext getBookmarksUndoContext() { if (bookmarksUndoContext == null) { bookmarksUndoContext = new ObjectUndoContext(new Object(), "Bookmarks Context"); //$NON-NLS-1$ bookmarksUndoContext.addMatch(getWorkspaceUndoContext()); } return bookmarksUndoContext; }