Browse Source

PFC-607 插件安装删除更新不重启支持

放弃动态代理,用javassist实现相同功能:
1、动态代理不能作用到没接口的class上
2、动态代理改变了class的类型,开发和调试都不太方便
3、动态代理影响性能
master
juhaoyu 7 years ago
parent
commit
bbff7976c7
  1. 34
      designer_base/src/com/fr/design/ExtraDesignClassManager.java

34
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -6,7 +6,13 @@ package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.*;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.fun.Feedback;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.core.WidgetOptionFactory;
import com.fr.design.menu.ShortCut;
@ -16,13 +22,19 @@ import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.AbstractExtraClassManager;
import com.fr.plugin.solution.closeable.CompatibleInjectionContainer;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.solution.closeable.CloseableContainedSet;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author : richie
@ -33,7 +45,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
private static ExtraDesignClassManager classManager = new ExtraDesignClassManager();
private CompatibleInjectionContainer<ShortCut> shortCuts = new CompatibleInjectionContainer<>();
private Set<ShortCut> shortCuts = new CloseableContainedSet<>(HashSet.class);
public synchronized static ExtraDesignClassManager getInstance() {
return classManager;
@ -204,8 +216,8 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
@Override
protected boolean demountSpecific(PluginSingleInjection injection) {
if (ShortCut.TEMPLATE_TREE.equals(injection.getName()) && injection.getOriginalObject() instanceof ShortCut) {
if (ShortCut.TEMPLATE_TREE.equals(injection.getName()) && injection.getObject() instanceof ShortCut) {
shortCuts.remove(injection.getObject());
return true;
}
@ -214,16 +226,16 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
@Override
protected boolean mountSpecific(PluginSingleInjection injection) {
if (ShortCut.TEMPLATE_TREE.equals(injection.getName()) && injection.getOriginalObject() instanceof ShortCut) {
shortCuts.put(injection.getObject(), (ShortCut) injection.getOriginalObject());
if (ShortCut.TEMPLATE_TREE.equals(injection.getName()) && injection.getObject() instanceof ShortCut) {
shortCuts.add((ShortCut) injection.getObject());
return true;
}
return false;
}
public Set<ShortCut> getExtraShortCuts() {
return shortCuts.getSet();
return Collections.unmodifiableSet(shortCuts);
}
}
Loading…
Cancel
Save