本文整理汇总了Java中org.eclipse.ui.actions.ActionFactory.IWorkbenchAction类的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchAction类的具体用法?Java IWorkbenchAction怎么用?Java IWorkbenchAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWorkbenchAction类属于org.eclipse.ui.actions.ActionFactory包,在下文中一共展示了IWorkbenchAction类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGlobalAction
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
public IWorkbenchAction getGlobalAction(ActionFactory actionFactory) {
IWorkbenchAction action = globalActions.get(actionFactory);
if (action == null) {
IWorkbenchWindow window = getWindow();
action = actionFactory.create(window);
if (action != null) { // hopefully action isn't ever null here
if (actionFactory == ActionFactory.DYNAMIC_HELP) {
action.setImageDescriptor(RcpPlugin.getImageDescriptor("icons/related_help_16_16.gif"));
} else if (actionFactory == ActionFactory.SAVE) {
action.setImageDescriptor(RcpPlugin.getImageDescriptor("icons/save.png"));
action.setDisabledImageDescriptor(RcpPlugin.getImageDescriptor("icons/save-disabled.png"));
} else if (actionFactory == ActionFactory.SAVE_ALL) {
action.setImageDescriptor(RcpPlugin.getImageDescriptor("icons/save-all.png"));
action.setDisabledImageDescriptor(RcpPlugin.getImageDescriptor("icons/save-all-disabled.png"));
} else if (actionFactory == ActionFactory.SAVE_AS) {
action.setImageDescriptor(RcpPlugin.getImageDescriptor("icons/save-as.png"));
action.setDisabledImageDescriptor(RcpPlugin.getImageDescriptor("icons/save-as-disabled.png"));
}
register(action);
globalActions.put(actionFactory, action);
}
}
return action;
}
示例2: createHelpMenu
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
/**
* Create the "Help" menu.
*
* @param window
* @return the help MenuManager
*/
protected IMenuManager createHelpMenu() {
IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new Separator());
menu.add(getGlobalAction(ActionFactory.DYNAMIC_HELP));
menu.add(getGlobalAction(ActionFactory.HELP_CONTENTS));
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
menu.add(new Separator());
IWorkbenchAction about = getGlobalAction(ActionFactory.ABOUT);
ActionContributionItem aboutItem = new ActionContributionItem(about);
menu.add(aboutItem);
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
aboutItem.setVisible(false);
}
return menu;
}
示例3: makeActions
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
protected void makeActions(IWorkbenchWindow window) {
openPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
register(openPerspectiveAction);
IWorkbenchAction refreshAction=ActionFactory.REFRESH.create(window);
register(refreshAction);
}
示例4: CutDeleteAction
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
public CutDeleteAction(final DisplayEditor editor, final boolean cut_or_delete)
{
super(editor, cut_or_delete
? ActionFactory.CUT.getCommandId()
: ActionFactory.DELETE.getCommandId());
IWorkbenchAction action = ActionFactory.DELETE.create(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
setText(action.getText());
setImageDescriptor(action.getImageDescriptor());
action = null;
}
示例5: dispose
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
@Override
public void dispose()
{
for (IWorkbenchAction action : global_actions)
action.dispose();
global_actions.clear();
}
示例6: createActionFactoryCommandContributionItem
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
private CommandContributionItem createActionFactoryCommandContributionItem(ActionFactory factory) {
IWorkbenchWindow window = getWindow();
CommandContributionItemParameter parameter = new CommandContributionItemParameter(window, factory.getId(), factory.getCommandId(), SWT.PUSH);
IWorkbenchAction action = factory.create(window);
parameter.icon = action.getImageDescriptor();
parameter.disabledIcon = action.getDisabledImageDescriptor();
parameter.label = action.getText();
parameter.tooltip = action.getToolTipText();
window.getPartService().removePartListener((RetargetAction)action);
return new CommandContributionItem(parameter);
}
示例7: createWindowMenu
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
/**
* Create the "Window" menu.
* file/new
* @return
*/
protected IMenuManager createWindowMenu() {
IWorkbenchWindow window = getWindow();
MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_window, IWorkbenchActionConstants.M_WINDOW);
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS+"2"));
menu.add(new Separator());
MenuManager perspectiveMenu = new MenuManager("Open Perspective", "openPerspective");
IContributionItem perspectiveList = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window);
perspectiveMenu.add(perspectiveList);
menu.add(perspectiveMenu);
MenuManager viewMenu = new MenuManager("Show View", "showView");
IContributionItem viewList = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
viewMenu.add(viewList);
menu.add(viewMenu);
menu.add(ActionFactory.RESET_PERSPECTIVE.create(window));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
IWorkbenchAction newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
newWindowAction.setText("New Window");
menu.add(newWindowAction);
IWorkbenchAction preferences = ActionFactory.PREFERENCES.create(window);
String oldText = preferences.getText();
if (!oldText.contains("...")) {
preferences.setText(oldText+"...");
}
ActionContributionItem preferenceItem = new ActionContributionItem(preferences);
menu.add(preferenceItem);
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
preferenceItem.setVisible(false);
}
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window));
return menu;
}
示例8: copyAttributes
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
private void copyAttributes(IAction actionHandler, ActionFactory actionFactory) {
IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
IWorkbenchAction factoryAction = actionFactory.create(workbenchWindow);
// the following two lines are commented out to suppress shortcuts on the context menu
// actionHandler.setAccelerator(factoryAction.getAccelerator());
// actionHandler.setActionDefinitionId(factoryAction.getActionDefinitionId());
actionHandler.setDescription(factoryAction.getDescription());
actionHandler.setDisabledImageDescriptor(factoryAction.getDisabledImageDescriptor());
actionHandler.setHoverImageDescriptor(factoryAction.getHoverImageDescriptor());
actionHandler.setId(factoryAction.getId());
actionHandler.setImageDescriptor(factoryAction.getImageDescriptor());
actionHandler.setText(factoryAction.getText());
actionHandler.setToolTipText(factoryAction.getToolTipText());
}
示例9: execute
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchAction savePerspectiveAction = ActionFactory.SAVE_PERSPECTIVE.create(window);
savePerspectiveAction.run();
return null;
}
示例10: makeAction
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
protected IWorkbenchAction makeAction(IWorkbenchWindow window,
ActionFactory af) {
IWorkbenchAction action = af.create(window);
register(action);
return action;
}
示例11: addImportWizardSubmenu
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
@SuppressWarnings("restriction")
public static void addImportWizardSubmenu(IMenuManager menu, IWorkbenchAction action, IWorkbenchWindow workbenchWindow, ISelection selection){
addWizardSubmenu(menu, action, WizardUtils.SUBMENU_IMPORT_WIZARD_CATEGORY,
org.eclipse.ui.internal.wizards.ImportWizardRegistry.getInstance(), "Import", workbenchWindow, selection);
}
示例12: addExportWizardSubmenu
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
@SuppressWarnings("restriction")
public static void addExportWizardSubmenu(IMenuManager menu, IWorkbenchAction action, IWorkbenchWindow workbenchWindow, ISelection selection ){
addWizardSubmenu(menu, action, WizardUtils.SUBMENU_EXPORT_WIZARD_CATEGORY,
org.eclipse.ui.internal.wizards.ExportWizardRegistry.getInstance(), "Export", workbenchWindow, selection);
}
示例13: execute
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchAction resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);
resetPerspectiveAction.run();
return null;
}
示例14: run
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
/**
* Creates and executes and action in the Eclipse UI thread.
*
* @see Runnable#run()
* @see Display#asyncExec(Runnable)
* @see #runFactoryAction(ActionFactory)
**/
public void run()
{
IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchAction action = actionFactory.create(activeWindow);
action.run();
}