/** * */ private void createQuickOutlineAction() { // Quick Outline Action ResourceAction action = new TextOperationAction(getBundleForConstructedKeys(), "QuickOutline.", this, //$NON-NLS-1$ PDEProjectionViewer.QUICK_OUTLINE, true); action.setActionDefinitionId(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE); action.setText(PDEUIMessages.PDESourcePage_actionTextQuickOutline); action.setId(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE); action.setImageDescriptor(PDEPluginImages.DESC_OVERVIEW_OBJ); setAction(PDEActionConstants.COMMAND_ID_QUICK_OUTLINE, action); }
/** * Initializes this action using the given bundle and prefix. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or <code>null</code> if none * @since 2.1 */ protected void initialize(ResourceBundle bundle, String prefix) { String labelKey= "label"; //$NON-NLS-1$ String tooltipKey= "tooltip"; //$NON-NLS-1$ String imageKey= "image"; //$NON-NLS-1$ String descriptionKey= "description"; //$NON-NLS-1$ if (prefix != null && prefix.length() > 0) { labelKey= prefix + labelKey; tooltipKey= prefix + tooltipKey; imageKey= prefix + imageKey; descriptionKey= prefix + descriptionKey; } setText(getString(bundle, labelKey, labelKey)); setToolTipText(getString(bundle, tooltipKey, null)); setDescription(getString(bundle, descriptionKey, null)); String file= getString(bundle, imageKey, null); if (file != null && file.trim().length() > 0) setImageDescriptor(ImageDescriptor.createFromFile(getClass(), file)); } }
/** * Creates a new action that configures itself from the given resource * bundle. * <p> * The following keys, prepended by the given option prefix, * are used for retrieving resources from the given bundle: * <ul> * <li><code>"label"</code> - <code>setText</code></li> * <li><code>"tooltip"</code> - <code>setToolTipText</code></li> * <li><code>"image"</code> - <code>setImageDescriptor</code></li> * <li><code>"description"</code> - <code>setDescription</code></li> * </ul> * </p> * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or * <code>null</code> if none */ public ResourceAction(ResourceBundle bundle, String prefix) { super(); initialize(bundle, prefix); }
/** * Creates a new encoding action group for the given editor. * * @param editor the text editor */ public EncodingActionGroup(ITextEditor editor) { fTextEditor= editor; ResourceAction a; if (SYSTEM_ENCODING != null) { a= new PredefinedEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), SYSTEM_ENCODING, editor); a.setHelpContextId(IEncodingActionsHelpContextIds.SYSTEM); a.setActionDefinitionId(IEncodingActionsDefinitionIds.SYSTEM); editor.setAction(IEncodingActionsConstants.SYSTEM, a); } for (int i= 0; i < ENCODINGS.length; i++) { a= new PredefinedEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], editor); //$NON-NLS-1$ //$NON-NLS-2$ a.setHelpContextId( ENCODINGS[i][1]); a.setActionDefinitionId( ENCODINGS[i][2]); editor.setAction(ENCODINGS[i][0], a); } a= new CustomEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + IEncodingActionsConstants.CUSTOM + ".", editor); //$NON-NLS-1$ //$NON-NLS-2$ a.setHelpContextId(IEncodingActionsHelpContextIds.CUSTOM); a.setActionDefinitionId(IEncodingActionsDefinitionIds.CUSTOM); editor.setAction(IEncodingActionsConstants.CUSTOM, a); }
action.setHelpContextId(ITextEditorHelpContextIds.BOOKMARK_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.ADD_BOOKMARK); setAction(IDEActionFactory.BOOKMARK.getId(), action); action.setHelpContextId(ITextEditorHelpContextIds.ADD_TASK_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.ADD_TASK); setAction(IDEActionFactory.ADD_TASK.getId(), action); action.setHelpContextId(ITextEditorHelpContextIds.CHANGE_ENCODING); action.setActionDefinitionId(ITextEditorActionDefinitionIds.CHANGE_ENCODING); setAction(ITextEditorActionConstants.CHANGE_ENCODING, action); markAsPropertyDependentAction(ITextEditorActionConstants.CHANGE_ENCODING, true); action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINENUMBER_TOGGLE); setAction(ITextEditorActionConstants.LINENUMBERS_TOGGLE, action); action.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_TOGGLE); setAction(ITextEditorActionConstants.QUICKDIFF_TOGGLE, action); action.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICKDIFF_REVERTLINE); setAction(ITextEditorActionConstants.QUICKDIFF_REVERTLINE, action); action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_RENDERING_CYCLE); setAction(ITextEditorActionConstants.REVISION_RENDERING_CYCLE, action); action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_AUTHOR_TOGGLE); setAction(ITextEditorActionConstants.REVISION_SHOW_AUTHOR_TOGGLE, action); action.setActionDefinitionId(ITextEditorActionDefinitionIds.REVISION_ID_TOGGLE);
/** * 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 the given editor. * * @param editor the text editor */ public EncodingActionGroup(ITextEditor editor) { fTextEditor= editor; ResourceAction a; if (SYSTEM_ENCODING != null) { a= new PredefinedEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), SYSTEM_ENCODING, editor); a.setHelpContextId(IEncodingActionsHelpContextIds.SYSTEM); a.setActionDefinitionId(IEncodingActionsDefinitionIds.SYSTEM); editor.setAction(IEncodingActionsConstants.SYSTEM, a); } for (int i= 0; i < ENCODINGS.length; i++) { a= new PredefinedEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + ENCODINGS[i][0] + ".", ENCODINGS[i][0], editor); //$NON-NLS-1$ //$NON-NLS-2$ a.setHelpContextId( ENCODINGS[i][1]); a.setActionDefinitionId( ENCODINGS[i][2]); editor.setAction(ENCODINGS[i][0], a); } a= new CustomEncodingAction(TextEditorMessages.getBundleForConstructedKeys(), "Editor.ConvertEncoding." + IEncodingActionsConstants.CUSTOM + ".", editor); //$NON-NLS-1$ //$NON-NLS-2$ a.setHelpContextId(IEncodingActionsHelpContextIds.CUSTOM); a.setActionDefinitionId(IEncodingActionsDefinitionIds.CUSTOM); editor.setAction(IEncodingActionsConstants.CUSTOM, a); }
/** * 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); } }
action.setHelpContextId(IAbstractTextEditorHelpContextIds.PRINT_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PRINT); setAction(ITextEditorActionConstants.PRINT, action);
/** * Initializes this action using the given bundle and prefix. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or <code>null</code> if none * @since 2.1 */ protected void initialize(ResourceBundle bundle, String prefix) { String labelKey= "label"; //$NON-NLS-1$ String tooltipKey= "tooltip"; //$NON-NLS-1$ String imageKey= "image"; //$NON-NLS-1$ String descriptionKey= "description"; //$NON-NLS-1$ if (prefix != null && prefix.length() > 0) { labelKey= prefix + labelKey; tooltipKey= prefix + tooltipKey; imageKey= prefix + imageKey; descriptionKey= prefix + descriptionKey; } setText(getString(bundle, labelKey, labelKey)); setToolTipText(getString(bundle, tooltipKey, null)); setDescription(getString(bundle, descriptionKey, null)); String file= getString(bundle, imageKey, null); if (file != null && file.trim().length() > 0) setImageDescriptor(ImageDescriptor.createFromFile(getClass(), file)); } }
/** * Creates a new action that configures itself from the given resource * bundle. * <p> * The following keys, prepended by the given option prefix, * are used for retrieving resources from the given bundle: * <ul> * <li><code>"label"</code> - <code>setText</code></li> * <li><code>"tooltip"</code> - <code>setToolTipText</code></li> * <li><code>"image"</code> - <code>setImageDescriptor</code></li> * <li><code>"description"</code> - <code>setDescription</code></li> * </ul> * </p> * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or * <code>null</code> if none */ public ResourceAction(ResourceBundle bundle, String prefix) { super(); initialize(bundle, prefix); }
/** * 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); } }
action.setHelpContextId(IAbstractTextEditorHelpContextIds.UNDO_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); setAction(ITextEditorActionConstants.UNDO, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.REDO_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); setAction(ITextEditorActionConstants.REDO, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT); setAction(ITextEditorActionConstants.CUT, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); setAction(ITextEditorActionConstants.COPY, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); setAction(ITextEditorActionConstants.PASTE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); setAction(ITextEditorActionConstants.DELETE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE); setAction(ITextEditorActionConstants.DELETE_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION);
/** * Initializes this action using the given bundle and prefix. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or <code>null</code> if none * @since 2.1 */ protected void initialize(ResourceBundle bundle, String prefix) { String labelKey= "label"; //$NON-NLS-1$ String tooltipKey= "tooltip"; //$NON-NLS-1$ String imageKey= "image"; //$NON-NLS-1$ String descriptionKey= "description"; //$NON-NLS-1$ if (prefix != null && prefix.length() > 0) { labelKey= prefix + labelKey; tooltipKey= prefix + tooltipKey; imageKey= prefix + imageKey; descriptionKey= prefix + descriptionKey; } setText(getString(bundle, labelKey, labelKey)); setToolTipText(getString(bundle, tooltipKey, null)); setDescription(getString(bundle, descriptionKey, null)); String file= getString(bundle, imageKey, null); if (file != null && file.trim().length() > 0) setImageDescriptor(ImageDescriptor.createFromFile(getClass(), file)); } }
/** * Creates a new action that configures itself from the given resource * bundle. * <p> * The following keys, prepended by the given option prefix, * are used for retrieving resources from the given bundle: * <ul> * <li><code>"label"</code> - <code>setText</code></li> * <li><code>"tooltip"</code> - <code>setToolTipText</code></li> * <li><code>"image"</code> - <code>setImageDescriptor</code></li> * <li><code>"description"</code> - <code>setDescription</code></li> * </ul> * </p> * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys, or * <code>null</code> if none */ public ResourceAction(ResourceBundle bundle, String prefix) { super(); initialize(bundle, prefix); }
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT); setAction(ITextEditorActionConstants.CUT, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); setAction(ITextEditorActionConstants.COPY, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE); setAction(ITextEditorActionConstants.PASTE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION); action.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE); setAction(ITextEditorActionConstants.DELETE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE); setAction(ITextEditorActionConstants.DELETE_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE); setAction(ITextEditorActionConstants.CUT_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_BEGINNING_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_BEGINNING); setAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_BEGINNING_ACTION);
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT); setAction(ITextEditorActionConstants.CUT, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); setAction(ITextEditorActionConstants.COPY, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); setAction(ITextEditorActionConstants.PASTE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); setAction(ITextEditorActionConstants.DELETE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE); setAction(ITextEditorActionConstants.DELETE_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE); setAction(ITextEditorActionConstants.CUT_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_BEGINNING_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE_TO_BEGINNING); setAction(ITextEditorActionConstants.DELETE_LINE_TO_BEGINNING, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_TO_BEGINNING_ACTION);
action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT); updateImages(action, IWorkbenchCommandConstants.EDIT_CUT); setAction(ITextEditorActionConstants.CUT, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.COPY_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); updateImages(action, IWorkbenchCommandConstants.EDIT_COPY); setAction(ITextEditorActionConstants.COPY, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.PASTE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); updateImages(action, IWorkbenchCommandConstants.EDIT_PASTE); setAction(ITextEditorActionConstants.PASTE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_ACTION); action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); updateImages(action, IWorkbenchCommandConstants.EDIT_DELETE); setAction(ITextEditorActionConstants.DELETE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_LINE); setAction(ITextEditorActionConstants.DELETE_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.CUT_LINE_ACTION); action.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT_LINE); setAction(ITextEditorActionConstants.CUT_LINE, action); action.setHelpContextId(IAbstractTextEditorHelpContextIds.DELETE_LINE_TO_BEGINNING_ACTION);