Browse Source

Merge pull request #31 in PF/design from ~JU/co-pf-9.0-design:9.0 to 9.0

* commit '016a70ee471d74aa3ea5b9a9f8498108fada5180':
  fix
master
superman 8 years ago
parent
commit
49b343feab
  1. 13
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  2. 128
      designer_base/src/com/fr/plugin/PluginManager.java

13
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -1,8 +1,6 @@
package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.HyperlinkPluginAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
@ -12,14 +10,12 @@ import com.fr.general.NameObject;
import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.plugin.PluginManager;
import com.fr.stable.ListMap;
import com.fr.stable.Nameable;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
/**
* 超级链接 界面.
@ -40,15 +36,6 @@ public class HyperlinkGroupPane extends JListControlPane {
for (NameableCreator creator : creators) {
nameCreators.put(creator.menuName(), creator);
}
PluginManager.getInstance().setExtensionPoint(HyperlinkPluginAction.XML_TAG);
ArrayList<UpdateAction> templateArrayLisy = PluginManager.getInstance().getResultList();
// if (templateArrayLisy.isEmpty()) {
// return creators;
// }
for (int i = 0; i < templateArrayLisy.size(); i++) {
NameableCreator nameableCreator = ((HyperlinkPluginAction) templateArrayLisy.get(i)).getHyperlinkCreator();
nameCreators.put(nameableCreator.menuName(), nameableCreator);
}
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) {
NameableCreator nc = provider.createHyperlinkCreator();

128
designer_base/src/com/fr/plugin/PluginManager.java

@ -1,128 +0,0 @@
package com.fr.plugin;
import com.fr.design.actions.UpdateAction;
import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
* Author : daisy
* Version: 6.5.6
* Date: 13-12-20
* Time: 下午5:05
*/
public class PluginManager extends XMLFileManager {
private static PluginManager pluginManager = null;
private String extensionPoint = StringUtils.EMPTY;
private ArrayList<UpdateAction> resultList = new ArrayList<UpdateAction>();
public synchronized static PluginManager getInstance() {
if (pluginManager == null) {
pluginManager = new PluginManager();
}
return pluginManager;
}
public PluginManager() {
}
/**
* 文件名
* @return 文件名
*/
public String fileName() {
return "plugin.xml";
}
public void setExtensionPoint(String point) {
extensionPoint = point;
resultList.clear();
pluginManager.readXMLFile();
}
@Override
public void readXML(XMLableReader reader) {
if (extensionPoint == StringUtils.EMPTY) {
return;
}
if (reader.getTagName().equals("PluginManager")) {
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
readExtension(reader);
}
});
}
}
private void readExtension(XMLableReader reader) {
if (reader.isChildNode()) {
if (reader.getTagName().equals("Extension")) {
String name = null, tmpVal = null;
if ((tmpVal = reader.getAttrAsString("position", null)) != null) {
name = tmpVal;
}
if (!ComparatorUtils.equals(name, extensionPoint)) {
return;
}
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
readActions(reader);
}
});
}
}
}
private void readActions(XMLableReader reader) {
if (reader.isChildNode()) {
if (reader.getTagName().equals("Action")) {
String name = null, tmpVal = null;
if ((tmpVal = reader.getAttrAsString("class", null)) != null) {
name = tmpVal;
}
//读取模板数据集菜单
if (name.isEmpty()) {
return;
}
try {
UpdateAction action = (UpdateAction) GeneralUtils.classForName(name).newInstance();
PluginManager.this.resultList.add(action);
} catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp);
}
}
}
}
public ArrayList<UpdateAction> getResultList() {
return resultList;
}
@Override
public void writeXML(XMLPrintWriter writer) {
}
}
Loading…
Cancel
Save