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


Java Action.setMenuCreator方法代码示例

本文整理汇总了Java中org.eclipse.jface.action.Action.setMenuCreator方法的典型用法代码示例。如果您正苦于以下问题:Java Action.setMenuCreator方法的具体用法?Java Action.setMenuCreator怎么用?Java Action.setMenuCreator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.action.Action的用法示例。


在下文中一共展示了Action.setMenuCreator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMenu

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
public static void createMenu(IWorkbenchWindow window, IToolBarManager man,
		ArrayList<Action> menuArray, Image image, int disableInx) {
	if(man.isEmpty()){
		if(menuArray.size() == 1){
			man.add(menuArray.get(0));
		}else{
			Action act = new Action("Show related Views", SWT.DROP_DOWN){};
			act.setImageDescriptor(ImageUtil.getImageDescriptor(image));
			act.setMenuCreator(new MenuUtil(menuArray, disableInx));
			man.add(act);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:14,代码来源:MenuUtil.java

示例2: createCoolBarManager

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
 * Create the coolbar manager.
 * 
 * @return the coolbar manager
 */
@Override
protected CoolBarManager createCoolBarManager(int style) {
	CoolBarManager coolBarManager = new CoolBarManager(style);

	actionFactory = new ActionFactory(this);

	ToolBarManager toolBarManager = new ToolBarManager();
	coolBarManager.add(toolBarManager);
	addtoolbarAction(toolBarManager, ImagePathConstant.DATA_VIEWER_EXPORT,
			actionFactory.getAction(ExportAction.class.getName()));

	/*
	 * addtoolbarAction( toolBarManager, (XMLConfigUtil.CONFIG_FILES_PATH + ImagePathConstant.DATA_VIEWER_FIND),
	 * actionFactory.getAction(FindAction.class.getName()));
	 */
	addtoolbarAction(toolBarManager, ImagePathConstant.DATA_VIEWER_RELOAD,
			actionFactory.getAction(ReloadAction.class.getName()));
	/*
	 * addtoolbarAction( toolBarManager, (XMLConfigUtil.CONFIG_FILES_PATH + ImagePathConstant.DATA_VIEWER_FILTER),
	 * actionFactory.getAction(FilterAction.class.getName()));
	 */
	addtoolbarAction(toolBarManager,ImagePathConstant.RESET_SORT,
			actionFactory.getAction(ResetSortAction.class.getName()));
	
	addtoolbarAction(toolBarManager,ImagePathConstant.TABLE_ICON,
			actionFactory.getAction(SelectColumnAction.class.getName()));

	addtoolbarAction(toolBarManager, ImagePathConstant.FIND_DATA, 
			actionFactory.getAction(FindAction.class.getName()));
	
	addtoolbarAction(toolBarManager, ImagePathConstant.AUTO_ADJUST_COLUMNS, 
			actionFactory.getAction(AutoExpandColumnsAction.class.getName()));
	
	dropDownAction = new Action("", SWT.DROP_DOWN) {
		@Override
		public void run() {
			tabFolder.showItem(tabFolder.getItem(0));
			tabFolder.setSelection(0);
		}
	};
	dropDownAction.setImageDescriptor(new ImageDescriptor() {

		@Override
		public ImageData getImageData() {
			return ImagePathConstant.DATA_VIEWER_SWITCH_VIEW.getImageFromRegistry().getImageData();
		}
	});

	dropDownAction.setMenuCreator(new ViewDataGridMenuCreator(actionFactory));
	toolBarManager.add(dropDownAction);

	return coolBarManager;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:59,代码来源:DebugDataViewer.java

示例3: VizActionTree

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
 * ActionTree constructor for <b>parent</b> tree nodes that will get a menu.
 * These nodes should have child ActionTrees added via the function
 * 
 * @param text
 *            The text displayed by the Action's IContributionItem. This
 *            will be seen on the MenuItem or ToolItem.
 */
public VizActionTree(String text) {
	// Set the text.
	this.text = text;

	// Define a new JFace Action that will open a Menu for this node. The
	// Menu will show items for the children of this node.
	action = new Action(this.text, IAction.AS_DROP_DOWN_MENU) {
		@Override
		public void run() {
			// This method only appears to be run when the action
			// corresponds to a ToolItem.
			// TODO Have the menu appear in the correct location below the
			// button.

			// ToolItem toolItem = null;
			// Menu menu = null;
			// TODO How do we get the Action's ToolItem?
			// TODO How do we get the Action's Menu?
			// getMenuCreator().getMenu(Control parent);
			//
			// Rectangle r = toolItem.getBounds();
			// Point p = new Point(r.x, r.y + r.height);
			// p = toolItem.getParent().toDisplay(p.x, p.y);
			// menu.setLocation(p.x, p.y);
			// menu.setVisible(true);
		}
	};
	action.setEnabled(false);

	// Initialize the list of children.
	children = new ArrayList<VizActionTree>();

	// Initialize and set the IMenuCreator that will build the menu.
	menuCreator = new MenuCreator();
	action.setMenuCreator(menuCreator);

	// Default to being enabled as soon as possible.
	enabled = true;

	return;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:50,代码来源:VizActionTree.java


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