use of org.eclipse.jface.action.IMenuManager 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.IMenuManager 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);
}
use of org.eclipse.jface.action.IMenuManager in project bndtools by bndtools.
the class OSGiRunLaunchDelegate method launch.
@Override
public void launch(final ILaunchConfiguration configuration, String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 2);
try {
boolean dynamic = configuration.getAttribute(LaunchConstants.ATTR_DYNAMIC_BUNDLES, LaunchConstants.DEFAULT_DYNAMIC_BUNDLES);
if (dynamic)
registerLaunchPropertiesRegenerator(run, launch);
} catch (Exception e) {
throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error obtaining OSGi project launcher.", e));
}
display = Workbench.getInstance().getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
dialog = new PopupDialog(new Shell(display), PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, false, true, true, true, false, "Errors in running OSGi Framework", "") {
@Override
protected Control createDialogArea(Composite parent) {
textArea = new Text(parent, SWT.LEAD | SWT.READ_ONLY | SWT.WRAP);
return textArea;
}
@Override
protected void fillDialogMenu(IMenuManager dialogMenu) {
super.fillDialogMenu(dialogMenu);
Action dismissAction = new Action("Close") {
@Override
public void run() {
close();
}
};
dialogMenu.add(dismissAction);
}
@Override
protected Control createInfoTextArea(Composite parent) {
Link link = new Link(parent, SWT.NONE);
link.setText("<a>Dismiss…</a> ");
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
close();
}
});
GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.FILL).applyTo(link);
return link;
}
@Override
protected Point getDefaultSize() {
Point p = getShell().getSize();
p.x = Math.max(400, p.x / 2);
p.y = Math.max(200, p.y / 2);
return p;
}
@Override
protected Point getInitialLocation(Point initialSize) {
Rectangle r = getShell().getBounds();
return new Point(r.x + r.width - initialSize.x, r.y + r.height - initialSize.y);
}
@Override
public boolean close() {
if (textArea != null) {
textArea.setText("");
}
return super.close();
}
};
}
});
super.launch(configuration, mode, launch, progress.newChild(1, SubMonitor.SUPPRESS_NONE));
}
Aggregations