diff --git a/designer-base/src/main/java/com/fr/design/fun/PluginErrorRemindHandleProvider.java b/designer-base/src/main/java/com/fr/design/fun/PluginErrorRemindHandleProvider.java new file mode 100644 index 000000000..4e1eb44c2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/PluginErrorRemindHandleProvider.java @@ -0,0 +1,19 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Selectable; + +/** + * 插件不匹配时设计器提示框的“立即处理”事件 + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/2/20 + */ +public interface PluginErrorRemindHandleProvider extends Selectable { + + String MARK_STRING = "PluginErrorRemindHandleProvider"; + + int CURRENT_LEVEL = 1; + + // 打开插件管理 + void openPluginManager(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginErrorRemindHandleProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginErrorRemindHandleProvider.java new file mode 100644 index 000000000..e8f24a753 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginErrorRemindHandleProvider.java @@ -0,0 +1,30 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.PluginErrorRemindHandleProvider; +import com.fr.stable.fun.assist.Selector; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/2/20 + */ +@API(level = PluginErrorRemindHandleProvider.CURRENT_LEVEL) +public abstract class AbstractPluginErrorRemindHandleProvider extends AbstractProvider implements PluginErrorRemindHandleProvider { + + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public Selector selector() { + return Selector.ALWAYS; + } + +} diff --git a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java index 42dae0fa1..dbdb21826 100644 --- a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java +++ b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java @@ -1,12 +1,15 @@ package com.fr.env; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.server.PluginManagerAction; +import com.fr.design.fun.PluginErrorRemindHandleProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; +import com.fr.stable.bridge.ObjectHolder; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -23,6 +26,7 @@ import java.awt.Frame; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Set; /** * 插件启动失败提示窗 @@ -113,6 +117,16 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener { @Override public void actionPerformed(ActionEvent e) { this.jDialog.dispose(); + // 先从插件找 + Set providers = ExtraDesignClassManager.getInstance().getArray(PluginErrorRemindHandleProvider.MARK_STRING); + if (providers != null) { + for (PluginErrorRemindHandleProvider provider : providers) { + if (provider.selector().accept(new ObjectHolder())) { + provider.openPluginManager(); + return; + } + } + } super.actionPerformed(e); } }