TPTP 4.4.0 Testing Tools Project
Public API Specification

org.eclipse.hyades.test.ui.navigator
Class TestFolderProxyNode

java.lang.Object
  extended byorg.eclipse.hyades.test.ui.navigator.TestFolderProxyNode
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.hyades.test.ui.internal.navigator.proxy.IExtendedProxyNode, IProxy, IProxyNode, IProxyNodeRenamer, IResourceChangeListenerProxyNode

public class TestFolderProxyNode
extends java.lang.Object
implements IProxyNodeRenamer, IResourceChangeListenerProxyNode, org.eclipse.hyades.test.ui.internal.navigator.proxy.IExtendedProxyNode

This class is test folder proxy node. A test folder is associated to a actual folder but it filters all test elements which are not ok according into the ITestFolderContentValidator interface.
This class is used inside the type provider proxies trees.

Since:
4.0

Constructor Summary
protected TestFolderProxyNode(org.eclipse.core.resources.IContainer container, ITestFolderContentValidator validator, IFileProxyManager fileProxyManager, boolean flat, java.lang.Object parent)
          Constructor.
protected TestFolderProxyNode(org.eclipse.core.resources.IContainer container, ITestFolderContentValidator validator, IFileProxyManager fileProxyManager, boolean flat, java.lang.Object parent, boolean computeChildren)
          Constructor.
 
Method Summary
protected  void buildChildren(java.util.List _children, org.eclipse.core.resources.IContainer cont)
          Builds the list of proxy node children of a given physical folder.
protected  void computeChildren()
           
static TestFolderProxyNode create(org.eclipse.core.resources.IContainer container, ITestFolderContentValidator validator, IFileProxyManager fileProxyManager, boolean flat, java.lang.Object parent)
          Public API of creation.
protected  IProxyNode createChildFileProxyNode(org.eclipse.core.resources.IFile file)
          Returns an IProxyNode that represents the given file.
protected  IResourceChangeListenerProxyNode createChildFolderProxyNode(org.eclipse.core.resources.IContainer container)
          Returns a TestFolderProxyNode that should represent the given container.
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 IProxyNode[] getChildren()
          Returns the array of children of this node.
 org.eclipse.core.resources.IResource getCorrespondingResource()
           
protected  IFileProxyManager getFileProxyManager()
          Returns the file proxy manager instance used by this folder proxy node.
 java.lang.String getIdentifier()
          Returns a unique identifier for the represented element within the underlying resource.
 org.eclipse.swt.graphics.Image getImage()
          Returns the icon of this node used in the navigator.
 java.lang.Object getParent()
          Returns the parent object of this node.
 java.lang.String getText()
          Returns the label used in the navigator to designate this node.
 org.eclipse.core.resources.IResource getUnderlyingResource()
          Returns the file system resource containing the element represented by this proxy.
protected  ITestFolderContentValidator getValidator()
          Returns the validator used by this test folder.
 boolean isApplicableFor()
          Returns whether this renamer is applicable for the adapted proxy or not.
protected  boolean isFlat()
          Returns the flat attribute.
 boolean performRename(java.lang.String newName)
          Performs the actual rename task on proxy node and referenced object.
 RenamerUIStatus performUserInteraction(java.lang.String oldName)
          Performs the GUI interaction in order to get the new name.
 IProxyNode resourceChanged(org.eclipse.core.resources.IResourceDelta rootDelta)
          Examines the resource delta and perform any consequent adjustment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestFolderProxyNode

protected TestFolderProxyNode(org.eclipse.core.resources.IContainer container,
                              ITestFolderContentValidator validator,
                              IFileProxyManager fileProxyManager,
                              boolean flat,
                              java.lang.Object parent)
Constructor. Equivalent to TestFolderProxyNode(IContainer, ITestFolderContentValidator, IFileProxyManager, boolean, Object, boolean) with computeChildren=true.

Parameters:
container - the actual folder (or project) the proxy is associated to.
validator - a validator used to test whether the members of the given container should be convert into test folder children.
fileProxyManager - the file proxy manager used to cache file proxy node.
flat - flat a flag that control the content hierarchy. If flag is true this means that the physical hierarchy is flattened. Otherwise, the original folder hierarchy is respected and converted into the proxy node hierarchy.
parent - the parent node of the test folder proxy node.

TestFolderProxyNode

protected TestFolderProxyNode(org.eclipse.core.resources.IContainer container,
                              ITestFolderContentValidator validator,
                              IFileProxyManager fileProxyManager,
                              boolean flat,
                              java.lang.Object parent,
                              boolean computeChildren)
Constructor.

Parameters:
container - the actual folder (or project) the proxy is associated to.
validator - a validator used to test whether the members of the given container should be convert into test folder children.
fileProxyManager - the file proxy manager used to cache file proxy node.
flat - flat a flag that control the content hierarchy. If flag is true this means that the physical hierarchy is flattened. Otherwise, the original folder hierarchy is respected and converted into the proxy node hierarchy.
parent - the parent node of the test folder proxy node.
computeChildren - Whether the children computation should occur immediately. Otherwise, computeChildren() must explicitely invoked by the sub-class's constructor.
Provisional API: This API is subject to change in the next release.
As of TPTP V4.4.0, this is stable provisional API (see http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).
Method Detail

create

public static TestFolderProxyNode create(org.eclipse.core.resources.IContainer container,
                                         ITestFolderContentValidator validator,
                                         IFileProxyManager fileProxyManager,
                                         boolean flat,
                                         java.lang.Object parent)
Public API of creation. It returns an instance of test folder proxy node or null if the new test folder is empty.

Parameters:
container - the actual folder (or project) the proxy is associated to.
validator - a validator used to test whether the members of the given container should be convert into test folder children.
fileProxyManager - the file proxy manager used to cache file proxy node.
flat - a flag that control the content hierarchy. If flag is true this means that the physical hierarchy is flattened. Otherwise, the original folder hierarchy is respected and converted into the proxy node hierarchy.
parent - the parent node of the test folder proxy node.
Returns:
an instance of test folder proxy node or null if the new test folder is empty.

computeChildren

protected final void computeChildren()
Provisional API: This API is subject to change in the next release.
As of TPTP V4.4.0, this is stable provisional API (see http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).

buildChildren

protected void buildChildren(java.util.List _children,
                             org.eclipse.core.resources.IContainer cont)
Builds the list of proxy node children of a given physical folder.

Parameters:
_children - the list of proxy node children
cont - an actual folder (or project).

createChildFolderProxyNode

protected IResourceChangeListenerProxyNode createChildFolderProxyNode(org.eclipse.core.resources.IContainer container)
Returns a TestFolderProxyNode that should represent the given container. This implementation instantiates a TestFolderProxyNode representing the given container. Sub-classes may override this method to instantiate sub-types of TestFolderProxyNode.

Parameters:
container - A container that is a child of the resource represented by this proxy node.
Returns:
A TestFolderProxyNode (or a sub-type), or null if the container should not be represented.

createChildFileProxyNode

protected IProxyNode createChildFileProxyNode(org.eclipse.core.resources.IFile file)
Returns an IProxyNode that represents the given file. This implementation is using the Test Navigator extensions point to instantiate the proper proxy node representing the file.

Parameters:
file - A file that is a child of the resource represented by this proxy node.
Returns:
An IProxyNode. This method is not expected to return null (since this method is invoked only if the validator returns true to isFileOk()).
Provisional API: This API is subject to change in the next release.
As of TPTP V4.4.0, this is stable provisional API (see http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).

getText

public java.lang.String getText()
Description copied from interface: IProxyNode
Returns the label used in the navigator to designate this node.

Specified by:
getText in interface IProxyNode
Returns:
the name of the node.
See Also:
IProxyNode.getText()

getImage

public org.eclipse.swt.graphics.Image getImage()
Description copied from interface: IProxyNode
Returns the icon of this node used in the navigator.

Specified by:
getImage in interface IProxyNode
Returns:
the icon of this node.
See Also:
IProxyNode.getImage()

getParent

public java.lang.Object getParent()
Description copied from interface: IProxyNode
Returns the parent object of this node.

Specified by:
getParent in interface IProxyNode
Returns:
the parent of this node.
See Also:
IProxyNode.getParent()

getChildren

public IProxyNode[] getChildren()
Description copied from interface: IProxyNode
Returns the array of children of this node. Children are proxies also.

Specified by:
getChildren in interface IProxyNode
Returns:
the array of children of this node.
See Also:
IProxyNode.getChildren()

getUnderlyingResource

public org.eclipse.core.resources.IResource getUnderlyingResource()
Description copied from interface: IProxy
Returns the file system resource containing the element represented by this proxy.

Specified by:
getUnderlyingResource in interface IProxy
Returns:
the file system resource containing the element represented by this proxy.
See Also:
IProxy.getUnderlyingResource()

getIdentifier

public java.lang.String getIdentifier()
Description copied from interface: IProxy
Returns a unique identifier for the represented element within the underlying resource. If two instances of IProxy have the same identifier for the same underlying resource, this means that those proxies designate the same element.

Specified by:
getIdentifier in interface IProxy
Returns:
an string that identify the element in its underlying resource.
See Also:
IProxy.getIdentifier()

isApplicableFor

public boolean isApplicableFor()
Description copied from interface: IProxyNodeRenamer
Returns whether this renamer is applicable for the adapted proxy or not.

Specified by:
isApplicableFor in interface IProxyNodeRenamer
Returns:
true if rename can be done and false otherwise.
See Also:
IProxyNodeRenamer.isApplicableFor()

performUserInteraction

public RenamerUIStatus performUserInteraction(java.lang.String oldName)
Description copied from interface: IProxyNodeRenamer
Performs the GUI interaction in order to get the new name. This method allows extenders to provide a specific GUI to retrieve the the new name (e.g. own dialog), but they can use the default behavior as well.

Specified by:
performUserInteraction in interface IProxyNodeRenamer
Parameters:
oldName - the string containing the current name before renaming.
Returns:
One instance of the the following subclasses of RenamerUIStatus class:
  • org.eclipse.hyades.test.ui.navigator.actions.RenamerUIOk: this means that rename action calls a specific GUI in order to get the new name and this GUI ends properly. The new name can be accessed through the RenameUIOK.getNewName(),
  • org.eclipse.hyades.test.ui.navigator.actions.RenamerUICancel: this means that rename action calls a specific GUI in order to get the new name and this GUI has been aborted by user. There is no new name set and the action needs to be aborted.
  • org.eclipse.hyades.test.ui.navigator.actions.RenamerUIInlineEditor: this means that rename action uses the default inline editor in order to get the new name. The name is internaly passed to the method IProxyNodeRenamer.performRename(String newName)
See Also:
IProxyNodeRenamer.performUserInteraction(java.lang.String)

performRename

public boolean performRename(java.lang.String newName)
Description copied from interface: IProxyNodeRenamer
Performs the actual rename task on proxy node and referenced object.

Specified by:
performRename in interface IProxyNodeRenamer
Parameters:
newName - the new name of the proxy node.
Returns:
boolean whether test navigator should be refreshed after the rename is applied.
See Also:
IProxyNodeRenamer.performRename(java.lang.String)

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
See Also:
IAdaptable.getAdapter(java.lang.Class)

resourceChanged

public IProxyNode resourceChanged(org.eclipse.core.resources.IResourceDelta rootDelta)
Description copied from interface: IResourceChangeListenerProxyNode
Examines the resource delta and perform any consequent adjustment.

Specified by:
resourceChanged in interface IResourceChangeListenerProxyNode
Parameters:
rootDelta - the delta describing the change about the resource represented by this proxy.
Returns:
the innermost proxy node in this proxy node hierarchy enclosing all proxy node changes.
See Also:
IResourceChangeListenerProxyNode.resourceChanged(org.eclipse.core.resources.IResourceDelta)

isFlat

protected final boolean isFlat()
Returns the flat attribute.

Returns:
the flat attribute.

getValidator

protected final ITestFolderContentValidator getValidator()
Returns the validator used by this test folder.

Returns:
the validator used by this test folder.

getFileProxyManager

protected final IFileProxyManager getFileProxyManager()
Returns the file proxy manager instance used by this folder proxy node.

Returns:
the file proxy manager instance used by this folder proxy node.

getCorrespondingResource

public org.eclipse.core.resources.IResource getCorrespondingResource()
Specified by:
getCorrespondingResource in interface org.eclipse.hyades.test.ui.internal.navigator.proxy.IExtendedProxyNode
Provisional API: This API is subject to change in the next release.

TPTP 4.4.0 Testing Tools Project
Public API Specification