Coverage Report - org.homeunix.thecave.buddi.plugin.api.BuddiSynchronizePlugin
 
Classes in this File Line Coverage Branch Coverage Complexity
BuddiSynchronizePlugin
0%
0/6
N/A
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.i18n.BuddiKeys;
 11  
 import org.homeunix.thecave.buddi.plugin.api.exception.PluginException;
 12  
 import org.homeunix.thecave.buddi.plugin.api.exception.PluginMessage;
 13  
 import org.homeunix.thecave.buddi.plugin.api.model.MutableDocument;
 14  
 
 15  
 import ca.digitalcave.moss.application.plugin.MossPlugin;
 16  
 import ca.digitalcave.moss.swing.MossDocumentFrame;
 17  
 
 18  
 /**
 19  
  * The abstract class to extend when creating a synchronize plugin.  The method synchronizeData() 
 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 synchronize with.
 23  
  * 
 24  
  * @author wyatt
 25  
  *
 26  
  */
 27  0
 public abstract class BuddiSynchronizePlugin extends MenuPlugin implements MossPlugin, FileAccess {
 28  
         
 29  
         /**
 30  
          * Synchronizes data as required.  The plugin launch code will prompt for a file
 31  
          * and pass it in (unless you override the isPromptForFile() method to return false).
 32  
          * 
 33  
          * This method is executed from the launch code within a SwingWorker thread.  Once this
 34  
          * method is completed, the launch code will update all windows with any new information
 35  
          * which may have come from this plugin.  Thus, it is not a good idea to use any threads
 36  
          * in this method, unless you can guarantee that this method will not complete until 
 37  
          * all data processing is completed.
 38  
          * 
 39  
          * As well, since this method is not run from the AWT Event thread, you should not display
 40  
          * any Swing objects here, as it can potentially cause deadlocks in some situations.  This
 41  
          * should not be a problem for most plugins, as they just need a file (provided), and that is
 42  
          * all.  If you do need to display some Swing objects, you can do so using the 
 43  
          * SwingUtilities.invokeLater() method.
 44  
          */
 45  
         public abstract void synchronizeData(MutableDocument model, MossDocumentFrame callingFrame, File file) throws PluginException, PluginMessage;
 46  
         
 47  
         @Override
 48  
         public void processData(MutableDocument model, MossDocumentFrame callingFrame, File file) throws PluginException, PluginMessage {
 49  0
                 synchronizeData(model, callingFrame, file);
 50  0
         }
 51  
         
 52  
         public String getDescription() {
 53  0
                 return BuddiKeys.FILE_DESCRIPTION_BUDDI_SYNCHRONIZE_FILES.toString();
 54  
         }
 55  
         
 56  
         public String getProcessingMessage() {
 57  0
                 return BuddiKeys.MESSAGE_SYNCHRONIZING_FILES.toString();
 58  
         }
 59  
         
 60  
         @Override
 61  
         public boolean isFileChooserSave() {
 62  0
                 return false;
 63  
         }
 64  
 }