summaryrefslogtreecommitdiffstats
path: root/rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend
diff options
context:
space:
mode:
Diffstat (limited to 'rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend')
-rw-r--r--rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend40
1 files changed, 40 insertions, 0 deletions
diff --git a/rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend b/rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend
new file mode 100644
index 0000000..1055423
--- /dev/null
+++ b/rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend
@@ -0,0 +1,40 @@
+package rba.tool.editor.util
+
+import java.util.Collection
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.emf.ecore.EStructuralFeature
+import org.eclipse.emf.ecore.EValidator
+import rba.core.AbstractAllocatable
+import rba.core.AbstractContent
+import rba.core.Expression
+import rba.core.RBACorePackage
+
+class RBAModelEditorToolUtil {
+
+ def public static String getExpressionText(Expression expression) {
+ return if (expression !== null) expression.getExpressionText() else "[Invalid_Expression]";
+ }
+
+ def public static boolean isSkippedSyntax(EObject obj, EStructuralFeature feature) {
+ // AbstractAllocatable -> contents
+ if (obj instanceof AbstractAllocatable && feature == RBACorePackage.Literals.ABSTRACT_ALLOCATABLE__CONTENTS) {
+ return true;
+ }
+ // AbstractAllocatable -> group
+ if (obj instanceof AbstractAllocatable && feature == RBACorePackage.Literals.ABSTRACT_ALLOCATABLE__ALLOCATABLE_GROUP) {
+ return true;
+ }
+ // AbstractContent -> group
+ if (obj instanceof AbstractContent && feature == RBACorePackage.Literals.ABSTRACT_CONTENT__CONTENT_GROUP) {
+ return true;
+ }
+ return false;
+ }
+
+ def public static boolean isValidated(Object context, EValidator validator) {
+ if (context instanceof Collection<?>) {
+ return (context as Collection<?>).contains(validator);
+ }
+ return false;
+ }
+}