Java Code Examples for org.eclipse.ui.actions.ActionContext#getSelection()
The following examples show how to use
org.eclipse.ui.actions.ActionContext#getSelection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N4JSNavigatorActionProvider.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public void setContext(final ActionContext context) { super.setContext(context); projectGroup.setContext(context); // context is null if disposal of the provider is triggered if (null != context) { StructuredSelection selection = (StructuredSelection) context.getSelection(); List<Object> selectedElements = Arrays.asList(selection.toArray()); selectionContainsWorkingSet = selectedElements.stream() .anyMatch(element -> element instanceof WorkingSet); // try to minimize number of context updates for working set action provider if (selectionContainsWorkingSet) { workingSetActionProvider.setContext(context); } assignWorkingSetsAction.selectionChanged(selection); } }
Example 2
Source File: NavigationActionProvider.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override public void fillContextMenu(IMenuManager menu) { ActionContext con = getContext(); var selection = (IStructuredSelection) con.getSelection(); List<INavigationElement<?>> elements = Viewers.getAll(selection); if (showDbCreate(elements)) { menu.add(new DbCreateAction()); menu.add(new DbImportAction()); if (App.runsInDevMode() && Database.get() == null) { menu.add(new XNexusEcoinventIndexExportAction()); } } if (elements.size() == 1) { registerSingleActions(elements.get(0), menu, actions); } else if (elements.size() > 1) { registerMultiActions(elements, menu, actions); } addCloudMenu(elements, menu); }
Example 3
Source File: N4JSOpenActions.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void setContext(final ActionContext context) { super.setContext(context); selection = null == context ? null : context.getSelection(); if (inViewPart) { openGroup.setContext(context); } }
Example 4
Source File: AppEngineActionProvider.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** Provides opportunity for actions to update based on current selection. */ @Override public void setContext(ActionContext context) { if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) context.getSelection(); openFileAction.selectionChanged(selection); } }
Example 5
Source File: WorkManagementActionProvider.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void setContext(ActionContext context) { super.setContext(context); if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) context.getSelection(); addBookmarkAction.selectionChanged(sSel); addTaskAction.selectionChanged(sSel); } else { addBookmarkAction.selectionChanged(StructuredSelection.EMPTY); addTaskAction.selectionChanged(StructuredSelection.EMPTY); } }
Example 6
Source File: WorkManagementActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void setContext(ActionContext context) { super.setContext(context); if (context != null && context.getSelection() instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) context.getSelection(); addBookmarkAction.selectionChanged(sSel); addTaskAction.selectionChanged(sSel); } else { addBookmarkAction.selectionChanged(StructuredSelection.EMPTY); addTaskAction.selectionChanged(StructuredSelection.EMPTY); } }