From e4a36956f7f8d6e804cf3a1b1b9b68d9bb363888 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Thu, 7 Nov 2024 10:26:17 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-138249=20cpt=E6=94=AF=E6=8C=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9B=BF=E6=8D=A2=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...actTableDataTreeToolBarActionProvider.java | 25 ------------- .../data/datapane/TableDataTreePane.java | 35 ++++++++++++------- .../TableDataTreeToolBarActionProvider.java | 25 ------------- 3 files changed, 23 insertions(+), 62 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java delete mode 100644 designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java b/designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java deleted file mode 100644 index 8d54b21d93..0000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/AbstractTableDataTreeToolBarActionProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.data.datapane; - -import com.fr.stable.fun.mark.API; - -/** - * 数据集Tree工具栏面板注入接口 - * - * @author Destiny.Lin - * @since 11.0 - * Created on 2024/11/1 - */ -@API(level = TableDataTreeToolBarActionProvider.CURRENT_LEVEL) -public abstract class AbstractTableDataTreeToolBarActionProvider implements TableDataTreeToolBarActionProvider { - - - @Override - public int currentAPILevel() { - return CURRENT_LEVEL; - } - - @Override - public String mark4Provider() { - return getClass().getName(); - } -} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 084eb1cc2d..c55524f247 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -47,7 +47,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.LineSeparator; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; -import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.esd.core.strategy.config.StrategyConfig; @@ -148,7 +147,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { private EsdOffAction esdOffAction; private SwitchAction switchAction; private PreviewTableDataAction previewTableDataAction; - private Set extraActions = new HashSet<>(); + private static Set extraActions = new HashSet<>(); private JPanel serverDatasetAuthTipJPanel = new JPanel(); private TableDataSearchRemindPane remindPane; @@ -257,26 +256,38 @@ public class TableDataTreePane extends BasicTableDataTreePane { esdAction = new EsdOnAction(); esdOffAction = new EsdOffAction(); switchAction = new SwitchAction(); - extraActions = new HashSet<>(); toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(addMenuDef, SeparatorDef.DEFAULT, editAction, removeAction); - ShortCut[] extraShortCut = initExtraAction(); - for (ShortCut shortCut: extraShortCut) { - toolbarDef.addShortCut(shortCut); - } + initExtraAction(); toolbarDef.addShortCut(SeparatorDef.DEFAULT, previewTableDataAction, connectionTableAction, esdAction, esdOffAction, switchAction); } - private ShortCut[] initExtraAction() { - Set toolBarActionProviders = ExtraDesignClassManager.getInstance().getArray(TableDataTreeToolBarActionProvider.XML_TAG); - for (TableDataTreeToolBarActionProvider handler : toolBarActionProviders) { + private void initExtraAction() { + for (AbstractExtraAction action: extraActions) { try { - extraActions.add(handler.createAction()); + toolbarDef.addShortCut(action); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - return extraActions.toArray(new ShortCut[0]); + } + + /** + * 注册ExtraAction + * + * @param extraAction TableDataTree工具栏的扩展接口Action + */ + public static void registerExtraAction(AbstractExtraAction extraAction) { + extraActions.add(extraAction); + } + + /** + * 移除ExtraAction + * + * @param extraAction TableDataTree工具栏的扩展接口Action + */ + public static void removeExtraAction(AbstractExtraAction extraAction) { + extraActions.remove(extraAction); } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java deleted file mode 100644 index 5746f9d136..0000000000 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreeToolBarActionProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fr.design.data.datapane; - -import com.fr.stable.fun.mark.Mutable; - - -/** - * 数据集Tree工具栏面板注入接口 - * - * @author Destiny.Lin - * @since 11.0 - * Created on 2024/11/1 - */ -public interface TableDataTreeToolBarActionProvider extends Mutable { - - String XML_TAG = "TableDataTreeToolBarActionProvider"; - - int CURRENT_LEVEL = 1; - - /** - * 创建Action对象,用于提供针对数据集的额外操作 - * - * @return 创建出来的Action对象 - */ - TableDataTreePane.AbstractExtraAction createAction(); -}