X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fadapters%2FTypicalMasterRemover.java;h=7ee9af0700997235d599c041294d5adb2b977391;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=7d1f0e2c2934558cbca407135b4cfde3eb54ae8b;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/TypicalMasterRemover.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/TypicalMasterRemover.java index 7d1f0e2c2..7ee9af070 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/TypicalMasterRemover.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/TypicalMasterRemover.java @@ -1,33 +1,33 @@ -package org.simantics.modeling.adapters; - -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.IsParent; -import org.simantics.db.exception.DatabaseException; - -/** - * @author Tuukka Lehtonen - */ -public class TypicalMasterRemover extends ExistingInstancesRemover { - - public TypicalMasterRemover(Resource resource, String typeDescription) { - super(resource, typeDescription); - } - - @Override - public void remove(WriteGraph graph) throws DatabaseException { - // In typical masters the actual typical type is defined as a part of - // the master instance itself. Therefore we need to customize this code - // to look for the correct type. - for (Resource type : graph.getPrincipalTypes(resource)) { - if (graph.syncRequest(new IsParent(resource, type))) { - remove(graph, resource, type, resource); - return; - } - } - - // Typical type not found. Just remove, no questions asked. - justRemove(graph); - } - +package org.simantics.modeling.adapters; + +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.IsParent; +import org.simantics.db.exception.DatabaseException; + +/** + * @author Tuukka Lehtonen + */ +public class TypicalMasterRemover extends ExistingInstancesRemover { + + public TypicalMasterRemover(Resource resource, String typeDescription) { + super(resource, typeDescription); + } + + @Override + public void remove(WriteGraph graph) throws DatabaseException { + // In typical masters the actual typical type is defined as a part of + // the master instance itself. Therefore we need to customize this code + // to look for the correct type. + for (Resource type : graph.getPrincipalTypes(resource)) { + if (graph.syncRequest(new IsParent(resource, type))) { + remove(graph, resource, type, resource); + return; + } + } + + // Typical type not found. Just remove, no questions asked. + justRemove(graph); + } + } \ No newline at end of file