public void setActivePage(IEditorPart part) { if (activeEditorPart == part) return; activeEditorPart = part; IActionBars actionBars = getActionBars(); if (actionBars != null) { ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; 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(); } }
public void init(IActionBars bars) { super.init(bars); IMenuManager menuManager = bars.getMenuManager(); IMenuManager editMenu = menuManager .findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); if (editMenu != null) { editMenu.add(new Separator()); editMenu.add(fContentAssistProposal); editMenu.add(fContentFormat); editMenu.add(fContentGotoLastEditPosition); } IToolBarManager toolBarManager = bars.getToolBarManager(); if (toolBarManager != null) { toolBarManager.add(new Separator()); // toolBarManager.add(fTogglePresentation); } bars.getToolBarManager().remove(ITextEditorActionConstants.DELETE); }
/** * Sets the current editor selection to the source range. Optionally sets the current editor * position. * * @param range the source range to be shown in the editor, can be null. * @param moveCursor if true the editor is scrolled to show the range. */ private void setSelection(ISourceRange range, boolean moveCursor) { if (range == null) return; try { int start = range.getOffset(); int length = range.getLength(); setHighlightRange(start, length, moveCursor); if (moveCursor) { if (start > -1 && getSourceViewer() != null) { getSourceViewer().revealRange(start, length); // getSourceViewer().setSelectedRange(start, length); } updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION); } return; } catch (IllegalArgumentException e) {} if (moveCursor) resetHighlightRange(); }
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$ }
@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); } } } }
@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); } } } }
protected OperationHistoryListener installUndoRedoSupport(SourceViewer viewer, IDocument document, final EmbeddedEditorActions actions) { IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(document); final IUndoContext context = undoManager.getUndoContext(); // XXX cp uncommented // IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); OperationHistoryListener operationHistoryListener = new OperationHistoryListener(context, new IUpdate() { public void update() { actions.updateAction(ITextEditorActionConstants.REDO); actions.updateAction(ITextEditorActionConstants.UNDO); } }); viewer.addTextListener(new ITextListener() { public void textChanged(TextEvent event) { actions.updateAction(ITextEditorActionConstants.REDO); actions.updateAction(ITextEditorActionConstants.UNDO); } }); // // operationHistory.addOperationHistoryListener(operationHistoryListener); return operationHistoryListener; }
@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); }
/** * 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); } }
@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); } } }
@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); } }
/** * 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$ }
/** * 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$ }
/** * 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$ }
/** * 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$ }
/** * 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$ }
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); }
@Override public void setActiveEditor(IEditorPart part) { super.setActiveEditor(part); IActionBars actionBars= getActionBars(); IStatusLineManager manager= actionBars.getStatusLineManager(); manager.setMessage(null); manager.setErrorMessage(null); ITextEditor textEditor= null; if (part instanceof ITextEditor) textEditor= (ITextEditor)part; actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, getAction(textEditor, JdtActionConstants.OPEN)); actionBars.setGlobalActionHandler("org.eclipse.jdt.internal.ui.actions.OpenHyperlink", getAction(textEditor, ITextEditorActionConstants.OPEN_HYPERLINK)); //$NON-NLS-1$ }
@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$ */ }
@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); }
@Override public void setActiveEditor(IEditorPart part) { super.setActiveEditor(part); ITextEditor textEditor= null; if (part instanceof ITextEditor) textEditor= (ITextEditor) part; // Source menu. IActionBars bars= getActionBars(); bars.setGlobalActionHandler(JdtActionConstants.COMMENT, getAction(textEditor, "Comment")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.TOGGLE_COMMENT, getAction(textEditor, "ToggleComment")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.FORMAT, getAction(textEditor, "Format")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.FORMAT_ELEMENT, getAction(textEditor, "QuickFormat")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.ADD_BLOCK_COMMENT, getAction(textEditor, "AddBlockComment")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.REMOVE_BLOCK_COMMENT, getAction(textEditor, "RemoveBlockComment")); //$NON-NLS-1$ bars.setGlobalActionHandler(JdtActionConstants.INDENT, getAction(textEditor, "Indent")); //$NON-NLS-1$ IAction action= getAction(textEditor, ITextEditorActionConstants.REFRESH); bars.setGlobalActionHandler(ITextEditorActionConstants.REFRESH, action); fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE)); }
@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); } } } }
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 ); }
/** * @see org.eclipse.ui.part.MultiPageEditorActionBarContributor#setActivePage(org.eclipse.ui.IEditorPart) */ @Override public void setActivePage(IEditorPart part) { if (this.activeEditorPart == part) { return; } this.activeEditorPart = part; final IActionBars actionBars = getActionBars(); if (actionBars != null) { final ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null; 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(); } }
public TLAMultiPageEditorActionBarContributor() { super(); fContentAssistProposal = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssistTip = new RetargetTextEditorAction(TLAEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$ fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); // status field for the line and column of the cursor cursorPositionStatusField = new StatusLineContributionItem( ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION); }