Search in sources :

Example 6 with ICommonViewerSite

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"));
}
Also used : ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) Separator(org.eclipse.jface.action.Separator)

Example 7 with ICommonViewerSite

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());
        }
    }
}
Also used : CommonViewer(org.eclipse.ui.navigator.CommonViewer) ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Aggregations

ICommonViewerSite (org.eclipse.ui.navigator.ICommonViewerSite)7 ICommonViewerWorkbenchSite (org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 Separator (org.eclipse.jface.action.Separator)2 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)2 CommonViewer (org.eclipse.ui.navigator.CommonViewer)2 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)1 IContextService (org.eclipse.ui.contexts.IContextService)1 IServer (org.eclipse.wst.server.core.IServer)1 ErlangSearchActionGroup (org.erlide.ui.actions.ErlangSearchActionGroup)1