public final class Context
extends java.lang.Object
In addition, to this information, the context allows clients to store arbitrary data to pass on to a command. Such data is stored in the context under a client specified string key. The data can be retrieved using that same key.
| Constructor and Description |
|---|
Context(Document document,
Project project)
Constructor.
|
Context(Document document,
Project project,
Element[] selection)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Document |
getDocument()
The current
Document the user is working on. |
Project |
getProject()
The current
Project the user is working on. |
java.lang.Object |
getProperty(java.lang.String name,
java.lang.Object defaultValue)
Retrieves the value associated with a property.
|
Element[] |
getSelection()
Get the currently selected objects.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the value for a property.
|
void |
setSelection(Element[] selection)
Set the currently selected objects.
|
public Context(Document document, Project project, Element[] selection)
document - The document the user is working on when a command is
executed.project - The project the document is in.selection - The selected objects.public Element[] getSelection()
Elements
that users can select inside IDE views.public void setSelection(Element[] selection)
Elements
that users can select inside IDE views.selection - An array of Elements.public java.lang.Object getProperty(java.lang.String name,
java.lang.Object defaultValue)
name - the property key for which a value is desired.defaultValue - the value to return if no value currently
exists.public void setProperty(java.lang.String name,
java.lang.Object value)
null
removes that property. Use context properties to pass along extra data
meaningful to an extension.name - the property key to setvalue - the value to set