xiaxiang 9 years ago
parent
commit
00cc0ec45a
  1. 254
      designer_base/src/com/fr/PluginManager.java
  2. 39
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

254
designer_base/src/com/fr/plugin/PluginManager.java → designer_base/src/com/fr/PluginManager.java

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

39
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -8,31 +8,10 @@ import com.fr.base.FRContext;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.BBSAction; import com.fr.design.actions.community.*;
import com.fr.design.actions.community.BugAction; import com.fr.design.actions.file.*;
import com.fr.design.actions.community.NeedAction; import com.fr.design.actions.help.*;
import com.fr.design.actions.community.QuestionAction; import com.fr.design.actions.server.*;
import com.fr.design.actions.community.SignAction;
import com.fr.design.actions.community.UpAction;
import com.fr.design.actions.community.VideoAction;
import com.fr.design.actions.file.CloseCurrentTemplateAction;
import com.fr.design.actions.file.ExitDesignerAction;
import com.fr.design.actions.file.OpenRecentReportMenuDef;
import com.fr.design.actions.file.OpenTemplateAction;
import com.fr.design.actions.file.PreferenceAction;
import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.FeedBackAction;
import com.fr.design.actions.help.ForumAction;
import com.fr.design.actions.help.SupportQQAction;
import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.actions.server.FunctionManagerAction;
import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
@ -55,7 +34,10 @@ import com.fr.stable.ProductConstants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Set;
/** /**
* @author richer * @author richer
@ -151,10 +133,11 @@ public abstract class ToolBarMenuDock {
// 添加服务器菜单 // 添加服务器菜单
menuList.add(createServerMenuDef(plus)); menuList.add(createServerMenuDef(plus));
// 添加帮助菜单 // 添加帮助菜单
menuList.add(createHelpMenuDef()); menuList.add(createHelpMenuDef());
// 添加社区菜单 // 添加社区菜单
menuList.add(createCommunityMenuDef()); menuList.add(createCommunityMenuDef());
return menuList.toArray(new MenuDef[menuList.size()]); return menuList.toArray(new MenuDef[menuList.size()]);
} }
@ -359,7 +342,7 @@ public abstract class ToolBarMenuDock {
for (ShortCut shortCut : otherCommunityShortCuts) { for (ShortCut shortCut : otherCommunityShortCuts) {
menuDef.addShortCut(shortCut); menuDef.addShortCut(shortCut);
} }
insertMenu(menuDef, MenuHandler.HELP); insertMenu(menuDef, MenuHandler.BBS);
return menuDef; return menuDef;
} }
/** /**

Loading…
Cancel
Save