|
|
@ -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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|