Search in sources :

Example 1 with IUndoContext

use of org.eclipse.core.commands.operations.IUndoContext 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 IUndoContext

use of org.eclipse.core.commands.operations.IUndoContext 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 3 with IUndoContext

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

the class UndoRedoActionProvider method init.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
	 */
public void init(ICommonActionExtensionSite anActionSite) {
    IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
    undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(), workspaceContext, true);
}
Also used : IUndoContext(org.eclipse.core.commands.operations.IUndoContext) UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Aggregations

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