-/*******************************************************************************\r
- * Copyright (c) 2013 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
- * Semantum Oy - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.adapters;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.modeling.ModelingResources;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class ReferenceElementRemover extends ElementRemover {\r
-\r
- public ReferenceElementRemover(Resource referenceElement) {\r
- super(referenceElement);\r
- }\r
-\r
- @Override\r
- public void remove(WriteGraph graph) throws DatabaseException {\r
- ModelingResources MOD = ModelingResources.getInstance(graph);\r
-\r
- Resource referencedComponent = graph.getPossibleObject(resource, MOD.HasParentComponent);\r
- Resource referenceRelation = graph.getPossibleObject(resource, MOD.HasReferenceRelation);\r
- //System.out.println("references component : " + NameUtils.getSafeName(graph, referencedComponent));\r
- //System.out.println("reference relation: " + NameUtils.getSafeName(graph, referenceRelation));\r
-\r
- if (referencedComponent != null && referenceRelation != null) {\r
- // Make sure that all referenceRelations from parentComponent are\r
- // removed since removing this reference element will also remove\r
- // the referenceRelation which would break the statements into\r
- // unusable form if the relation was still used anywhere.\r
- graph.deny(referencedComponent, referenceRelation);\r
- }\r
-\r
- // Only after successfully denying all uses of referenceRelation\r
- // can we delete the reference element itself.\r
- super.remove(graph);\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.adapters;
+
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.modeling.ModelingResources;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class ReferenceElementRemover extends ElementRemover {
+
+ public ReferenceElementRemover(Resource referenceElement) {
+ super(referenceElement);
+ }
+
+ @Override
+ public void remove(WriteGraph graph) throws DatabaseException {
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+
+ Resource referencedComponent = graph.getPossibleObject(resource, MOD.HasParentComponent);
+ Resource referenceRelation = graph.getPossibleObject(resource, MOD.HasReferenceRelation);
+ //System.out.println("references component : " + NameUtils.getSafeName(graph, referencedComponent));
+ //System.out.println("reference relation: " + NameUtils.getSafeName(graph, referenceRelation));
+
+ if (referencedComponent != null && referenceRelation != null) {
+ // Make sure that all referenceRelations from parentComponent are
+ // removed since removing this reference element will also remove
+ // the referenceRelation which would break the statements into
+ // unusable form if the relation was still used anywhere.
+ graph.deny(referencedComponent, referenceRelation);
+ }
+
+ // Only after successfully denying all uses of referenceRelation
+ // can we delete the reference element itself.
+ super.remove(graph);
+ }
+
+}