Browse Source

REPORT-64920 复制粘贴接口报错处理

zheng-1641779399395
Tommy 3 years ago
parent
commit
b74c40c8b5
  1. 33
      designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java

33
designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java

@ -27,11 +27,7 @@ public abstract class ClipboardFilter {
} }
public static <T> T cut(T selection) { public static <T> T cut(T selection) {
for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); selection = ((ClipboardHandlerProvider<T>) provider).cut(selection);
} }
@ -40,10 +36,7 @@ public abstract class ClipboardFilter {
} }
public static <T> T copy(T selection) { public static <T> T copy(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); selection = ((ClipboardHandlerProvider<T>) provider).copy(selection);
} }
@ -52,15 +45,27 @@ public abstract class ClipboardFilter {
} }
public static <T> T paste(T selection) { public static <T> T paste(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); for (ClipboardHandlerProvider provider : getClipboardHandlerProviders()) {
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
providers.addAll(clipboardHandlerProviders);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) { if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); selection = ((ClipboardHandlerProvider<T>) provider).paste(selection);
} }
} }
return selection; return selection;
} }
private static Set<ClipboardHandlerProvider> getClipboardHandlerProviders() {
Set<ClipboardHandlerProvider> providers = new HashSet<>();
for (ClipboardHandlerProvider clipboardHandlerProvider : clipboardHandlerProviders) {
providers.add(clipboardHandlerProvider);
}
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> pluginProviders = manager.getArray(ClipboardHandlerProvider.XML_TAG);
for (ClipboardHandlerProvider clipboardHandlerProvider : pluginProviders) {
providers.add(clipboardHandlerProvider);
}
return providers;
}
} }

Loading…
Cancel
Save