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