]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/connection/RemoveLineAction.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / nodes / connection / RemoveLineAction.java
index b497b869ab4f21d9bc8cc818afa46940d5a18505..c684ea5ff09c32b07e9dfdaf2b6f7af58fbaee55 100644 (file)
@@ -1,69 +1,69 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 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.scenegraph.g2d.nodes.connection;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import org.simantics.diagram.connection.RouteGraph;\r
-import org.simantics.diagram.connection.RouteLine;\r
-import org.simantics.diagram.connection.RouteTerminal;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class RemoveLineAction {\r
-\r
-    RouteGraph rg;\r
-    RouteGraph rgc;\r
-    RouteTerminal terminal;\r
-\r
-    public RemoveLineAction(RouteGraph rg, RouteGraph rgc, RouteTerminal terminal) {\r
-        this.rg = rg;\r
-        this.rgc = rgc;\r
-        this.terminal = terminal;\r
-    }\r
-\r
-    public RouteGraph getOriginalRouteGraph() {\r
-        return rg;\r
-    }\r
-\r
-    public RouteGraph getRouteGraph() {\r
-        return rgc;\r
-    }\r
-\r
-    /**\r
-     * @param rg\r
-     * @param l the route line to remove\r
-     * @param x\r
-     * @param y\r
-     * @return the performed action or <code>null</code> if no action to perform\r
-     */\r
-    public static RemoveLineAction perform(RouteGraph rg, RouteLine line, double x, double y) {\r
-        // Can't remove segments from connections that have only two terminals.\r
-        if (rg.isSimpleConnection() || rg.getTerminals().size() <= 2)\r
-            return null;\r
-\r
-        THashMap<Object, Object> map = new THashMap<Object, Object>();\r
-        RouteGraph rgc = rg.copy(map);\r
-        RouteLine lc = (RouteLine) map.get(line);\r
-\r
-        RouteTerminal terminal = lc.getTerminal();\r
-        if (terminal == null)\r
-            return null;\r
-\r
-        rgc.disconnect(terminal);\r
-        rgc.remove(terminal);\r
-\r
-        return new RemoveLineAction(rg, rgc, terminal);\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 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.scenegraph.g2d.nodes.connection;
+
+import gnu.trove.map.hash.THashMap;
+
+import org.simantics.diagram.connection.RouteGraph;
+import org.simantics.diagram.connection.RouteLine;
+import org.simantics.diagram.connection.RouteTerminal;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class RemoveLineAction {
+
+    RouteGraph rg;
+    RouteGraph rgc;
+    RouteTerminal terminal;
+
+    public RemoveLineAction(RouteGraph rg, RouteGraph rgc, RouteTerminal terminal) {
+        this.rg = rg;
+        this.rgc = rgc;
+        this.terminal = terminal;
+    }
+
+    public RouteGraph getOriginalRouteGraph() {
+        return rg;
+    }
+
+    public RouteGraph getRouteGraph() {
+        return rgc;
+    }
+
+    /**
+     * @param rg
+     * @param l the route line to remove
+     * @param x
+     * @param y
+     * @return the performed action or <code>null</code> if no action to perform
+     */
+    public static RemoveLineAction perform(RouteGraph rg, RouteLine line, double x, double y) {
+        // Can't remove segments from connections that have only two terminals.
+        if (rg.isSimpleConnection() || rg.getTerminals().size() <= 2)
+            return null;
+
+        THashMap<Object, Object> map = new THashMap<Object, Object>();
+        RouteGraph rgc = rg.copy(map);
+        RouteLine lc = (RouteLine) map.get(line);
+
+        RouteTerminal terminal = lc.getTerminal();
+        if (terminal == null)
+            return null;
+
+        rgc.disconnect(terminal);
+        rgc.remove(terminal);
+
+        return new RemoveLineAction(rg, rgc, terminal);
+    }
+
+}