|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.action.Action | +--org.eclipse.ui.texteditor.ResourceAction | +--org.eclipse.ui.texteditor.TextEditorAction | +--org.eclipse.ui.texteditor.AddMarkerAction
Action for creating a marker of a specified type for the editor's
input element based on the editor's selection. If required, the
action asks the user to provide a marker label. The action is initially
associated with a text editor via the constructor, but that can be
subsequently changed using 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 message
Field Summary |
Fields inherited from interface org.eclipse.jface.action.IAction |
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, CHECKED, DESCRIPTION, ENABLED, IMAGE, TEXT, TOOL_TIP_TEXT |
Constructor Summary | |
AddMarkerAction(ResourceBundle bundle,
String prefix,
ITextEditor textEditor,
String markerType,
boolean askForLabel)
Creates a new action for the given text editor. |
Method Summary | |
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. |
Methods inherited from class org.eclipse.ui.texteditor.TextEditorAction |
getTextEditor, setEditor |
Methods inherited from class org.eclipse.ui.texteditor.ResourceAction |
getString, setHelpContextId |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
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 nonemarkerType
- the type of marker to addaskForLabel
- true
if the user should be asked for
a label for the new markerResourceAction.ResourceAction(java.util.ResourceBundle, java.lang.String)
Method Detail |
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 run(Event)
if they do.
run
in interface IAction
run
in class Action
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 map
true
if a label has been enteredprotected Map getInitialAttributes()
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 proposal
protected IResource getResource()
null
if there is no applicable resource. This
queries the editor's input using getAdapter(IResource.class)
.
Subclasses may override this method.
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |