use of org.eclipse.jface.action.IMenuListener in project tdi-studio-se by Talend.
the class ThreadFilteredTree method createContextMenu.
/**
* Creates the context menu.
*
* @param actionBars The action bars
*/
private void createContextMenu(IActionBars actionBars) {
configureColumnsAction = new ConfigureColumnsAction(this);
final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
getViewer().addSelectionChangedListener(copyAction);
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.add(copyAction);
manager.add(new Separator());
manager.add(configureColumnsAction);
}
});
Menu menu = menuMgr.createContextMenu(getViewer().getControl());
getViewer().getControl().setMenu(menu);
}
use of org.eclipse.jface.action.IMenuListener in project tdi-studio-se by Talend.
the class BuildInDBStructure method addContextMenu.
/**
* qzhang Comment method "addContextMenu".
*/
private void addContextMenu() {
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("Menu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
manager.add(generateSelectAction);
}
});
Menu contextMenu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(contextMenu);
}
use of org.eclipse.jface.action.IMenuListener in project tdi-studio-se by Talend.
the class DBStructureComposite method addContextMenu.
/**
* Add context menu.
*
* method description.
*
* @param
* @return
* @exception
*/
private void addContextMenu() {
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("Menu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
}
@SuppressWarnings("unchecked")
private void fillContextMenu(IMenuManager manager) {
// GenerateSelectSQL
manager.add(generateSelectAction);
// open editor
builderDialog.getConnParameters().setQueryObject(null);
manager.add(openNewEditorAction);
// Separator
manager.add(separator);
// refresh
((RefreshConnectionAction) refreshConnectionAction).init();
manager.add(refreshConnectionAction);
manager.add(separator);
// metadata refresh
manager.add(metadataRefreshAction);
manager.add(separator);
manager.add(openQueryAction);
manager.add(deleteQueryAction);
manager.add(showQueryPropertyAction);
}
});
Menu contextMenu = menuMgr.createContextMenu(treeViewer.getTree());
treeViewer.getTree().setMenu(contextMenu);
}
Aggregations