From a4f1748b0d96a8e7e4f700ee80f6d81e60bd822e Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 27 Dec 2021 09:49:52 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-64920=20=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E6=8E=A5=E5=8F=A3=E6=8A=A5=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/clipboard/ClipboardFilter.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java b/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java index 140a46579..22fff0d17 100644 --- a/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java +++ b/designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java @@ -27,11 +27,7 @@ public abstract class ClipboardFilter { } public static T cut(T selection) { - - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).cut(selection); } @@ -40,10 +36,7 @@ public abstract class ClipboardFilter { } public static T copy(T selection) { - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).copy(selection); } @@ -52,15 +45,27 @@ public abstract class ClipboardFilter { } public static T paste(T selection) { - ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); - Set providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); - providers.addAll(clipboardHandlerProviders); - - for (ClipboardHandlerProvider provider : providers) { + for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) { if (provider.support(selection)) { selection = ((ClipboardHandlerProvider) provider).paste(selection); } } return selection; } + + private static Set getClipboardHandlerProviders() { + Set providers = new HashSet<>(); + + for (ClipboardHandlerProvider clipboardHandlerProvider : clipboardHandlerProviders) { + providers.add(clipboardHandlerProvider); + } + + ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); + Set pluginProviders = manager.getArray(ClipboardHandlerProvider.XML_TAG); + for (ClipboardHandlerProvider clipboardHandlerProvider : pluginProviders) { + providers.add(clipboardHandlerProvider); + } + + return providers; + } }