Class Extension


  • public abstract class Extension
    extends java.lang.Object
    Defines the interface between BlueJ and an extension. All extensions must extend this class. A concrete extension class must also have a no-arguments constructor.
    Author:
    Clive Miller, University of Kent at Canterbury, 2002, Damiano Bolla, University of Kent at Canterbury, 2003,2004
    • Constructor Summary

      Constructors 
      Constructor Description
      Extension()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDescription()
      Should return a description of the extension's function.
      protected static int getExtensionsAPIVersionMajor()
      Obtains the major version of the Extensions API.
      protected static int getExtensionsAPIVersionMinor()
      Obtains the minor version of the Extensions API.
      abstract java.lang.String getName()
      Should return a name for this extension.
      java.net.URL getURL()
      Should return a URL where more information about the extension is available.
      abstract java.lang.String getVersion()
      Should return the version of the extension.
      abstract boolean isCompatible()
      Determines whether this extension is compatible with a particular version of the extensions API.
      abstract void startup​(BlueJ bluej)
      Called when the extension can start its activity.
      void terminate()
      Called when the extension should tidy up and terminate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Extension

        public Extension()
    • Method Detail

      • isCompatible

        public abstract boolean isCompatible()
        Determines whether this extension is compatible with a particular version of the extensions API. This method is called before the startup() method. An extension can use getExtensionsAPIVersionMajor() and getExtensionsAPIVersionMinor() as an aid to determine whether it is compatible with the current BlueJ release.
        Returns:
        A boolean value indicating if the extension is compatible with the extension API (true).
      • getExtensionsAPIVersionMajor

        protected static final int getExtensionsAPIVersionMajor()
        Obtains the major version of the Extensions API.
        Returns:
        An integer indicating the major version of the Extensions API. Currently 3.
      • getExtensionsAPIVersionMinor

        protected static final int getExtensionsAPIVersionMinor()
        Obtains the minor version of the Extensions API.
        Returns:
        An integer indicating the minor version of the Extensions API. Currently 1.
      • startup

        public abstract void startup​(BlueJ bluej)
        Called when the extension can start its activity. This is not called on a separate thread. Extensions should return as quick as possible from this method after creating their own thread if necessary.
        Parameters:
        bluej - a BlueJ object which serves as the starting point for interactions with BlueJ.
      • terminate

        public void terminate()
        Called when the extension should tidy up and terminate. When BlueJ decides that this extension is no longer needed it will call this method before removing it from the system. Note that an extension may be reloaded after having been terminated.

        Any attempt by an extension to call methods on its BlueJ object after this method has been called will result in an (unchecked) ExtensionUnloadedException being thrown by the BlueJ object.

      • getName

        public abstract java.lang.String getName()
        Should return a name for this extension. This will be displayed in the Help -> Installed Extensions dialog.

        Please limit the name to between 5 and 10 characters, and bear in mind the possibility of name conflicts.

      • getVersion

        public abstract java.lang.String getVersion()
        Should return the version of the extension. Please limit the string to between 5 and 10 characters. This will be displayed in the Help -> Installed Extensions dialog
      • getDescription

        public java.lang.String getDescription()
        Should return a description of the extension's function. It should be a brief statement of the extension's purpose. This will be displayed in the Help -> Installed Extensions dialog
      • getURL

        public java.net.URL getURL()
        Should return a URL where more information about the extension is available. This will be displayed in the Help -> Installed Extensions dialog.

        Ideally the information provided at the URL includes a complete manual, possible upgrades and configuration details.

        Returns:
        A URL object referring to the URL of the extension, null if no information is available.