Revision 34307
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/PluginServices.java | ||
---|---|---|
63 | 63 |
import javax.swing.SwingUtilities; |
64 | 64 |
import javax.swing.Timer; |
65 | 65 |
|
66 |
import org.slf4j.Logger; |
|
67 |
import org.slf4j.LoggerFactory; |
|
68 |
|
|
66 | 69 |
import org.gvsig.andami.authentication.IAuthentication; |
67 | 70 |
import org.gvsig.andami.iconthemes.IIconTheme; |
68 | 71 |
import org.gvsig.andami.iconthemes.IconThemeManager; |
... | ... | |
83 | 86 |
import org.gvsig.tools.persistence.PersistenceManager; |
84 | 87 |
import org.gvsig.tools.persistence.PersistentState; |
85 | 88 |
import org.gvsig.tools.persistence.exception.AddDefinitionException; |
86 |
import org.gvsig.tools.persistence.exception.PersistenceCreateException; |
|
87 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
88 |
import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions; |
|
89 | 89 |
import org.gvsig.utils.XMLEntity; |
90 | 90 |
import org.gvsig.utils.swing.threads.IMonitorableTask; |
91 | 91 |
import org.gvsig.utils.swing.threads.IProgressMonitorIF; |
92 | 92 |
import org.gvsig.utils.swing.threads.TaskMonitorTimerListener; |
93 | 93 |
import org.gvsig.utils.swing.threads.UndefinedProgressMonitor; |
94 |
import org.slf4j.Logger; |
|
95 |
import org.slf4j.LoggerFactory; |
|
96 | 94 |
|
97 | 95 |
/** |
98 | 96 |
* Provides services to Plugins. Each plugin has an associated PluginServices |
... | ... | |
747 | 745 |
} |
748 | 746 |
|
749 | 747 |
|
750 |
File persistenceFile = |
|
751 |
new File(Launcher.getAppHomeDir() + File.separator |
|
752 |
+ "plugins" + File.separator + this.getPluginName() |
|
753 |
+ File.separator + "plugin-persistence.dat"); |
|
748 |
File persistenceFile = getPluginPersistenceFile(); |
|
754 | 749 |
if (persistenceFile.exists()) { |
755 | 750 |
PersistentState state; |
756 | 751 |
|
... | ... | |
775 | 770 |
return; |
776 | 771 |
} |
777 | 772 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
778 |
File persistenceFile = |
|
779 |
new File(Launcher.getAppHomeDir() + File.separator + "plugins" |
|
780 |
+ File.separator + this.getPluginName() |
|
781 |
+ File.separator + "plugin-persistence.dat"); |
|
782 |
File folder = persistenceFile.getParentFile(); |
|
783 |
folder.mkdirs(); |
|
773 |
File persistenceFile = getPluginPersistenceFile(); |
|
784 | 774 |
PersistentState state; |
785 | 775 |
FileOutputStream fos; |
786 | 776 |
try { |
... | ... | |
793 | 783 |
|
794 | 784 |
} |
795 | 785 |
|
786 |
/** |
|
787 |
* Returns the plugin persistence file. |
|
788 |
* |
|
789 |
* @return the plugin persistence file |
|
790 |
*/ |
|
791 |
private File getPluginPersistenceFile() { |
|
792 |
return new File(getPluginPersistenceFolder(), "plugin-persistence.dat"); |
|
793 |
} |
|
796 | 794 |
|
795 |
/** |
|
796 |
* Returns the folder where the plugin stores its resources. That folder |
|
797 |
* will be usually a subfolder into the application folder in the user home |
|
798 |
* folder. |
|
799 |
* |
|
800 |
* @return the folder where the plugin stores its resources |
|
801 |
*/ |
|
802 |
public File getPluginPersistenceFolder() { |
|
803 |
File persistenceFolder = new File(Launcher.getAppHomeDir() |
|
804 |
+ File.separator + "plugins" + File.separator |
|
805 |
+ this.getPluginName()); |
|
797 | 806 |
|
807 |
if (!persistenceFolder.exists()) { |
|
808 |
persistenceFolder.mkdirs(); |
|
809 |
} |
|
810 |
|
|
811 |
return persistenceFolder; |
|
812 |
} |
|
813 |
|
|
798 | 814 |
public class PluginPersistenceNeedDefinitionException extends |
799 | 815 |
BaseRuntimeException { |
800 | 816 |
|
Also available in: Unified diff