Extension SDK 10.1.2

oracle.ide.addin
Class DefaultContext

java.lang.Object
  extended byoracle.ide.addin.DefaultContext
All Implemented Interfaces:
Context
Direct Known Subclasses:
IdeContext

public class DefaultContext
extends java.lang.Object
implements Context

DefaultContext class. Provides a default implementation of the Context interface. In general, extensions should not implement their own context class. They should use the class IdeContext directly.


Field Summary
protected  java.lang.Object _data
           
protected  Document _doc
           
protected  Element _elem
           
protected  java.util.EventObject _event
           
protected  Project _project
           
protected  Element[] _sel
           
protected  View _view
           
protected  Workspace _workspace
           
 
Constructor Summary
DefaultContext()
          Default constructor
DefaultContext(Document doc)
          Constructor.
DefaultContext(Element element)
          Constructor.
DefaultContext(View view, Workspace workspace, Project project, Element[] selection, Document doc, Element elem)
          Constructor.
 
Method Summary
protected  boolean areMultipleDocumentsSelected()
           
 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()
          Create a copy of the current context and copy accross the relavent properties
 void setDocument(Document document)
          Sets the document that owns the selection.
 void setElement(Element element)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_view

protected View _view

_workspace

protected Workspace _workspace

_project

protected Project _project

_sel

protected Element[] _sel

_doc

protected Document _doc

_elem

protected Element _elem

_event

protected java.util.EventObject _event

_data

protected java.lang.Object _data
Constructor Detail

DefaultContext

public DefaultContext()
Default constructor


DefaultContext

public DefaultContext(Element element)
Constructor.

Parameters:
element - the document associated with this context.

DefaultContext

public DefaultContext(Document doc)
Constructor.

Parameters:
doc - the document associated with this context.

DefaultContext

public DefaultContext(View view,
                      Workspace workspace,
                      Project project,
                      Element[] selection,
                      Document doc,
                      Element elem)
Constructor.

Parameters:
view - the view this context comes from.
workspace - the workspace associated with this context.
project - the project associated with this context.
selection - the elements selected in the view.
doc - the document associated with this context.
elem - the 0th element in the selection.
Method Detail

makeCopy

public Context makeCopy()
Create a copy of the current context and copy accross the relavent properties

Specified by:
makeCopy in interface Context
Returns:
a copy of this context with the same type as the object this method is being called upon

getView

public View getView()
Description copied from interface: Context
Provides a reference to the View associated with this Context.

Specified by:
getView in interface Context
Returns:
the associated View object.

setView

public void setView(View view)
Description copied from interface: Context
Set a reference to the View to be associated with this Context.

Specified by:
setView in interface Context

getWorkspace

public Workspace getWorkspace()
Description copied from interface: Context
Provides a reference to the Workspace associated with this Context.

Specified by:
getWorkspace in interface Context

setWorkspace

public void setWorkspace(Workspace workspace)
Description copied from interface: Context
Sets a reference to the Workspace to be associated with this Context.

Specified by:
setWorkspace in interface Context

getProject

public Project getProject()
Description copied from interface: Context
Provides a reference to the Project data associated with this Context.

Specified by:
getProject in interface Context

setProject

public void setProject(Project project)
Description copied from interface: Context
Set a reference to the Project data associated with this Context.

Specified by:
setProject in interface Context

getEvent

public java.util.EventObject getEvent()
Description copied from interface: Context
Provides a reference to the EventObject associated with this Context.

Specified by:
getEvent in interface Context
Returns:
the EventObject associated with this Context.
See Also:
Context.setEvent(java.util.EventObject)

setEvent

public void setEvent(java.util.EventObject event)
Description copied from interface: Context
Set the EventObject to be associated with this Context.

Specified by:
setEvent in interface Context
Parameters:
event - the EventObject to associate with this Context.
See Also:
Context.getEvent()

getSelection

public Element[] getSelection()
Description copied from interface: Context
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.

Specified by:
getSelection in interface Context
Returns:
array of selected Elements.
See Also:
#getDefaultSubject

setSelection

public void setSelection(Element[] selection)
Description copied from interface: Context
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.

Specified by:
setSelection in interface Context
See Also:
#getDefaultSubject

getDocument

public Document getDocument()
Description copied from interface: Context
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.

Specified by:
getDocument in interface Context
Returns:
the document that owns the selection.

setDocument

public void setDocument(Document document)
Description copied from interface: Context
Sets the document that owns the selection.

Specified by:
setDocument in interface Context

getElement

public Element getElement()
Description copied from interface: Context
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.

Specified by:
getElement in interface Context
Returns:
the first Element of interest.
See Also:
Context.getSelection()

setElement

public void setElement(Element element)

getExtraData

public java.lang.Object getExtraData()
Description copied from interface: Context
Provides a reference to the user data associated with this Context.

Specified by:
getExtraData in interface Context
Returns:
the associated user data.
See Also:
Context.setExtraData(java.lang.Object)

setExtraData

public void setExtraData(java.lang.Object data)
Description copied from interface: Context
Set the user data to be associated with this Context.

Specified by:
setExtraData in interface Context
See Also:
Context.getExtraData()

findOwner

public Folder findOwner(Element element)
Specified by:
findOwner in interface Context
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.

areMultipleDocumentsSelected

protected boolean areMultipleDocumentsSelected()
Returns:
true if several Document objects are found in the selection list.

Extension SDK

 

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