import org.simantics.district.network.ontology.DistrictNetworkResource;
import org.simantics.layer0.Layer0;
import org.simantics.layer0.utils.binaryPredicates.OrderedSetElementsPredicate;
+import org.simantics.modeling.ModelingResources;
import org.simantics.modeling.adapters.ElementRemover;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Boolean trackChangesEnabled = DistrictNetworkUtil.trackChangesEnabled(graph, graph.getPossibleObject(resource, Layer0.getInstance(graph).PartOf));
if (trackChangesEnabled) {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource mappedComponent = graph.getPossibleObject(resource, DN.MappedComponent);
- if (mappedComponent != null) {
- RemoverUtil.remove(graph, mappedComponent);
+ Resource element = graph.getPossibleObject(resource, DN.MappedComponent);
+ if (element != null) {
+ // get component
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ Resource component = graph.getPossibleObject(element, MOD.ElementToComponent);
+ if (component != null)
+ RemoverUtil.remove(graph, component);
+ else
+ RemoverUtil.remove(graph, element);
}
}
}