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; ...@@ -27,6 +27,7 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import de.mkonersmann.advert.java.embed.ASTUtils; import de.mkonersmann.advert.java.embed.ASTUtils;
import de.mkonersmann.advert.java.embed.ModelUtils; 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> public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObject, JAVAELEMENTCLASS extends IJavaElement>
extends RecursiveAction implements IMayHaveIssues, IModelCodeTransformation<ELEMENTECLASS, JAVAELEMENTCLASS> { extends RecursiveAction implements IMayHaveIssues, IModelCodeTransformation<ELEMENTECLASS, JAVAELEMENTCLASS> {
...@@ -257,11 +258,20 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj ...@@ -257,11 +258,20 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
*/ */
@Override @Override
public JAVAELEMENTCLASS resolveCodeElement() throws CodelingException { public JAVAELEMENTCLASS resolveCodeElement() throws CodelingException {
if (priorIDRegistry != null && priorModelElement != null) if (priorIDRegistry != null && priorModelElement != null) {
codeElement = (JAVAELEMENTCLASS) priorIDRegistry if (this instanceof IALTransformation)
.getCodeElementFromImplementationModelElement(priorModelElement); codeElement = (JAVAELEMENTCLASS) priorIDRegistry.getCodeElementFromTranslationModelElement(
else ((IALTransformation<?, ?>) this).getIALHolder().getFoundationalIALElement());
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromImplementationModelElement(modelElement); 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; 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