public class AddMarkerAction extends TextEditorAction
setEditor
.
The following keys, prepended by the given option prefix, are used for retrieving resources from the given bundle:
"dialog.title"
- the input dialog's title"dialog.message"
- the input dialog's message"error.dialog.title"
- the error dialog's title"error.dialog.message"
- the error dialog's messageAS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
Constructor and Description |
---|
AddMarkerAction(ResourceBundle bundle,
String prefix,
ITextEditor textEditor,
String markerType,
boolean askForLabel)
Creates a new action for the given text editor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
askForLabel(Map attributes)
Asks the user for a marker label.
|
protected Map |
getInitialAttributes()
Returns the attributes the new marker will be initialized with.
|
protected String |
getLabelProposal(IDocument document,
int offset,
int length)
Returns the initial label for the marker.
|
protected IResource |
getResource()
Returns the resource on which to create the marker,
or
null if there is no applicable resource. |
protected ResourceBundle |
getResourceBundle()
Returns this action's resource bundle.
|
protected String |
getResourceKeyPrefix()
Returns this action's resource key prefix.
|
void |
run()
The default implementation of this
IAction method does
nothing. |
void |
update()
Always enables this action if it is connected to a text editor.
|
canModifyEditor, getTextEditor, setEditor, validateEditorInputState
getString, initialize, setHelpContextId
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
public AddMarkerAction(ResourceBundle bundle, String prefix, ITextEditor textEditor, String markerType, boolean askForLabel)
bundle
- the resource bundleprefix
- a prefix to be prepended to the various resource keys
(described in ResourceAction
constructor), or
null
if nonetextEditor
- the text editormarkerType
- the type of marker to addaskForLabel
- true
if the user should be asked for
a label for the new markerTextEditorAction.TextEditorAction(ResourceBundle, String, ITextEditor)
protected ResourceBundle getResourceBundle()
protected String getResourceKeyPrefix()
public void run()
Action
IAction
method does
nothing. Subclasses should override this method if they do not need
information from the triggering event, or override
runWithEvent(Event)
if they do.run
in interface IAction
run
in class Action
How radio buttons are handled
,
How check boxes are handled
public void update()
TextEditorAction
null
, the action is disabled.
Subclasses may override.update
in interface IUpdate
update
in class TextEditorAction
protected boolean askForLabel(Map attributes)
true
if a label
is entered, false
if the user cancels the input dialog.
The value for the attribute message
is modified in the given
attribute map.attributes
- the attributes maptrue
if a label has been enteredprotected Map getInitialAttributes()
Subclasses may extend or replace this method.
protected String getLabelProposal(IDocument document, int offset, int length)
document
- the document from which to extract a label proposaloffset
- the document offset of the range from which to extract the label proposallength
- the length of the range from which to extract the label proposalprotected IResource getResource()
null
if there is no applicable resource. This
queries the editor's input using getAdapter(IResource.class)
.
Subclasses may override this method.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.