|
Eclipse Platform Release 3.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.ui.texteditor.ResourceAction
org.eclipse.ui.texteditor.TextEditorAction
org.eclipse.ui.texteditor.AddMarkerAction
public class 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, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, 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 |
|---|
canModifyEditor, getTextEditor, setEditor, validateEditorInputState |
| Methods inherited from class org.eclipse.ui.texteditor.ResourceAction |
|---|
getString, initialize, setHelpContextId |
| Methods inherited from class org.eclipse.jface.action.AbstractAction |
|---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener |
| Methods inherited from class org.eclipse.core.commands.common.EventManager |
|---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.jface.action.IAction |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| 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 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)| Method Detail |
|---|
protected ResourceBundle getResourceBundle()
protected String getResourceKeyPrefix()
public void run()
ActionIAction 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 IActionrun in class Actionpublic void update()
TextEditorActionnull, the action is disabled.
Subclasses may override.
update in interface IUpdateupdate in class TextEditorActionprotected 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()
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 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 Release 3.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.