1 package org.simantics.modeling.ui.actions;
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.Collections;
7 import org.simantics.db.Resource;
8 import org.simantics.db.layer0.adapter.ActionFactory;
9 import org.simantics.db.layer0.adapter.ActionFactory2;
10 import org.simantics.modeling.ui.modelBrowser.handlers.StandardCopyHandler;
12 public class Copy implements ActionFactory, ActionFactory2 {
15 public Runnable create(Object target) {
16 return create(Collections.singletonList(target));
20 public Runnable create(Collection<?> target) {
22 final ArrayList<Resource> resources = new ArrayList<Resource>();
24 for(Object o : target) {
25 if(!(o instanceof Resource))
27 resources.add((Resource)o);
30 return new Runnable() {
34 StandardCopyHandler.copyResourcesToClipboard(resources.toArray(new Resource[resources.size()]), null);