public ActionContributorXML() { super(); ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle(); // edit commands fShowTooltipAction = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fShowTooltipAction.setActionDefinitionId(ActionDefinitionIds.INFORMATION); fContentAssist = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); // source commands fCleanupDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fCleanupDocument.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT); fFormatDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fFormatDocument.setActionDefinitionId(ActionDefinitionIds.FORMAT_DOCUMENT); fFormatActiveElements = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fFormatActiveElements.setActionDefinitionId(ActionDefinitionIds.FORMAT_ACTIVE_ELEMENTS); // navigate commands fOpenFileAction = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fOpenFileAction.setActionDefinitionId(ActionDefinitionIds.OPEN_FILE); fFindOccurrences = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$ fFindOccurrences.setActionDefinitionId(ActionDefinitionIds.FIND_OCCURRENCES); }
/** * Retargets this action group to the given editor. * * @param editor the text editor to which the group should be retargeted */ public void retarget(ITextEditor editor) { fTextEditor= editor; Iterator<RetargetTextEditorAction> e= fRetargetActions.iterator(); while (e.hasNext()) { RetargetTextEditorAction a= e.next(); a.setAction(editor == null ? null : editor.getAction(a.getId())); } }
public void setViewerSpecificContributionsEnabled(boolean enabled) { super.setViewerSpecificContributionsEnabled(enabled); fShowTooltipAction.setEnabled(enabled); fContentAssist.setEnabled(enabled); // cleanup and format document actions do not rely on source viewer // being enabled // fCleanupDocument.setEnabled(enabled); // fFormatDocument.setEnabled(enabled); fFormatActiveElements.setEnabled(enabled); fOpenFileAction.setEnabled(enabled); fFindOccurrences.setEnabled(enabled); } }
/** * Creates a new action. The action configures its initial visual * representation from the given resource bundle. If this action's * wrapped action is set to <code>null</code> it also uses the * information in the resource bundle. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or * <code>null</code> if none * @see ResourceAction#ResourceAction(ResourceBundle, String) */ public RetargetTextEditorAction(ResourceBundle bundle, String prefix) { super(bundle, prefix); fDefaultText= getText(); installHelpListener(); }
/** * Creates a new action. The action configures its initial visual * representation from the given resource bundle. If this action's * wrapped action is set to <code>null</code> it also uses the * information in the resource bundle. The action gets the given * action id. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none * @param actionId the action id * @see ResourceAction#ResourceAction(ResourceBundle, String) * @since 2.0 */ public RetargetTextEditorAction(ResourceBundle bundle, String prefix, String actionId) { super(bundle, prefix); fDefaultText= getText(); setId(actionId); installHelpListener(); }
/** * {@inheritDoc} */ public void setActiveEditor( IEditorPart part ) { super.setActiveEditor( part ); ITextEditor editor = ( part instanceof ITextEditor ) ? ( ITextEditor ) part : null; contentAssist.setAction( getAction( editor, CONTENTASSIST_ACTION ) ); }
public BasicCompilationUnitEditorActionContributor() { fRetargetContentAssist= new RetargetAction(JdtActionConstants.CONTENT_ASSIST, JavaEditorMessages.ContentAssistProposal_label); fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fRetargetContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fRetargetContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); markAsPartListener(fRetargetContentAssist); fContentAssist= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); fContextInformation= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$ fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fQuickAssistAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$ fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); fChangeEncodingAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$ }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }
/** * Creates a new encoding action group for an action bar contributor. */ public EncodingActionGroup() { fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[0][0] + ".", ENCODINGS[0][0], IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ //$NON-NLS-2$ if (SYSTEM_ENCODING != null) fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding.System.", IEncodingActionsConstants.SYSTEM, IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ for (int i= 1; i < ENCODINGS.length; i++) fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ //$NON-NLS-2$ fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding.Custom.", IEncodingActionsConstants.CUSTOM, IAction.AS_PUSH_BUTTON)); //$NON-NLS-1$ }
/** * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart) */ public void setActiveEditor(IEditorPart activeEditor) { if (getActiveEditorPart() == activeEditor) { return; } super.setActiveEditor(activeEditor); IActionBars actionBars = getActionBars(); if (actionBars != null) { IStatusLineManager statusLineManager = actionBars.getStatusLineManager(); if (statusLineManager != null) { statusLineManager.setMessage(null); statusLineManager.setErrorMessage(null); } } ITextEditor textEditor = getTextEditor(activeEditor); fShowTooltipAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION)); fContentAssist.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS)); fCleanupDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT)); fFormatDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT)); fFormatActiveElements.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS)); fCleanupDocument.setEnabled((textEditor != null) && textEditor.isEditable()); fFormatDocument.setEnabled((textEditor != null) && textEditor.isEditable()); fFormatActiveElements.setEnabled((textEditor != null) && textEditor.isEditable()); fOpenFileAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE)); fFindOccurrences.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES)); }
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS, getAction(editor, ITextEditorActionConstants.SHOW_WHITESPACE_CHARACTERS)); fFindNext.setAction(getAction(editor, ITextEditorActionConstants.FIND_NEXT)); fFindPrevious.setAction(getAction(editor, ITextEditorActionConstants.FIND_PREVIOUS)); fIncrementalFind.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL)); fIncrementalFindReverse.setAction(getAction(editor, ITextEditorActionConstants.FIND_INCREMENTAL_REVERSE)); fGotoLine.setAction(getAction(editor, ITextEditorActionConstants.GOTO_LINE)); fHippieCompletion.setAction(getAction(editor, ITextEditorActionConstants.HIPPIE_COMPLETION));
public BasicCompilationUnitEditorActionContributor() { fRetargetContentAssist= new RetargetAction(JdtActionConstants.CONTENT_ASSIST, JavaEditorMessages.ContentAssistProposal_label); fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fRetargetContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fRetargetContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); markAsPartListener(fRetargetContentAssist); fContentAssist= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); fContextInformation= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$ fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fQuickAssistAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$ fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); fChangeEncodingAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$ }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }
/** * Creates a new encoding action group for an action bar contributor. */ public EncodingActionGroup() { fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[0][0] + ".", ENCODINGS[0][0], IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ //$NON-NLS-2$ if (SYSTEM_ENCODING != null) fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding.System.", IEncodingActionsConstants.SYSTEM, IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ for (int i= 1; i < ENCODINGS.length; i++) fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], IAction.AS_RADIO_BUTTON)); //$NON-NLS-1$ //$NON-NLS-2$ fRetargetActions.add(new RetargetTextEditorAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding.Custom.", IEncodingActionsConstants.CUSTOM, IAction.AS_PUSH_BUTTON)); //$NON-NLS-1$ }
/** * Creates a new action. The action configures its initial visual * representation from the given resource bundle. If this action's * wrapped action is set to <code>null</code> it also uses the * information in the resource bundle. The action gets the given * action id. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or <code>null</code> if none * @param actionId the action id * @see ResourceAction#ResourceAction(ResourceBundle, String) * @since 2.0 */ public RetargetTextEditorAction(ResourceBundle bundle, String prefix, String actionId) { super(bundle, prefix); fDefaultText= getText(); setId(actionId); installHelpListener(); }
/** * Creates a new action. The action configures its initial visual * representation from the given resource bundle. If this action's * wrapped action is set to <code>null</code> it also uses the * information in the resource bundle. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys * (described in <code>ResourceAction</code> constructor), or * <code>null</code> if none * @see ResourceAction#ResourceAction(ResourceBundle, String) */ public RetargetTextEditorAction(ResourceBundle bundle, String prefix) { super(bundle, prefix); fDefaultText= getText(); installHelpListener(); }
public CompilationUnitEditorActionContributor() { super(); ResourceBundle b= JavaEditorMessages.getBundleForConstructedKeys(); fToggleInsertModeAction= new RetargetTextEditorAction(b, "CompilationUnitEditorActionContributor.ToggleInsertMode.", IAction.AS_CHECK_BOX); //$NON-NLS-1$ fToggleInsertModeAction.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE); }
fToggleMarkOccurrencesAction.setEditor(textEditor); fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET)); fShowOutline.setAction(getAction(textEditor, IJavaEditorActionDefinitionIds.SHOW_OUTLINE)); fOpenHierarchy.setAction(getAction(textEditor, IJavaEditorActionDefinitionIds.OPEN_HIERARCHY)); fOpenStructure.setAction(getAction(textEditor, IJavaEditorActionDefinitionIds.OPEN_STRUCTURE)); fStructureSelectEnclosingAction.setAction(getAction(textEditor, StructureSelectionAction.ENCLOSING)); fStructureSelectNextAction.setAction(getAction(textEditor, StructureSelectionAction.NEXT)); fStructureSelectPreviousAction.setAction(getAction(textEditor, StructureSelectionAction.PREVIOUS)); fStructureSelectHistoryAction.setAction(getAction(textEditor, StructureSelectionAction.HISTORY)); fGotoNextMemberAction.setAction(getAction(textEditor, GoToNextPreviousMemberAction.NEXT_MEMBER)); fGotoPreviousMemberAction.setAction(getAction(textEditor, GoToNextPreviousMemberAction.PREVIOUS_MEMBER)); fRemoveOccurrenceAnnotationsAction.setAction(getAction(textEditor, "RemoveOccurrenceAnnotations")); //$NON-NLS-1$ fRetargetShowInformationAction.setAction(getAction(textEditor, ITextEditorActionConstants.SHOW_INFORMATION));
public BasicCompilationUnitEditorActionContributor() { fRetargetContentAssist= new RetargetAction(JdtActionConstants.CONTENT_ASSIST, JavaEditorMessages.ContentAssistProposal_label); fRetargetContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fRetargetContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fRetargetContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); markAsPartListener(fRetargetContentAssist); fContentAssist= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistProposal."); //$NON-NLS-1$ fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssist.setImageDescriptor(JavaPluginImages.DESC_ELCL_CODE_ASSIST); fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST); fContextInformation= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "ContentAssistContextInformation."); //$NON-NLS-1$ fContextInformation.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fQuickAssistAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "CorrectionAssistProposal."); //$NON-NLS-1$ fQuickAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); fChangeEncodingAction= new RetargetTextEditorAction(JavaEditorMessages.getBundleForConstructedKeys(), "Editor.ChangeEncodingAction."); //$NON-NLS-1$ }
/** * Sets the underlying action. * * @param action the underlying action */ public void setAction(IAction action) { if (fAction != null) { fAction.removePropertyChangeListener(fListener); fAction= null; } fAction= action; if (fAction == null) { setEnabled(false); if (getStyle() == AS_CHECK_BOX || getStyle() == AS_RADIO_BUTTON) setChecked(false); setText(fDefaultText); setToolTipText(""); //$NON-NLS-1$ } else { setEnabled(fAction.isEnabled()); if (fAction.getStyle() == AS_CHECK_BOX || fAction.getStyle() == AS_RADIO_BUTTON) super.setChecked(fAction.isChecked()); setText(fAction.getText()); setToolTipText(fAction.getToolTipText()); fAction.addPropertyChangeListener(fListener); } }