|
|
@@ -10,17 +10,13 @@
|
|
|
*/
|
|
|
package org.yakindu.sct.model.sgraph.validation;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
import org.eclipse.emf.common.util.TreeIterator;
|
|
|
import org.eclipse.emf.ecore.EObject;
|
|
|
-import org.eclipse.emf.ecore.EPackage;
|
|
|
import org.eclipse.emf.ecore.util.EcoreUtil;
|
|
|
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
|
|
|
import org.eclipse.xtext.validation.Check;
|
|
|
import org.eclipse.xtext.validation.CheckType;
|
|
|
+import org.eclipse.xtext.validation.EValidatorRegistrar;
|
|
|
import org.yakindu.sct.model.sgraph.Choice;
|
|
|
import org.yakindu.sct.model.sgraph.Entry;
|
|
|
import org.yakindu.sct.model.sgraph.EntryKind;
|
|
|
@@ -30,13 +26,20 @@ import org.yakindu.sct.model.sgraph.Transition;
|
|
|
import org.yakindu.sct.model.sgraph.Vertex;
|
|
|
import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
|
|
|
|
|
|
+import com.google.inject.Inject;
|
|
|
+
|
|
|
/**
|
|
|
+ * This validator is intended to be used by a compositeValidator (See
|
|
|
+ * {@link org.eclipse.xtext.validation.ComposedChecks}) of another language
|
|
|
+ * specific validator. It does not register itself as an EValidator.
|
|
|
+ *
|
|
|
+ * This validator checks for common graphical constraints for all kinds of state charts.
|
|
|
*
|
|
|
* @author terfloth
|
|
|
* @author muelder
|
|
|
* @author bohl - migrated to xtext infrastruture
|
|
|
+ * @author schwertfeger
|
|
|
*/
|
|
|
-
|
|
|
public class SGraphJavaValidator extends AbstractDeclarativeValidator {
|
|
|
|
|
|
public static final String ISSUE_STATE_WITHOUT_NAME = "A state must have a name.";
|
|
|
@@ -56,7 +59,8 @@ public class SGraphJavaValidator extends AbstractDeclarativeValidator {
|
|
|
int incomingTransitions = 0;
|
|
|
incomingTransitions += vertex.getIncomingTransitions().size();
|
|
|
|
|
|
- // in context of a state it is sufficient if a sub state is targeted by
|
|
|
+ // in context of a state it is sufficient if a sub state is targeted
|
|
|
+ // by
|
|
|
// an external transition
|
|
|
if (vertex instanceof org.yakindu.sct.model.sgraph.State) {
|
|
|
TreeIterator<EObject> eAllContents = vertex.eAllContents();
|
|
|
@@ -153,25 +157,13 @@ public class SGraphJavaValidator extends AbstractDeclarativeValidator {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- protected List<EPackage> getEPackages() {
|
|
|
- List<EPackage> result = new ArrayList<EPackage>();
|
|
|
- result.add(EPackage.Registry.INSTANCE
|
|
|
- .getEPackage("http://www.yakindu.org/sct/sgraph/2.0.0"));
|
|
|
- result.add(EPackage.Registry.INSTANCE
|
|
|
- .getEPackage("http://www.yakindu.org/base/base/2.0.0"));
|
|
|
- result.add(EPackage.Registry.INSTANCE
|
|
|
- .getEPackage("http://www.yakindu.org/base/types/2.0.0"));
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public boolean isLanguageSpecific() {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- protected boolean isResponsible(Map<Object, Object> context, EObject eObject) {
|
|
|
- return true;
|
|
|
+ @Inject
|
|
|
+ public void register(EValidatorRegistrar registrar) {
|
|
|
+ // Do not register because this validator is only a composite #398987
|
|
|
}
|
|
|
}
|