From b74c40c8b5192222ba47073f56386cf5d25e4b73 Mon Sep 17 00:00:00 2001 From: Tommy Date: Wed, 29 Dec 2021 16:25:05 +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 140a46579d..22fff0d178 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; + } }