You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.8 KiB
50 lines
1.8 KiB
package com.fr.design.base.clipboard; |
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
import com.fr.design.fun.ClipboardHandlerProvider; |
|
import com.fr.plugin.injectable.PluginModule; |
|
|
|
import java.util.Set; |
|
|
|
/** |
|
* created by Harrison on 2020/05/14 |
|
**/ |
|
@SuppressWarnings({"rawtypes", "unchecked"}) |
|
public abstract class ClipboardFilter { |
|
|
|
public static <T> T cut(T selection) { |
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
for (ClipboardHandlerProvider provider : providers) { |
|
if (provider.support(selection)) { |
|
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); |
|
} |
|
} |
|
return selection; |
|
} |
|
|
|
public static <T> T copy(T selection) { |
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
for (ClipboardHandlerProvider provider : providers) { |
|
if (provider.support(selection)) { |
|
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); |
|
} |
|
} |
|
return selection; |
|
} |
|
|
|
public static <T> T paste(T selection) { |
|
|
|
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
|
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
|
for (ClipboardHandlerProvider provider : providers) { |
|
if (provider.support(selection)) { |
|
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); |
|
} |
|
} |
|
return selection; |
|
} |
|
}
|
|
|