Search in sources :

Example 1 with ICommonViewerSite

use of org.eclipse.ui.navigator.ICommonViewerSite in project erlide_eclipse by erlang.

the class ErlangFileActionProvider method init.

@Override
public void init(final ICommonActionExtensionSite aSite) {
    final ICommonViewerSite viewSite = aSite.getViewSite();
    if (viewSite instanceof ICommonViewerWorkbenchSite) {
        final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite) viewSite;
        final IWorkbenchPartSite site = workbenchSite.getSite();
        openAction = new OpenErlangAction(aSite, workbenchSite.getSelectionProvider());
        searchActionGroup = new ErlangSearchActionGroup(site);
        final IContextService service = site.getService(IContextService.class);
        if (service != null) {
            service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
        }
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) IContextService(org.eclipse.ui.contexts.IContextService) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Example 2 with ICommonViewerSite

use of org.eclipse.ui.navigator.ICommonViewerSite in project liferay-ide by liferay.

the class PropertiesActionProvider 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();
    }
    PropertiesFile file = null;
    if (selection != null && !selection.isEmpty()) {
        Iterator<?> iterator = selection.iterator();
        Object obj = iterator.next();
        if (obj instanceof PropertiesFile) {
            file = (PropertiesFile) obj;
        }
        if (iterator.hasNext()) {
            file = null;
        }
    }
    menu.add(invisibleSeparator(TOP_SECTION_START_SEPARATOR));
    addTopSection(menu, file);
    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 3 with ICommonViewerSite

use of org.eclipse.ui.navigator.ICommonViewerSite in project liferay-ide by liferay.

the class PropertiesActionProvider method init.

public void init(ICommonActionExtensionSite site) {
    super.init(site);
    this.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(cv, 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)

Example 4 with ICommonViewerSite

use of org.eclipse.ui.navigator.ICommonViewerSite in project jbosstools-openshift by jbosstools.

the class CDKActionProvider method createActions.

protected void createActions(ICommonActionExtensionSite aSite) {
    ICommonViewerSite site = aSite.getViewSite();
    if (site instanceof ICommonViewerWorkbenchSite) {
        ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
        showInOpenshiftViewAction = new ShowInOpenshiftViewAfterStartupAction(wsSite.getSelectionProvider(), OPENSHIFT_VIEW_ID);
        showInDockerViewAction = new ShowInDockerViewAfterStartupAction(wsSite.getSelectionProvider(), DOCKER_VIEW_ID);
        setupCDKAction = new SetupCDKAction(wsSite.getSelectionProvider());
    }
}
Also used : ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) ICommonViewerWorkbenchSite(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite)

Example 5 with ICommonViewerSite

use of org.eclipse.ui.navigator.ICommonViewerSite in project jbosstools-openshift by jbosstools.

the class CDKActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    ICommonViewerSite site = actionSite.getViewSite();
    IStructuredSelection selection = null;
    if (site instanceof ICommonViewerWorkbenchSite) {
        ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
        selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection();
    }
    // $NON-NLS-1$
    IContributionItem quick = menu.find("org.eclipse.ui.navigate.showInQuickMenu");
    if (quick != null && selection != null && selection.size() == 1) {
        if (selection.getFirstElement() instanceof IServer) {
            IServer server = (IServer) selection.getFirstElement();
            if (acceptsServer(server)) {
                if (menu instanceof MenuManager) {
                    ((MenuManager) quick).add(showInDockerViewAction);
                    ((MenuManager) quick).add(showInOpenshiftViewAction);
                }
            }
            if (setupCDKAction.shouldRun()) {
                menu.insertBefore(ServerActionProvider.TOP_SECTION_END_SEPARATOR, setupCDKAction);
            }
        }
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IContributionItem(org.eclipse.jface.action.IContributionItem) ICommonViewerSite(org.eclipse.ui.navigator.ICommonViewerSite) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) 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