]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network.ui/src/org/simantics/district/network/ui/contributions/CopyDistrictVertexHandler.java
Support copy and cut of dh element & create connections after
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / contributions / CopyDistrictVertexHandler.java
index 3f99f60b7bae1a6b7a7b095655e5d32e9727d2fd..9365a8c0ccb784a1f66b7ea8e539705fe70d41b8 100644 (file)
@@ -4,6 +4,7 @@ import java.util.List;
 
 import javax.inject.Named;
 
+import org.eclipse.core.commands.ParameterizedCommand;
 import org.eclipse.e4.core.di.annotations.CanExecute;
 import org.eclipse.e4.core.di.annotations.Execute;
 import org.eclipse.e4.ui.services.IServiceConstants;
@@ -51,10 +52,11 @@ public class CopyDistrictVertexHandler {
     }
 
     @Execute
-    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) Object selection) {
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, ParameterizedCommand command) {
         final List<Resource> elements = ISelectionUtils.getPossibleKeys(selection, SelectionHints.KEY_MAIN, Resource.class);
-        // we store these to a static variable for pasting.. maybe not the best solution 
+        // we store these to a static variable for pasting.. maybe not the best solution
         CopyDistrictVertexHandler.elements = elements;
-        //CopyDistrictVertexHandler.cut = cut != null && !cut.isEmpty();
+        Object cut = command.getParameterMap().get("org.simantics.district.network.ui.commandparameter.0");
+        CopyDistrictVertexHandler.cut = cut != null;
     }
 }