org.eclipse.ui.actions.ActionGroup Java Examples

The following examples show how to use org.eclipse.ui.actions.ActionGroup. 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: GWTJavaEditor.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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");
}
 
Example #2
Source File: JavaEditorBreadcrumbActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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)
	});
}
 
Example #3
Source File: ClassFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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$
	 */
}
 
Example #4
Source File: ViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	fMenuManager= actionBars.getMenuManager();
	fillViewMenu(fMenuManager);

	if (fActiveActionGroup == null)
		fActiveActionGroup= fFilterActionGroup;
	((ActionGroup)fActiveActionGroup).fillActionBars(actionBars);
}
 
Example #5
Source File: CompositeActionGroup.java    From typescript.java with MIT License 5 votes vote down vote up
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;
	}
}
 
Example #6
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #7
Source File: GamaNavigator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ActionGroup createCommonActionGroup() {
	return new CommonNavigatorActionGroup(this, getCommonViewer(), getLinkHelperService()) {

		@Override
		protected void fillViewMenu(final IMenuManager menu) {
			menu.removeAll();
		}

	};
}
 
Example #8
Source File: CompositeActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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;
	}
}
 
Example #9
Source File: NewSearchViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #10
Source File: ModulaEditor.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
protected ActionGroup createDeclarationsSearchGroup() {
	return new DeclarationsSearchGroup(this);
}
 
Example #11
Source File: LangNavigatorActionProvider.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	for(ActionGroup actionGroup : actionGroups) {
		actionGroup.fillContextMenu(menu);
	}
}
 
Example #12
Source File: LangNavigatorActionProvider.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	for(ActionGroup actionGroup : actionGroups) {
		actionGroup.fillActionBars(actionBars);
	}
}
 
Example #13
Source File: LangNavigatorActionProvider.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setContext(ActionContext context) {
	for(ActionGroup actionGroup : actionGroups) {
		actionGroup.setContext(context);
	}
}
 
Example #14
Source File: ReportLayoutEditorBreadcrumb.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ActionGroup createContextMenuActionGroup(
		ISelectionProvider selectionProvider )
{
	return null;
}
 
Example #15
Source File: CompositeActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void setGroups(ActionGroup[] groups) {
	Assert.isTrue(fGroups == null);
	Assert.isNotNull(groups);
	fGroups= groups;
}
 
Example #16
Source File: CompositeActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public CompositeActionGroup(ActionGroup[] groups) {
	setGroups(groups);
}
 
Example #17
Source File: JavaEditorBreadcrumb.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ActionGroup createContextMenuActionGroup(ISelectionProvider selectionProvider) {
	return new JavaEditorBreadcrumbActionGroup(getJavaEditor(), selectionProvider);
}
 
Example #18
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
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
              });
  }
 
Example #19
Source File: TypeScriptEditor.java    From typescript.java with MIT License 4 votes vote down vote up
protected ActionGroup getActionGroup() {
	return fActionGroups;
}
 
Example #20
Source File: CompositeActionGroup.java    From typescript.java with MIT License 4 votes vote down vote up
public ActionGroup get(int index) {
	if (fGroups == null)
		return null;
	return fGroups[index];
}
 
Example #21
Source File: CompositeActionGroup.java    From typescript.java with MIT License 4 votes vote down vote up
protected void setGroups(ActionGroup[] groups) {
	Assert.isTrue(fGroups == null);
	Assert.isNotNull(groups);
	fGroups= groups;		
}
 
Example #22
Source File: CompositeActionGroup.java    From typescript.java with MIT License 4 votes vote down vote up
public CompositeActionGroup(ActionGroup[] groups) {
	setGroups(groups);
}
 
Example #23
Source File: ModulaEditor.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
protected ActionGroup createReferencesSearchGroup() {
	return new ReferencesSearchGroup(this);
}
 
Example #24
Source File: ModulaEditor.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
protected ActionGroup createOpenViewActionGroup() {
	return new OpenViewActionGroup(this);
}
 
Example #25
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the standard action group of this editor.
 *
 * @return returns this editor's standard action group
 */
protected ActionGroup getActionGroup() {
	return fActionGroups;
}
 
Example #26
Source File: EditorBreadcrumb.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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);
 
Example #27
Source File: EditorBreadcrumb.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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 );