当前位置: 首页>>代码示例>>Java>>正文


Java IWorkbenchAction类代码示例

本文整理汇总了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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:26,代码来源:EnsembleActionBarAdvisor.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:EnsembleActionBarAdvisor.java

示例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);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:8,代码来源:ApplicationActionBarAdvisor.java

示例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;
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:12,代码来源:CutDeleteAction.java

示例5: dispose

import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; //导入依赖的package包/类
@Override
public void dispose()
{
    for (IWorkbenchAction action : global_actions)
        action.dispose();
    global_actions.clear();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:8,代码来源:DisplayEditorToolbarContributor.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:12,代码来源:EnsembleActionBarAdvisor.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:37,代码来源:EnsembleActionBarAdvisor.java

示例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());
	}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:AbstractEnsembleEditorPart.java

示例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;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:8,代码来源:SavePerspectiveHandler.java

示例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;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:7,代码来源:GUIEditorActionBarAdvisor.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:6,代码来源:WizardUtils.java

示例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);

}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:7,代码来源:WizardUtils.java

示例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;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:7,代码来源:ResetPerspectiveHandler.java

示例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();
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:14,代码来源:FactoryActionRunner.java


注:本文中的org.eclipse.ui.actions.ActionFactory.IWorkbenchAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。