Browse Source

Pull request #3612: REPORT-48228 【10.0.15】国际化接口-插件jar包不匹配弹窗接口

Merge in DESIGN/design from ~LUCIAN.CHEN/design:release/10.0 to release/10.0

* commit '202b0292698974c1a148ec201a2a7f02356c02d9':
  REPORT-48228 插件实现的插件管理不受shouldShowPlugin限制
  REPORT-47901 填报-导入excel-双向扩展是,表头部分扩展,多行导入数据丢失
  REPORT-48228 【10.0.15】国际化接口-插件jar包不匹配弹窗接口
feature/big-screen
Lucian.Chen 4 years ago
parent
commit
f8ce5b35a5
  1. 20
      designer-base/src/main/java/com/fr/design/fun/PluginManagerProvider.java
  2. 30
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginManagerProvider.java
  3. 25
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  4. 29
      designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java

20
designer-base/src/main/java/com/fr/design/fun/PluginManagerProvider.java

@ -0,0 +1,20 @@
package com.fr.design.fun;
import com.fr.design.actions.UpdateAction;
import com.fr.stable.fun.mark.Selectable;
/**
* 替换插件管理入口
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2021/2/20
*/
public interface PluginManagerProvider extends Selectable {
String MARK_STRING = "PluginManagerProvider";
int CURRENT_LEVEL = 1;
// 插件管理
UpdateAction pluginManagerAction();
}

30
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPluginManagerProvider.java

@ -0,0 +1,30 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.PluginManagerProvider;
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 = PluginManagerProvider.CURRENT_LEVEL)
public abstract class AbstractPluginManagerProvider extends AbstractProvider implements PluginManagerProvider {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public Selector selector() {
return Selector.ALWAYS;
}
}

25
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -41,6 +41,7 @@ import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
@ -72,6 +73,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.ObjectHolder;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler;
@ -487,11 +489,7 @@ public abstract class ToolBarMenuDock {
}
if (!DesignerMode.isAuthorityEditing()) {
if (shouldShowPlugin()) {
menuDef.addShortCut(
new PluginManagerAction()
);
}
addPluginManagerAction(menuDef);
menuDef.addShortCut(
new FunctionManagerAction(),
new GlobalParameterAction()
@ -502,6 +500,23 @@ public abstract class ToolBarMenuDock {
return menuDef;
}
private void addPluginManagerAction(MenuDef menuDef) {
Set<PluginManagerProvider> providers = ExtraDesignClassManager.getInstance().getArray(PluginManagerProvider.MARK_STRING);
if (providers != null) {
for (PluginManagerProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
menuDef.addShortCut(provider.pluginManagerAction());
return;
}
}
}
if (shouldShowPlugin()) {
menuDef.addShortCut(
new PluginManagerAction()
);
}
}
private ShortCut createGlobalTDAction() {
TableDataPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TableDataPaneProcessor.XML_TAG);
return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction();

29
designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java vendored

@ -1,12 +1,16 @@
package com.fr.env;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.fun.PluginManagerProvider;
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 +27,7 @@ import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Set;
/**
* 插件启动失败提示窗
@ -77,7 +82,7 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With"));
cancelButton.addActionListener(this);
okButton.addActionListener(new PluginManagerActionAdapter(this));
okButton.addActionListener(new PluginManagerHandleAction(this));
// 按钮
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
@ -102,18 +107,34 @@ public class PluginErrorRemindDialog extends JDialog implements ActionListener {
this.dispose();
}
private static class PluginManagerActionAdapter extends PluginManagerAction {
private static class PluginManagerHandleAction extends UpdateAction {
private JDialog jDialog;
private UpdateAction pluginManagerAction;
public PluginManagerActionAdapter(JDialog jDialog) {
public PluginManagerHandleAction(JDialog jDialog) {
this.jDialog = jDialog;
initPluginManagerAction();
}
private void initPluginManagerAction() {
Set<PluginManagerProvider> providers = ExtraDesignClassManager.getInstance().getArray(PluginManagerProvider.MARK_STRING);
if (providers != null) {
for (PluginManagerProvider provider : providers) {
if (provider.selector().accept(new ObjectHolder())) {
this.pluginManagerAction = provider.pluginManagerAction();
}
}
}
if (this.pluginManagerAction == null) {
this.pluginManagerAction = new PluginManagerAction();
}
}
@Override
public void actionPerformed(ActionEvent e) {
this.jDialog.dispose();
super.actionPerformed(e);
this.pluginManagerAction.actionPerformed(e);
}
}

Loading…
Cancel
Save