org.eclipse.ui.texteditor.ITextEditorActionConstants Java Examples

The following examples show how to use org.eclipse.ui.texteditor.ITextEditorActionConstants. 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: GamlEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void rulerContextMenuAboutToShow(final IMenuManager menu) {
	super.rulerContextMenuAboutToShow(menu);
	menu.remove("projection");

	final IMenuManager foldingMenu = new MenuManager(XtextUIMessages.Editor_FoldingMenu_name, "projection"); //$NON-NLS-1$
	menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, foldingMenu);
	IAction action = getAction("FoldingToggle"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingExpandAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingCollapseAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingCollapseStrings"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingRestore"); //$NON-NLS-1$
	foldingMenu.add(action);
}
 
Example #2
Source File: DeclarationsSearchGroup.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	
	IMenuManager incomingMenu = menu;

	IMenuManager declarationsMenu = new MenuManager(Messages.DeclarationsSearchGroup_Declarations, IContextMenuConstants.GROUP_SEARCH); 
	
	if (editor != null){
		menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, declarationsMenu);	
	} else {
		incomingMenu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, declarationsMenu);
	}
	incomingMenu = declarationsMenu;
	
	incomingMenu.add(findDeclarationsAction);
	incomingMenu.add(findDeclarationsProjectAction);
}
 
Example #3
Source File: ReferencesSearchGroup.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);
	
	IMenuManager incomingMenu = menu;

	IMenuManager declarationsMenu = new MenuManager(Messages.ReferencesSearchGroup_References, IContextMenuConstants.GROUP_SEARCH); 
	
	if (editor != null){
		menu.appendToGroup(ITextEditorActionConstants.GROUP_FIND, declarationsMenu);	
	} else {
		incomingMenu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, declarationsMenu);
	}
	incomingMenu = declarationsMenu;
	
	incomingMenu.add(findReferencesAction);
	incomingMenu.add(findReferencesProjectAction);
}
 
Example #4
Source File: MacroModeStateHandler.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Resets the state of the editor to what it was before macro record or playback
 * started.
 */
public void leaveMacroMode() {
    if (fEditorPart != null) {
        ITextOperationTarget textOperationTarget = fEditorPart.getAdapter(ITextOperationTarget.class);
        if (textOperationTarget instanceof ITextOperationTargetExtension) {
            ITextOperationTargetExtension targetExtension = (ITextOperationTargetExtension) textOperationTarget;
            if (textOperationTarget instanceof ITextOperationTargetExtension) {
                restore(targetExtension, ISourceViewer.CONTENTASSIST_PROPOSALS, CONTENT_ASSIST_ENABLED);
                restore(targetExtension, ISourceViewer.QUICK_ASSIST, QUICK_ASSIST_ENABLED);
            }
        }

        if (fEditorPart instanceof ITextEditor) {
            ITextEditor textEditor = (ITextEditor) fEditorPart;
            restore(textEditor, ITextEditorActionConstants.CONTENT_ASSIST);
            restore(textEditor, ITextEditorActionConstants.QUICK_ASSIST);
            restore(textEditor, ITextEditorActionConstants.BLOCK_SELECTION_MODE);
        }
    }
}
 
Example #5
Source File: DecoratedScriptEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void rulerContextMenuAboutToShow( IMenuManager menu )
{
	super.rulerContextMenuAboutToShow( menu );

	IMenuManager foldingMenu = new MenuManager( Messages.getString( "JSEditor.Folding.Group" ) ); //$NON-NLS-1$

	menu.appendToGroup( ITextEditorActionConstants.GROUP_RULERS,
			foldingMenu );

	IAction expandAll = getAction( "FoldingExpandAll" ); //$NON-NLS-1$
	IAction collapseAll = getAction( "FoldingCollapseAll" ); //$NON-NLS-1$
	IAction collapseComments = getAction( "FoldingCollapseComments" ); //$NON-NLS-1$
	IAction collapseMethods = getAction( "FoldingCollapseMethods" ); //$NON-NLS-1$

	// Enables all actions.
	enableAction( expandAll );
	enableAction( collapseAll );
	enableAction( collapseComments );
	enableAction( collapseMethods );

	// Adds all actions into folding group.
	foldingMenu.add( expandAll );
	foldingMenu.add( collapseAll );
	foldingMenu.add( collapseComments );
	foldingMenu.add( collapseMethods );
}
 
Example #6
Source File: EmbeddedEditorActions.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected void initialize() {
	createFocusAndDisposeListeners();

	createActions();

	// create context menu
	MenuManager manager = new MenuManager(null, null);
	manager.setRemoveAllWhenShown(true);
	manager.addMenuListener(new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager mgr) {
			fillContextMenu(mgr);
		}
	});

	StyledText text = viewer.getTextWidget();
	Menu menu = manager.createContextMenu(text);
	text.setMenu(menu);
	
	List<ActionActivationCode> activationCodes = Lists.newArrayList();
	setActionActivationCode(activationCodes, ITextEditorActionConstants.SHIFT_RIGHT_TAB,'\t', -1, SWT.NONE);
	setActionActivationCode(activationCodes, ITextEditorActionConstants.SHIFT_LEFT, '\t', -1, SWT.SHIFT);
	viewer.getTextWidget().addVerifyKeyListener(new ActivationCodeTrigger(allActions, activationCodes));
}
 
Example #7
Source File: JavaMergeViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
	if (fEditor != null) {
		Object editor= fEditor.get(sourceViewer);
		if (editor instanceof CompilationUnitEditorAdapter) {
			CompilationUnitEditorAdapter cuea = (CompilationUnitEditorAdapter)editor;
			cuea.setActionsActivated(state);

			IAction saveAction= cuea.getAction(ITextEditorActionConstants.SAVE);
			if (saveAction instanceof IPageListener) {
				PartEventAction partEventAction = (PartEventAction) saveAction;
				IWorkbenchPart compareEditorPart= getCompareConfiguration().getContainer().getWorkbenchPart();
				if (state)
					partEventAction.partActivated(compareEditorPart);
				else
					partEventAction.partDeactivated(compareEditorPart);
			}
		}
	}
}
 
Example #8
Source File: DefaultMergeViewer.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
	DefaultMergeEditor mergeEditor = getEditor(sourceViewer);
	if (mergeEditor != null) {
		mergeEditor.setActionsActivated(state);
		IAction saveAction = mergeEditor.getAction(ITextEditorActionConstants.SAVE);
		if (saveAction instanceof IPageListener) {
			PartEventAction partEventAction = (PartEventAction) saveAction;
			IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
			if (state) {
				partEventAction.partActivated(compareEditorPart);
			} else {
				partEventAction.partDeactivated(compareEditorPart);
			}
		}
	}
}
 
Example #9
Source File: EditTemplateDialog.java    From typescript.java with MIT License 6 votes vote down vote up
private void fillContextMenu(IMenuManager menu) {
	menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_UNDO));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO));

	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.CUT));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.COPY));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.PASTE));
	menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
			(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));

	menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
	menu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$
}
 
Example #10
Source File: TypeScriptMergeViewer.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
	if (fEditor != null) {
		Object editor = fEditor.get(sourceViewer);
		if (editor instanceof TypeScriptEditorAdapter) {
			TypeScriptEditorAdapter cuea = (TypeScriptEditorAdapter) editor;
			cuea.setActionsActivated(state);

			IAction saveAction = cuea.getAction(ITextEditorActionConstants.SAVE);
			if (saveAction instanceof IPageListener) {
				PartEventAction partEventAction = (PartEventAction) saveAction;
				IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
				if (state)
					partEventAction.partActivated(compareEditorPart);
				else
					partEventAction.partDeactivated(compareEditorPart);
			}
		}
	}
}
 
Example #11
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void rulerContextMenuAboutToShow(IMenuManager menu) {
	super.rulerContextMenuAboutToShow(menu);
	IMenuManager foldingMenu= new MenuManager(JavaEditorMessages.Editor_FoldingMenu_name, "projection"); //$NON-NLS-1$
	menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, foldingMenu);

	IAction action= getAction("FoldingToggle"); //$NON-NLS-1$
	foldingMenu.add(action);
	action= getAction("FoldingExpandAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action= getAction("FoldingCollapseAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action= getAction("FoldingRestore"); //$NON-NLS-1$
	foldingMenu.add(action);
	action= getAction("FoldingCollapseMembers"); //$NON-NLS-1$
	foldingMenu.add(action);
	action= getAction("FoldingCollapseComments"); //$NON-NLS-1$
	foldingMenu.add(action);
}
 
Example #12
Source File: FindBarDecorator.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Updates the find bar action (sets it as the Aptana find bar or restores the original one).
 */
private void updateFindBarAction()
{
	IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore();
	boolean useCustomFindBar = preferenceStore.getBoolean(IPreferencesConstants.USE_CUSTOM_FIND_BAR);
	if (useCustomFindBar)
	{
		// Replaces the actual find with our find.
		textEditor.setAction(ITextEditorActionConstants.FIND, new ShowFindBarAction(textEditor));
	}
	else
	{
		// Restore the original find action.
		textEditor.setAction(ITextEditorActionConstants.FIND, fOriginalFindBarAction);
	}

}
 
Example #13
Source File: CommonTextEditorActionContributor.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void contributeToStatusLine(IStatusLineManager statusLineManager) {
	commandsMenuContributionItem = new CommandsMenuContributionItem();
	statusLineManager.add(commandsMenuContributionItem);
	super.contributeToStatusLine(statusLineManager);

	inputPositionStatsContributionItem = new StatusLineContributionItem(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION, true, 24);
	IContributionItem[] contributionItems = statusLineManager.getItems();
	for (IContributionItem contributionItem : contributionItems) {
		String id = contributionItem.getId();

		if (ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION.equals(id)) {
			statusLineManager.remove(contributionItem);
			statusLineManager.add(inputPositionStatsContributionItem);
		}
	}
}
 
Example #14
Source File: CommonTextEditorActionContributor.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setActiveEditor(IEditorPart part) {
	super.setActiveEditor(part);
	if (part instanceof ITextEditor) {
		ITextEditor textEditor = (ITextEditor) part;
		if (commandsMenuContributionItem != null) {
			commandsMenuContributionItem.setTextEditor(textEditor);
		}

		if (inputPositionStatsContributionItem != null) {
			inputPositionStatsContributionItem.setActionHandler(getAction(textEditor, ITextEditorActionConstants.GOTO_LINE));
			ITextEditorExtension extension = (ITextEditorExtension) textEditor;
			extension.setStatusField(inputPositionStatsContributionItem, ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
		}

		if (part instanceof AbstractThemeableEditor) {
			FoldingActionsGroup foldingActions = ((AbstractThemeableEditor) part).getFoldingActionsGroup();
			if (foldingActions != null) {
				foldingActions.updateActionBars();
			}
		}
		markOccurrencesAction.setEditor(textEditor);
	}
}
 
Example #15
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 #16
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public ImplementorsSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindImplementorsAction= new FindImplementorsAction(fEditor);
	fFindImplementorsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKSPACE);
	fEditor.setAction("SearchImplementorsInWorkspace", fFindImplementorsAction); //$NON-NLS-1$

	fFindImplementorsInProjectAction= new FindImplementorsInProjectAction(fEditor);
	fFindImplementorsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_PROJECT);
	fEditor.setAction("SearchImplementorsInProject", fFindImplementorsInProjectAction); //$NON-NLS-1$

	fFindImplementorsInWorkingSetAction= new FindImplementorsInWorkingSetAction(fEditor);
	fFindImplementorsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_IMPLEMENTORS_IN_WORKING_SET);
	fEditor.setAction("SearchImplementorsInWorkingSet", fFindImplementorsInWorkingSetAction); //$NON-NLS-1$
}
 
Example #17
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public WriteReferencesSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindWriteReferencesAction= new FindWriteReferencesAction(fEditor);
	fFindWriteReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
	fEditor.setAction("SearchWriteAccessInWorkspace", fFindWriteReferencesAction); //$NON-NLS-1$

	fFindWriteReferencesInProjectAction= new FindWriteReferencesInProjectAction(fEditor);
	fFindWriteReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_PROJECT);
	fEditor.setAction("SearchWriteAccessInProject", fFindWriteReferencesInProjectAction); //$NON-NLS-1$

	fFindWriteReferencesInHierarchyAction= new FindWriteReferencesInHierarchyAction(fEditor);
	fFindWriteReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
	fEditor.setAction("SearchWriteAccessInHierarchy", fFindWriteReferencesInHierarchyAction); //$NON-NLS-1$

	fFindWriteReferencesInWorkingSetAction= new FindWriteReferencesInWorkingSetAction(fEditor);
	fFindWriteReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
	fEditor.setAction("SearchWriteAccessInWorkingSet", fFindWriteReferencesInWorkingSetAction); //$NON-NLS-1$
}
 
Example #18
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 *
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public DeclarationsSearchGroup(JavaEditor editor) {
	Assert.isNotNull(editor);
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindDeclarationsAction= new FindDeclarationsAction(fEditor);
	fFindDeclarationsAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE);
	fEditor.setAction("SearchDeclarationsInWorkspace", fFindDeclarationsAction); //$NON-NLS-1$

	fFindDeclarationsInProjectAction= new FindDeclarationsInProjectAction(fEditor);
	fFindDeclarationsInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS);
	fEditor.setAction("SearchDeclarationsInProjects", fFindDeclarationsInProjectAction); //$NON-NLS-1$

	fFindDeclarationsInHierarchyAction= new FindDeclarationsInHierarchyAction(fEditor);
	fFindDeclarationsInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY);
	fEditor.setAction("SearchDeclarationsInHierarchy", fFindDeclarationsInHierarchyAction); //$NON-NLS-1$

	fFindDeclarationsInWorkingSetAction= new FindDeclarationsInWorkingSetAction(fEditor);
	fFindDeclarationsInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET);
	fEditor.setAction("SearchDeclarationsInWorkingSet", fFindDeclarationsInWorkingSetAction); //$NON-NLS-1$
}
 
Example #19
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public ReadReferencesSearchGroup(JavaEditor editor) {
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindReadReferencesAction= new FindReadReferencesAction(fEditor);
	fFindReadReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKSPACE);
	fEditor.setAction("SearchReadAccessInWorkspace", fFindReadReferencesAction); //$NON-NLS-1$

	fFindReadReferencesInProjectAction= new FindReadReferencesInProjectAction(fEditor);
	fFindReadReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_READ_ACCESS_IN_PROJECT);
	fEditor.setAction("SearchReadAccessInProject", fFindReadReferencesInProjectAction); //$NON-NLS-1$

	fFindReadReferencesInHierarchyAction= new FindReadReferencesInHierarchyAction(fEditor);
	fFindReadReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_HIERARCHY);
	fEditor.setAction("SearchReadAccessInHierarchy", fFindReadReferencesInHierarchyAction); //$NON-NLS-1$

	fFindReadReferencesInWorkingSetAction= new FindReadReferencesInWorkingSetAction(fEditor);
	fFindReadReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_WRITE_ACCESS_IN_WORKING_SET);
	fEditor.setAction("SearchReadAccessInWorkingSet", fFindReadReferencesInWorkingSetAction); //$NON-NLS-1$
}
 
Example #20
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public ReferencesSearchGroup(JavaEditor editor) {
	Assert.isNotNull(editor);
	fEditor= editor;
	fSite= fEditor.getSite();
	fGroupId= ITextEditorActionConstants.GROUP_FIND;

	fFindReferencesAction= new FindReferencesAction(editor);
	fFindReferencesAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKSPACE);
	fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$

	fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor);
	fFindReferencesInProjectAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_PROJECT);
	fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$

	fFindReferencesInHierarchyAction= new FindReferencesInHierarchyAction(fEditor);
	fFindReferencesInHierarchyAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_HIERARCHY);
	fEditor.setAction("SearchReferencesInHierarchy", fFindReferencesInHierarchyAction); //$NON-NLS-1$

	fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor);
	fFindReferencesInWorkingSetAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.SEARCH_REFERENCES_IN_WORKING_SET);
	fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$
}
 
Example #21
Source File: AbstractInfoView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void menuAboutToShow(IMenuManager menu) {
	menu.add(new Separator(IContextMenuConstants.GROUP_GOTO));
	menu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
	menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
	menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));

	IAction action;

	action= getCopyToClipboardAction();
	if (action != null)
		menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action);

	action= getSelectAllAction();
	if (action != null)
		menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action);

	menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fGotoInputAction);
}
 
Example #22
Source File: BasicJavaEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void contributeToMenu(IMenuManager menu) {

	super.contributeToMenu(menu);

	IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
	if (editMenu != null) {

		MenuManager structureSelection= new MenuManager(JavaEditorMessages.ExpandSelectionMenu_label, "expandSelection"); //$NON-NLS-1$
		editMenu.insertAfter(ITextEditorActionConstants.SELECT_ALL, structureSelection);
		structureSelection.add(fStructureSelectEnclosingAction);
		structureSelection.add(fStructureSelectNextAction);
		structureSelection.add(fStructureSelectPreviousAction);
		structureSelection.add(fStructureSelectHistoryAction);

		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_INFORMATION, fRetargetShowInformationAction);
	}

	IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
	if (navigateMenu != null) {
		navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
		navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fOpenHierarchy);
	}

	IMenuManager gotoMenu= menu.findMenuUsingPath("navigate/goTo"); //$NON-NLS-1$
	if (gotoMenu != null) {
		gotoMenu.add(new Separator("additions2"));  //$NON-NLS-1$
		gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); //$NON-NLS-1$
		gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); //$NON-NLS-1$
		gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); //$NON-NLS-1$
	}
}
 
Example #23
Source File: EditTemplateDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void doSourceChanged(IDocument document) {
	String text= document.get();
	fValidationStatus.setOK();
	TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId());
	if (contextType != null) {
		try {
			contextType.validate(text);
		} catch (TemplateException e) {
			fValidationStatus.setError(e.getLocalizedMessage());
		}
	}

	updateAction(ITextEditorActionConstants.UNDO);
	updateStatusAndButtons();
}
 
Example #24
Source File: LangEditorActionContributor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void prepareEditMenu(IMenuManager menu) {
	IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
	if(editMenu != null) {
		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
			ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, 
			ITextEditorActionConstants.CONTENT_ASSIST));
		
		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, pushItem(
			ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION, 
			ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION));
	}
	
}
 
Example #25
Source File: BasicCompilationUnitEditorActionContributor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void contributeToMenu(IMenuManager menu) {

	super.contributeToMenu(menu);
	if (fContentAssistMenuListener != null)
		fContentAssistMenuListener.dispose();

	IMenuManager editMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
	if (editMenu != null) {
		editMenu.add(fChangeEncodingAction);
		IMenuManager caMenu= new MenuManager(JavaEditorMessages.BasicEditorActionContributor_specific_content_assist_menu, "specific_content_assist"); //$NON-NLS-1$
		editMenu.insertAfter(ITextEditorActionConstants.GROUP_ASSIST, caMenu);

		caMenu.add(fRetargetContentAssist);
		Collection<CompletionProposalCategory> descriptors= CompletionProposalComputerRegistry.getDefault().getProposalCategories();
		List<IAction> specificAssistActions= new ArrayList<IAction>(descriptors.size());
		for (Iterator<CompletionProposalCategory> it= descriptors.iterator(); it.hasNext();) {
			final CompletionProposalCategory cat= it.next();
			if (cat.hasComputers()) {
				IAction caAction= new SpecificContentAssistAction(cat);
				caMenu.add(caAction);
				specificAssistActions.add(caAction);
			}
		}
		fSpecificAssistActions= specificAssistActions.toArray(new SpecificContentAssistAction[specificAssistActions.size()]);
		if (fSpecificAssistActions.length > 0) {
			fContentAssistMenuListener= new MenuListener(caMenu);
			caMenu.addMenuListener(fContentAssistMenuListener);
		}
		caMenu.add(new Separator("context_info")); //$NON-NLS-1$
		caMenu.add(fContextInformation);

		editMenu.appendToGroup(ITextEditorActionConstants.GROUP_ASSIST, fQuickAssistAction);
	}
}
 
Example #26
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 #27
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 #28
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void setActiveEditor(IEditorPart part) {
  if (activeEditorPart == part)
    return;

  if (null == part)
    return;
  activeEditorPart = part;

  IActionBars actionBars = getActionBars();
  if (actionBars != null) {

    MultiPageEditorPart editor = (MultiPageEditorPart) part;

    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor,
            ITextEditorActionConstants.DELETE));
    actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor,
            ITextEditorActionConstants.UNDO));
    actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor,
            ITextEditorActionConstants.REDO));
    actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor,
            ITextEditorActionConstants.CUT));
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor,
            ITextEditorActionConstants.COPY));
    actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor,
            ITextEditorActionConstants.PASTE));
    actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor,
            ITextEditorActionConstants.SELECT_ALL));
    actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor,
            ITextEditorActionConstants.FIND));
    actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor,
            IDEActionFactory.BOOKMARK.getId()));
    actionBars.updateActionBars();
  }
}
 
Example #29
Source File: MultiPageEditorContributor.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void setActivePage(IEditorPart part) {

  IActionBars actionBars = getActionBars();
  if (actionBars != null) {

    ITextEditor textEditor = (part instanceof XMLEditor) ? (ITextEditor) part : null;

    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction1(textEditor,
            ITextEditorActionConstants.DELETE));
    actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction1(textEditor,
            ITextEditorActionConstants.UNDO));
    actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction1(textEditor,
            ITextEditorActionConstants.REDO));
    actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction1(textEditor,
            ITextEditorActionConstants.CUT));
    actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction1(textEditor,
            ITextEditorActionConstants.COPY));
    actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction1(textEditor,
            ITextEditorActionConstants.PASTE));
    actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction1(textEditor,
            ITextEditorActionConstants.SELECT_ALL));
    actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction1(textEditor,
            ITextEditorActionConstants.FIND));
    actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction1(textEditor,
            IDEActionFactory.BOOKMARK.getId()));
    actionBars.updateActionBars();
  }
}
 
Example #30
Source File: JavaSelectMarkerRulerAction2.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void annotationDefaultSelected(VerticalRulerEvent event) {
	Annotation annotation= event.getSelectedAnnotation();
	IAnnotationModel model= getAnnotationModel();

	if (isOverrideIndicator(annotation)) {
		((OverrideIndicatorManager.OverrideIndicator)annotation).open();
		return;
	}

	if (isBreakpoint(annotation))
		triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, event.getEvent());

	Position position= model.getPosition(annotation);
	if (position == null)
		return;

	if (isQuickFixTarget(annotation)) {
		ITextOperationTarget operation= (ITextOperationTarget) getTextEditor().getAdapter(ITextOperationTarget.class);
		final int opCode= ISourceViewer.QUICK_ASSIST;
		if (operation != null && operation.canDoOperation(opCode)) {
			getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
			operation.doOperation(opCode);
			return;
		}
	}

	// default:
	super.annotationDefaultSelected(event);
}