uk.ac.kcl.cch.jb.pliny.dnd
Interface IResourceExtensionProcessor

All Known Implementing Classes:
AbstractResourceExtensionProcessor

public interface IResourceExtensionProcessor

Plugins who wish to interact with Pliny should implement this interface. See the extension point defined by the Pliny Plugin 'resourceExtensionProcessor'.

The interface makes it possible for Pliny to do several things with the the implementor:

Which IResourceExtensionProcessor to use is determined by the resource's ObjectType. Thus, the implementor must identify which resource type he is for by providing it through method getMyObjectType

Author:
John Bradley
See Also:
AbstractResourceExtensionProcessor which provides some useful common code to support drop processing.

Nested Class Summary
static class IResourceExtensionProcessor.CacheElement
           
 
Method Summary
 boolean canHandleObject(Object data)
          tests an object that has been dropped onto an ObjectType folder within the Resource Explorer to see if this object can process it.
 IResourceExtensionProcessor.CacheElement[] getCacheElements(Resource r)
          provides access to cache data you want stored in the pliny archive file.
 org.eclipse.draw2d.IFigure getContentFigure(Resource resource)
          return an IFigure object that can be used to provide a 'content' display by Pliny.
 ObjectType getMyObjectType()
          provides the ObjectType that this Processor is for.
 IResourceExtensionProcessorSource getSource()
          return an appropriate instance of IResourceExtensionProcessorSource.
 Resource makeMyResource()
          generate an empty instance of the appropriate Resource class that this plugin expects to use for its Resources.
 void processArchiveEntries(IGetsArchiveEntries archive, Resource r)
          provides a way for the Pliny archive importer to give your access to data from its archive that you will want to store in a local cache.
 boolean processDrop(org.eclipse.swt.dnd.DropTargetEvent event)
          processes an object that has been dropped onto an ObjectType folder within the Resource Explorer.
 void setViewPart(org.eclipse.ui.part.ViewPart myViewPart)
          Pliny's Resource Explorer will make its ViewPart available to the implementor of this interface by calling this method at the time that this processor is setup by the Explorer.
 

Method Detail

setViewPart

public void setViewPart(org.eclipse.ui.part.ViewPart myViewPart)
Pliny's Resource Explorer will make its ViewPart available to the implementor of this interface by calling this method at the time that this processor is setup by the Explorer. Store it in your implementation if you need it for future use.

Parameters:
myViewPart -

getMyObjectType

public ObjectType getMyObjectType()
provides the ObjectType that this Processor is for. Pliny will look at the ObjectType associated with the Resource it is working with to decide which IResourceExtensionProcessor to invoke.

Returns:
ObjectType this processor will support

processDrop

public boolean processDrop(org.eclipse.swt.dnd.DropTargetEvent event)
processes an object that has been dropped onto an ObjectType folder within the Resource Explorer. Details about the dropped object are provided by the DropTargetEvent.

Parameters:
event -

canHandleObject

public boolean canHandleObject(Object data)
tests an object that has been dropped onto an ObjectType folder within the Resource Explorer to see if this object can process it. The object passed as a parameter is the data field in the DropTargetEvent.

Parameters:
data -

makeMyResource

public Resource makeMyResource()
generate an empty instance of the appropriate Resource class that this plugin expects to use for its Resources. The constructor should create an instance, but not write it to the DB. (Often this is the rdb2java object constructor with the parameter boolean realEmpty set to true, e.g. new Resource(true)). This is because this method is invoked on pre-existing DB resource data, and the caller within Pliny will fill data that has already been read from the DB into this created instance.

See Also:
PlinyXMLImporter

getSource

public IResourceExtensionProcessorSource getSource()
return an appropriate instance of IResourceExtensionProcessorSource.

Returns:
the appropriate IResourceExtensionProcessorSource

getContentFigure

public org.eclipse.draw2d.IFigure getContentFigure(Resource resource)
return an IFigure object that can be used to provide a 'content' display by Pliny. For resources that represent an image, this is likely to be an IFigure containing a thumbnail represention of that image.

Parameters:
resource - the Resource the IFigure should be about.

getCacheElements

public IResourceExtensionProcessor.CacheElement[] getCacheElements(Resource r)
provides access to cache data you want stored in the pliny archive file.

Returns:
an array of CacheElements that the the archiver what data is to be put in the archive file, and give a handle to a Stream that can provide it.

processArchiveEntries

public void processArchiveEntries(IGetsArchiveEntries archive,
                                  Resource r)
                           throws PlinyImportException
provides a way for the Pliny archive importer to give your access to data from its archive that you will want to store in a local cache.

Once the archive reader has invoked your caching code through this method, your code can request data for caching by calling IGetsArchiveEntries.getArchiveEntry(java.lang.String)

Parameters:
archive - IGetsArchiveEntries archive process that can provide you with access to input streams from the archive containing the data you want to put in the cache.
r - Resource the cache data should belong to.
Throws:
PlinyImportException