|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.stp.core.saf.handler.AbstractHandler
org.eclipse.stp.core.saf.handler.AbstractComponentHandler
This class is to be extended by all component handler contributions.
Constructor Summary | |
AbstractComponentHandler()
|
Method Summary | |
boolean |
canAddReference()
Queries if a reference can be added by the client to a component of the supported kind. |
boolean |
canAddService()
Queries if a service can be added by the client to a component of the supported kind. |
boolean |
canCreateComponent()
Queries if an unimplemented component of the kind supported by this handler can be created. |
boolean |
canCreateComponentFor(java.lang.Object implementationObj)
Queries if a component of the kind supported by this handler can be created for the specified implementation file. |
boolean |
canCreateImplementation()
Queries if implementation files can be created for components created by this component handler. |
boolean |
canSetImplementation()
Queries if the component handler provides support for setting the implementation of a component using the method setImplementation(). |
boolean |
canSetInterface()
Queries if an interface can be set by the client in an existing service or reference contained by a component of the supported kind. |
org.eclipse.stp.core.sca.SCAObject[] |
createComponentFor(java.lang.Object implementationObj,
org.eclipse.core.resources.IContainer container,
IUIContext callback)
Creates a component with an implementation based on the specified implementation model object. |
boolean |
isInterfaceKindSupported(IInterfaceHandler interfaceHandler,
boolean interfaceSet)
Queries if a component of the kind supported by this handler supports interfaces of the kind specified by the given interface handler in its services or references. |
org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation |
resetKind(org.eclipse.stp.core.sca.Component theComponent)
Changes the component to be unclassified by removing the implementation of the component or by creating an untyped AbstractImplementation . |
org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation |
setImplementation(org.eclipse.stp.core.sca.Component component,
java.lang.Object implementationFile,
IUIContext callback)
Sets the implementation of the component to the specified model object. |
org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation |
setKind(org.eclipse.stp.core.sca.Component theComponent)
Sets the component to be one of the specified kind. |
Methods inherited from class org.eclipse.stp.core.saf.handler.AbstractHandler |
getDescription, getDescriptiveKindName, getKind, getLargeIcon, getName, getSmallIcon, initialize |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.stp.core.saf.handler.IComponentHandler |
createComponent, createImplementationFor, getImplementationFor, open |
Methods inherited from interface org.eclipse.stp.core.saf.handler.IHandler |
getDescription, getDescriptiveKindName, getKind, getLargeIcon, getName, getSmallIcon |
Constructor Detail |
public AbstractComponentHandler()
Method Detail |
public boolean canCreateComponent()
IComponentHandler
false
. If this
method returns true
, the handler's
createComponent()
method may be called to
create a component.
canCreateComponent
in interface IComponentHandler
true
if the handler can create an unimplemented
Component
object; false
otherwisepublic boolean canAddReference()
IComponentHandler
canAddReference
in interface IComponentHandler
true
if the client is allowed to add a reference
object; false
otherwisepublic boolean canAddService()
IComponentHandler
canAddService
in interface IComponentHandler
true
if the client is allowed to add a service
object; false
otherwisepublic boolean canSetInterface()
IComponentHandler
canSetInterface
in interface IComponentHandler
true
if the client is allowed to set the interface
on a given service or reference object; false
otherwisepublic boolean canCreateComponentFor(java.lang.Object implementationObj)
IComponentHandler
true
, the handler's
IComponentHandler.createComponentFor(Object,IContainer,IUIContext)
method may be
called to create a component for the file.
This method should be quick to execute, because it may be called to populate a context menu or a user dialog.
canCreateComponentFor
in interface IComponentHandler
implementationObj
- an object representing the implementation for a component
true
if the handler can create an
Component
object from the specified file;
false
otherwisepublic org.eclipse.stp.core.sca.SCAObject[] createComponentFor(java.lang.Object implementationObj, org.eclipse.core.resources.IContainer container, IUIContext callback) throws SAFException, java.lang.InterruptedException
IComponentHandler
createComponentFor
in interface IComponentHandler
implementationObj
- the object representing the implementation for the componentcontainer
- the IContainer that holds the module, subsystem, composite, etc.
that will use the resulting component. The handler could use
the container's location to generate relative file paths that
it stores in the component (to reference the implementation
file, for example) or use the location as a place for additional
files that need to be generated.callback
- callback object that the handler can use to obtain additional
information needed to create the component. Callers
can pass in a null value.
SCAObject
containing the new component and
any other SCA objects generated by the handler to
support the new component
SAFException
- an unexpected exception occurred
java.lang.InterruptedException
- the caller did not provide a callback object needed by the
handler, or the callback request was canceled or abortedpublic boolean canCreateImplementation()
IComponentHandler
canCreateImplementation
in interface IComponentHandler
true
if support is provided for creating
implementations; false
otherwisepublic boolean canSetImplementation()
IComponentHandler
setImplementation()
.
If this method returns false, neither method should be called.
canSetImplementation
in interface IComponentHandler
true
if the handler supports the calling of setImplementation();
false
otherwisepublic org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation setImplementation(org.eclipse.stp.core.sca.Component component, java.lang.Object implementationFile, IUIContext callback) throws SAFException, java.lang.InterruptedException
IComponentHandler
setImplementation
in interface IComponentHandler
component
- the component being modifiedimplementationFile
- the object to be used to implement the specified componentcallback
- callback object that the component handler can use to obtain
additional information needed to create the component; can be
left null, although some calls may fail
SAFException
- An unexpected exception occurred.
java.lang.InterruptedException
- A callback method throws an exception, or
the user cancels the callback conversation.public boolean isInterfaceKindSupported(IInterfaceHandler interfaceHandler, boolean interfaceSet) throws SAFException
IComponentHandler
isInterfaceKindSupported
in interface IComponentHandler
interfaceHandler
- the interface handler that will be used to manipulate the
interface. The implementation of this method can obtain the
interface kind by invoking IHandler.getKind()
when performing the evaluation.interfaceSet
- flag indicating if the query applies to the services of the
component or its references. The values
ISAFManager.SERVICE
and
ISAFManager.REFERENCE
can be used for improved
code readability.
true
if the component supports the specified use
of the interface kind; false
otherwise
SAFException
- An unexpected exception occurred in the handler.public final org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation setKind(org.eclipse.stp.core.sca.Component theComponent) throws SAFException, InvalidOperationException
IComponentHandler
AbstractImplementation
or no implementation at all). Call IComponentHandler.resetKind(Component)
beforehand, if necessary. If the kind cannot be set for the given
component (perhaps due to unsupported interface kinds already set), an
error message will be displayed through the given callback object.
setKind
in interface IComponentHandler
theComponent
- the component being modified
SAFException
- No handler for the specified kind is found, or the
type is not supported.
InvalidOperationException
- The component kind cannot be set for the given
component.public final org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation resetKind(org.eclipse.stp.core.sca.Component theComponent) throws SAFException, InvalidOperationException
IComponentHandler
AbstractImplementation
.
Generally, existing interfaces and references will be preserved. No
clean-up is done on existing implementation files. If the component is
already unclassified, this method performs no work.
resetKind
in interface IComponentHandler
theComponent
- the component being modified
IDataModelOperation
instance that, once executed by the
caller, resets the component kind
SAFException
- No handler for the specified kind is found, or the
handler throws an exception.
InvalidOperationException
- The component kind cannot be reset for the given
component.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |