]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/actions/MoveDown.java
Remove usage of deprecated SimanticsUI-methods
[simantics/platform.git] / bundles / org.simantics.modeling.template2d.ui / src / org / simantics / modeling / template2d / ui / actions / MoveDown.java
index 2fa5b7120dda7aae8cce01c5ae6a71d2b3b28aeb..637962d05cef2abcd051dd5d3c2c705863dc9816 100644 (file)
@@ -1,57 +1,57 @@
-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.template2d.ui.actions;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.common.utils.ListUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.adapter.ActionFactory;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.scenegraph.ontology.ScenegraphResources;\r
-import org.simantics.ui.SimanticsUI;\r
-\r
-public class MoveDown implements ActionFactory {\r
-\r
-       @Override\r
-    public Runnable create(Object target) {\r
-        if(!(target instanceof Resource))\r
-            return null;\r
-        final Resource selection = (Resource)target;\r
-\r
-        return new Runnable() {\r
-            @Override\r
-            public void run() {\r
-                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
-                    @Override\r
-                    public void perform(WriteGraph g) throws DatabaseException {\r
-                        g.markUndoPoint();\r
-                        \r
-                        Layer0 L0 = Layer0.getInstance(g);\r
-                        ScenegraphResources SG = ScenegraphResources.getInstance(g);\r
-                        \r
-                        Resource parent = g.getPossibleObject(selection, L0.PartOf);\r
-                        if (parent == null)\r
-                               return;\r
-                        \r
-                        Resource list = g.getPossibleObject(parent, SG.Node_children);\r
-                        if (list == null)\r
-                               return;\r
-                        \r
-                        ListUtils.swapWithNext(g, list, selection);\r
-                    }\r
-                });\r
-            }\r
-        };\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.template2d.ui.actions;
+
+import org.simantics.Simantics;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.WriteRequest;
+import org.simantics.db.common.utils.ListUtils;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.adapter.ActionFactory;
+import org.simantics.layer0.Layer0;
+import org.simantics.scenegraph.ontology.ScenegraphResources;
+
+public class MoveDown implements ActionFactory {
+
+       @Override
+    public Runnable create(Object target) {
+        if(!(target instanceof Resource))
+            return null;
+        final Resource selection = (Resource)target;
+
+        return new Runnable() {
+            @Override
+            public void run() {
+                Simantics.getSession().asyncRequest(new WriteRequest() {
+                    @Override
+                    public void perform(WriteGraph g) throws DatabaseException {
+                        g.markUndoPoint();
+                        
+                        Layer0 L0 = Layer0.getInstance(g);
+                        ScenegraphResources SG = ScenegraphResources.getInstance(g);
+                        
+                        Resource parent = g.getPossibleObject(selection, L0.PartOf);
+                        if (parent == null)
+                               return;
+                        
+                        Resource list = g.getPossibleObject(parent, SG.Node_children);
+                        if (list == null)
+                               return;
+                        
+                        ListUtils.swapWithNext(g, list, selection);
+                    }
+                });
+            }
+        };
+    }
+}