| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MenuPlugin |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Created on Sep 14, 2006 by wyatt | |
| 3 | * | |
| 4 | * The interface which can be extended to create import filters | |
| 5 | */ | |
| 6 | package org.homeunix.thecave.buddi.plugin.api; | |
| 7 | ||
| 8 | import java.io.File; | |
| 9 | ||
| 10 | import org.homeunix.thecave.buddi.plugin.api.exception.PluginException; | |
| 11 | import org.homeunix.thecave.buddi.plugin.api.exception.PluginMessage; | |
| 12 | import org.homeunix.thecave.buddi.plugin.api.model.MutableDocument; | |
| 13 | ||
| 14 | import ca.digitalcave.moss.application.plugin.MossPlugin; | |
| 15 | import ca.digitalcave.moss.common.Version; | |
| 16 | import ca.digitalcave.moss.swing.MossDocumentFrame; | |
| 17 | ||
| 18 | /** | |
| 19 | * The abstract class to extend when creating an import plugin. The method importData() | |
| 20 | * is the one which is called by Buddi when executing the plugin. In this method, | |
| 21 | * you have access to the main document object, the frame from which the plugin was | |
| 22 | * called, and the file to import from. | |
| 23 | * | |
| 24 | * @author wyatt | |
| 25 | * | |
| 26 | */ | |
| 27 | 0 | public abstract class MenuPlugin extends PreferenceAccess implements MossPlugin, FileAccess { |
| 28 | ||
| 29 | /** | |
| 30 | * Processes data as required. This method will call one of exportData(), importData(), or | |
| 31 | * synchronizeData(), depending on the plugin type. This method is only included to make | |
| 32 | * it easier to call the plugins from the File menu. Plugin implementors should *not* | |
| 33 | * override this method, as you will get unpredictable results if you do. Instead, | |
| 34 | * override the correct method for your plugin type. | |
| 35 | */ | |
| 36 | public abstract void processData(MutableDocument model, MossDocumentFrame callingFrame, File file) throws PluginException, PluginMessage; | |
| 37 | ||
| 38 | /** | |
| 39 | * If we show a file chooser, should it be of type 'Save'? If | |
| 40 | * false, it will be of type Open. This method is meant to be | |
| 41 | * implemented in the Buddi*Plugin classes; plugin authors: | |
| 42 | * do not implement this unless you are POSITIVE that you know | |
| 43 | * exactly what you are doing. Also be aware that this method | |
| 44 | * may be subject to change in future versions without any notice. | |
| 45 | * @return | |
| 46 | */ | |
| 47 | public abstract boolean isFileChooserSave(); | |
| 48 | ||
| 49 | /** | |
| 50 | * Returns the description for the plugin. This is used in the File Chooser, as the | |
| 51 | * name for the file filter. | |
| 52 | * @see org.homeunix.thecave.moss.plugin.MossPlugin#getDescription() | |
| 53 | */ | |
| 54 | public abstract String getDescription(); | |
| 55 | ||
| 56 | public boolean isPluginActive() { | |
| 57 | 0 | return true; |
| 58 | } | |
| 59 | ||
| 60 | public boolean isPromptForFile(){ | |
| 61 | 0 | return true; |
| 62 | } | |
| 63 | ||
| 64 | public String[] getFileExtensions(){ | |
| 65 | 0 | return null; |
| 66 | } | |
| 67 | ||
| 68 | public Version getMaximumVersion() { | |
| 69 | 0 | return null; |
| 70 | } | |
| 71 | ||
| 72 | public Version getMinimumVersion() { | |
| 73 | 0 | return null; |
| 74 | } | |
| 75 | } |