Skip to content
Snippets Groups Projects
Commit e1669056 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

extended STLC example with deployment

refs 350
parent a57e4ed3
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.model.IIdLabeledReference;
import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -31,7 +32,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: BFAEE573B73BEA35ED5EC160F4015FB5
* @ConQAT.Rating YELLOW Hash: E77DC792D810E6886DD06EC35AB21D0D
*/
public final class KernelModelElementUtils {
......@@ -112,4 +113,29 @@ public final class KernelModelElementUtils {
}
return false;
}
/**
* Iterates the content of the given root element and finds a contained
* element with the given name and the given class.
*
* @param root
* the root element to be searched
* @param name
* the name of the element to find
* @param clazz
* the class of the element to find
* @return the element found or <code>null</code> if none was found
*/
@SuppressWarnings("unchecked")
public static <T extends INamedElement> T findContentElementByNameAndClass(
EObject root, String name, Class<T> clazz) {
Iterator<EObject> iter = root.eAllContents();
while (iter.hasNext()) {
EObject nxt = iter.next();
if (clazz.isInstance(nxt) && ((T) nxt).getName().equals(name)) {
return (T) nxt;
}
}
return null;
}
}
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