org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds Java Examples

The following examples show how to use org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds. 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: OccurrencesSearchMenuAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void init(IWorkbenchWindow window) {
	disposeSubmenuActions(); // paranoia code: double initialization should not happen
	if (window != null) {
		fPartService= window.getPartService();
		if (fPartService != null) {
			fRetargetActions= new RetargetAction[] {
				createSubmenuAction(fPartService, JdtActionConstants.FIND_OCCURRENCES_IN_FILE, ActionMessages.OccurrencesSearchMenuAction_occurrences_in_file_label, IJavaEditorActionDefinitionIds.SEARCH_OCCURRENCES_IN_FILE),
				createSubmenuAction(fPartService, JdtActionConstants.FIND_IMPLEMENT_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_implementing_methods_label, IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENT_OCCURRENCES_IN_FILE),
				createSubmenuAction(fPartService, JdtActionConstants.FIND_EXCEPTION_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_throwing_exception_label, IJavaEditorActionDefinitionIds.SEARCH_EXCEPTION_OCCURRENCES_IN_FILE),
				createSubmenuAction(fPartService, JdtActionConstants.FIND_METHOD_EXIT_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_method_exits_label, IJavaEditorActionDefinitionIds.SEARCH_METHOD_EXIT_OCCURRENCES),
				createSubmenuAction(fPartService, JdtActionConstants.FIND_BREAK_CONTINUE_TARGET_OCCURRENCES, ActionMessages.OccurrencesSearchMenuAction_break_continue_target_label, IJavaEditorActionDefinitionIds.SEARCH_BREAK_CONTINUE_TARGET_OCCURRENCES)
			};
		}
	}
}
 
Example #2
Source File: GWTOpenEditorActionGroup.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call
 * this constructor.
 * 
 * @param editor the Java editor
 */
public GWTOpenEditorActionGroup(JavaEditor editor) {
  isEditorOwner = true;
  openAction = new GWTOpenAction(editor);
  openAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
  editor.setAction("OpenEditor", openAction); //$NON-NLS-1$
  site = editor.getEditorSite();
  initialize(site.getSelectionProvider());
}
 
Example #3
Source File: ContractConstraintEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();
    //Disable unsupported actions for groovy editor inside dialogs
    setAction(ITextEditorActionConstants.FIND, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE, null);
    setAction(IJavaEditorActionDefinitionIds.EXTRACT_CLASS, null);
    setAction(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS, null);
    setAction(IJavaEditorActionDefinitionIds.EXTRACT_INTERFACE, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_EDITOR, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_HYPERLINK, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.PULL_UP, null);
    setAction(IJavaEditorActionDefinitionIds.PUSH_DOWN, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_IN_NAVIGATOR_VIEW, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE, null);
    if (fActionGroups != null) {
        fActionGroups.dispose();
        fActionGroups = null;
    }
}
 
Example #4
Source File: BonitaGroovyEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();
    //Disable unsupported actions for groovy editor inside dialogs
    setAction(ITextEditorActionConstants.FIND, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_OUTLINE, null);
    setAction(IJavaEditorActionDefinitionIds.EXTRACT_CLASS, null);
    setAction(IJavaEditorActionDefinitionIds.EXTERNALIZE_STRINGS, null);
    setAction(IJavaEditorActionDefinitionIds.EXTRACT_INTERFACE, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_EDITOR, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_HYPERLINK, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB, null);
    setAction(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.PULL_UP, null);
    setAction(IJavaEditorActionDefinitionIds.PUSH_DOWN, null);
    setAction(IJavaEditorActionDefinitionIds.SHOW_IN_NAVIGATOR_VIEW, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET, null);
    setAction(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE, null);
    if (fActionGroups != null) {
        fActionGroups.dispose();
        fActionGroups = null;
    }
}
 
Example #5
Source File: SurroundWithActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
static SurroundWithTryMultiCatchAction createSurroundWithTryMultiCatchAction(CompilationUnitEditor editor) {
	SurroundWithTryMultiCatchAction result= new SurroundWithTryMultiCatchAction(editor);
	result.setText(ActionMessages.SurroundWithTemplateMenuAction_SurroundWithTryMultiCatchActionName);
	result.setImageDescriptor(JavaPluginImages.getDescriptor(JavaPluginImages.IMG_CORRECTION_CHANGE));
	result.setActionDefinitionId(IJavaEditorActionDefinitionIds.SURROUND_WITH_TRY_MULTI_CATCH);
	editor.setAction("SurroundWithTryMultiCatch", result); //$NON-NLS-1$
	return result;
}
 
Example #6
Source File: SurroundWithActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
static SurroundWithTryCatchAction createSurroundWithTryCatchAction(CompilationUnitEditor editor) {
	SurroundWithTryCatchAction result= new SurroundWithTryCatchAction(editor);
	result.setText(ActionMessages.SurroundWithTemplateMenuAction_SurroundWithTryCatchActionName);
	result.setImageDescriptor(JavaPluginImages.getDescriptor(JavaPluginImages.IMG_CORRECTION_CHANGE));
	result.setActionDefinitionId(IJavaEditorActionDefinitionIds.SURROUND_WITH_TRY_CATCH);
	editor.setAction("SurroundWithTryCatch", result); //$NON-NLS-1$
	return result;
}
 
Example #7
Source File: BasicJavaEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IActionBars bars, IWorkbenchPage page) {
	fToggleBreadcrumbAction= new ToggleBreadcrumbAction(page);
	Iterator<RetargetAction> e= fPartListeners.iterator();
	while (e.hasNext())
		page.addPartListener(e.next());

	super.init(bars, page);

	bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation);
	bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_MARK_OCCURRENCES, fToggleMarkOccurrencesAction);
	bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_BREADCRUMB, fToggleBreadcrumbAction);
}
 
Example #8
Source File: ToggleTextHoverAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructs and updates the action.
 */
public ToggleTextHoverAction() {
	super(JavaEditorMessages.getBundleForConstructedKeys(), "ToggleTextHover.", null); //$NON-NLS-1$
	JavaPluginImages.setToolImageDescriptors(this, "jdoc_hover_edit.gif"); //$NON-NLS-1$
	setActionDefinitionId(IJavaEditorActionDefinitionIds.TOGGLE_TEXT_HOVER);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TOGGLE_TEXTHOVER_ACTION);
	update();
}
 
Example #9
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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);

}
 
Example #10
Source File: PropertiesFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Configures the toggle comment action.
 *
 * @since 3.4
 */
private void configureToggleCommentAction() {
	IAction action= getAction(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT);
	if (action instanceof ToggleCommentAction) {
		ISourceViewer sourceViewer= getSourceViewer();
		SourceViewerConfiguration configuration= getSourceViewerConfiguration();
		((ToggleCommentAction)action).configure(sourceViewer, configuration);
	}
}
 
Example #11
Source File: PropertiesFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createActions() {
	super.createActions();

	IAction action= new ToggleCommentAction(PropertiesFileEditorMessages.getBundleForConstructedKeys(), "ToggleComment.", this); //$NON-NLS-1$
	action.setActionDefinitionId(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT);
	setAction(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT, action);
	markAsStateDependentAction(IJavaEditorActionDefinitionIds.TOGGLE_COMMENT, true);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IJavaHelpContextIds.TOGGLE_COMMENT_ACTION);
	configureToggleCommentAction();

	fOpenAction= new OpenAction(this);
	fOpenAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
	setAction(JdtActionConstants.OPEN, fOpenAction);
}
 
Example #12
Source File: RenameInformationPopup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * WARNING: only works in workbench window context!
 * @return the keybinding for Refactor &gt; Rename
 */
private static String getOpenDialogBinding() {
	IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	if (bindingService == null)
		return ""; //$NON-NLS-1$
	String binding= bindingService.getBestActiveBindingFormattedFor(IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
	return binding == null ? "" : binding; //$NON-NLS-1$
}
 
Example #13
Source File: JavaEditorBreadcrumbActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB, fGoToEditor);
}
 
Example #14
Source File: JavaEditorBreadcrumbActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public BreadcrumbActionGroup(JavaEditor javaEditor) {
	fGoToEditor= new GoToEditorAction(javaEditor);
	fGoToEditor.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_IN_BREADCRUMB);
	fHideBreadcrumb= new ToggleBreadcrumbAction(javaEditor.getSite().getPage(), true);
	fHideBreadcrumb.setActionDefinitionId(IJavaEditorActionDefinitionIds.TOGGLE_BREADCRUMB);
}
 
Example #15
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @deprecated As of 3.5, got replaced by generic Navigate &gt; Show In &gt;
 */
private void createDeprecatedShowInPackageExplorerAction() {
	IAction action= new org.eclipse.jdt.ui.actions.ShowInPackageViewAction(this);
	action.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_IN_PACKAGE_VIEW);
	setAction("ShowInPackageView", action); //$NON-NLS-1$
}
 
Example #16
Source File: PropertiesQuickAssistProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public String getCommandId() {
	return IJavaEditorActionDefinitionIds.RENAME_ELEMENT;
}
 
Example #17
Source File: BasicJavaEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public BasicJavaEditorActionContributor() {
	super();

	ResourceBundle b= JavaEditorMessages.getBundleForConstructedKeys();

	fRetargetShowInformationAction= new RetargetTextEditorAction(b, "Editor.ShowInformation."); //$NON-NLS-1$
	fRetargetShowInformationAction.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_INFORMATION);

	// actions that are "contributed" to editors, they are considered belonging to the active editor
	fTogglePresentation= new TogglePresentationAction();

	fToggleMarkOccurrencesAction= new ToggleMarkOccurrencesAction();

	fGotoMatchingBracket= new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$
	fGotoMatchingBracket.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);

	fShowOutline= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ShowOutline."); //$NON-NLS-1$
	fShowOutline.setActionDefinitionId(IJavaEditorActionDefinitionIds.SHOW_OUTLINE);

	fOpenHierarchy= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "OpenHierarchy."); //$NON-NLS-1$
	fOpenHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_HIERARCHY);

	fOpenStructure= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "OpenStructure."); //$NON-NLS-1$
	fOpenStructure.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_STRUCTURE);

	fStructureSelectEnclosingAction= new RetargetTextEditorAction(b, "StructureSelectEnclosing."); //$NON-NLS-1$
	fStructureSelectEnclosingAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_ENCLOSING);
	fStructureSelectNextAction= new RetargetTextEditorAction(b, "StructureSelectNext."); //$NON-NLS-1$
	fStructureSelectNextAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_NEXT);
	fStructureSelectPreviousAction= new RetargetTextEditorAction(b, "StructureSelectPrevious."); //$NON-NLS-1$
	fStructureSelectPreviousAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_PREVIOUS);
	fStructureSelectHistoryAction= new RetargetTextEditorAction(b, "StructureSelectHistory."); //$NON-NLS-1$
	fStructureSelectHistoryAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SELECT_LAST);

	fGotoNextMemberAction= new RetargetTextEditorAction(b, "GotoNextMember."); //$NON-NLS-1$
	fGotoNextMemberAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
	fGotoPreviousMemberAction= new RetargetTextEditorAction(b, "GotoPreviousMember."); //$NON-NLS-1$
	fGotoPreviousMemberAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER);

	fRemoveOccurrenceAnnotationsAction= new RetargetTextEditorAction(b, "RemoveOccurrenceAnnotations."); //$NON-NLS-1$
	fRemoveOccurrenceAnnotationsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.REMOVE_OCCURRENCE_ANNOTATIONS);
}
 
Example #18
Source File: PropertiesFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void editorContextMenuAboutToShow(IMenuManager menu) {
	super.editorContextMenuAboutToShow(menu);

	addAction(menu, ITextEditorActionConstants.GROUP_EDIT, IJavaEditorActionDefinitionIds.TOGGLE_COMMENT);
}
 
Example #19
Source File: SourceView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void fillActionBars(IActionBars actionBars) {
	super.fillActionBars(actionBars);
	actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, fOpen);
	fOpen.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
}
 
Example #20
Source File: HierarchyInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public HierarchyInformationControl(Shell parent, int shellStyle, int treeStyle) {
	super(parent, shellStyle, treeStyle, IJavaEditorActionDefinitionIds.OPEN_HIERARCHY, true);
	fOtherExpandedElements= null;
	fDoFilter= true;
	fMethodOverrideTester= null;
}
 
Example #21
Source File: RenameRefactoringProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public String getCommandId() {
	return IJavaEditorActionDefinitionIds.RENAME_ELEMENT;
}
 
Example #22
Source File: GWTOpenEditorActionGroup.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Creates a new <code>GWTOpenEditorActionGroup</code>. The group requires
 * that the selection provided by the part's selection provider is of type
 * <code>org.eclipse.jface.viewers.IStructuredSelection</code>.
 * 
 * @param part the view part that owns this action group
 */
public GWTOpenEditorActionGroup(IViewPart part) {
  site = part.getSite();
  openAction = new GWTOpenAction(site);
  openAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR);
  initialize(site.getSelectionProvider());
}