@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); } }
protected void contextMenuAboutToShow(IMenuManager mgr) { if (mgr.isEmpty()) { mgr.add(new GroupMarker(ICommonMenuConstants.GROUP_GOTO)); mgr.add(new Separator(ICommonMenuConstants.GROUP_EDIT)); mgr.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); mgr.add(new Separator(ICommonMenuConstants.GROUP_PROPERTIES)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_COPY)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_CUT)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_PASTE)); mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_DELETE)); } actionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); actionGroups.fillContextMenu(mgr); }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW)); ActionContext context = new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); // Quick views IAction action = getAction(ITypeScriptEditorActionDefinitionIds.SHOW_OUTLINE); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); action = getAction(ITypeScriptEditorActionDefinitionIds.OPEN_IMPLEMENTATION); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); }
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS)); if (fFocusOnSelectionAction.canActionBeAdded()) { menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction); } if (fExpandWithConstructorsAction.canActionBeAdded()) { menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction); } if (fRemoveFromViewAction.canActionBeAdded()){ menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction); } fActionGroups.setContext(new ActionContext(getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); if (fCopyAction.canActionBeAdded()) { menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction); } }
@Override protected BreadcrumbViewer createViewer(Composite composite) { fViewer= new ProblemBreadcrumbViewer(composite, SWT.HORIZONTAL); fViewer.setLabelProvider(createLabelProvider()); fViewer.setToolTipLabelProvider(createToolTipLabelProvider()); fViewer.setContentProvider(createContentProvider()); fViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { fBreadcrumbActionGroup.setContext(new ActionContext(fViewer.getSelection())); } }); fBreadcrumbActionGroup= new JavaEditorBreadcrumbActionGroup(getJavaEditor(), fViewer); fElementChangeListener= new ElementChangeListener(); JavaCore.addElementChangedListener(fElementChangeListener); JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB); return fViewer; }
@Override protected void fillContextMenu(IMenuManager mgr) { super.fillContextMenu(mgr); addSortActions(mgr); fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroup.fillContextMenu(mgr); AbstractPythonSearchQuery query = (AbstractPythonSearchQuery) getInput().getQuery(); if (query.getSearchString().length() > 0) { IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection(); if (!selection.isEmpty()) { ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(), getInput(), selection.toArray(), true); replaceSelection.setText(SearchMessages.ReplaceAction_label_selected); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection); } ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(), null, true); replaceAll.setText(SearchMessages.ReplaceAction_label_all); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll); } }
@Override public void fillContextMenu(IMenuManager menu) { ActionContext con = getContext(); IStructuredSelection selection = (IStructuredSelection) con .getSelection(); List<INavigationElement<?>> elements = Viewers.getAll(selection); if (showDbCreate(elements)) { menu.add(new DbCreateAction()); menu.add(new DbImportAction()); } if (elements.size() == 1) { registerSingleActions(elements.get(0), menu, actions); } else if (elements.size() > 1) { registerMultiActions(elements, menu, actions); } addCloudMenu(elements, menu); }
@Override public void setContext(final ActionContext context) { super.setContext(context); selection = null == context ? null : context.getSelection(); if (inViewPart) { openGroup.setContext(context); } }
@Override public void setContext(final ActionContext context) { super.setContext(context); if (inViewPart) { manageGroup.setContext(context); editGroup.setContext(context); newWizardsGroup.setContext(context); importExportGroup.setContext(context); } }
@Override public void setContext(ActionContext context) { super.setContext(context); if (fGroups == null) return; for (int i= 0; i < fGroups.length; i++) { fGroups[i].setContext(context); } }
public void setContext(ActionContext context) { fReferencesGroup.setContext(context); // fDeclarationsGroup.setContext(context); //// fImplementorsGroup.setContext(context); // fReadAccessGroup.setContext(context); // fWriteAccessGroup.setContext(context); // fOccurrencesGroup.setContext(context); }
public void setContext(ActionContext context) { super.setContext(context); if (fGroups == null) return; for (int i= 0; i < fGroups.length; i++) { fGroups[i].setContext(context); } }
@Override public void setContext(ActionContext context) { if (context == null) { return; } selection = getRealSelection((IStructuredSelection) context.getSelection()); copyQualifiedNameAction.update(selection); super.setContext(context); }
@SuppressWarnings("restriction") private void fillContextMenu(IMenuManager manager) { JavaPlugin.createStandardGroups(manager); IStructuredSelection selection = selectionProvider.getSelection(); actionGroups.setContext(new ActionContext(selection)); actionGroups.fillContextMenu(manager); actionGroups.setContext(null); // manager.add(new Separator()); // drillDownAdapter.addNavigationActions(manager); // Other plug-ins can contribute there actions here // manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }
@Override public void setContext(ActionContext context) { fReferencesGroup.setContext(context); fDeclarationsGroup.setContext(context); fImplementorsGroup.setContext(context); fReadAccessGroup.setContext(context); fWriteAccessGroup.setContext(context); fOccurrencesGroup.setContext(context); }
public void menuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); fActionSet.setContext(new ActionContext(getSelection())); fActionSet.fillContextMenu(menu); fActionSet.setContext(null); }
@Override protected void fillContextMenu(IMenuManager mgr) { super.fillContextMenu(mgr); addSortActions(mgr); mgr.appendToGroup(IContextMenuConstants.GROUP_EDIT, getCopyQualifiedNameAction()); fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroup.fillContextMenu(mgr); }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); }
protected void contextMenuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); IStructuredSelection selection= (IStructuredSelection)getSelection(); fActionGroups.setContext(new ActionContext(selection)); fActionGroups.fillContextMenu(menu); }
@Override public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW)); ActionContext context= new ActionContext(getSelectionProvider().getSelection()); fContextMenuGroup.setContext(context); fContextMenuGroup.fillContextMenu(menu); fContextMenuGroup.setContext(null); //Breadcrumb IAction action= getAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); // Quick views action= getAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); action= getAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY); menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action); // Copy qualified name action= getAction(IJavaEditorActionConstants.COPY_QUALIFIED_NAME); if (menu.find(ITextEditorActionConstants.COPY) != null) menu.insertAfter(ITextEditorActionConstants.COPY, action); else addAction(menu, ITextEditorActionConstants.GROUP_COPY, IJavaEditorActionConstants.COPY_QUALIFIED_NAME); }
private void fillTypesViewerContextMenu(TypeHierarchyViewer viewer, IMenuManager menu) { JavaPlugin.createStandardGroups(menu); menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS)); // viewer entries viewer.contributeToContextMenu(menu); if (fFocusOnSelectionAction.canActionBeAdded()) menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction); menu.appendToGroup(GROUP_FOCUS, fFocusOnTypeAction); fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
private void fillMethodsViewerContextMenu(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); // viewer entries fMethodsViewer.contributeToContextMenu(menu); fActionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection())); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
@Override public void setContext(ActionContext context) { super.setContext(context); if (fInViewPart) { fOpenGroup.setContext(context); } }
@Override public void setContext(ActionContext context) { super.setContext(context); if (fInViewPart) { fOpenViewGroup.setContext(context); fCCPGroup.setContext(context); fGenerateGroup.setContext(context); fSearchGroup.setContext(context); fBuildPathGroup.setContext(context); } }
public void menuAboutToShow(IMenuManager menu) { JavaPlugin.createStandardGroups(menu); IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection(); int size= selection.size(); Object element= selection.getFirstElement(); if (size == 1) addOpenNewWindowAction(menu, element); fActionGroups.setContext(new ActionContext(selection)); fActionGroups.fillContextMenu(menu); fActionGroups.setContext(null); }
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); } }