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


Java ToolItem.getParent方法代码示例

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


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

示例1: runWithEvent

import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
@Override
public void runWithEvent(final Event event) {
	if (event.widget instanceof ToolItem) {
		final ToolItem toolItem = (ToolItem) event.widget;
		final Control control = toolItem.getParent();
		@SuppressWarnings("hiding")
		final Menu menu = getMenu(control);
		final Rectangle bounds = toolItem.getBounds();
		final Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
		menu.setLocation(control.toDisplay(topLeft));
		menu.setVisible(true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:DropDownAction.java

示例2: runWithEvent

import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
@Override
public void runWithEvent(Event event) {
	if (event.widget instanceof ToolItem) {
		final ToolItem toolItem = (ToolItem) event.widget;
		final Control control = toolItem.getParent();
		final Menu menu = getMenuCreator().getMenu(control);

		final Rectangle bounds = toolItem.getBounds();
		final Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
		menu.setLocation(control.toDisplay(topLeft));
		menu.setVisible(true);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:ShowHistoryAction.java

示例3: widgetSelected

import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
/**
 * Handle selection events.
 */	
public void widgetSelected(SelectionEvent event) {
	/**
	 * A selection event will be fired when a drop down tool
	 * item is selected in the main area and in the drop
	 * down arrow.  Examine the event detail to determine
	 * where the widget was selected.
	 */		
	if (event.detail == SWT.ARROW) {
		/*
		 * The drop down arrow was selected.
		 */
		if (visible) {
			// Hide the menu to give the Arrow the appearance of being a toggle button.
			setMenuVisible(false);
		} else {	
			// Position the menu below and vertically aligned with the the drop down tool button.
			final ToolItem toolItem = (ToolItem) event.widget;
			final ToolBar  toolBar = toolItem.getParent();
			
			Rectangle toolItemBounds = toolItem.getBounds();
			Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
			menu.setLocation(point.x, point.y + toolItemBounds.height);
			setMenuVisible(true);
		}
	} else {
		/*
		 * Main area of drop down tool item selected.
		 * An application would invoke the code to perform the action for the tool item.
		 */
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:35,代码来源:DropDownSelectionListener.java

示例4: removeToolItem

import org.eclipse.swt.widgets.ToolItem; //导入方法依赖的package包/类
public void removeToolItem(ToolItem toolItem) {
		if (toolItem.getParent()!=getToolBar())
			return;
		
		toolItem.dispose();
		toolItem = null;
		
//		this.pack();	
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:10,代码来源:PagingToolBar.java


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