|
@@ -10,12 +10,19 @@
|
|
|
*/
|
|
|
package org.yakindu.sct.model.sgraph.resource.provider;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import org.eclipse.emf.ecore.EObject;
|
|
|
import org.eclipse.emf.ecore.util.EcoreUtil;
|
|
|
+import org.eclipse.xtext.naming.QualifiedName;
|
|
|
+import org.eclipse.xtext.resource.EObjectDescription;
|
|
|
import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
|
|
|
import org.eclipse.xtext.resource.IEObjectDescription;
|
|
|
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy;
|
|
|
import org.eclipse.xtext.util.IAcceptor;
|
|
|
+import org.yakindu.base.types.ComplexType;
|
|
|
+import org.yakindu.base.types.TypedElement;
|
|
|
import org.yakindu.sct.model.sgraph.Statechart;
|
|
|
|
|
|
/**
|
|
@@ -28,12 +35,36 @@ import org.yakindu.sct.model.sgraph.Statechart;
|
|
|
public class SCTResourceDescriptionStrategy extends
|
|
|
DefaultResourceDescriptionStrategy {
|
|
|
|
|
|
+ public static final String IS_COMPLEX_TYPE = "IS_COMPLEX_TYPE";
|
|
|
+
|
|
|
@Override
|
|
|
public boolean createEObjectDescriptions(EObject eObject,
|
|
|
IAcceptor<IEObjectDescription> acceptor) {
|
|
|
if (EcoreUtil.getRootContainer(eObject) instanceof Statechart)
|
|
|
- return super.createEObjectDescriptions(eObject, acceptor);
|
|
|
+ return createDescriptions(eObject, acceptor);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ protected boolean createDescriptions(EObject eObject,
|
|
|
+ IAcceptor<IEObjectDescription> acceptor) {
|
|
|
+ if (getQualifiedNameProvider() == null)
|
|
|
+ return false;
|
|
|
+ try {
|
|
|
+ QualifiedName qualifiedName = getQualifiedNameProvider()
|
|
|
+ .getFullyQualifiedName(eObject);
|
|
|
+ if (qualifiedName != null) {
|
|
|
+ Map<String, String> userData = new HashMap<String, String>();
|
|
|
+// if (eObject instanceof TypedElement
|
|
|
+// && ((TypedElement) eObject).getType() instanceof ComplexType) {
|
|
|
+ userData.put(IS_COMPLEX_TYPE, "true");
|
|
|
+// }
|
|
|
+ acceptor.accept(EObjectDescription.create(qualifiedName,
|
|
|
+ eObject, userData));
|
|
|
+ }
|
|
|
+ } catch (Exception exc) {
|
|
|
+ exc.printStackTrace();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|