本文整理了Java中org.eclipse.swt.widgets.ToolBar.setMenu()
方法的一些代码示例,展示了ToolBar.setMenu()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToolBar.setMenu()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.ToolBar
类名称:ToolBar
方法名:setMenu
暂无
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Sets the context menu manager for this tool bar manager to the given menu
* manager. If the tool bar control exists, it also adds the menu control to
* the tool bar.
*
* @param contextMenuManager
* the context menu manager, or <code>null</code> if none
*/
public void setContextMenuManager(MenuManager contextMenuManager) {
this.contextMenuManager = contextMenuManager;
if (toolBar != null) {
toolBar.setMenu(getContextMenuControl());
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Sets the context menu manager for this tool bar manager to the given menu
* manager. If the tool bar control exists, it also adds the menu control to
* the tool bar.
*
* @param contextMenuManager
* the context menu manager, or <code>null</code> if none
* @since 3.0
*/
public void setContextMenuManager(MenuManager contextMenuManager) {
this.contextMenuManager = contextMenuManager;
if (toolBar != null) {
toolBar.setMenu(getContextMenuControl());
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Sets the context menu manager for this tool bar manager to the given menu
* manager. If the tool bar control exists, it also adds the menu control to
* the tool bar.
*
* @param contextMenuManager
* the context menu manager, or <code>null</code> if none
* @since 3.0
*/
public void setContextMenuManager(MenuManager contextMenuManager) {
this.contextMenuManager = contextMenuManager;
if (toolBar != null) {
toolBar.setMenu(getContextMenuControl());
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Creates and returns this manager's tool bar control. Does not create a
* new control if one already exists.
* <!-- Also create an @link AccessibleListener for the {@link ToolBar}. -->
*
*
* @param parent
* the parent control
* @return the tool bar control
*/
public ToolBar createControl(Composite parent) {
if (!toolBarExist() && parent != null) {
toolBar = new ToolBar(parent, itemStyle);
toolBar.setMenu(getContextMenuControl());
update(true);
// RAP [bm]: no accessible support
// toolBar.getAccessible().addAccessibleListener(getAccessibleListener());
}
return toolBar;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
@Override
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Handles the event when the toobar item does not have its own context
* menu.
*
* @param event
* the event object
*/
private void handleContextMenu(Event event) {
ToolBar toolBar = toolBarManager.getControl();
// If parent has a menu then use that one
Menu parentMenu = toolBar.getParent().getMenu();
if ((parentMenu != null) && (!parentMenu.isDisposed())) {
toolBar.setMenu(parentMenu);
// Hook listener to remove menu once it has disapeared
parentMenu.addListener(SWT.Hide, new Listener() {
@Override
public void handleEvent(Event innerEvent) {
ToolBar innerToolBar = toolBarManager.getControl();
if (innerToolBar != null) {
innerToolBar.setMenu(null);
Menu innerParentMenu = innerToolBar.getParent()
.getMenu();
if (innerParentMenu != null) {
innerParentMenu.removeListener(SWT.Hide, this);
}
}
}
});
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Creates and returns this manager's tool bar control. Does not create
* a new control if one already exists and is not disposed.
* Also create an {@link AccessibleListener} for the {@link ToolBar}.
*
* @param parent
* the parent control
* @return the tool bar control
*/
public ToolBar createControl(Composite parent) {
if (!toolBarExist() && parent != null) {
toolBar = new ToolBar(parent, itemStyle);
toolBar.setMenu(getContextMenuControl());
update(true);
toolBar.getAccessible().addAccessibleListener(getAccessibleListener());
}
return toolBar;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Creates and returns this manager's tool bar control. Does not create
* a new control if one already exists and is not disposed.
* Also create an {@link AccessibleListener} for the {@link ToolBar}.
*
* @param parent
* the parent control
* @return the tool bar control
*/
public ToolBar createControl(Composite parent) {
if (!toolBarExist() && parent != null) {
toolBar = new ToolBar(parent, itemStyle);
toolBar.setMenu(getContextMenuControl());
update(true);
toolBar.getAccessible().addAccessibleListener(getAccessibleListener());
}
return toolBar;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro
manager.addMenuListener(listener);
Menu contextMenu = manager.createContextMenu(toolBarManager.getControl());
toolBarManager.getControl().setMenu(contextMenu);
IntroPlugin.getDefault().setLaunchBar(this);
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
trimStackTB.setMenu(trimStackMenu);
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
trimStackTB.setMenu(trimStackMenu);
内容来源于网络,如有侵权,请联系作者删除!