Project: com.ibm.rational.teamapi.scout

com.ibm.rational.teamapi.scout
Class ProxyElement

java.lang.Object
  extended by com.ibm.rational.teamapi.scout.DefaultPropertySource
      extended by com.ibm.rational.teamapi.scout.ResourceSource
          extended by com.ibm.rational.teamapi.scout.ProxyElement
All Implemented Interfaces:
org.eclipse.ui.views.properties.IPropertySource

public class ProxyElement
extends ResourceSource

A tree viewer model element for a CM API Resource. This model element also implements the IPropertySource interface so that the element selected in the tree viewer can be examined in the standard Eclipse property view.


Nested Class Summary
(package private) static class ProxyElement.UnPw
          A simple Authentication object in which the username and password obtained from the user is cached for use by the CM API.
 
Nested classes/interfaces inherited from class com.ibm.rational.teamapi.scout.ResourceSource
ResourceSource.ArraySource, ResourceSource.ListSource, ResourceSource.PropertySource, ResourceSource.ResourcePropertyDescriptor
 
Field Summary
private static java.util.List<ProxyElement> EMPTY_ARRAY
          A constant used for empty results
private static javax.wvcm.PropertyRequestItem.PropertyRequest FOLDER_PROPERTIES
          The properties requested from a Folder
private static java.util.HashMap<java.lang.Object,java.lang.Object> g_memberListPropertyMap
           
private static java.util.Map<java.lang.Class<?>,java.lang.String> g_typeMap
          Maps proxy classes to a string used to identify their type
(package private)  java.util.List<ProxyElement> m_children
          The children (virtual CHILD_BINDING_LIST) of this ProxyElement.
(package private)  com.ibm.rational.wvcm.stp.StpLocation.Namespace m_namespace
          The namespace that is being traversed through this element
(package private)  java.lang.Object m_parent
          At the root, the CM API provider for the tree; otherwise the parent ProxyElement of this one
private static java.lang.Object[] table
          For each namespace, maps the proxy classes in that namespace to the property name for the property that defines the member list of that resource type in the namespace.
 
Fields inherited from class com.ibm.rational.teamapi.scout.ResourceSource
ADVANCED_PROPERTY_FLAGS, m_descriptors, m_resource, WANTED_PROPS
 
Constructor Summary
private ProxyElement(ProxyElement parent, com.ibm.rational.wvcm.stp.StpResource resource)
          Constructs a model element for a given resource.
(package private) ProxyElement(org.eclipse.swt.widgets.Shell shell)
          Constructs the root ProxyElement of a tree view.
 
Method Summary
(package private)  void addChild(com.ibm.rational.wvcm.stp.StpResource child)
          Adds a child resource to this element of the tree view model
(package private)  void addChild(java.lang.String selectorString)
          Adds a child resource to this element of the tree view model
(package private)  boolean couldBeFolder()
          Determines if this model element could be a folder.
(package private) static com.ibm.rational.wvcm.stp.StpProvider createProvider(org.eclipse.swt.widgets.Shell shell)
          Constructs an instance of the CM API provider with an authenticator.
(package private)  java.lang.Object[] getChildren()
          Returns the children of the resource represented by this ProxyElement; reading them from the CHILD_BINDING_LIST.
(package private)  ProxyElement getParent()
          The ProxyElement of which this is a child.
(package private)  com.ibm.rational.wvcm.stp.StpProvider getProvider()
          The Provider for this element of the tree.
 java.lang.String getSelector()
          Returns the selector for this resource.
 java.lang.String getText()
          Computes a String to identify this model element in the tree view.
(package private)  boolean isEmptyFolder()
          Determines if this model element is an empty folder;
(package private)  boolean isFolder()
          Determines if this model element should be considered a folder when sorting and filtering the tree view.
(package private)  boolean isRoot()
          Returns whether or not this object is the root of the tree view.
(package private)  javax.wvcm.PropertyNameList.PropertyName memberListProperty(com.ibm.rational.wvcm.stp.StpResource res, com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace)
          For a resource in a given namespace, returns the PropertyName that identifies the property that serves as the bound member list of that resource in the namespace.
(package private)  void refresh()
          Empties the cache of child elements; forcing them to be reread the next time they are to be displayed.
(package private)  boolean removeChild(java.lang.Object child)
          Removes a child model element from this model element.
(package private)  java.lang.String resourceType()
          Returns a String suitable for displaying the type of resource as determined by its proxy class.
 java.lang.String toString()
          (non-Javadoc)
 
Methods inherited from class com.ibm.rational.teamapi.scout.ResourceSource
getPropertyDescriptors, getPropertyValue
 
Methods inherited from class com.ibm.rational.teamapi.scout.DefaultPropertySource
getEditableValue, isPropertySet, resetPropertyValue, setPropertyValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

g_memberListPropertyMap

private static final java.util.HashMap<java.lang.Object,java.lang.Object> g_memberListPropertyMap

table

private static final java.lang.Object[] table
For each namespace, maps the proxy classes in that namespace to the property name for the property that defines the member list of that resource type in the namespace.


m_parent

java.lang.Object m_parent
At the root, the CM API provider for the tree; otherwise the parent ProxyElement of this one


m_children

java.util.List<ProxyElement> m_children
The children (virtual CHILD_BINDING_LIST) of this ProxyElement.


m_namespace

com.ibm.rational.wvcm.stp.StpLocation.Namespace m_namespace
The namespace that is being traversed through this element


EMPTY_ARRAY

private static java.util.List<ProxyElement> EMPTY_ARRAY
A constant used for empty results


FOLDER_PROPERTIES

private static final javax.wvcm.PropertyRequestItem.PropertyRequest FOLDER_PROPERTIES
The properties requested from a Folder


g_typeMap

private static final java.util.Map<java.lang.Class<?>,java.lang.String> g_typeMap
Maps proxy classes to a string used to identify their type

Constructor Detail

ProxyElement

private ProxyElement(ProxyElement parent,
                     com.ibm.rational.wvcm.stp.StpResource resource)
Constructs a model element for a given resource. Used to implement the public addChild methods.

Parameters:
parent - The parent of this element in the tree viewer. Is null only for the (unseen) root of the tree.
resource - The Resource proxy linking this element to the resource being viewed. Must not be null except in the root element of the tree.

ProxyElement

ProxyElement(org.eclipse.swt.widgets.Shell shell)
       throws java.lang.Exception
Constructs the root ProxyElement of a tree view.

Parameters:
shell - The display shell for this ProxyElement; used for context when requesting credentials from the user.
Throws:
java.lang.Exception - if a CM API provider cannot be instantiated.
Method Detail

addChild

void addChild(com.ibm.rational.wvcm.stp.StpResource child)
Adds a child resource to this element of the tree view model

Parameters:
child - The Resource proxy for the new child element.

addChild

void addChild(java.lang.String selectorString)
        throws javax.wvcm.WvcmException
Adds a child resource to this element of the tree view model

Parameters:
selectorString - A String containing the object selector for the resource to be added as a child of this element.
Throws:
javax.wvcm.WvcmException - If the resource proxy can't be constructed

removeChild

boolean removeChild(java.lang.Object child)
Removes a child model element from this model element.

Parameters:
child - The subordinate model element to be removed.
Returns:
true if the child was an element and was removed; false otherwise.

getText

public java.lang.String getText()
Computes a String to identify this model element in the tree view.

Returns:
A String containing the type and name of the resource.

getSelector

public java.lang.String getSelector()
Returns the selector for this resource.

Returns:
A String containing the image of this resource's selector.

toString

public java.lang.String toString()
(non-Javadoc)

Overrides:
toString in class java.lang.Object
Returns:
The Text for this ProxyElement.
See Also:
Object.toString()

memberListProperty

javax.wvcm.PropertyNameList.PropertyName memberListProperty(com.ibm.rational.wvcm.stp.StpResource res,
                                                            com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace)
                                                      throws javax.wvcm.WvcmException
For a resource in a given namespace, returns the PropertyName that identifies the property that serves as the bound member list of that resource in the namespace.

Parameters:
res -
namespace -
Returns:
the property name
Throws:
javax.wvcm.WvcmException

couldBeFolder

boolean couldBeFolder()
Determines if this model element could be a folder.

Returns:
true if the resource is a Folder proxy and it defines the CHILD_BINDING_LIST property; false otherwise.

isFolder

boolean isFolder()
Determines if this model element should be considered a folder when sorting and filtering the tree view.

Returns:
true if the resource proxy is a folder proxy or if there is no resource associated with this element (i.e. the root of the tree).

isEmptyFolder

boolean isEmptyFolder()
Determines if this model element is an empty folder;

Returns:
true if the model element represents a folder with no children.

getChildren

java.lang.Object[] getChildren()
Returns the children of the resource represented by this ProxyElement; reading them from the CHILD_BINDING_LIST. The results are cached in this element. A special case is made for selectors having no repository name. This form of selector is interpreted as a request for one of the folder lists available from the provider. Which method is used is based on the namespace and repository type provided
Repository Type Namespace Method
CLEAR_CASE REPOSITORY serverWorkspaceFolderList
CLEAR_CASE VIEW
WORKSPACE
clientWorkspaceFolderList

Returns:
An Array of model elements for the children.

refresh

void refresh()
Empties the cache of child elements; forcing them to be reread the next time they are to be displayed.


isRoot

boolean isRoot()
Returns whether or not this object is the root of the tree view.

Returns:
true if this ProxyElement has not parent.

getParent

ProxyElement getParent()
The ProxyElement of which this is a child.

Returns:
Returns the parent.

getProvider

com.ibm.rational.wvcm.stp.StpProvider getProvider()
The Provider for this element of the tree.

Returns:
A Provider object.

createProvider

static com.ibm.rational.wvcm.stp.StpProvider createProvider(org.eclipse.swt.widgets.Shell shell)
                                                     throws java.lang.Exception
Constructs an instance of the CM API provider with an authenticator.

Parameters:
shell - The Shell to be used for display context when requesting credentials.
Returns:
The instantiated Provider object
Throws:
java.lang.Exception - If the Provider could not be instantiated

resourceType

java.lang.String resourceType()
Returns a String suitable for displaying the type of resource as determined by its proxy class.

Returns:
A String containing the simple name of the most derived CM API interface implemented by the proxy of this ProxyElement.

Generated Tue 3-Mar-2009 02:02 AM

Copyright © IBM 2009. All rights reserved.