/** * Overwrite the OpenEditorActionGroup in the CompositeActionGroup with our * custom GWTOpenEditorActionGroup that contains our JSNI-aware GWTOpenAction. */ private void replaceOpenEditorAction(CompositeActionGroup actionGroup, GWTOpenEditorActionGroup newAction) throws Exception { // The fGroups backing array in CompositeActionGroup is private, so we have // to resort to reflection to update it. Field groupsField = CompositeActionGroup.class.getDeclaredField("fGroups"); groupsField.setAccessible(true); ActionGroup[] actionGroups = (ActionGroup[]) groupsField.get(actionGroup); // Search the ActionGroup array and replace the OpenEditorActionGroup for (int i = 0; i < actionGroups.length; i++) { if (actionGroups[i] instanceof OpenEditorActionGroup) { actionGroups[i] = newAction; return; } } throw new Exception("No existing OpenEditorActionGroup found"); }
public JavaEditorBreadcrumbActionGroup(JavaEditor javaEditor, ISelectionProvider selectionProvider) { super(new ActionGroup[] { new BreadcrumbActionGroup(javaEditor), new UndoRedoActionGroup(javaEditor.getEditorSite(), (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class), true), new NewWizardsActionGroup(javaEditor.getEditorSite()), new JavaSearchActionGroup(javaEditor.getEditorSite(), selectionProvider), new NavigateActionGroup(javaEditor.getEditorSite(), selectionProvider), new CCPActionGroup(javaEditor.getEditorSite(), selectionProvider), new GenerateBuildPathActionGroup(javaEditor.getEditorSite(), selectionProvider), new GenerateActionGroup(javaEditor.getEditorSite(), selectionProvider), new RefactorActionGroup(javaEditor.getEditorSite(), selectionProvider), new BuildActionGroup(javaEditor.getEditorSite(), selectionProvider), new ProjectActionGroup(javaEditor.getEditorSite(), selectionProvider), new WorkingSetActionGroup(javaEditor.getEditorSite(), selectionProvider) }); }
@Override protected void createActions() { super.createActions(); setAction(ITextEditorActionConstants.SAVE, null); setAction(ITextEditorActionConstants.REVERT_TO_SAVED, null); fSourceCopyAction= getAction(ITextEditorActionConstants.COPY); fSelectAllAction= getAction(ITextEditorActionConstants.SELECT_ALL); final ActionGroup group= new RefactorActionGroup(this, ITextEditorActionConstants.GROUP_EDIT, true); fActionGroups.addGroup(group); fContextMenuGroup= new CompositeActionGroup(new ActionGroup[] {group}); /* * 1GF82PL: ITPJUI:ALL - Need to be able to add bookmark to class file * * // replace default action with class file specific ones * * setAction(ITextEditorActionConstants.BOOKMARK, new AddClassFileMarkerAction("AddBookmark.", this, IMarker.BOOKMARK, true)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.ADD_TASK, new AddClassFileMarkerAction("AddTask.", this, IMarker.TASK, false)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.RULER_MANAGE_BOOKMARKS, new ClassFileMarkerRulerAction("ManageBookmarks.", getVerticalRuler(), this, IMarker.BOOKMARK, true)); //$NON-NLS-1$ * setAction(ITextEditorActionConstants.RULER_MANAGE_TASKS, new ClassFileMarkerRulerAction("ManageTasks.", getVerticalRuler(), this, IMarker.TASK, true)); //$NON-NLS-1$ */ }
private void createActionControls(Tree tree) { String outlineId = FluentMkUI.PLUGIN_ID + ".outline"; MenuManager menuMgr = new MenuManager(outlineId, outlineId); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager m) { contextMenuAboutToShow(m); } }); menu = menuMgr.createContextMenu(tree); tree.setMenu(menu); IPageSite site = getSite(); site.registerContextMenu(outlineId, menuMgr, viewer); // $NON-NLS-1$ site.setSelectionProvider(viewer); actionGroups = new CompositeActionGroup(new ActionGroup[] { new OpenViewActionGroup(this) }); setAction(ACTION_EXPAND, new ExpandAllAction(viewer)); setAction(ACTION_COLLAPSE, new CollapseAllAction(viewer)); setAction(ACTION_TOGGLE, new ToggleLinkingAction(editor)); setAction(ACTION_COPY, new OutlineCopyAction(this)); setAction(ACTION_CUT, new OutlineCutAction(this)); setAction(ACTION_PASTE, new OutlinePasteAction(this)); setAction(ACTION_DELETE, new OutlineDeleteAction(this)); createToolBar(); }
public void addGroup(ActionGroup group) { if (fGroups == null) { fGroups= new ActionGroup[] { group }; } else { ActionGroup[] newGroups= new ActionGroup[fGroups.length + 1]; System.arraycopy(fGroups, 0, newGroups, 0, fGroups.length); newGroups[fGroups.length]= group; fGroups= newGroups; } }
static CompositeActionGroup createActionsGroup(DataHierarchyView part, ISelectionProvider selProvider) { IViewPart ppart = createPartProxy(part); return new CompositeActionGroup(new ActionGroup[] { new OpenEditorActionGroup(ppart), new OpenViewActionGroup(ppart), // new CCPActionGroup(ppart), new JavaActionsGroup(ppart, new SelectionProviderProxy(part)), new GenerateActionGroup(ppart), new RefactorActionGroup(ppart), new JavaSearchActionGroup(ppart) }); }
@Override protected ActionGroup createCommonActionGroup() { return new CommonNavigatorActionGroup(this, getCommonViewer(), getLinkHelperService()) { @Override protected void fillViewMenu(final IMenuManager menu) { menu.removeAll(); } }; }
public NewSearchViewActionGroup(IViewPart part) { Assert.isNotNull(part); OpenViewActionGroup openViewActionGroup; setGroups(new ActionGroup[]{ new OpenEditorActionGroup(part), openViewActionGroup= new OpenViewActionGroup(part), new GenerateActionGroup(part), new RefactorActionGroup(part), new JavaSearchActionGroup(part) }); openViewActionGroup.containsShowInMenu(false); }
protected void createActions() { fActionGroups= new CompositeActionGroup(new ActionGroup[] { new NewWizardsActionGroup(this.getSite()), fOpenEditorGroup= new OpenEditorActionGroup(this), new OpenViewActionGroup(this), fCCPActionGroup= new CCPActionGroup(this), new GenerateActionGroup(this), new RefactorActionGroup(this), new ImportActionGroup(this), fBuildActionGroup= new BuildActionGroup(this), new JavaSearchActionGroup(this)}); if (fHasWorkingSetFilter) { String viewId= getConfigurationElement().getAttribute("id"); //$NON-NLS-1$ Assert.isNotNull(viewId); IPropertyChangeListener workingSetListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { doWorkingSetChanged(event); } }; fWorkingSetFilterActionGroup= new WorkingSetFilterActionGroup(getSite(), workingSetListener); fViewer.addFilter(fWorkingSetFilterActionGroup.getWorkingSetFilter()); } // Custom filter group if (fHasCustomFilter) fCustomFiltersActionGroup= new CustomFiltersActionGroup(this, fViewer); fToggleLinkingAction= new ToggleLinkingAction(this); fToggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR); }
/** * {@inheritDoc} */ @Override public void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); fMenuManager= actionBars.getMenuManager(); fillViewMenu(fMenuManager); if (fActiveActionGroup == null) fActiveActionGroup= fFilterActionGroup; ((ActionGroup)fActiveActionGroup).fillActionBars(actionBars); }
public CompositeActionGroup(ActionGroup[] groups) { setGroups(groups); }
protected void setGroups(ActionGroup[] groups) { Assert.isTrue(fGroups == null); Assert.isNotNull(groups); fGroups= groups; }
public ActionGroup get(int index) { if (fGroups == null) return null; return fGroups[index]; }
protected ActionGroup getActionGroup() { return fActionGroups; }
private void makeActions() { fRefreshViewAction = new RefreshViewAction(this); fRefreshSingleElementAction= new RefreshElementAction(fCallHierarchyViewer); new CallHierarchyOpenEditorHelper(fLocationViewer); new CallHierarchyOpenEditorHelper(fCallHierarchyViewer); fOpenLocationAction= new OpenLocationAction(this, getSite()); fLocationCopyAction= fLocationViewer.initCopyAction(getViewSite(), fClipboard); fFocusOnSelectionAction = new FocusOnSelectionAction(this); fCopyAction= new CopyCallHierarchyAction(this, fClipboard, fCallHierarchyViewer); fSearchScopeActions = new SearchScopeActionGroup(this, fDialogSettings); fShowSearchInDialogAction= new ShowSearchInDialogAction(this, fCallHierarchyViewer); fFiltersActionGroup = new CallHierarchyFiltersActionGroup(this, fCallHierarchyViewer); fHistoryDropDownAction = new HistoryDropDownAction(this); fHistoryDropDownAction.setEnabled(false); fCancelSearchAction = new CancelSearchAction(this); setCancelEnabled(false); fExpandWithConstructorsAction= new ExpandWithConstructorsAction(this, fCallHierarchyViewer); fRemoveFromViewAction= new RemoveFromViewAction(this, fCallHierarchyViewer); fPinViewAction= new PinCallHierarchyViewAction(this); fToggleOrientationActions = new ToggleOrientationAction[] { new ToggleOrientationAction(this, VIEW_ORIENTATION_VERTICAL), new ToggleOrientationAction(this, VIEW_ORIENTATION_HORIZONTAL), new ToggleOrientationAction(this, VIEW_ORIENTATION_AUTOMATIC), new ToggleOrientationAction(this, VIEW_ORIENTATION_SINGLE) }; fRemoveFromViewAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); fToggleCallModeActions = new ToggleCallModeAction[] { new ToggleCallModeAction(this, CALL_MODE_CALLERS), new ToggleCallModeAction(this, CALL_MODE_CALLEES) }; fToggleFieldModeActions = new SelectFieldModeAction[] { new SelectFieldModeAction(this, IJavaSearchConstants.REFERENCES), new SelectFieldModeAction(this, IJavaSearchConstants.READ_ACCESSES), new SelectFieldModeAction(this, IJavaSearchConstants.WRITE_ACCESSES) }; fActionGroups = new CompositeActionGroup(new ActionGroup[] { new OpenEditorActionGroup(this), new OpenViewActionGroup(this), new CCPActionGroup(this, true), new GenerateActionGroup(this), new RefactorActionGroup(this), new JavaSearchActionGroup(this), fSearchScopeActions, fFiltersActionGroup }); }
@Override protected ActionGroup createContextMenuActionGroup(ISelectionProvider selectionProvider) { return new JavaEditorBreadcrumbActionGroup(getJavaEditor(), selectionProvider); }
@Override protected ActionGroup createContextMenuActionGroup( ISelectionProvider selectionProvider ) { return null; }
@Override public void setContext(ActionContext context) { for(ActionGroup actionGroup : actionGroups) { actionGroup.setContext(context); } }
@Override public void fillActionBars(IActionBars actionBars) { for(ActionGroup actionGroup : actionGroups) { actionGroup.fillActionBars(actionBars); } }
@Override public void fillContextMenu(IMenuManager menu) { for(ActionGroup actionGroup : actionGroups) { actionGroup.fillContextMenu(menu); } }
/** * Create an action group for the context menu shown for the selection of the given selection * provider or <code>null</code> if no context menu should be shown. * * @param selectionProvider the provider of the context selection * @return action group to use to fill the context menu or <code>null</code> */ protected abstract ActionGroup createContextMenuActionGroup(ISelectionProvider selectionProvider);
/** * Returns the standard action group of this editor. * * @return returns this editor's standard action group */ protected ActionGroup getActionGroup() { return fActionGroups; }