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");
}
}
}
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"));
}
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());
}
}
}
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());
}
}
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);
}
}
}
}
Aggregations