use of org.eclipse.ui.navigator.ICommonViewerSite in project liferay-ide by liferay.
the class WorkflowDefinitionsActionProvider method fillContextMenu.
public void fillContextMenu(IMenuManager menu) {
/*
* This is a temp workaround to clean up the default group that are
* provided by CNF
*/
menu.removeAll();
ICommonViewerSite site = _actionSite.getViewSite();
IStructuredSelection selection = null;
if (site instanceof ICommonViewerWorkbenchSite) {
ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
}
WorkflowDefinitionEntry definition = null;
WorkflowDefinitionsFolder definitionsFolder = null;
if ((selection != null) && !selection.isEmpty()) {
Iterator<?> iterator = selection.iterator();
Object obj = iterator.next();
if (obj instanceof WorkflowDefinitionEntry) {
definition = (WorkflowDefinitionEntry) obj;
}
if (obj instanceof WorkflowDefinitionsFolder) {
definitionsFolder = (WorkflowDefinitionsFolder) obj;
}
if (iterator.hasNext()) {
definition = null;
definitionsFolder = null;
}
}
menu.add(_invisibleSeparator(TOP_SECTION_START_SEPARATOR));
addTopSection(menu, definition, definitionsFolder);
menu.add(_invisibleSeparator(TOP_SECTION_END_SEPARATOR));
menu.add(new Separator());
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end"));
}
use of org.eclipse.ui.navigator.ICommonViewerSite in project liferay-ide by liferay.
the class WorkflowDefinitionsActionProvider method init.
public void init(ICommonActionExtensionSite site) {
super.init(site);
_actionSite = site;
ICommonViewerSite viewerSite = site.getViewSite();
if (viewerSite instanceof ICommonViewerWorkbenchSite) {
StructuredViewer v = site.getStructuredViewer();
if (v instanceof CommonViewer) {
CommonViewer cv = (CommonViewer) v;
ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) viewerSite;
_addListeners(cv);
_makeActions(wsSite.getSelectionProvider());
}
}
}
Aggregations