类org.eclipse.ui.operations.UndoRedoActionGroup源码实例Demo

下面列出了怎么用org.eclipse.ui.operations.UndoRedoActionGroup的API类实例代码及写法,或者点击链接到github查看源代码。

public JavaEditorBreadcrumbActionGroup(JavaEditor javaEditor, ISelectionProvider selectionProvider) {
	super(new ActionGroup[] {
			new BreadcrumbActionGroup(javaEditor),
			new UndoRedoActionGroup(javaEditor.getEditorSite(), (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class), true),
			new NewWizardsActionGroup(javaEditor.getEditorSite()),
			new JavaSearchActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new NavigateActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new CCPActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new GenerateBuildPathActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new GenerateActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new RefactorActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new BuildActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new ProjectActionGroup(javaEditor.getEditorSite(), selectionProvider),
			new WorkingSetActionGroup(javaEditor.getEditorSite(), selectionProvider)
	});
}
 
源代码2 项目: gef   文件: AbstractFXEditor.java
/**
 * Creates the actions for this editor and registers them in the editor's
 * site action bar.
 *
 */
protected void createActions() {
	undoRedoActionGroup = new UndoRedoActionGroup(getSite(),
			(IUndoContext) getAdapter(IUndoContext.class), true);

	deleteAction = new DeleteAction();
	getContentViewer().setAdapter(deleteAction);

	selectAllAction = new SelectAllAction();
	getContentViewer().setAdapter(selectAllAction);
}
 
源代码3 项目: gef   文件: AbstractFXView.java
/**
 * Create actions for this view and registers at the action bars of the
 * view's site.
 */
protected void createActions() {
	IViewSite site = getViewSite();
	IActionBars actionBars = site.getActionBars();
	undoRedoActionGroup = new UndoRedoActionGroup(getSite(),
			(IUndoContext) getAdapter(IUndoContext.class), true);
	undoRedoActionGroup.fillActionBars(actionBars);

	deleteAction = new DeleteAction();
	getContentViewer().setAdapter(deleteAction);
	actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
			deleteAction);

	selectAllAction = new SelectAllAction();
	getContentViewer().setAdapter(selectAllAction);
	actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(),
			selectAllAction);

	zoomActionGroup = new ZoomActionGroup(new FitToViewportAction());
	getContentViewer().setAdapter(zoomActionGroup);
	fitToViewportActionGroup = new FitToViewportActionGroup();
	getContentViewer().setAdapter(fitToViewportActionGroup);
	scrollActionGroup = new ScrollActionGroup();
	getContentViewer().setAdapter(scrollActionGroup);

	IToolBarManager mgr = actionBars.getToolBarManager();
	zoomActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	fitToViewportActionGroup.fillActionBars(actionBars);
	mgr.add(new Separator());
	scrollActionGroup.fillActionBars(actionBars);
}
 
源代码4 项目: gef   文件: FXEditorActionBarContributor.java
/**
 * Registers undo and redo action handlers for the given target editor. The
 * target editor is adapted for an {@link UndoRedoActionGroup}, which is
 * used to fill the action bars.
 *
 * @param targetEditor
 *            The editor to register undo and redo action handlers for.
 */
protected void registerUndoRedoActions(final IEditorPart targetEditor) {
	// XXX: IAdaptable.getAdapter() has been 'generified' with Mars.
	// However, to maintain backwards compatibility with Luna, we need to
	// explicitly cast here.
	final UndoRedoActionGroup undoRedoActionGroup = (UndoRedoActionGroup) targetEditor
			.getAdapter(UndoRedoActionGroup.class);
	if (undoRedoActionGroup != null) {
		undoRedoActionGroup.fillActionBars(getActionBars());
	}
}
 
/**
 * Creates a new <code>RefactorActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type <code>
 * org.eclipse.jface.viewers.IStructuredSelection</code>.
 *
 * @param part the view part that owns this action group
 */
public RefactorActionGroup(IViewPart part) {
	this(part.getSite(), null);

	IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
	fUndoRedoActionGroup= new UndoRedoActionGroup(part.getViewSite(), workspaceContext, true);

	installQuickAccessAction();
}
 
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);
}
 
源代码7 项目: tmxeditor8   文件: TmxEditorViewer.java
@Override
public void init(IViewSite site) throws PartInitException {
	super.init(site);
	this.openCloseListener = new ArrayList<TmxEditorOpenCloseListener>();
	undoRedoActionGroup = new UndoRedoActionGroup(getSite(), getSite().getWorkbenchWindow().getWorkbench()
			.getOperationSupport().getUndoContext(), true);
	PlatformUI.getWorkbench().addWorkbenchListener(workbenchListener);
}
 
源代码8 项目: tmxeditor8   文件: XLIFFEditorImplWithNatTable.java
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);
}
 
源代码9 项目: gef   文件: AbstractFXEditor.java
@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(final Class key) {
	// Provide a default selection provider (subclasses may overwrite by
	// handling the key and returning a different implementation
	// replace with binding
	if (ISelectionProvider.class.equals(key)) {
		if (selectionProvider != null) {
			return selectionProvider;
		}
	}
	// contribute to Properties view
	if (IPropertySheetPage.class.equals(key)) {
		if (propertySheetPage == null) {
			propertySheetPage = createPropertySheetPage();
		}
		if (propertySheetPage != null) {
			return propertySheetPage;
		}
	}
	if (IUndoContext.class.equals(key)) {
		if (domain instanceof HistoricizingDomain) {
			return ((HistoricizingDomain) domain).getUndoContext();
		}
	}
	if (IOperationHistory.class.equals(key)) {
		if (domain instanceof HistoricizingDomain) {
			return ((HistoricizingDomain) domain).getOperationHistory();
		}
	}
	if (UndoRedoActionGroup.class.equals(key)) {
		// used by action bar contributor
		return undoRedoActionGroup;
	}
	if (DeleteAction.class.equals(key)) {
		// used by action bar contributor
		return deleteAction;
	}
	if (SelectAllAction.class.equals(key)) {
		// used by action bar contributor
		return selectAllAction;
	}
	return super.getAdapter(key);
}
 
public void init(ICommonActionExtensionSite anActionSite) {
	IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin
			.getWorkspace().getAdapter(IUndoContext.class);
	undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(),
			workspaceContext, true);
}
 
源代码11 项目: tmxeditor8   文件: UndoRedoActionProvider.java
public void init(ICommonActionExtensionSite anActionSite) {
	IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin
			.getWorkspace().getAdapter(IUndoContext.class);
	undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(),
			workspaceContext, true);
}
 
 类所在包
 同包方法