Kaynağa Gözat

Fixes issue 1488: PluginInfo should look for "persistent" not "persistant"


git-svn-id: http://svn.dmdirc.com/trunk@4419 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 yıl önce
ebeveyn
işleme
078e4953c3

+ 2
- 2
src/com/dmdirc/addons/dcc/plugin.info Dosyayı Görüntüle

@@ -6,6 +6,6 @@ name=dcc
6 6
 nicename=DCC Plugin
7 7
 minversion=0
8 8
 require-ui=com.dmdirc.ui.swing
9
-persistant-com.dmdirc.addons.dcc.actions.DCCActions=true
10
-persistant-com.dmdirc.addons.dcc.actions.DCCEvents=true
9
+persistent-com.dmdirc.addons.dcc.actions.DCCActions=true
10
+persistent-com.dmdirc.addons.dcc.actions.DCCEvents=true
11 11
 addonid=23

+ 2
- 2
src/com/dmdirc/addons/nowplaying/plugin.info Dosyayı Görüntüle

@@ -5,6 +5,6 @@ description=Adds a command to show nowplaying information
5 5
 name=nowplaying
6 6
 nicename=Now Playing Plugin
7 7
 minversion=0
8
-persistant-com.dmdirc.addons.nowplaying.MediaSource=true
9
-persistant-com.dmdirc.addons.nowplaying.MediaSourceManager=true
8
+persistent-com.dmdirc.addons.nowplaying.MediaSource=true
9
+persistent-com.dmdirc.addons.nowplaying.MediaSourceManager=true
10 10
 addonid=8

+ 3
- 3
src/com/dmdirc/addons/timeplugin/plugin.info Dosyayı Görüntüle

@@ -5,7 +5,7 @@ description=Provides time-based actions and commands
5 5
 name=timeplugin
6 6
 nicename=Time Plugin
7 7
 minversion=0
8
-persistant-com.dmdirc.addons.timeplugin.TimeActionMetaType=true
9
-persistant-com.dmdirc.addons.timeplugin.TimeActionMetaType$1=true
10
-persistant-com.dmdirc.addons.timeplugin.TimeActionType=true
8
+persistent-com.dmdirc.addons.timeplugin.TimeActionMetaType=true
9
+persistent-com.dmdirc.addons.timeplugin.TimeActionMetaType$1=true
10
+persistent-com.dmdirc.addons.timeplugin.TimeActionType=true
11 11
 addonid=6

+ 2
- 2
src/com/dmdirc/addons/userlevel/plugin.info Dosyayı Görüntüle

@@ -7,5 +7,5 @@ nicename=User Levels
7 7
 minversion=0
8 8
 addonid=21
9 9
 
10
-persistant-com.dmdirc.addons.userlevel.AccessLevelComponent=true
11
-persistant-com.dmdirc.addons.userlevel.ChannelAccessLevelComponent=tre
10
+persistent-com.dmdirc.addons.userlevel.AccessLevelComponent=true
11
+persistent-com.dmdirc.addons.userlevel.ChannelAccessLevelComponent=tre

+ 2
- 2
src/com/dmdirc/plugins/GlobalClassLoader.java Dosyayı Görüntüle

@@ -32,7 +32,7 @@ import java.util.List;
32 32
 import java.util.Map;
33 33
 
34 34
 /**
35
- * This classloader knows about plugins and is used to store persistant classes.
35
+ * This classloader knows about plugins and is used to store persistent classes.
36 36
  */
37 37
 public final class GlobalClassLoader extends ClassLoader {
38 38
 
@@ -83,7 +83,7 @@ public final class GlobalClassLoader extends ClassLoader {
83 83
 	 * @throws ClassNotFoundException if the class to be loaded could not be found.
84 84
 	 */
85 85
 	public Class<?> loadClass(final String name, final PluginInfo pi) throws ClassNotFoundException {
86
-		for (String classname : pi.getPersistantClasses()) {
86
+		for (String classname : pi.getPersistentClasses()) {
87 87
 			if (!resourcesList.containsKey(classname)) {
88 88
 				resourcesList.put(classname, pi.getFullFilename());
89 89
 			}

+ 3
- 3
src/com/dmdirc/plugins/PluginClassLoader.java Dosyayı Görüntüle

@@ -86,8 +86,8 @@ public class PluginClassLoader extends ClassLoader {
86 86
 
87 87
 		final String fileName = name.replace('.', '/')+".class";
88 88
 		try {
89
-			if (pluginInfo.isPersistant(name) || !res.resourceExists(fileName)) {
90
-				if (!pluginInfo.isPersistant(name) && askGlobal) {
89
+			if (pluginInfo.isPersistent(name) || !res.resourceExists(fileName)) {
90
+				if (!pluginInfo.isPersistent(name) && askGlobal) {
91 91
 					return GlobalClassLoader.getGlobalClassLoader().loadClass(name);
92 92
 				} else {
93 93
 					// Try to load class from previous load.
@@ -118,7 +118,7 @@ public class PluginClassLoader extends ClassLoader {
118 118
 		}
119 119
 		
120 120
 		try {
121
-			if (pluginInfo.isPersistant(name)) {
121
+			if (pluginInfo.isPersistent(name)) {
122 122
 				GlobalClassLoader.getGlobalClassLoader().defineClass(name, data);
123 123
 			} else {
124 124
 				loadedClass = defineClass(name, data, 0, data.length);

+ 42
- 30
src/com/dmdirc/plugins/PluginInfo.java Dosyayı Görüntüle

@@ -66,6 +66,9 @@ public class PluginInfo implements Comparable<PluginInfo> {
66 66
 	
67 67
 	/** Last Error Message. */
68 68
 	private String lastError = "No Error";
69
+	
70
+	/** Are we trying to load? */
71
+	private boolean isLoading = false;
69 72
 
70 73
 	/**
71 74
 	 * Create a new PluginInfo.
@@ -166,7 +169,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
166 169
 				}
167 170
 			}
168 171
 
169
-			if (isPersistant() && loadAll()) { loadEntirePlugin(); }
172
+			if (isPersistent() && loadAll()) { loadEntirePlugin(); }
170 173
 		} else {
171 174
 			lastError = "One or more requirements not met ("+requirementsError+")";
172 175
 			throw new PluginException("Plugin "+filename+" was not loaded. "+lastError);
@@ -572,22 +575,31 @@ public class PluginInfo implements Comparable<PluginInfo> {
572 575
 	 * Load the plugin files.
573 576
 	 */
574 577
 	public void loadPlugin() {
578
+		System.out.println("["+getName()+"] loadPlugin called");
575 579
 		if (isTempLoaded()) {
576 580
 			tempLoaded = false;
581
+			System.out.println("["+getName()+"] temp -> full");
582
+			System.out.println("["+getName()+"] loadingRequirements");
577 583
 			loadRequired();
584
+			System.out.println("["+getName()+"] calling onLoad");
578 585
 			plugin.onLoad();
586
+			System.out.println("["+getName()+"] onLoad Result: "+lastError);
579 587
 		} else {
580
-			if (isLoaded() || metaData == null) {
581
-				lastError = "Not Loading: ("+isLoaded()+"||"+(metaData == null)+")";
588
+			if (isLoaded() || metaData == null || isLoading) {
589
+				lastError = "Not Loading: ("+isLoaded()+"||"+(metaData == null)+"||"+isLoading+")";
590
+				System.out.println("["+getName()+"] loadPlugin failed: "+lastError);
582 591
 				return;
583 592
 			}
584
-			
593
+			isLoading = true;
594
+			System.out.println("["+getName()+"] loadingRequirements");
585 595
 			loadRequired();
586
-			
596
+			System.out.println("["+getName()+"] loading Main class");
587 597
 			loadClass(getMainClass());
598
+			System.out.println("["+getName()+"] load Result: "+lastError);
588 599
 			if (isLoaded()) {
589 600
 				ActionManager.processEvent(CoreActionType.PLUGIN_LOADED, null, this);
590 601
 			}
602
+			isLoading = false;
591 603
 		}
592 604
 	}
593 605
 
@@ -667,7 +679,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
667 679
 	 * Unload the plugin if possible.
668 680
 	 */
669 681
 	public void unloadPlugin() {
670
-		if (!isPersistant() && (isLoaded() || isTempLoaded())) {
682
+		if (!isPersistent() && (isLoaded() || isTempLoaded())) {
671 683
 			if (!isTempLoaded()) {
672 684
 				try {
673 685
 					plugin.onUnload();
@@ -761,27 +773,27 @@ public class PluginInfo implements Comparable<PluginInfo> {
761 773
 	}
762 774
 
763 775
 	/**
764
-	 * Is this a persistant plugin?
776
+	 * Is this a persistent plugin?
765 777
 	 *
766
-	 * @return true if persistant, else false
778
+	 * @return true if persistent, else false
767 779
 	 */
768
-	public boolean isPersistant() {
769
-		final String persistance = metaData.getProperty("persistant","no");
770
-		return persistance.equalsIgnoreCase("true") || persistance.equalsIgnoreCase("yes");
780
+	public boolean isPersistent() {
781
+		final String persistence = metaData.getProperty("persistent","no");
782
+		return persistence.equalsIgnoreCase("true") || persistence.equalsIgnoreCase("yes");
771 783
 	}
772 784
 
773 785
 	/**
774
-	 * Does this plugin contain any persistant classes?
786
+	 * Does this plugin contain any persistent classes?
775 787
 	 *
776
-	 * @return true if this plugin contains any persistant classes, else false
788
+	 * @return true if this plugin contains any persistent classes, else false
777 789
 	 */
778
-	public boolean hasPersistant() {
779
-		final String persistance = metaData.getProperty("persistant","no");
780
-		if (persistance.equalsIgnoreCase("true")) {
790
+	public boolean hasPersistent() {
791
+		final String persistence = metaData.getProperty("persistent","no");
792
+		if (persistence.equalsIgnoreCase("true")) {
781 793
 			return true;
782 794
 		} else {
783 795
 			for (Object keyObject : metaData.keySet()) {
784
-				if (keyObject.toString().toLowerCase().startsWith("persistant-")) {
796
+				if (keyObject.toString().toLowerCase().startsWith("persistent-")) {
785 797
 					return true;
786 798
 				}
787 799
 			}
@@ -790,14 +802,14 @@ public class PluginInfo implements Comparable<PluginInfo> {
790 802
 	}
791 803
 
792 804
 	/**
793
-	 * Get a list of all persistant classes in this plugin
805
+	 * Get a list of all persistent classes in this plugin
794 806
 	 *
795
-	 * @return List of all persistant classes in this plugin
807
+	 * @return List of all persistent classes in this plugin
796 808
 	 */
797
-	public List<String> getPersistantClasses() {
809
+	public List<String> getPersistentClasses() {
798 810
 		final List<String> result = new ArrayList<String>();
799
-		final String persistance = metaData.getProperty("persistant","no");
800
-		if (persistance.equalsIgnoreCase("true")) {
811
+		final String persistence = metaData.getProperty("persistent","no");
812
+		if (persistence.equalsIgnoreCase("true")) {
801 813
 			try {
802 814
 				ResourceManager res = getResourceManager();
803 815
 
@@ -811,7 +823,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
811 823
 			}
812 824
 		} else {
813 825
 			for (Object keyObject : metaData.keySet()) {
814
-				if (keyObject.toString().toLowerCase().startsWith("persistant-")) {
826
+				if (keyObject.toString().toLowerCase().startsWith("persistent-")) {
815 827
 					result.add(keyObject.toString().substring(11));
816 828
 				}
817 829
 			}
@@ -820,17 +832,17 @@ public class PluginInfo implements Comparable<PluginInfo> {
820 832
 	}
821 833
 
822 834
 	/**
823
-	 * Is this a persistant class?
835
+	 * Is this a persistent class?
824 836
 	 *
825
-	 * @param classname class to check persistance of
826
-	 * @return true if file (or whole plugin) is persistant, else false
837
+	 * @param classname class to check persistence of
838
+	 * @return true if file (or whole plugin) is persistent, else false
827 839
 	 */
828
-	public boolean isPersistant(final String classname) {
829
-		if (isPersistant()) {
840
+	public boolean isPersistent(final String classname) {
841
+		if (isPersistent()) {
830 842
 			return true;
831 843
 		} else {
832
-			final String persistance = metaData.getProperty("persistant-"+classname,"no");
833
-			return persistance.equalsIgnoreCase("true") || persistance.equalsIgnoreCase("yes");
844
+			final String persistence = metaData.getProperty("persistent-"+classname,"no");
845
+			return persistence.equalsIgnoreCase("true") || persistence.equalsIgnoreCase("yes");
834 846
 		}
835 847
 	}
836 848
 

+ 1
- 1
src/com/dmdirc/ui/swing/components/pluginpanel/PluginPanel.java Dosyayı Görüntüle

@@ -195,7 +195,7 @@ public final class PluginPanel extends JPanel implements
195 195
                 toggleButton.setEnabled(true);
196 196
                 
197 197
                 if (pluginInfo.getState()) {
198
-                    if (pluginInfo.getPluginInfo().isPersistant()) {
198
+                    if (pluginInfo.getPluginInfo().isPersistent()) {
199 199
                         toggleButton.setEnabled(false);
200 200
                     }
201 201
                     toggleButton.setText("Disable");

+ 2
- 2
src/com/dmdirc/updater/components/PluginComponent.java Dosyayı Görüntüle

@@ -92,11 +92,11 @@ public class PluginComponent implements UpdateComponent {
92 92
     public boolean doInstall(final String path) throws Throwable {
93 93
         final File target = new File(plugin.getFullFilename());
94 94
         
95
-        if (!plugin.hasPersistant() && target.exists()) {
95
+        if (!plugin.hasPersistent() && target.exists()) {
96 96
             target.delete();
97 97
         }
98 98
         
99
-        if (plugin.hasPersistant() || !new File(path).renameTo(target)) {
99
+        if (plugin.hasPersistent() || !new File(path).renameTo(target)) {
100 100
             // Windows rocks!
101 101
             final File newTarget = new File(plugin.getFullFilename() + ".update");
102 102
             

Loading…
İptal
Kaydet