Extension SDK 10.1.2

oracle.ide.model
Class Project

java.lang.Object
  extended byoracle.ide.model.DefaultDisplayable
      extended byoracle.ide.model.DefaultElement
          extended byoracle.ide.model.DefaultDocument
              extended byoracle.ide.model.DefaultNode
                  extended byoracle.ide.model.DataNode
                      extended byoracle.ide.model.DataContainer
                          extended byoracle.ide.model.Project
All Implemented Interfaces:
Category, Container, Copyable, Data, Dirtyable, Displayable, Document, DynamicPropertySet, Element, Folder, LazyLoadable, Locatable, Node, Observer, Subject, VetoableSubject
Direct Known Subclasses:
JProject

public class Project
extends DataContainer
implements Copyable, Observer, VetoableSubject, DynamicPropertySet

This is the base class for all data classes that represent a user project. A project may contain children owned by other containers which are also part of the same project. When owned children are added to the project, clients should use the method: add( Node child, Container containerOwner ) The child owner relationship is maintained by the project and persited in the project file. The child must be a Node and the owner must be a Container. This is necessary because the NodeFactory is used to create the nodes from the persisted data. The method getChildren gets called, it returns all children of the project including the children owned by other containers. Note: Container owners must be direct children of the project.


Field Summary
static java.lang.String TECHNOLOGY_SCOPE_PROPERTY
           
 
Fields inherited from class oracle.ide.model.DataContainer
_children
 
Fields inherited from class oracle.ide.model.DataNode
_objectStore
 
Fields inherited from interface oracle.ide.addin.Subject
OBJECT_MODIFIED
 
Fields inherited from interface oracle.ide.model.Category
UNDEFINED
 
Constructor Summary
Project()
          Default constructor.
Project(Project project)
          Copy constructor.
 
Method Summary
 void add(java.util.Collection elements)
          Adds the collection of elements to the project.
 void add(java.util.Collection elements, Container ownerContainer)
          Adds the collection of Nodes to the project.
 boolean add(Node node, Container ownerContainer)
          Add the Node to the project.
 void addDependency(Dependable dependable)
          Adds a dependency to the project.
protected  void addElements(java.util.Collection elements, Container containerOwner)
          Adds the collection of elements to the project.
 void addToProject(java.util.Collection elements)
          Adds the collection of elements to the project.
 boolean canAdd(Element element)
          Call this method to determine if an Element can be added to this project.
 boolean canRemove(Element element)
          Call this method to determine if the element can be removed from this project.
 void close()
          Closes the Document and unloads any associated data.
 boolean containsChild(Element child)
          Returns true if the child is contained by the project even if the owner is another folder contained in the project.
 boolean containsOwnedChild(Element child)
          Returns true if the child is contained by the project even if the owner is another folder contained in the project.
 java.lang.Object copyTo(java.lang.Object object)
          Copies the internal state of this object to the specified copy.
protected  void copyToImpl(Project copy)
          Design pattern for supporting strongly typed copying.
protected  Subject createSubject()
          Creates an instance of a Subject implementation.
 boolean equals(java.lang.Object o)
           
protected  boolean equalsImpl(Project project)
          This is a helper method for equals(Object) that can also be used by subclasses that implement equals(Object).
 Folder findOwner(Element element)
           
protected  void firePropertyChanged(java.lang.String propertyName, java.lang.Object oldVal, java.lang.Object newVal)
           
 java.util.Iterator getAllDependencies()
          Returns all dependables this project depends on.
 java.util.List getAllDependenciesList()
          Returns all dependables this project depends on.
 java.util.Iterator getChildren()
          Returns all children of the project including children owned by other folders contained in the project.
protected  Container getContainerOwner(Element element)
          Get the container that owns the specified node.
protected  Container getContainerOwner(java.net.URL url)
          Get the container that owns the node associated with the specfied url.
 URLPath getContentProvidersPath()
           
static java.lang.String getDefaultName()
          Returns the default name (prefix only) for project files in general.
 java.util.Iterator getDependencies()
          Returns dependables this project depends on.
 java.util.List getDependencyList()
          Get a list of Elements this project depends on.
 javax.swing.Icon getIcon()
          Returns an Icon that can be shown in association with this Displayable.
 java.util.Iterator getMyChildren()
          Returns the children owned by this project.
 java.util.Iterator getOwnedChildren()
          Get a collection of children that are owned by other folders included in this project.
protected  java.util.List getOwnedChildrenList()
          Initialize the list of children owned by other folders included in this project.
 java.util.Map getOwnerMap()
          Get the map that associates an element with its owner.
 URLPath getProjectSourcePath()
           
 java.util.Map getProperties()
          Retrieves a map holding the property-value pairs.
 java.lang.Object getProperty(java.lang.String name)
          Retrieves the value associated with a property.
 java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
          Accessor to user data saved in the project file
 TechnologyScope getTechnologyScope()
           
 void notifyObservers(java.lang.Object subject, VetoableMessage change)
          Notifies all observers that the state of the subject has changed.
 boolean remove(Element element, boolean notify)
          Remove the especified element.
 void removeAll(boolean notify)
          Removes all children of the project including those owned by other folders.
 void removeDependency(Dependable dependable)
          Removes the specified element from the dependencies list.
 void removeOwnedChildren(Folder owner)
          Removes the children of the project that are owned by the specified owner.
 void setDependencyList(java.util.List dependencies)
           
 void setOwnerMap(java.util.Map ownerMap)
           
 void setProperties(java.util.Map properties)
          Sets the map holding the property-value pairs.
 void setProperty(java.lang.String name, java.lang.Object value)
          Accessor to user data saved in the project file
 void setTechnologyScope(TechnologyScope scope)
           
 int size()
          Returns the total number of children in the project.
 void update(java.lang.Object observed, UpdateMessage change)
          Projects are interested in receiving notification of when an owned child is renamed in order to update owner map.
 boolean updateTechnologyScope(java.lang.String[] technologyKeys)
          Helper method to update the technology scope of a Project after a Wizard has been successfully executed.
 
Methods inherited from class oracle.ide.model.DataContainer
add, add, add, copyToImpl, getBaseDirectory, getListOfChildren, mayHaveChildren, remove, removeAll, resetSubDirtyableOwners, setListOfChildren, setSubDirtyableOwner
 
Methods inherited from class oracle.ide.model.DataNode
currentObjectStore, fireObjectOpened, getURL, open, open, reopen, save, setObjectStore
 
Methods inherited from class oracle.ide.model.DefaultNode
equalsImpl, getCategory, setURL
 
Methods inherited from class oracle.ide.model.DefaultDocument
attach, copyToImpl, detach, ensureOpen, equalsImpl, getInputStream, getLongLabel, getShortLabel, getSubject, getTimestamp, getTimestampDirectly, getToolTipText, isDirty, isNew, isOpen, isReadOnly, markDirty, notifyObservers, refreshTimestamp, setOpen, setTimestampDirectly, setURLDirectly
 
Methods inherited from class oracle.ide.model.DefaultElement
getAttributes, getData
 
Methods inherited from class oracle.ide.model.DefaultDisplayable
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.ide.addin.Subject
attach, detach, notifyObservers
 
Methods inherited from interface oracle.ide.model.Document
getInputStream, getTimestamp, isNew, isReadOnly, open, save
 
Methods inherited from interface oracle.ide.model.Locatable
getURL, setURL
 
Methods inherited from interface oracle.ide.model.Element
getAttributes
 
Methods inherited from interface oracle.ide.model.Data
getData
 
Methods inherited from interface oracle.ide.model.Displayable
getLongLabel, getShortLabel, getToolTipText, toString
 
Methods inherited from interface oracle.ide.model.Dirtyable
isDirty, markDirty
 
Methods inherited from interface oracle.ide.model.LazyLoadable
isOpen
 
Methods inherited from interface oracle.ide.model.Category
getCategory
 

Field Detail

TECHNOLOGY_SCOPE_PROPERTY

public static final java.lang.String TECHNOLOGY_SCOPE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

Project

public Project()
Default constructor. Required for JavaBean status.


Project

public Project(Project project)
Copy constructor.

Method Detail

copyTo

public java.lang.Object copyTo(java.lang.Object object)
Description copied from interface: Copyable
Copies the internal state of this object to the specified copy. If copy is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.

Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this object's state was copied.

There is a standard implementation pattern for the copyTo method that helps avoid problems that arise when a Copyable object is subclassed. The pattern is:

public Object copyTo( Object target )
{
final <this_class> copy =
target != null ? (<this_class>) target : new <this_class>();
copyToImpl( copy );
return copy;
} protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
The parameter passed into the copyToImpl method is the same type of this class. The responsibility of copyToImpl is to copy the state of this class through direct access of the fields. The copyToImpl method should not use getters and setters since these may be overridden, causing the state of this class to be incompletely copied.

Specified by:
copyTo in interface Copyable
Parameters:
object - The target object to which the state of this object should be copied. If target is null, then the copyTo method will return a new instance of this class.
Returns:
The object to which the state of this object was copied. If the target was non-null, then the return value is the same as the target object that was passed in; otherwise, the return value is a new instance of this class.

copyToImpl

protected final void copyToImpl(Project copy)
Design pattern for supporting strongly typed copying.

This method is intended to be helper method that subclasses can use, if they implement the Copyable interface.


equals

public boolean equals(java.lang.Object o)

equalsImpl

protected final boolean equalsImpl(Project project)
This is a helper method for equals(Object) that can also be used by subclasses that implement equals(Object). It assumes that the argument is not null.


getIcon

public javax.swing.Icon getIcon()
Description copied from interface: Displayable
Returns an Icon that can be shown in association with this Displayable. Typically the icon will be used in a tree control or list control. Therefore the icon must fit naturally within the space normally given to items within those controls. Such icons are usually 16x16 in size or, if there is a one-pixel transparent padding around the edge, 18x18 in size. It is strongly recommended that icons returned by this method be either 16x16 or 18x18 in size. If null is returned, the control may show a default icon, or it may show no icon, whichever is appropriate.

Specified by:
getIcon in interface Displayable
Overrides:
getIcon in class DefaultDisplayable
See Also:
Displayable.getIcon()

canRemove

public boolean canRemove(Element element)
Call this method to determine if the element can be removed from this project. If the specified element is not a Node, this method returns true. If it is a node and it has an owner, it delegates the call to the Folder owner. It the node does not have an owner, implying that the project owns the node, this method returns true.

Specified by:
canRemove in interface Folder
Overrides:
canRemove in class DataContainer
Returns:
true if and only if the specified Element is not null.
See Also:
Folder.canRemove(Element)

canAdd

public boolean canAdd(Element element)
Call this method to determine if an Element can be added to this project. This method does not allow the addition of Workspaces and other projects.

Specified by:
canAdd in interface Folder
Overrides:
canAdd in class DataContainer
Returns:
true if and only if the specified Element is not null.
See Also:
Folder.canAdd(Element)

containsChild

public boolean containsChild(Element child)
Returns true if the child is contained by the project even if the owner is another folder contained in the project.

Specified by:
containsChild in interface Folder
Overrides:
containsChild in class DataContainer

containsOwnedChild

public boolean containsOwnedChild(Element child)
Returns true if the child is contained by the project even if the owner is another folder contained in the project.


size

public int size()
Returns the total number of children in the project. It adds the number children owned by the project to the number of children owned by other folders.

Specified by:
size in interface Folder
Overrides:
size in class DataContainer

remove

public boolean remove(Element element,
                      boolean notify)
Remove the especified element. Notify observers when notify is set to true. If the specified element is an owned element, this method will also remove the element.

Specified by:
remove in interface Container
Overrides:
remove in class DataContainer

removeAll

public void removeAll(boolean notify)
Removes all children of the project including those owned by other folders.

Specified by:
removeAll in interface Container
Overrides:
removeAll in class DataContainer

getOwnerMap

public java.util.Map getOwnerMap()
Get the map that associates an element with its owner. An element can be a child of a project but in reality be owned by another folder contained in the project. It is the owner Folder that has veto over operations such as removing the owned element from the project. This method will create an owner map if none exist. Call this method when the owner map is actually needed.


setOwnerMap

public void setOwnerMap(java.util.Map ownerMap)

getDependencyList

public java.util.List getDependencyList()
Get a list of Elements this project depends on. Returns a copy of the internal list or null if there are no dependencies.


setDependencyList

public void setDependencyList(java.util.List dependencies)

getTechnologyScope

public TechnologyScope getTechnologyScope()
                                   throws TransientMarker
Throws:
TransientMarker

setTechnologyScope

public void setTechnologyScope(TechnologyScope scope)

updateTechnologyScope

public boolean updateTechnologyScope(java.lang.String[] technologyKeys)
Helper method to update the technology scope of a Project after a Wizard has been successfully executed.

If the project has a non-empty technology scope, then the specified technologies are added to the project's scope; otherwise, no action is taken.

Parameters:
technologyKeys - A String array of the technology keys to add to the project.
Returns:
true if the technology scope changed as a result of this method, otherwise false.

findOwner

public Folder findOwner(Element element)

addToProject

public void addToProject(java.util.Collection elements)
Adds the collection of elements to the project. The elements that could not be added to the project are removed from the collection. The elements collection specified should not be null. Subclasses should override this method to make sure that other properties of a project, such as source path, are updated from the url of the specified elements.


add

public void add(java.util.Collection elements,
                Container ownerContainer)
Adds the collection of Nodes to the project. The nodes that could not be added to the project are removed from the collection. Call this method when adding nodes to the project that are owned by another folder. That is they are children of a folder contained also in the project. The items in the specified in the collection must be nodes. The ownerContainer must point to a Container The container owner is returned when the findOwner method is called.


add

public boolean add(Node node,
                   Container ownerContainer)
Add the Node to the project. Call this method when adding a node to the project that is owned by another folder. If the node is already contained by this project, this method returns without doing anything. The ownerContainer must point to a Container The container owner is returned when the findOwner method is called.


add

public void add(java.util.Collection elements)
Adds the collection of elements to the project. The elements that could not be added to the project are removed from the collection. The elements collection specified should not be null. This method adds the elements in the collection to the project without updating any other project property.


getChildren

public java.util.Iterator getChildren()
Returns all children of the project including children owned by other folders contained in the project.

Specified by:
getChildren in interface Element
Overrides:
getChildren in class DataContainer
See Also:
Element.getChildren()

getMyChildren

public java.util.Iterator getMyChildren()
Returns the children owned by this project. This method excludes children that are owned by other folders contained in the project. To get all children of the project, including those owned by sub-folders, call the method getChildren.


getOwnedChildren

public java.util.Iterator getOwnedChildren()
Get a collection of children that are owned by other folders included in this project.


removeOwnedChildren

public void removeOwnedChildren(Folder owner)
Removes the children of the project that are owned by the specified owner. The owner need not be a direct child of this project. The method recursively removes children owned by other containers that may be children of the given owner. This method also notifies observers of the project that children were removed.


addDependency

public void addDependency(Dependable dependable)
Adds a dependency to the project.


removeDependency

public void removeDependency(Dependable dependable)
Removes the specified element from the dependencies list.


getDependencies

public java.util.Iterator getDependencies()
Returns dependables this project depends on. Returns a copy of the internal dependency list.


getAllDependencies

public java.util.Iterator getAllDependencies()
Returns all dependables this project depends on. Recurses collecting dependables of dependables.

Returns:
Iterator over all dependables.

getAllDependenciesList

public java.util.List getAllDependenciesList()
Returns all dependables this project depends on. Recurses collecting dependables of dependables.

Returns:
List of all dependables.

getProjectSourcePath

public URLPath getProjectSourcePath()
Returns:
The user defined project source path. This path does not include the dependencies, libraries, nor any other source path. This implementation always returns an empty URLPath. Subclasses should override this method and return a meaniningful source path. In general, the source path indicates where the files associated with this project can be found on a file system.

getContentProvidersPath

public URLPath getContentProvidersPath()
Returns:
additional source paths provided by extensions. For example, the modelers path is a content provider path.

getProperties

public java.util.Map getProperties()
Description copied from interface: DynamicPropertySet
Retrieves a map holding the property-value pairs.

Specified by:
getProperties in interface DynamicPropertySet

setProperties

public void setProperties(java.util.Map properties)
Description copied from interface: DynamicPropertySet
Sets the map holding the property-value pairs.

Specified by:
setProperties in interface DynamicPropertySet

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: DynamicPropertySet
Retrieves the value associated with a property.

Specified by:
getProperty in interface DynamicPropertySet
Parameters:
name - the property key for which a value is desired. exists.
Returns:
the value of the requested property, or a null value if the property does not exist or is not set.

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Accessor to user data saved in the project file

Specified by:
getProperty in interface DynamicPropertySet
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)
Accessor to user data saved in the project file

Specified by:
setProperty in interface DynamicPropertySet
Parameters:
name - the property key to set
value - the value to set

update

public void update(java.lang.Object observed,
                   UpdateMessage change)
Projects are interested in receiving notification of when an owned child is renamed in order to update owner map.

Specified by:
update in interface Observer
Parameters:
observed - the subject whose state has changed.
change - what has changed.

notifyObservers

public void notifyObservers(java.lang.Object subject,
                            VetoableMessage change)
                     throws ChangeVetoException
Description copied from interface: VetoableSubject
Notifies all observers that the state of the subject has changed.

Specified by:
notifyObservers in interface VetoableSubject
Parameters:
subject - the subject whose state has changed.
change - what changed.
Throws:
ChangeVetoException

getDefaultName

public static java.lang.String getDefaultName()
Returns the default name (prefix only) for project files in general.


close

public void close()
Description copied from interface: Document
Closes the Document and unloads any associated data. When this method returns, the state of the Document object should be equivalent to when the Document object has just been instantiated but not yet opened.

Specified by:
close in interface Document
Overrides:
close in class DataContainer

createSubject

protected Subject createSubject()
Creates an instance of a Subject implementation. This method is called from DefaultDocument.getSubject() the first time the subject is created. This implementation creates an IdeVetoableSubject.

Overrides:
createSubject in class DefaultDocument

addElements

protected void addElements(java.util.Collection elements,
                           Container containerOwner)
Adds the collection of elements to the project. The elements that could not be added to the project are removed from the collection. The elements collection specified should not be null. If owner is specified it indicates that the elements in the collection are nodes and are owned by another container in the project.


getOwnedChildrenList

protected java.util.List getOwnedChildrenList()
Initialize the list of children owned by other folders included in this project.


getContainerOwner

protected Container getContainerOwner(java.net.URL url)
Get the container that owns the node associated with the specfied url.


getContainerOwner

protected Container getContainerOwner(Element element)
Get the container that owns the specified node.


firePropertyChanged

protected void firePropertyChanged(java.lang.String propertyName,
                                   java.lang.Object oldVal,
                                   java.lang.Object newVal)

Extension SDK

 

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