Revision 11142 branches/v10/libraries/libCorePlugin/src/com/iver/core/PreferencesExtension.java
PreferencesExtension.java | ||
---|---|---|
1 | 1 |
package com.iver.core; |
2 | 2 |
|
3 |
import java.util.ArrayList;
|
|
3 |
import java.io.File;
|
|
4 | 4 |
import java.util.HashMap; |
5 | 5 |
import java.util.Iterator; |
6 |
import java.util.Map.Entry; |
|
6 | 7 |
|
7 | 8 |
import com.iver.andami.Launcher; |
8 | 9 |
import com.iver.andami.PluginServices; |
... | ... | |
94 | 95 |
|
95 | 96 |
private void initializeExtensionsConfig() { |
96 | 97 |
HashMap pc = Launcher.getPluginConfig(); |
97 |
ArrayList array = new ArrayList(); |
|
98 |
Iterator iter = pc.values().iterator(); |
|
99 |
|
|
98 |
String pluginDirectory=Launcher.getAndamiConfig().getPluginsDirectory(); |
|
99 |
|
|
100 |
Iterator iter = pc.entrySet().iterator(); |
|
101 |
Entry entry; |
|
102 |
String pluginName; |
|
103 |
Extensions extensions; |
|
104 |
String extensionName; |
|
105 |
com.iver.andami.plugins.config.generate.Extension ext; |
|
106 |
File configFile; |
|
107 |
ExtensionPage extensionPage; |
|
100 | 108 |
while (iter.hasNext()) { |
101 |
array.add(((PluginConfig) iter.next()).getExtensions()); |
|
109 |
entry = (Entry)iter.next(); |
|
110 |
pluginName = (String)entry.getKey(); |
|
111 |
configFile = new File(pluginDirectory + File.separator + |
|
112 |
pluginName + File.separator + "config.xml"); |
|
113 |
extensions = ((PluginConfig) entry.getValue()).getExtensions(); |
|
114 |
for (int j = 0; j < extensions.getExtensionCount(); j++) { |
|
115 |
ext = extensions.getExtension(j); |
|
116 |
extensionName = ext.getClassName().toString(); |
|
117 |
extensionPage =new ExtensionPage(ext); |
|
118 |
extensionPage.setReadOnly(!configFile.canWrite()); |
|
119 |
this.extensionPoints.add("AplicationPreferences",extensionName, extensionPage); |
|
120 |
} |
|
102 | 121 |
} |
103 | 122 |
|
104 |
Extensions[] exts = (Extensions[]) array.toArray(new Extensions[0]); |
|
105 |
for (int i = 0; i < exts.length; i++) { |
|
106 |
for (int j = 0; j < exts[i].getExtensionCount(); j++) { |
|
107 |
com.iver.andami.plugins.config.generate.Extension ext = exts[i] |
|
108 |
.getExtension(j); |
|
109 |
String sExt = ext.getClassName().toString(); |
|
110 |
// String pn = null; |
|
111 |
// pn = sExt.substring(0, sExt.lastIndexOf(".")); |
|
112 |
// dlgPrefs.addPreferencePage(new PluginsPage(pn)); |
|
113 |
// dlgPrefs.addPreferencePage(new ExtensionPage(ext)); |
|
114 |
this.extensionPoints.add("AplicationPreferences",sExt, new ExtensionPage(ext)); |
|
115 |
} |
|
116 |
} |
|
123 |
|
|
117 | 124 |
} |
118 | 125 |
/** |
119 | 126 |
* |
Also available in: Unified diff