package org.yakindu.sct.commons;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.ecore.EClass;

public class EMFHelper {
	public static List<EClass> getAllSuperClasses(EClass eClass) {
		List<List<EClass>> superClasses = new ArrayList<>();

		getSuperClassTree(superClasses, eClass, 0);

		List<EClass> result = new ArrayList<>();
		for (List<EClass> list : superClasses) {
			result.addAll(list);
		}

		return result;
	}

	protected static void getSuperClassTree(List<List<EClass>> superClasses, EClass eClass, int depth) {
		if (superClasses.size() <= depth) {
			superClasses.add(depth, new ArrayList<>());
		}

		List<EClass> superTypes = eClass.getESuperTypes();

		superClasses.get(depth).add(eClass);

		for (EClass superType : superTypes) {
			getSuperClassTree(superClasses, superType, depth + 1);
		}
	}
}

@@ -1,8 +1,397 @@
+/**%0A * Copyright (c) 2018 committers of YAKINDU and others.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A * Contributors:%0A * %09committers of YAKINDU - initial API and implementation%0A *%0A */%0A
 package 
@@ -416,16 +416,17 @@
 mmons;%0A%0A
+%0A
 import j
@@ -469,16 +469,186 @@
 .List;%0A%0A
+import org.eclipse.core.resources.IFile;%0Aimport org.eclipse.core.resources.ResourcesPlugin;%0Aimport org.eclipse.core.runtime.Path;%0Aimport org.eclipse.emf.common.util.URI;%0A
 import o
@@ -1393,13 +1393,165 @@
 1);%0A
-
 %09%09%7D%0A%09%7D
+%0A%0A%09public static IFile getIFileFromEMFUri(URI uri) %7B%0A%09%09return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));%0A%09%7D
 %0A%7D%0A

Add copyright header and URI helper func