Extension SDK 10.1.2

oracle.ide.addin
Interface Context

All Known Implementing Classes:
DefaultContext

public interface Context

The Context interface provides information about the current IDE state. From this interface, Wizards and other classes receiving IDE actions can determine the active Project and Workspace as well as the currently selected Element.


Method Summary
 Folder findOwner(Element element)
           
 Document getDocument()
          Gets the document that owns the selection.
 Element getElement()
          Provides a reference to the Element of interest.
 java.util.EventObject getEvent()
          Provides a reference to the EventObject associated with this Context.
 java.lang.Object getExtraData()
          Provides a reference to the user data associated with this Context.
 Project getProject()
          Provides a reference to the Project data associated with this Context.
 Element[] getSelection()
          Gets the list of selected Elements.
 View getView()
          Provides a reference to the View associated with this Context.
 Workspace getWorkspace()
          Provides a reference to the Workspace associated with this Context.
 Context makeCopy()
          This methods allows clients to make a copy of the current context whilst preserving the type of the Context object.
 void setDocument(Document document)
          Sets the document that owns the selection.
 void setEvent(java.util.EventObject event)
          Set the EventObject to be associated with this Context.
 void setExtraData(java.lang.Object data)
          Set the user data to be associated with this Context.
 void setProject(Project project)
          Set a reference to the Project data associated with this Context.
 void setSelection(Element[] selection)
          Sets the list of selected Elements.
 void setView(View view)
          Set a reference to the View to be associated with this Context.
 void setWorkspace(Workspace workspace)
          Sets a reference to the Workspace to be associated with this Context.
 

Method Detail

makeCopy

public Context makeCopy()
This methods allows clients to make a copy of the current context whilst preserving the type of the Context object. Previously when a copy constructor was used, we found that custom Context object were being replaced by those that didn't work the same way.

Returns:
a copy of this context with the same type as the object this method is being called upon

getView

public View getView()
Provides a reference to the View associated with this Context.

Returns:
the associated View object.

setView

public void setView(View view)
Set a reference to the View to be associated with this Context.


getWorkspace

public Workspace getWorkspace()
Provides a reference to the Workspace associated with this Context.


setWorkspace

public void setWorkspace(Workspace workspace)
Sets a reference to the Workspace to be associated with this Context.


getProject

public Project getProject()
Provides a reference to the Project data associated with this Context.


setProject

public void setProject(Project project)
Set a reference to the Project data associated with this Context.


getEvent

public java.util.EventObject getEvent()
Provides a reference to the EventObject associated with this Context.

Returns:
the EventObject associated with this Context.
See Also:
setEvent(java.util.EventObject)

setEvent

public void setEvent(java.util.EventObject event)
Set the EventObject to be associated with this Context.

Parameters:
event - the EventObject to associate with this Context.
See Also:
getEvent()

getSelection

public Element[] getSelection()
Gets the list of selected Elements. The selection must either be all Subjecs, else all not Subjects. That is to say, all the Elements in the selection will also be Subjects, else none of them will. In the case where none of the selected Elements are Subjects, the getDefaultSubject method will return the Subject to which the selected Elements apply. The primary purpose of this restrciction is to allow the Inspector to know what object(s) to use when sending update notification messages.

Returns:
array of selected Elements.
See Also:
#getDefaultSubject

setSelection

public void setSelection(Element[] selection)
Sets the list of selected Elements. The selection must either be all Subjecs, else all not Subjects. That is to say, all the Elements in the selection will also be Subjects, else none of them will. In the case where none of the selected Elements are Subjects, the getDefaultSubject method will return the Subject to which the selected Elements apply. The primary purpose of this restrciction is to allow the Inspector to know what object(s) to use when sending update notification messages.

See Also:
#getDefaultSubject

getDocument

public Document getDocument()
Gets the document that owns the selection. If the selection contains multiple documents, this methods must return null. The CommandProcessor uses this method to determine what undo stack to activate. Since operations on multiple documents cannot be undone, the return value should be null. This method also allows the Inspector to know what object to use when sending update notification messages in the event that none of the selected Elements were Subjects and the document is a subject.

Returns:
the document that owns the selection.

setDocument

public void setDocument(Document document)
Sets the document that owns the selection.


getElement

public Element getElement()
Provides a reference to the Element of interest. In cases where selection is no different than the Element of interest, will also be the first item in the selection. Objects needing to manipulate the complete selection list should use the getSelection method.

Returns:
the first Element of interest.
See Also:
getSelection()

getExtraData

public java.lang.Object getExtraData()
Provides a reference to the user data associated with this Context.

Returns:
the associated user data.
See Also:
setExtraData(java.lang.Object)

setExtraData

public void setExtraData(java.lang.Object data)
Set the user data to be associated with this Context.

See Also:
getExtraData()

findOwner

public Folder findOwner(Element element)
Parameters:
element - the Element being checked for removal from this folder
Returns:
the Folder that owns the specified element. In general a folder owns an element when that folder has veto power to remove a child element. This method will be called when the IDE needs to determine the container on whom to call the remove, canRemove, add, and canAdd methods.

Extension SDK

 

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