|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
package com.fr.design.base.clipboard; |
|
|
|
|
|
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
import com.fr.design.fun.ClipboardHandlerProvider; |
|
|
|
|
import com.fr.form.main.ExtraFormClassManager; |
|
|
|
|
import com.fr.plugin.injectable.PluginModule; |
|
|
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
@ -13,12 +13,11 @@ import java.util.Set;
|
|
|
|
|
public abstract class ClipboardFilter { |
|
|
|
|
|
|
|
|
|
public static <T> T cut(T selection) { |
|
|
|
|
|
|
|
|
|
Class<?> clazz = selection.getClass(); |
|
|
|
|
ExtraFormClassManager manager = PluginModule.getAgent(PluginModule.ExtraForm); |
|
|
|
|
|
|
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
|
|
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
|
|
|
for (ClipboardHandlerProvider provider : providers) { |
|
|
|
|
if (provider.support(clazz)) { |
|
|
|
|
if (provider.support(selection)) { |
|
|
|
|
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -26,12 +25,11 @@ public abstract class ClipboardFilter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static <T> T copy(T selection) { |
|
|
|
|
|
|
|
|
|
Class<?> clazz = selection.getClass(); |
|
|
|
|
ExtraFormClassManager manager = PluginModule.getAgent(PluginModule.ExtraForm); |
|
|
|
|
|
|
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
|
|
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
|
|
|
for (ClipboardHandlerProvider provider : providers) { |
|
|
|
|
if (provider.support(clazz)) { |
|
|
|
|
if (provider.support(selection)) { |
|
|
|
|
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -39,12 +37,11 @@ public abstract class ClipboardFilter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static <T> T paste(T selection) { |
|
|
|
|
|
|
|
|
|
Class<?> clazz = selection.getClass(); |
|
|
|
|
ExtraFormClassManager manager = PluginModule.getAgent(PluginModule.ExtraForm); |
|
|
|
|
|
|
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
|
|
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
|
|
|
for (ClipboardHandlerProvider provider : providers) { |
|
|
|
|
if (provider.support(clazz)) { |
|
|
|
|
if (provider.support(selection)) { |
|
|
|
|
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|