本文整理了Java中org.eclipse.swt.widgets.Tree.setMenu()
方法的一些代码示例,展示了Tree.setMenu()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.setMenu()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:setMenu
暂无
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void mouseDown(MouseEvent arg0) {
if (arg0.button == 3) {
Point point = new Point(arg0.x, arg0.y);
TreeItem selectedItem = tree.getItem(point);
selectTreeItem();
if (selectedItem == rootRedisServers
|| selectedItem == null) {
tree.setMenu(menu_null);
} else {
NodeType type = (NodeType) selectedItem
.getData(NODE_TYPE);
if (type == NodeType.ROOT) {
tree.setMenu(menu_null);
} else if (type == NodeType.SERVER) {
updateMenuServer(false, menuTreeServer);
tree.setMenu(menuTreeServer);
} else if (type == NodeType.DATABASE
|| type == NodeType.CONTAINER) {
updateMenuDBContainer(type, menuTreeDBContainer);
tree.setMenu(menuTreeDBContainer);
}
}
}
}
});
代码示例来源:origin: pentaho/pentaho-kettle
@Override public void callExtensionPoint( LogChannelInterface logChannelInterface, Object extension )
throws KettleException {
Menu popupMenu = null;
Tree selectionTree = (Tree) extension;
TreeSelection[] objects = spoonSupplier.get().getTreeObjects( selectionTree );
TreeSelection object = objects[ 0 ];
Object selection = object.getSelection();
if ( selection == RunConfiguration.class ) {
popupMenu = createRootPopupMenu( selectionTree );
} else if ( selection instanceof String ) {
runConfiguration = (String) selection;
if ( runConfiguration.equalsIgnoreCase( DefaultRunConfigurationProvider.DEFAULT_CONFIG_NAME ) ) {
return;
}
popupMenu = createItemPopupMenu( selectionTree );
}
if ( popupMenu != null ) {
ConstUI.displayMenu( popupMenu, selectionTree );
} else {
selectionTree.setMenu( null );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
ConstUI.displayMenu( spoonMenu, tree );
} else {
tree.setMenu( null );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void menuDetected( MenuDetectEvent event ) {
if ( tree.getSelectionCount() < 1 ) {
return;
}
TreeItem treeItem = tree.getSelection()[0];
if ( treeItem != null ) {
String[] labels = ConstUI.getTreeStrings( treeItem );
int depth = ConstUI.getTreeLevel( treeItem );
if ( depth == 3 ) {
final String metaStoreName = labels[0];
final String namespace = labels[1];
final String elementTypeName = labels[2];
final String elementName = labels[3];
Menu menu = new Menu( tree );
MenuItem removeItem = new MenuItem( menu, SWT.POP_UP );
removeItem.setText( "Remove element" );
removeItem.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent arg0 ) {
removeElement( metaStoreName, namespace, elementTypeName, elementName );
}
} );
tree.setMenu( menu );
menu.setVisible( true );
}
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
wTree.setMenu( tMenu );
代码示例来源:origin: pentaho/pentaho-kettle
wTree.setMenu( tMenu );
代码示例来源:origin: pentaho/pentaho-kettle
wTree.setMenu( tMenu );
代码示例来源:origin: pentaho/pentaho-kettle
wTree.setMenu( mTree );
代码示例来源:origin: stackoverflow.com
tree.setMenu(menu);
menu.addMenuListener(new MenuAdapter()
代码示例来源:origin: cbeust/testng-eclipse
private void initMenu() {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(this);
Menu menu = menuMgr.createContextMenu(m_tree);
m_tree.setMenu(menu);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Attaches a context menu listener to the tree
* @param menuListener the menu listener
* @param viewSite the view site
* @param selectionProvider the selection provider
*/
void initContextMenu(IMenuListener menuListener, IWorkbenchPartSite viewSite, ISelectionProvider selectionProvider) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(menuMgr, selectionProvider);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
/**
* Attaches a context menu listener to the tree.
*
* @param menuListener the menu listener
* @param popupId the popup id
* @param viewSite the view site
*/
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(popupId, menuMgr, this);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Attaches a context menu listener to the tree.
*
* @param menuListener the menu listener
* @param popupId the popup id
* @param viewSite the view site
*/
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(popupId, menuMgr, this);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Attaches a contextmenu listener to the tree
* @param menuListener the menu listener
* @param popupId the popup id
* @param viewSite the view site
*/
public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(popupId, menuMgr, this);
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
/**
* Attaches a contextmenu listener to the tree
* @param menuListener the menu listener
* @param viewSite the view site
* @param selectionProvider the selection provider
*/
void initContextMenu(IMenuListener menuListener, IWorkbenchPartSite viewSite, ISelectionProvider selectionProvider) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(menuMgr, selectionProvider);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
/**
* Attaches a context menu listener to the tree
* @param menuListener the menu listener
* @param viewSite the view site
* @param selectionProvider the selection provider
*/
void initContextMenu(IMenuListener menuListener, IWorkbenchPartSite viewSite, ISelectionProvider selectionProvider) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(menuListener);
Menu menu= menuMgr.createContextMenu(getTree());
getTree().setMenu(menu);
viewSite.registerContextMenu(menuMgr, selectionProvider);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* Initializes and registers the context menu.
*
* @since 2.0
*/
protected void initContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(manager -> ResourceNavigator.this.fillContextMenu(manager));
TreeViewer viewer = getTreeViewer();
Menu menu = menuMgr.createContextMenu(viewer.getTree());
viewer.getTree().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
代码示例来源:origin: wala/WALA
@Override
protected Control createContents(Composite parent) {
treeViewer = new TreeViewer(parent);
treeViewer.setContentProvider(new GraphContentProvider());
treeViewer.setLabelProvider(new GraphLabelProvider());
treeViewer.setInput(getGraphInput());
// create a pop-up menu
if (getPopUpActions().size() > 0) {
MenuManager mm = new MenuManager();
treeViewer.getTree().setMenu(mm.createContextMenu(treeViewer.getTree()));
for (IAction iAction : getPopUpActions()) {
mm.add(iAction);
}
}
return treeViewer.getTree();
}
代码示例来源:origin: org.eclipse.xtext/ui
/**
* @since 2.4
*/
protected void configureContextMenu() {
MenuManager menuManager = new MenuManager(CONTEXT_MENU_ID, CONTEXT_MENU_ID);
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(getTreeViewer().getTree());
getTreeViewer().getTree().setMenu(contextMenu);
getSite().registerContextMenu(MENU_ID, menuManager, getTreeViewer());
}
代码示例来源:origin: org.eclipse.mylyn.builds/ui
protected void createPopupMenu(Composite parent) {
MenuManager menuManager = new MenuManager();
menuManager.add(new GroupMarker("group.open"));
menuManager.add(new Separator("group.edit"));
menuManager.add(new Separator("group.file"));
menuManager.add(new Separator("group.run"));
menuManager.add(new Separator("group.refresh"));
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menuManager.add(new Separator(BuildsUiConstants.GROUP_PROPERTIES));
Menu contextMenu = menuManager.createContextMenu(parent);
viewer.getTree().setMenu(contextMenu);
getSite().registerContextMenu(menuManager, viewer);
}
内容来源于网络,如有侵权,请联系作者删除!