Skip to content
Snippets Groups Projects
Commit 4ededccc authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

Added language compliance checking for model-checking-based analyzes.

refs 385
parent 11dc56a9
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 9C6BFB0E29B3623A7A4BE3DC69FA3BEC
* @ConQAT.Rating YELLOW Hash: 38F43F6516A99A19C128B6706D7CBE45
*/
public final class KernelModelElementUtils {
......@@ -55,6 +55,27 @@ public final class KernelModelElementUtils {
.getRootModelElement().eContents());
}
/**
* Returns the parent of an element with a certain type.
*
* @param element
* a model element.
* @param targetClass
* the class of the parent that is returned.
* @return instance of class <code>targetClass</code> or <code>null</code>
* if no such parent element was found.
*/
@SuppressWarnings("unchecked")
public static <T extends EObject> T getParentElement(EObject element,
Class<T> targetClass) {
EObject currentParent = element;
while (currentParent != null
&& !(targetClass.isAssignableFrom(currentParent.getClass()))) {
currentParent = currentParent.eContainer();
}
return (T) currentParent;
}
/**
* Finds the model element referenced by the given
* {@link IIdLabeledReference} element or <code>null</code> if no such
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment