Extension SDK 10.1.2

oracle.ide.inspector
Class InspectorFactory

java.lang.Object
  extended byoracle.ide.inspector.InspectorFactory

public class InspectorFactory
extends java.lang.Object

The InspectorFactory class is a singleton class that provides a registry for registering Inspectable implemenations on a class by class basis.


Method Summary
 void addInspectableFactory(InspectableFactory factory)
          Register an InspectableFactory to be used when requesting an Inspectable for a given Context in its entirety.
static java.beans.BeanInfo getBeanInfo(java.lang.Class beanClass)
          Utility method to retrieve a BeanInfo for a given class.
 Inspectable getInspectable(Context context)
          Get an Inspectable implementation for the entire set of data referred to within the given Context, else null if no single Inspectable can be found to handle the entire contents.
 Inspectable getInspectable(Context context, Element element)
          Get an Inspectable implementation for the data referred to by the given Element within the given Context, else null if no Inspectable can be found for the given Element's data.
static InspectorFactory getInstance()
          Get the singleton InspectorFactory instance.
 MultiInspectable getMultiInspectable(Context context)
          Get a MultiInspectable instance for the given Context.
 java.lang.Class getPropertyModelType(java.lang.Class cls)
          Get the registered IdePropertyModel type for the data type provided, else the default type IdeMultiObjectModel.class.
 void registerInspectable(java.lang.Class targetClass, java.lang.Class inspectableClass)
          Register an Inspectable type to be used when requesting the Inspectable for a given data type.
 void registerPropertyModel(java.lang.Class targetClass, java.lang.Class modelClass)
          Register an IdePropertyModel type to be used when requesting the model type for a given data type.
 void removeInspectableFactory(InspectableFactory factory)
          Remove a registered InspectableFactory.
 void setDefaultInspectable(java.lang.Class cls)
          Set the default Inspectable implementation to use when no other match can be found for any give Class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static InspectorFactory getInstance()
Get the singleton InspectorFactory instance.

Returns:
the singleton InspectorFactory instance.

getMultiInspectable

public MultiInspectable getMultiInspectable(Context context)
Get a MultiInspectable instance for the given Context.

Parameters:
context - the Context for which a MultiInspectable is desired.
Returns:
a MultiInspectable.

getInspectable

public Inspectable getInspectable(Context context)
Get an Inspectable implementation for the entire set of data referred to within the given Context, else null if no single Inspectable can be found to handle the entire contents.

Parameters:
context - the Context in which to interpret the Element.
Returns:
an Inspectable.

getInspectable

public Inspectable getInspectable(Context context,
                                  Element element)
Get an Inspectable implementation for the data referred to by the given Element within the given Context, else null if no Inspectable can be found for the given Element's data.

Parameters:
context - the Context in which to interpret the Element.
element - the Element holding the data to inspect.
Returns:
an Inspectable.

registerInspectable

public void registerInspectable(java.lang.Class targetClass,
                                java.lang.Class inspectableClass)
                         throws java.lang.ClassCastException
Register an Inspectable type to be used when requesting the Inspectable for a given data type. Registering a null value for a given data type will remove any previous Inspectable registered for that data type.

By default any data type which implements SupportsInspection is already registered to use the DefaultInspectable and need not be registered by a call to this method. Use this method when an instance of the targetClass could theoretically appear as the contents of a selection along with selected objects of some other data type. For example; A Node type for one kind of file could easily appear in a selection with a Node type of different kind of file within the Context of a NavigatorWindow or the Context of a UML Modeler. If the result of Node.getData() for each of those Node types both are available to inspection, then they each should be registered independantly via this method.

Typically, this is the method that most integrators would use, and still applies even if the targetClass is never expected to be intermixed in a selection with any other data types.

Parameters:
targetClass - the data type for which an Inspectable implementation is being registered.
inspectableClass - the Inspectable implementation being registered.
Throws:
java.lang.ClassCastException - Thrown when inspectableClass is not an instance of Inspectable.
See Also:
#registerInspectableFactory, getInspectable(oracle.ide.addin.Context), oracle.ide.model.Element.getData

addInspectableFactory

public void addInspectableFactory(InspectableFactory factory)
Register an InspectableFactory to be used when requesting an Inspectable for a given Context in its entirety.

Optionally use this method to handle a Context whose selection is made of homogenous Elements whose data type would never appear intermixed with Elements of any other data type in any Context of any View. For example; If an Editor is known to tokenizes a source file into one or more Element instances of a single data type where that type is unique to that Editor. Then an InspectableFactory could be registered to handle a Context from that Editor such that a single Inspectable may be returned which handles the entire homogenous selection as opposed to one Inspectable being fetched for each Element of the selection as would be the case otherwise. If there is any chance that a given data type could appear intermixed with other data types in the selection of any given Context, then registerInspectable should be used instead of this method.

Typically, this is not the method that most integrators would use.

Parameters:
factory - an InspectableFactory capable of handling a Context whose selection is made up of homogenous Elements of a unique data type.
See Also:
registerInspectable(java.lang.Class, java.lang.Class), getInspectable(oracle.ide.addin.Context), oracle.ide.model.Element.getData

removeInspectableFactory

public void removeInspectableFactory(InspectableFactory factory)
Remove a registered InspectableFactory.

Parameters:
factory - the InspectableFactory to remove.

setDefaultInspectable

public void setDefaultInspectable(java.lang.Class cls)
Set the default Inspectable implementation to use when no other match can be found for any give Class.

Parameters:
cls - the Inspectable implementation to use as default.
See Also:
getInspectable(oracle.ide.addin.Context)

getPropertyModelType

public java.lang.Class getPropertyModelType(java.lang.Class cls)
Get the registered IdePropertyModel type for the data type provided, else the default type IdeMultiObjectModel.class.

Parameters:
cls - the data type for which a model type is desired.
Returns:
a IdePropertyModel.

registerPropertyModel

public void registerPropertyModel(java.lang.Class targetClass,
                                  java.lang.Class modelClass)
                           throws java.lang.ClassCastException
Register an IdePropertyModel type to be used when requesting the model type for a given data type. Registering a null value for a given data type will remove any previous model type registered for that data type.

Parameters:
targetClass - the data type for which an IdePropertyModel implementation is being registered.
modelClass - the IdePropertyModel implementation being registered.
Throws:
java.lang.ClassCastException - Thrown when modelClass does not extend IdePropertyModel
See Also:
getPropertyModelType(java.lang.Class)

getBeanInfo

public static final java.beans.BeanInfo getBeanInfo(java.lang.Class beanClass)
                                             throws java.beans.IntrospectionException
Utility method to retrieve a BeanInfo for a given class.

Parameters:
beanClass - the Class for which a BeanInfo is desired.
Returns:
the BeanInfo for the given Class.
Throws:
java.beans.IntrospectionException - if an exception occurs during introspection.

Extension SDK

 

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