use of org.eclipse.jface.action.MenuManager in project erlide_eclipse by erlang.
the class ImplementorsSearchGroup method fillContextMenu.
@Override
public void fillContextMenu(final IMenuManager manager) {
final MenuManager erlangSearchMM = new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
addAction(fFindImplementorsAction, erlangSearchMM);
addAction(fFindImplementorsInProjectAction, erlangSearchMM);
erlangSearchMM.add(new Separator());
for (final IWorkingSet[] i : SearchUtil.getLRUWorkingSets().getSorted()) {
addWorkingSetAction(i, erlangSearchMM);
}
addAction(fFindImplementorsInWorkingSetAction, erlangSearchMM);
if (!erlangSearchMM.isEmpty()) {
manager.appendToGroup(fGroupId, erlangSearchMM);
}
}
use of org.eclipse.jface.action.MenuManager in project erlide_eclipse by erlang.
the class AbstractInfoView method createContextMenu.
/**
* Creates the context menu for this view.
*/
protected void createContextMenu() {
// $NON-NLS-1$
final MenuManager menuManager = new MenuManager("#PopupMenu");
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(this);
final Menu contextMenu = menuManager.createContextMenu(getControl());
getControl().setMenu(contextMenu);
}
use of org.eclipse.jface.action.MenuManager in project vorto by eclipse.
the class DatatypeTreeViewer method initContextMenu.
protected void initContextMenu() {
final MenuManager menuMgr = new MenuManager("#PopupMenuDt");
Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (!treeViewer.getStructuredSelection().isEmpty()) {
final IModelElement model = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
if (model.getId().getModelType() == ModelType.Datatype) {
menuMgr.add(ShareModelAction.newInstance(treeViewer, model));
menuMgr.add(DeleteModelAction.newInstance(localModelWorkspace, treeViewer, model));
menuMgr.add(new ProjectAction("New Mapping Model", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
IModelElement firstElement = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
ModelId modelId = firstElement.getId();
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), new MappingModelWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject(), modelId));
dialog.create();
dialog.open();
}
});
}
}
manager.add(new ProjectAction("New Entity", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
WizardDialog wizardDialog = new WizardDialog(treeViewer.getControl().getShell(), new EntityWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject()));
if (wizardDialog.open() == Window.OK) {
populate(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject().getModelElementsByType(ModelType.Datatype));
}
}
});
manager.add(new ProjectAction("New Enum", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
WizardDialog wizardDialog = new WizardDialog(treeViewer.getControl().getShell(), new EnumWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject()));
if (wizardDialog.open() == Window.OK) {
populate(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject().getModelElementsByType(ModelType.Datatype));
}
}
});
}
});
menuMgr.setRemoveAllWhenShown(true);
this.treeViewer.getControl().setMenu(menu);
}
use of org.eclipse.jface.action.MenuManager in project vorto by eclipse.
the class FunctionblockTreeViewer method initContextMenu.
protected void initContextMenu() {
final MenuManager menuMgr = new MenuManager("#PopupMenuFb");
Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (!treeViewer.getStructuredSelection().isEmpty()) {
final IModelElement model = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
if (model.getId().getModelType() == ModelType.Functionblock) {
MenuManager generatorMenuMgr = new MenuManager("Generate Code");
generatorMenuMgr.add(new PopulateGeneratorsMenu());
menuMgr.add(generatorMenuMgr);
menuMgr.add(ShareModelAction.newInstance(treeViewer, model));
menuMgr.add(DeleteModelAction.newInstance(localModelWorkspace, treeViewer, model));
menuMgr.add(new ProjectAction("New Mapping Model", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
IModelElement firstElement = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
ModelId modelId = firstElement.getId();
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), new MappingModelWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject(), modelId));
dialog.create();
dialog.open();
}
});
}
}
manager.add(new ProjectAction("New Functionblock", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
WizardDialog wizardDialog = new WizardDialog(treeViewer.getControl().getShell(), new FunctionBlockWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject()));
if (wizardDialog.open() == Window.OK) {
populate(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject().getModelElementsByType(ModelType.Functionblock));
}
}
});
}
});
menuMgr.setRemoveAllWhenShown(true);
this.treeViewer.getControl().setMenu(menu);
}
use of org.eclipse.jface.action.MenuManager in project vorto by eclipse.
the class InfomodelTreeViewer method initContextMenu.
protected void initContextMenu() {
final MenuManager menuMgr = new MenuManager("#PopupMenuIM");
Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (!treeViewer.getStructuredSelection().isEmpty()) {
final IModelElement model = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
if (model.getId().getModelType() == ModelType.InformationModel) {
MenuManager generatorMenuMgr = new MenuManager("Generate Code");
generatorMenuMgr.add(new PopulateGeneratorsMenu());
menuMgr.add(generatorMenuMgr);
menuMgr.add(ShareModelAction.newInstance(treeViewer, model));
menuMgr.add(DeleteModelAction.newInstance(localModelWorkspace, treeViewer, model));
menuMgr.add(new ProjectAction("New Mapping Model", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
IModelElement firstElement = (IModelElement) treeViewer.getStructuredSelection().getFirstElement();
ModelId modelId = firstElement.getId();
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), new MappingModelWizard(treeViewer.getLocalModelWorkspace().getProjectBrowser().getSelectedProject(), modelId));
dialog.create();
dialog.open();
}
});
}
}
manager.add(new ProjectAction("New Information Model", ImageUtil.getImage("add_obj.gif"), treeViewer.getLocalModelWorkspace()) {
@Override
public void doAction() {
WizardDialog wizardDialog = new WizardDialog(treeViewer.getControl().getShell(), new InfomodelWizard(localModelWorkspace.getProjectBrowser().getSelectedProject()));
if (wizardDialog.open() == Window.OK) {
populate(localModelWorkspace.getProjectBrowser().getSelectedProject().getModelElementsByType(ModelType.InformationModel));
}
}
});
}
});
menuMgr.setRemoveAllWhenShown(true);
this.treeViewer.getControl().setMenu(menu);
}
Aggregations