|
@@ -40,10 +40,14 @@ import java.util.Map;
|
|
|
|
|
|
import org.eclipse.emf.ecore.EClass;
|
|
|
import org.eclipse.emf.ecore.EReference;
|
|
|
+import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
|
|
|
import org.eclipse.xtext.resource.IEObjectDescription;
|
|
|
import org.eclipse.xtext.util.Pair;
|
|
|
import org.eclipse.xtext.util.Tuples;
|
|
|
+import org.yakindu.base.types.ComplexType;
|
|
|
+import org.yakindu.base.types.Event;
|
|
|
import org.yakindu.base.types.TypesPackage;
|
|
|
+import org.yakindu.sct.model.stext.stext.StextPackage;
|
|
|
|
|
|
import com.google.common.base.Predicate;
|
|
|
import com.google.common.base.Predicates;
|
|
@@ -55,6 +59,8 @@ import com.google.common.base.Predicates;
|
|
|
*/
|
|
|
public class ContextPredicateProvider {
|
|
|
|
|
|
+ public static final String IS_COMPLEX_TYPE = "IS_COMPLEX_TYPE";
|
|
|
+
|
|
|
static class TypePredicate implements Predicate<IEObjectDescription> {
|
|
|
public boolean apply(IEObjectDescription input) {
|
|
|
return TypesPackage.Literals.TYPE.isSuperTypeOf(input.getEClass())
|
|
@@ -74,9 +80,21 @@ public class ContextPredicateProvider {
|
|
|
public boolean apply(IEObjectDescription input) {
|
|
|
if (super.apply(input))
|
|
|
return true;
|
|
|
- // TODO: Check if the propertys type is of type ComplexType
|
|
|
- return TypesPackage.Literals.EVENT.isSuperTypeOf(input.getEClass())
|
|
|
- || TypesPackage.Literals.PROPERTY.isSuperTypeOf(input.getEClass());
|
|
|
+ return TypesPackage.Literals.EVENT.isSuperTypeOf(input.getEClass()) || isComplexTypeVariable(input);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@link ComplexType} variables may have properties of type
|
|
|
+ * {@link Event} So we have to made them visible. Since we do not want
|
|
|
+ * to resolve proxies here, contributors of Complex Types have to
|
|
|
+ * register an {@link IDefaultResourceDescriptionStrategy} that adds the
|
|
|
+ * user data boolean flag.
|
|
|
+ */
|
|
|
+ protected boolean isComplexTypeVariable(IEObjectDescription input) {
|
|
|
+ if (StextPackage.Literals.VARIABLE_DEFINITION.isSuperTypeOf(input.getEClass())) {
|
|
|
+ return Boolean.parseBoolean(input.getUserData(IS_COMPLEX_TYPE));
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|