本文整理汇总了Java中org.eclipse.ui.actions.ActionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ActionFactory类的具体用法?Java ActionFactory怎么用?Java ActionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionFactory类属于org.eclipse.ui.actions包,在下文中一共展示了ActionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCopyPaste
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
/**
* Initialize copy paste by getting the clipboard and hooking
* the actions to global edit menu.
*
* @param viewer
*/
private void initCopyPaste(TreeViewer viewer) {
this.clipboard = new Clipboard(getSite().getShell().getDisplay());
IActionBars bars = getSite().getActionBars();
bars.setGlobalActionHandler(
ActionFactory.CUT.getId(),
(Action)outlineActions.get(ACTION_CUT));
bars.setGlobalActionHandler(
ActionFactory.COPY.getId(),
(Action)outlineActions.get(ACTION_COPY));
bars.setGlobalActionHandler(
ActionFactory.PASTE.getId(),
(Action)outlineActions.get(ACTION_PASTE));
bars.setGlobalActionHandler(
ActionFactory.DELETE.getId(),
(Action)outlineActions.get(ACTION_DELETE));
}
示例2: makeActions
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
@Override
protected void makeActions ( final IWorkbenchWindow window )
{
this.exitAction = ActionFactory.QUIT.create ( window );
register ( this.exitAction );
this.aboutAction = ActionFactory.ABOUT.create ( window );
register ( this.aboutAction );
this.newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create ( window );
register ( this.newWindowAction );
register ( ActionFactory.NEW_WIZARD_DROP_DOWN.create ( window ) );
register ( ActionFactory.NEW.create ( window ) );
register ( ActionFactory.INTRO.create ( window ) );
register ( ActionFactory.SAVE.create ( window ) );
this.showViews = ContributionItemFactory.VIEWS_SHORTLIST.create ( window );
this.newWizards = ContributionItemFactory.NEW_WIZARD_SHORTLIST.create ( window );
register ( ActionFactory.NEW_EDITOR.create ( window ) );
register ( ActionFactory.PREFERENCES.create ( window ) );
}
示例3: setActivePage
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY));
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE));
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL));
actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND));
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
示例4: createControl
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public void createControl(Composite parent) {
sash = new SashForm(parent, SWT.VERTICAL);
IActionBars bars = getSite().getActionBars();
ActionRegistry ar = getActionRegistry();
bars.setGlobalActionHandler(ActionFactory.COPY.getId(), ar.getAction(ActionFactory.COPY.getId()));
bars.setGlobalActionHandler(ActionFactory.PASTE.getId(), ar.getAction(ActionFactory.PASTE.getId()));
OutLineComposite composite = new OutLineComposite(filter, sash, SWT.NONE);
Control tree = getViewer().createControl(composite.getComposite());
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 10, 1));
tree.setData(GW_WIDGET_ID,GW_OUTLINE_ELEMENTS_TREE);
getViewer().setEditDomain(getEditDomain());
getViewer().setEditPartFactory(gwtpf);
getViewer().setContents(gWGraph);
getSelectionSynchronizer().addViewer(getViewer());
}
示例5: init
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public void init(IPageSite pageSite) {
super.init(pageSite);
IActionBars bars = pageSite.getActionBars();
bars.getToolBarManager().add(getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID));
bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.DELETE.getId()));
bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.UNDO.getId()));
bars.getToolBarManager().add(getActionRegistry().getAction(ActionFactory.REDO.getId()));
bars.setGlobalActionHandler(ClearEdgeBendpointLayoutAction.ID,
getActionRegistry().getAction(ClearEdgeBendpointLayoutAction.ID));
bars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
getActionRegistry().getAction(ActionFactory.UNDO.getId()));
bars.setGlobalActionHandler(ActionFactory.REDO.getId(),
getActionRegistry().getAction(ActionFactory.REDO.getId()));
bars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
getActionRegistry().getAction(ActionFactory.DELETE.getId()));
bars.updateActionBars();
getViewer().setKeyHandler(keyHandler);
pageSite.setSelectionProvider(getViewer());
}
示例6: buildContextMenu
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public void buildContextMenu(IMenuManager menu) {
GEFActionConstants.addStandardActionGroups(menu);
menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionIdConstants.MODIFY_ACTION_ID));
IAction saveAction = getAction(ActionFactory.SAVE.getId());
saveAction.setImageDescriptor(Activator.getImageDescriptor(Activator.IMAGE_SAVE));
menu.appendToGroup(GEFActionConstants.GROUP_SAVE, saveAction);
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, createExportMenuManager());
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.IMPORT_DATABASE_ACTION_ID));
menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, getAction(ActionIdConstants.CHANGE_DATABASE_ACTION_ID));
}
示例7: getAction
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public IAction getAction(final String actionId) {
if (!ActionFactory.DELETE.getId().equals(actionId)) {
return null;
}
final TableViewer tableViewer = getFocusedTableViewer();
if (tableViewer == null) {
return null;
}
if (tableViewer.getTable().getSelectionCount() == 0) {
return null;
}
return deleteAction;
}
示例8: createActions
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
private void createActions() {
// For the following commands we use actions, as they are already available
final IActionBars ab = getViewSite().getActionBars();
openAction = new OpenAction(getSite());
openAction
.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction);
openAction.setEnabled(false);
viewer.addSelectionChangedListener(openAction);
PropertyDialogAction propertiesAction = new PropertyDialogAction(getSite(),
viewer);
propertiesAction
.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES);
ab.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(),
propertiesAction);
propertiesAction.setEnabled(false);
viewer.addSelectionChangedListener(propertiesAction);
}
示例9: PasteAction
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public PasteAction(IWorkbenchPart part) {
super(part);
this.setText(ResourceString.getResourceString("action.title.paste"));
ISharedImages sharedImages = PlatformUI.getWorkbench()
.getSharedImages();
setImageDescriptor(sharedImages
.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
setDisabledImageDescriptor(sharedImages
.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
this.setId(ActionFactory.PASTE.getId());
ERDiagramEditor editor = (ERDiagramEditor) part;
this.editor = editor;
}
示例10: fillActionBars
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
@Override
public void fillActionBars(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(),
new DFSAction(DFSActions.DELETE));
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(),
new DFSAction(DFSActions.REFRESH));
if (site == null)
return;
if ((site.getStructuredViewer().getSelection() instanceof IStructuredSelection)
&& (((IStructuredSelection) site.getStructuredViewer()
.getSelection()).size() == 1)
&& (((IStructuredSelection) site.getStructuredViewer()
.getSelection()).getFirstElement() instanceof DFSFile)) {
actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
new DFSAction(DFSActions.OPEN));
}
actionBars.updateActionBars();
}
示例11: init
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
public void init(IPageSite pageSite) {
super.init(pageSite);
ActionRegistry registry = editor.getEditorActionRegistry();
IActionBars bars = pageSite.getActionBars();
String id = ActionFactory.UNDO.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
id = ActionFactory.REDO.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
id = ActionFactory.DELETE.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
bars.setGlobalActionHandler(ActionFactory.COPY.getId(),
registry.getAction(ActionFactory.COPY.getId()));
bars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
registry.getAction(ActionFactory.PASTE.getId()));
}
示例12: buildActions
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
/**
* Create actions managed by this contributor.
*
* @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions()
*/
protected void buildActions() {
addRetargetAction(new DeleteRetargetAction());
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
IWorkbenchWindow iww = getPage().getWorkbenchWindow();
addRetargetAction((RetargetAction)ActionFactory.COPY.create(iww));
addRetargetAction((RetargetAction)ActionFactory.PASTE.create(iww));
// Registering the zooming actions at the menu bar.
addRetargetAction(new ZoomInRetargetAction());
addRetargetAction(new ZoomOutRetargetAction());
addRetargetAction(new RetargetAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY,
GEFMessages.ToggleGrid_Label, IAction.AS_CHECK_BOX));
}
示例13: contributeToToolBar
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
/**
* Add actions to the given toolbar.
*
* @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
*/
public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(getAction(ActionFactory.COPY.getId()));
toolBarManager.add(getAction(ActionFactory.PASTE.getId()));
toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
toolBarManager.add(getAction(ActionFactory.REDO.getId()));
// Adding the zooming action for the editor.
String[] zoomStrings = new String[] { ZoomManager.FIT_ALL,
ZoomManager.FIT_WIDTH, ZoomManager.FIT_HEIGHT };
ZoomComboContributionItem zoomActionItem = new ZoomComboContributionItem(getPage(), zoomStrings);
toolBarManager.add(zoomActionItem);
//toolBarManager.add(getAction(GEFActionConstants.TOGGLE_GRID_VISIBILITY));
}
示例14: contributeToToolBar
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
/**
* @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
*/
public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
toolBarManager.add(getAction(ActionFactory.REDO.getId()));
toolBarManager.add(new Separator());
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT));
toolBarManager.add(new Separator());
// 수평 방향의 정렬 액션의 추가
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_LEFT));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_CENTER));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_RIGHT));
toolBarManager.add(new Separator());
// 수직 방향의 정렬 액션의 추가
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_TOP));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_MIDDLE));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.ALIGN_BOTTOM));
toolBarManager.add(new Separator());
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.MATCH_WIDTH));
toolBarManager.add(getActionRegistry().getAction(GEFActionConstants.MATCH_HEIGHT));
}
示例15: fillActionBars
import org.eclipse.ui.actions.ActionFactory; //导入依赖的package包/类
/**
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
*/
@Override
public void fillActionBars(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), new DeleteElementAction());
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), new RefreshAction());
actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), new RenameAction());
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
new UndoAction(((ICommonViewerWorkbenchSite) getActionSite().getViewSite()).getPart()));
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), new RedoAction());
// rename 모드일 경우 일반적인 ctrl+c,v 의 액션이고
// rename 모드가 아닌 경우 모델에 대한 ctrl+c, v
if(RenameAction.IS_RENAME_MODE){
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), ActionFactory.COPY.create(((ICommonViewerWorkbenchSite) getActionSite().getViewSite()).getWorkbenchWindow()));
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), ActionFactory.PASTE.create(((ICommonViewerWorkbenchSite) getActionSite().getViewSite()).getWorkbenchWindow()));
} else {
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction());
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), new PasteAction());
}
super.fillActionBars(actionBars);
}