org.eclipse.stp.core.saf.handler
Class AbstractInterfaceHandler

java.lang.Object
  extended byorg.eclipse.stp.core.saf.handler.AbstractHandler
      extended byorg.eclipse.stp.core.saf.handler.AbstractInterfaceHandler
All Implemented Interfaces:
IHandler, IInterfaceHandler

public abstract class AbstractInterfaceHandler
extends AbstractHandler
implements IInterfaceHandler

This class is to be extended by all interface handler contributions.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.stp.core.saf.handler.IInterfaceHandler
IInterfaceHandler.IInterfaceLabelProvider
 
Constructor Summary
AbstractInterfaceHandler()
           
 
Method Summary
 boolean canCreateInterfaceFor(java.lang.Object interfaceObj)
          Queries if an interface of the kind supported by this handler can be created for the specified interface object.
 boolean canCreateInterfaceObject()
          Queries if this handler can create an interface object for the supported type.
 IInterfaceHandler.IInterfaceLabelProvider getInterfaceLabelProvider()
          This method returns the handler's instance of IInterfaceLabelProvider.
 
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.IInterfaceHandler
createInterfaceFor, createInterfaceObject, getInterfaceObjects, open
 
Methods inherited from interface org.eclipse.stp.core.saf.handler.IHandler
getDescription, getDescriptiveKindName, getKind, getLargeIcon, getName, getSmallIcon
 

Constructor Detail

AbstractInterfaceHandler

public AbstractInterfaceHandler()
Method Detail

canCreateInterfaceFor

public boolean canCreateInterfaceFor(java.lang.Object interfaceObj)
Description copied from interface: IInterfaceHandler
Queries if an interface of the kind supported by this handler can be created for the specified interface object. If this method returns true, the handler's createInterfaceFor() method may be called to create an interface for the file.

This method should be quick to execute as it may be called to populate a context menu or a user dialog. When interfaceObj is a container, a quick check should be performed to verify that an SCA interface can be created from one of the objects contained by interfaceObj. For example, if interfaceObj is a file, perhaps the file extension can be checked rather than opening the file to inspect its contents. If this method returns true for an invalid container, the IInterfaceHandler.createInterfaceFor(Object, IUIContext) can throw an InvalidOperationException to let the caller know that an interface could not be created from it.

Specified by:
canCreateInterfaceFor in interface IInterfaceHandler
Parameters:
interfaceObj - an object representing the interface
Returns:
true if the handler can create an interface from the specified object; false otherwise

canCreateInterfaceObject

public boolean canCreateInterfaceObject()
Description copied from interface: IInterfaceHandler
Queries if this handler can create an interface object for the supported type. If this method returns true, the handler's #createInterfaceObject(IProject, IUIContext) method may be called to create an interface object.

Specified by:
canCreateInterfaceObject in interface IInterfaceHandler
Returns:
true if the handler can create an interface object; false otherwise

getInterfaceLabelProvider

public final IInterfaceHandler.IInterfaceLabelProvider getInterfaceLabelProvider()
Description copied from interface: IInterfaceHandler
This method returns the handler's instance of IInterfaceHandler.IInterfaceLabelProvider. The provider is reponsible for generating label information for objects returned by IInterfaceHandler.getInterfaceObjects(IResource).

Specified by:
getInterfaceLabelProvider in interface IInterfaceHandler
Returns:
the IInterfaceHandler.IInterfaceLabelProvider instance