Search in sources :

Example 1 with UndoRedoActionGroup

use of org.eclipse.ui.operations.UndoRedoActionGroup 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 2 with UndoRedoActionGroup

use of org.eclipse.ui.operations.UndoRedoActionGroup in project hale by halestudio.

the class HaleUI method registerWorkbenchUndoRedo.

/**
 * Register a view site for undo/redo in workbench context.
 *
 * @param site the view site
 */
public static void registerWorkbenchUndoRedo(IViewSite site) {
    IUndoContext undoContext = site.getWorkbenchWindow().getWorkbench().getOperationSupport().getUndoContext();
    UndoRedoActionGroup undoRedoActionGroup = new UndoRedoActionGroup(site, undoContext, true);
    IActionBars actionBars = site.getActionBars();
    undoRedoActionGroup.fillActionBars(actionBars);
}
Also used : IUndoContext(org.eclipse.core.commands.operations.IUndoContext) UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) IActionBars(org.eclipse.ui.IActionBars)

Example 3 with UndoRedoActionGroup

use of org.eclipse.ui.operations.UndoRedoActionGroup 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)

Example 4 with UndoRedoActionGroup

use of org.eclipse.ui.operations.UndoRedoActionGroup in project eclipse.platform.text by eclipse.

the class SearchView method createActions.

private void createActions() {
    fSearchesDropDownAction = new SearchHistoryDropDownAction(this);
    fSearchesDropDownAction.updateEnablement();
    fSearchAgainAction = new SearchAgainAction(this);
    fSearchAgainAction.setEnabled(false);
    fSearchAgainAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
    fCancelAction = new CancelSearchAction(this);
    fCancelAction.setEnabled(false);
    fPinSearchViewAction = new PinSearchViewAction(this);
    IUndoContext workspaceContext = ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
    fUndoRedoActionGroup = new UndoRedoActionGroup(getViewSite(), workspaceContext, true);
}
Also used : IUndoContext(org.eclipse.core.commands.operations.IUndoContext) UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup)

Example 5 with UndoRedoActionGroup

use of org.eclipse.ui.operations.UndoRedoActionGroup 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

UndoRedoActionGroup (org.eclipse.ui.operations.UndoRedoActionGroup)6 IUndoContext (org.eclipse.core.commands.operations.IUndoContext)4 ObjectUndoContext (org.eclipse.core.commands.operations.ObjectUndoContext)2 File (java.io.File)1 MessageFormat (java.text.MessageFormat)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Consumer (java.util.function.Consumer)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1