Source:
private void collectPotentialContainerTypes(Collection<String> possibleSemanticTypes, Collection<String> possibleViewTypes, DiagramElementMapping mapping) { EObject container = mapping.eContainer(); if (container instanceof Layer) { container = container.eContainer(); } if (container instanceof AbstractNodeMapping) { String domainClass = ((AbstractNodeMapping) container).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } collectViewTypes(possibleViewTypes, (AbstractNodeMapping) container); } else if (container instanceof DiagramDescription) { String domainClass = ((DiagramDescription) container).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } possibleViewTypes.add("diagram.DSemanticDiagram"); } ECrossReferenceAdapter crossReferencer = ECrossReferenceAdapter.getCrossReferenceAdapter(mapping); if (crossReferencer != null) { for (Setting xRef : crossReferencer.getInverseReferences(mapping)) { EStructuralFeature eStructuralFeature = xRef.getEStructuralFeature(); EObject referencingObject = xRef.getEObject(); if (eStructuralFeature == DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__REUSED_MAPPINGS && referencingObject instanceof DiagramDescription) { String domainClass = ((DiagramDescription) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } else if (eStructuralFeature == DescriptionPackage.Literals.ABSTRACT_NODE_MAPPING__REUSED_BORDERED_NODE_MAPPINGS && referencingObject instanceof AbstractNodeMapping) { String domainClass = ((AbstractNodeMapping) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } else if ((eStructuralFeature == DescriptionPackage.Literals.CONTAINER_MAPPING__REUSED_CONTAINER_MAPPINGS || eStructuralFeature == DescriptionPackage.Literals.CONTAINER_MAPPING__REUSED_NODE_MAPPINGS) && referencingObject instanceof ContainerMapping) { String domainClass = ((ContainerMapping) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } } } }

Target:
private void collectPotentialContainerTypes(Collection<String> possibleSemanticTypes, Collection<String> possibleViewTypes, DiagramElementMapping mapping) { EObject container = mapping.eContainer(); if (container instanceof Layer) { container = container.eContainer(); } if (container instanceof AbstractNodeMapping) { String domainClass = ((AbstractNodeMapping) container).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } collectViewTypes(possibleViewTypes, (AbstractNodeMapping) container); } else if (container instanceof DiagramDescription) { String domainClass = ((DiagramDescription) container).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } possibleViewTypes.add(DIAGRAM_D_SEMANTIC_DIAGRAM); } ECrossReferenceAdapter crossReferencer = ECrossReferenceAdapter.getCrossReferenceAdapter(mapping); if (crossReferencer != null) { for (Setting xRef : crossReferencer.getInverseReferences(mapping)) { EStructuralFeature eStructuralFeature = xRef.getEStructuralFeature(); EObject referencingObject = xRef.getEObject(); if (eStructuralFeature == DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__REUSED_MAPPINGS && referencingObject instanceof DiagramDescription) { String domainClass = ((DiagramDescription) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } else if (eStructuralFeature == DescriptionPackage.Literals.ABSTRACT_NODE_MAPPING__REUSED_BORDERED_NODE_MAPPINGS && referencingObject instanceof AbstractNodeMapping) { String domainClass = ((AbstractNodeMapping) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } else if ((eStructuralFeature == DescriptionPackage.Literals.CONTAINER_MAPPING__REUSED_CONTAINER_MAPPINGS || eStructuralFeature == DescriptionPackage.Literals.CONTAINER_MAPPING__REUSED_NODE_MAPPINGS) && referencingObject instanceof ContainerMapping) { String domainClass = ((ContainerMapping) referencingObject).getDomainClass(); if (!StringUtil.isEmpty(domainClass)) { possibleSemanticTypes.add(domainClass); } } } } }