File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/modelinference Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1818import org .eclipse .emf .ecore .resource .Resource ;
1919import org .eclipse .jdt .annotation .NonNull ;
2020import org .eclipse .jdt .annotation .Nullable ;
21- import org .eclipse .xtext .resource .XtextResource ;
21+ import org .eclipse .xtext .resource .XtextResource
2222
2323
2424/**
@@ -29,6 +29,22 @@ public class InferredModelUtil {
2929 protected InferredModelUtil () { // No public constructor for utility class
3030 }
3131
32+ /**
33+ * Gets the inference container for the given resource.
34+ *
35+ * @param resource
36+ * the resource
37+ * @return the inference container or {@code null} if there aren't any
38+ */
39+ public static @ Nullable InferenceContainer getInferenceContainer (final @ NonNull Resource resource ) {
40+ for (EObject content : resource .getContents ()) {
41+ if (content instanceof InferenceContainer inferenceContainer ) {
42+ return inferenceContainer ;
43+ }
44+ }
45+ return null ;
46+ }
47+
3248 /**
3349 * Gets the model associations corresponding to an EObject.
3450 * <p>
You can’t perform that action at this time.
0 commit comments