Commit 370d1520 authored by Marco Konersmann's avatar Marco Konersmann

Ensures that IALTransformations can resolve their code elements

parent 2b37a8b5
......@@ -27,6 +27,7 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import de.mkonersmann.advert.java.embed.ASTUtils;
import de.mkonersmann.advert.java.embed.ModelUtils;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObject, JAVAELEMENTCLASS extends IJavaElement>
extends RecursiveAction implements IMayHaveIssues, IModelCodeTransformation<ELEMENTECLASS, JAVAELEMENTCLASS> {
......@@ -257,11 +258,20 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
*/
@Override
public JAVAELEMENTCLASS resolveCodeElement() throws CodelingException {
if (priorIDRegistry != null && priorModelElement != null)
codeElement = (JAVAELEMENTCLASS) priorIDRegistry
.getCodeElementFromImplementationModelElement(priorModelElement);
else
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromImplementationModelElement(modelElement);
if (priorIDRegistry != null && priorModelElement != null) {
if (this instanceof IALTransformation)
codeElement = (JAVAELEMENTCLASS) priorIDRegistry.getCodeElementFromTranslationModelElement(
((IALTransformation<?, ?>) this).getIALHolder().getFoundationalIALElement());
else
codeElement = (JAVAELEMENTCLASS) priorIDRegistry
.getCodeElementFromImplementationModelElement(priorModelElement);
} else {
if (this instanceof IALTransformation)
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromTranslationModelElement(
((IALTransformation<?, ?>) this).getIALHolder().getFoundationalIALElement());
else
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromImplementationModelElement(modelElement);
}
return codeElement;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment