|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.core.runtime.Plugin org.eclipse.ui.plugin.AbstractUIPlugin uk.ac.kcl.cch.jb.pliny.PlinyPlugin
The main plugin class for Pliny 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.
This plugin class itself, as well as supporting the usual base Eclipse functionality provides several Pliny-specific functions:
DBServices
),
and provides a central place for getting a DB connection.
resourceExtensionProcessor
plugin extension point -- looking to see what other plugins have a
contribution to this, and maintaining a list of them for other Pliny elements
to use. A resourceExtensionProcessor object is associated with a Pliny ObjectType.
Field Summary |
Fields inherited from class org.eclipse.core.runtime.Plugin |
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME |
Constructor Summary | |
PlinyPlugin()
The constructor. |
Method Summary | |
boolean |
cacheImage(URL url,
int imageNo)
fetches and stores the image associated with the URL in the image cache managed by this plugin. |
static void |
clearStreamBuffer()
|
static void |
copyInputStream(InputStream in,
OutputStream out)
a utility function to copy material in input stream to the output stream. |
static org.eclipse.swt.graphics.Color |
getColour(String name,
org.eclipse.swt.graphics.RGB rgb)
uses the parameter as a key to the colour registry. |
Connection |
getConnection()
returns a DB connection to the Pliny backing database. |
static BaseObject |
getCurrentObject()
|
static DBServices |
getDBServicesInstance()
Returns the shared instance of DBServices -- the access mechanism for Pliny's backing database. |
static PlinyPlugin |
getDefault()
Returns the shared instance. |
org.eclipse.jface.resource.ImageDescriptor |
getFromImageCache(URL url,
int imageNo)
returns an ImageDescriptor that points to an image in the cache. |
org.eclipse.swt.graphics.Image |
getImage(String id)
Returns an image from the image registry based on a given string as a key. |
File |
getImageCachePath()
returns a File that represents the directory where the Pliny image cache is located. |
static org.eclipse.jface.resource.ImageDescriptor |
getImageDescriptor(String path)
Returns an image descriptor for the image file at the given plug-in relative path. |
Set |
getOpenNotesIds()
returns the set of Pliny open note editors. |
static int |
getReferenceNumber()
returns the current reference number associated with the referent. |
static Resource |
getReferent()
gets the current referent. |
static IResourceExtensionProcessor |
getResourceExtensionProcessor(int otKey)
returns a ResourceExtensionProcessor associated with the given DB key for an ObjectType . |
static IResourceExtensionProcessor |
getResourceExtensionProcessor(ObjectType type)
returns a ResourceExtensionProcessor associated with the given ObjectType . |
static IResourceExtensionProcessor |
getResourceExtensionProcessor(Resource resource)
returns a ResourceExtensionProcessor associated with the given Resource through that Resource's ObjectType. |
String |
getStateLocationUrl(String objectName)
returns a path to the plugin's state area that is extended by the given name. |
static int |
incReferenceNumber()
increments and returns the current reference number associated with the referent. |
void |
returnConnection(Connection c)
returns the given connection (got with getConnection()
back. |
static void |
setCurrentObject(BaseObject obj)
|
static void |
setReferent(Resource resource)
stores the given Resource to be the new Referent. |
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 |
static void |
updateColour(String name,
org.eclipse.swt.graphics.RGB rgb)
updates the colour associated with the given name to be the new colour. |
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 |
Constructor Detail |
public PlinyPlugin()
Method Detail |
public void start(org.osgi.framework.BundleContext context) throws Exception
Exception
public void stop(org.osgi.framework.BundleContext context) throws Exception
Exception
public static PlinyPlugin getDefault()
public static DBServices getDBServicesInstance()
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(String path)
path
- the path
public org.eclipse.swt.graphics.Image getImage(String id)
id
- the key by which the image is identified in the registry
public String getStateLocationUrl(String objectName)
objectName
- name to be added to the state area path
public Connection getConnection()
public void returnConnection(Connection c)
getConnection()
back. This allows for connection pooling, although this is not currently
used in Pliny -- there is only one connection made available.
c
- the connection to returnpublic File getImageCachePath()
public boolean cacheImage(URL url, int imageNo)
url
- a URL to the image to be cached.imageNo
- the key to be used to store the image
public org.eclipse.jface.resource.ImageDescriptor getFromImageCache(URL url, int imageNo)
url
- URL to the imageimageNo
- key number in cache for the image.
public Set getOpenNotesIds()
public static org.eclipse.swt.graphics.Color getColour(String name, org.eclipse.swt.graphics.RGB rgb)
The returned Color object is managed by the registry and need not be disposed by the caller.
name
- name as key to the colourrgb
- colour to be used if not in registry
public static void updateColour(String name, org.eclipse.swt.graphics.RGB rgb)
name
- name of registry entry to be updated.rgb
- RGB of new colour to be storedpublic static IResourceExtensionProcessor getResourceExtensionProcessor(int otKey)
ObjectType
.
The value might be null if there is no associated processor.
otKey
- DB key of the ObjectType
public static IResourceExtensionProcessor getResourceExtensionProcessor(ObjectType type)
ObjectType
.
The value might be null if there is no associated processor.
type
-
public static IResourceExtensionProcessor getResourceExtensionProcessor(Resource resource)
resource
- the Resource in question
public static void setReferent(Resource resource)
resource
- the new object to be the referentpublic static Resource getReferent()
public static int incReferenceNumber()
public static int getReferenceNumber()
public static void setCurrentObject(BaseObject obj)
public static BaseObject getCurrentObject()
public static final void copyInputStream(InputStream in, OutputStream out) throws IOException
in
- Input Streamout
- Output Stream
IOException
public static final void clearStreamBuffer()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |