uk.ac.kcl.cch.jb.pliny.pdfAnnot
Class PdfAnnotPlugin

java.lang.Object
  extended byorg.eclipse.core.runtime.Plugin
      extended byorg.eclipse.ui.plugin.AbstractUIPlugin
          extended byuk.ac.kcl.cch.jb.pliny.pdfAnnot.PdfAnnotPlugin
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public class PdfAnnotPlugin
extends org.eclipse.ui.plugin.AbstractUIPlugin

The main plugin class for Pliny's PDF Editor to be used in the desktop. The plugin as a whole is a classic Eclipse plugin, and contains many basic Pliny elements including most of the model and UI code.

Much of the code found in the the Editor itself, and some in this particular class come from models provided with JPedal -- the PDF display engine used here.

This plugin class itself, as well as supporting the usual base Eclipse functionality provides several Pliny-specific functions:

Author:
John Bradley

Field Summary
static String EDITOR_ID
           
static boolean isBroken
           
static String PLUGIN_ID
           
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
PdfAnnotPlugin()
          The constructor.
 
Method Summary
 boolean cachePdf(URL url, int cacheNo)
          fetches the PDF file pointed to by the given URL and stores it in the PDF cache, with the given cache ID.
static PdfAnnotPlugin getDefault()
          Returns the shared instance.
static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(String path)
          Returns an image descriptor for the image file at the given plug-in relative path.
static ObjectType getMyObjectType()
          returns the ObjectType for PDF resources that the editor in this plugin can handle.
 String getOSStringForCachedPdf(int cacheNo)
          returns the absolute path to the specific PDF file (identified by the cache number) on this machine.
 File getPdfCachePath()
           
 org.eclipse.jface.resource.ImageDescriptor getThumbnailFromImageCache(int cacheNo)
           
 void start(org.osgi.framework.BundleContext context)
          This method is called upon plug-in activation
 void stop(org.osgi.framework.BundleContext context)
          This method is called when the plug-in is stopped
 
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
 
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EDITOR_ID

public static String EDITOR_ID

PLUGIN_ID

public static String PLUGIN_ID

isBroken

public static boolean isBroken
Constructor Detail

PdfAnnotPlugin

public PdfAnnotPlugin()
The constructor.

Method Detail

start

public void start(org.osgi.framework.BundleContext context)
           throws Exception
This method is called upon plug-in activation

Throws:
Exception

stop

public void stop(org.osgi.framework.BundleContext context)
          throws Exception
This method is called when the plug-in is stopped

Throws:
Exception

getDefault

public static PdfAnnotPlugin getDefault()
Returns the shared instance.


getImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(String path)
Returns an image descriptor for the image file at the given plug-in relative path.

Parameters:
path - the path
Returns:
the image descriptor

getMyObjectType

public static ObjectType getMyObjectType()
returns the ObjectType for PDF resources that the editor in this plugin can handle.

Returns:
the ObjectType for PDF resources.

getPdfCachePath

public File getPdfCachePath()

cachePdf

public boolean cachePdf(URL url,
                        int cacheNo)
fetches the PDF file pointed to by the given URL and stores it in the PDF cache, with the given cache ID.

Parameters:
url - a URL that points to the PDF file to be cached
cacheNo - a number that will act as an ID for this PDF file in the cache in the future.
Returns:
true if PDF file was successfully cached.

getOSStringForCachedPdf

public String getOSStringForCachedPdf(int cacheNo)
returns the absolute path to the specific PDF file (identified by the cache number) on this machine.

Parameters:
cacheNo - cache ID for the PDF file
Returns:
String absolute path to the file.

getThumbnailFromImageCache

public org.eclipse.jface.resource.ImageDescriptor getThumbnailFromImageCache(int cacheNo)