use of org.talend.designer.core.ui.action.OpenExistVersionProcessAction in project tdi-studio-se by Talend.
the class ProcessVersionComposite method addPopUpMenu.
/**
* DOC Administrator Comment method "addPoppuMenu".
*/
private void addPopUpMenu() {
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopUp");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager mgr) {
if (getParentWizard() == null) {
ISelection selection = tableViewer.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
List<ITreeContextualAction> contextualsActions = ActionsHelper.getRepositoryContextualsActions();
for (ITreeContextualAction action : contextualsActions) {
if (action instanceof OpenExistVersionProcessAction) {
continue;
}
if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
action.init(null, structuredSelection);
Object o = structuredSelection.getFirstElement();
if (o instanceof RepositoryNode) {
((AContextualAction) action).setAvoidUnloadResources(true);
}
if (action.isVisible()) {
mgr.add(action);
}
}
}
}
}
}
});
Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
tableViewer.getControl().setMenu(menu);
}
Aggregations