]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Rename and move 'modeling.adapters.Removers' and make it API 66/3866/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Wed, 12 Feb 2020 13:13:38 +0000 (15:13 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Wed, 12 Feb 2020 13:15:33 +0000 (15:15 +0200)
gitlab #466

Change-Id: I0e86bf7ebce158de3e1627059909040960c6ba08

bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/ConnectionRelationRemover.java
bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/FlagRemover.java
bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/TerminalRemover.java
bundles/org.simantics.modeling/src/org/simantics/modeling/utils/RemoverUtils.java [moved from bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/Removers.java with 99% similarity]

index 1c69e45a92c602422baf34a4089a0a6699301bdf..83ec57afd50bcee0632c0ded4f3632b0c0c53068 100644 (file)
@@ -24,7 +24,8 @@ import org.simantics.db.layer0.util.RemoverUtil;
 import org.simantics.diagram.stubs.DiagramResource;
 import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;
-import org.simantics.modeling.adapters.Removers.ValidationResult;
+import org.simantics.modeling.utils.RemoverUtils;
+import org.simantics.modeling.utils.RemoverUtils.ValidationResult;
 
 /**
  * @author Tuukka Lehtonen
@@ -45,9 +46,9 @@ public class ConnectionRelationRemover extends AbstractRemover {
             diagramConnectionRelation = resource;
         else
             connectionRelation = resource;
-        ValidationResult result = Removers.validateConnectionRelationRemoval(graph, connectionRelation, diagramConnectionRelation);
+        ValidationResult result = RemoverUtils.validateConnectionRelationRemoval(graph, connectionRelation, diagramConnectionRelation);
         if (result.inUse())
-            return Removers.formatError(graph, result);
+            return RemoverUtils.formatError(graph, result);
         return null;
     }
 
index c73486a56280ea7a5ddad6e404c361884b7630f2..62b70c9aed6a16bdce9691c78aa45df20c83750f 100644 (file)
@@ -21,7 +21,8 @@ import org.simantics.db.WriteGraph;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.diagram.flag.FlagUtil;
 import org.simantics.diagram.stubs.DiagramResource;
-import org.simantics.modeling.adapters.Removers.ValidationResult;
+import org.simantics.modeling.utils.RemoverUtils;
+import org.simantics.modeling.utils.RemoverUtils.ValidationResult;
 
 /**
  * @author Tuukka Lehtonen
@@ -36,9 +37,9 @@ public class FlagRemover extends ElementRemover {
     public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {
         boolean lifted = FlagUtil.isLifted(graph, resource);
         if (lifted) {
-            ValidationResult result = Removers.validateFlagRemoval(graph, resource);
+            ValidationResult result = RemoverUtils.validateFlagRemoval(graph, resource);
             if (result.inUse()) {
-                return Removers.formatError(graph, result);
+                return RemoverUtils.formatError(graph, result);
             }
         }
         return null;
index ecf59e72c366366a04d9465b844a8d7a789fd826..deb6434c2f1e1f243d1345e82e66a301d24e5be0 100644 (file)
@@ -20,7 +20,8 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.diagram.stubs.DiagramResource;
 import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;
-import org.simantics.modeling.adapters.Removers.ValidationResult;
+import org.simantics.modeling.utils.RemoverUtils;
+import org.simantics.modeling.utils.RemoverUtils.ValidationResult;
 
 /**
  * A remover implementation for symbol terminals.
@@ -48,9 +49,9 @@ public class TerminalRemover extends ElementRemover {
 
         for (Resource diagramConnectionRelation : graph.getObjects(resource, DIA.HasConnectionPoint)) {
             for (Resource connectionRelation : graph.getObjects(diagramConnectionRelation, MOD.DiagramConnectionRelationToConnectionRelation)) {
-                ValidationResult result = Removers.validateConnectionRelationRemoval(graph, connectionRelation, diagramConnectionRelation);
+                ValidationResult result = RemoverUtils.validateConnectionRelationRemoval(graph, connectionRelation, diagramConnectionRelation);
                 if (result.inUse())
-                    return Removers.formatError(graph, result);
+                    return RemoverUtils.formatError(graph, result);
             }
         }
 
similarity index 99%
rename from bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/Removers.java
rename to bundles/org.simantics.modeling/src/org/simantics/modeling/utils/RemoverUtils.java
index 4949793b46b9bbdae244427a8646e82fecae6364..13fbf7b817109e8d229567fef054955a141673ef 100644 (file)
@@ -9,7 +9,7 @@
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
  *******************************************************************************/
-package org.simantics.modeling.adapters;
+package org.simantics.modeling.utils;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -42,7 +42,7 @@ import gnu.trove.set.hash.THashSet;
 /**
  * @author Tuukka Lehtonen
  */
-final class Removers {
+final public class RemoverUtils {
 
     public static ValidationResult validateFlagRemoval(ReadGraph graph, Resource flag) throws DatabaseException {
         DiagramResource DIA = DiagramResource.getInstance(graph);