summaryrefslogtreecommitdiffstats
path: root/rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend
diff options
context:
space:
mode:
authorKenji Hosokawa <khosokawa@jp.adit-jv.com>2021-08-03 18:42:39 +0900
committerKenji Hosokawa <khosokawa@jp.adit-jv.com>2021-08-06 19:32:38 +0900
commitbe4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch)
tree1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor/src/rba/tool/editor/util/RBAModelEditorToolUtil.xtend
parent71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff)
Initial commit
Bug-AGL: SPEC-4033 Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
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;
+ }
+}