org.homeunix.thecave.buddi.plugin.api
Class MenuPlugin

java.lang.Object
  extended by org.homeunix.thecave.buddi.plugin.api.PreferenceAccess
      extended by org.homeunix.thecave.buddi.plugin.api.MenuPlugin
All Implemented Interfaces:
FileAccess, MossPlugin
Direct Known Subclasses:
BuddiExportPlugin, BuddiImportPlugin, BuddiSynchronizePlugin

public abstract class MenuPlugin
extends PreferenceAccess
implements MossPlugin, FileAccess

The abstract class to extend when creating an import plugin. The method importData() is the one which is called by Buddi when executing the plugin. In this method, you have access to the main document object, the frame from which the plugin was called, and the file to import from.

Author:
wyatt

Constructor Summary
MenuPlugin()
           
 
Method Summary
abstract  java.lang.String getDescription()
          Returns the description for the plugin.
 java.lang.String[] getFileExtensions()
          Override to specify that Buddi should only include certain file types in the file chooser.
 Version getMaximumVersion()
          Returns the maximum program version needed to run this plugin.
 Version getMinimumVersion()
          Returns the minimum program version needed to run this plugin.
abstract  boolean isFileChooserSave()
          If we show a file chooser, should it be of type 'Save'? If false, it will be of type Open.
 boolean isPluginActive()
          Should this plugin be activated? Most people can just put true here; if there is some logic which determines if this is to be shown or not, though, you can add it here.
 boolean isPromptForFile()
          Should Buddi prompt for a file to import? Defaults to true.
abstract  void processData(MutableDocument model, MossDocumentFrame callingFrame, java.io.File file)
          Processes data as required.
 
Methods inherited from class org.homeunix.thecave.buddi.plugin.api.PreferenceAccess
getListPreference, getPreference, getSecurePreference, putListPreference, putPreference, putSecurePreference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.homeunix.thecave.moss.plugin.MossPlugin
getName
 
Methods inherited from interface org.homeunix.thecave.buddi.plugin.api.FileAccess
getProcessingMessage
 

Constructor Detail

MenuPlugin

public MenuPlugin()
Method Detail

processData

public abstract void processData(MutableDocument model,
                                 MossDocumentFrame callingFrame,
                                 java.io.File file)
                          throws PluginException,
                                 PluginMessage
Processes data as required. This method will call one of exportData(), importData(), or synchronizeData(), depending on the plugin type. This method is only included to make it easier to call the plugins from the File menu. Plugin implementors should *not* override this method, as you will get unpredictable results if you do. Instead, override the correct method for your plugin type.

Throws:
PluginException
PluginMessage

isFileChooserSave

public abstract boolean isFileChooserSave()
If we show a file chooser, should it be of type 'Save'? If false, it will be of type Open. This method is meant to be implemented in the Buddi*Plugin classes; plugin authors: do not implement this unless you are POSITIVE that you know exactly what you are doing. Also be aware that this method may be subject to change in future versions without any notice.

Returns:

getDescription

public abstract java.lang.String getDescription()
Returns the description for the plugin. This is used in the File Chooser, as the name for the file filter.

Specified by:
getDescription in interface FileAccess
Specified by:
getDescription in interface MossPlugin
Returns:
See Also:
MossPlugin.getDescription()

isPluginActive

public boolean isPluginActive()
Description copied from interface: MossPlugin
Should this plugin be activated? Most people can just put true here; if there is some logic which determines if this is to be shown or not, though, you can add it here.

Specified by:
isPluginActive in interface MossPlugin
Returns:

isPromptForFile

public boolean isPromptForFile()
Description copied from interface: FileAccess
Should Buddi prompt for a file to import? Defaults to true. If you know what the file name is (or you are importing from a different source, such as the network), you should override this method and return false.

Specified by:
isPromptForFile in interface FileAccess
Returns:

getFileExtensions

public java.lang.String[] getFileExtensions()
Description copied from interface: FileAccess
Override to specify that Buddi should only include certain file types in the file chooser. This only has an effect if isPromptForFile() is true. If you want to do this, return a String array of the file extensions which you wish to match. The plugin loader will create a FileFilter for this.

Specified by:
getFileExtensions in interface FileAccess
Returns:

getMaximumVersion

public Version getMaximumVersion()
Description copied from interface: MossPlugin
Returns the maximum program version needed to run this plugin. If this is null, there is no limitation on the program (not recommended unless you can guarantee that the plugin uses no API calls within the program).

Specified by:
getMaximumVersion in interface MossPlugin
Returns:
The Version object containing the maximum version number.

getMinimumVersion

public Version getMinimumVersion()
Description copied from interface: MossPlugin
Returns the minimum program version needed to run this plugin. If this is null, there is no limitation on the program (not recommended unless you can guarantee that the plugin uses no API calls within the program).

Specified by:
getMinimumVersion in interface MossPlugin
Returns:
The Version object containing the minimum version number.