Search in sources :

Example 1 with ObjectUndoContext

use of org.eclipse.core.commands.operations.ObjectUndoContext in project che by eclipse.

the class RefactoringCorePlugin method getUndoContext.

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;
}
Also used : IUndoContext(org.eclipse.core.commands.operations.IUndoContext) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) ObjectUndoContext(org.eclipse.core.commands.operations.ObjectUndoContext)

Example 2 with ObjectUndoContext

use of org.eclipse.core.commands.operations.ObjectUndoContext in project translationstudio8 by heartsome.

the class XLIFFEditorImplWithNatTable method initializeOperationHistory.

/*
	 * Initialize the workbench operation history for our undo context.
	 */
private void initializeOperationHistory() {
    // create a unique undo context to
    // represent this view's undo history
    undoContext = new ObjectUndoContext(this);
    // set the undo limit for this context based on the preference
    HISTORY.setLimit(undoContext, 99);
    // 初始化“重做、”“撤销”菜单项
    undoRedoGroup = new UndoRedoActionGroup(getSite(), undoContext, true);
}
Also used : UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) ObjectUndoContext(org.eclipse.core.commands.operations.ObjectUndoContext)

Example 3 with ObjectUndoContext

use of org.eclipse.core.commands.operations.ObjectUndoContext in project che by eclipse.

the class RefactoringCorePlugin method stop.

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);
}
Also used : RefactoringHistoryService(org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService) IUndoContext(org.eclipse.core.commands.operations.IUndoContext) ObjectUndoContext(org.eclipse.core.commands.operations.ObjectUndoContext)

Example 4 with ObjectUndoContext

use of org.eclipse.core.commands.operations.ObjectUndoContext in project tmdm-studio-se by Talend.

the class DataModelMainPage method initializeOperationHistory.

/**
 * @author achen
 */
private void initializeOperationHistory() {
    if (undoContext == null) {
        undoContext = new ObjectUndoContext(this.toString(), xobject.getDisplayName());
    }
    PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().setLimit(undoContext, undoLimit);
    UndoRedoActionGroup undoRedoGroup = new UndoRedoActionGroup(getSite(), undoContext, true);
    undoRedoGroup.fillActionBars(getEditorSite().getActionBars());
}
Also used : UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) ObjectUndoContext(org.eclipse.core.commands.operations.ObjectUndoContext)

Aggregations

ObjectUndoContext (org.eclipse.core.commands.operations.ObjectUndoContext)4 IUndoContext (org.eclipse.core.commands.operations.IUndoContext)2 UndoRedoActionGroup (org.eclipse.ui.operations.UndoRedoActionGroup)2 IOperationHistory (org.eclipse.core.commands.operations.IOperationHistory)1 RefactoringHistoryService (org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService)1