Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

javax.ide.command
Class Context

java.lang.Object
  extended by javax.ide.command.Context

public final class Context
extends java.lang.Object

The Context class provides information about the state of the IDE when a command is in the process of being executed. Such information includes:

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 Summary
Context(Document document, Project project)
          Constructor.
Context(Document document, Project project, Element[] selection)
          Constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context(Document document,
               Project project,
               Element[] selection)
Constructor.

Parameters:
document - The document the user is working on when a command is executed.
project - The project the document is in.
selection - The selected objects.

Context

public Context(Document document,
               Project project)
Constructor.

Parameters:
document - The document the user is working on when a command is executed.
project - The project the document is in.
Method Detail

getProject

public Project getProject()
The current Project the user is working on.


getDocument

public Document getDocument()
The current Document the user is working on.


getSelection

public Element[] getSelection()
Get the currently selected objects. These are Elements that users can select inside IDE views.

Returns:
the currently selected objects. If nothing selected this method returns an empty array.

setSelection

public void setSelection(Element[] selection)
Set the currently selected objects. These are Elements that users can select inside IDE views.

Parameters:
selection - An array of Elements.

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Retrieves the value associated with a property. If no value exists for the requested property, the specified default value is returned. Use context properties to pass along extra data meaningful to an extension.

Parameters:
name - the property key for which a value is desired.
defaultValue - the value to return if no value currently exists.
Returns:
the value of the requested property, or the default value if the property does not exist.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets the value for a property. Setting a value to null removes that property. Use context properties to pass along extra data meaningful to an extension.

Parameters:
name - the property key to set
value - the value to set

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.