Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java10
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java63
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/IRoomValidator.java2
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java52
4 files changed, 95 insertions, 32 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
index a2a871f19..f6af883b3 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java
@@ -96,4 +96,14 @@ public class AbstractExecutionValidator implements IRoomValidator {
}
}
+ @Override
+ public String getName() {
+ return "Abstract FSM Execution Validator";
+ }
+
+ @Override
+ public String getDescription() {
+ return "This validator checks the state machine against the protocol semantics of its ports.";
+ }
+
}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
index c4774b55c..7bacb6610 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
@@ -39,38 +39,43 @@ public class ReachabilityValidator implements IRoomValidator {
ActorClass ac = (ActorClass) object;
- NullDiagnostician diagnostician = new NullDiagnostician();
- GeneratorModelBuilder builder = new GeneratorModelBuilder(new NullLogger(), diagnostician);
- ExpandedActorClass xpac = builder.createExpandedActorClass(ac);
-
- if (xpac != null && !diagnostician.isFailed()) {
- ReachabilityCheck checker = new ReachabilityCheck(xpac);
- checker.computeReachability();
- TreeIterator<EObject> it = xpac.getStateMachine().eAllContents();
- while (it.hasNext()) {
- EObject item = it.next();
- if (item instanceof StateGraphItem)
- {
-
- StateGraphItem toCheck = (StateGraphItem) item;
- //System.out.println("Checked : " + toCheck.getName());
- if (!checker.isReachable(toCheck)) {
- //System.out.println("Unreachable "+ toCheck.getName());
-
- EObject orig = xpac.getOrig(toCheck);
- EObject container = orig.eContainer();
- @SuppressWarnings("unchecked")
- int idx = ((List<? extends EObject>)container.eGet(orig.eContainingFeature())).indexOf(orig);
- messageAcceptor.acceptWarning(
- "Unreachable state/point of graph",
- xpac.getOrig(toCheck).eContainer(), xpac.getOrig(toCheck).eContainingFeature(), idx,
- DIAG_CODE_UNREACHABLE, toCheck.getName());
- }
+ NullDiagnostician diagnostician = new NullDiagnostician();
+ GeneratorModelBuilder builder = new GeneratorModelBuilder(new NullLogger(), diagnostician);
+ ExpandedActorClass xpac = builder.createExpandedActorClass(ac);
+
+ if (xpac != null && !diagnostician.isFailed()) {
+ ReachabilityCheck checker = new ReachabilityCheck(xpac);
+ checker.computeReachability();
+ TreeIterator<EObject> it = xpac.getStateMachine().eAllContents();
+ while (it.hasNext()) {
+ EObject item = it.next();
+ if (item instanceof StateGraphItem)
+ {
+
+ StateGraphItem toCheck = (StateGraphItem) item;
+ if (!checker.isReachable(toCheck)) {
+ EObject orig = xpac.getOrig(toCheck);
+ EObject container = orig.eContainer();
+ @SuppressWarnings("unchecked")
+ int idx = ((List<? extends EObject>)container.eGet(orig.eContainingFeature())).indexOf(orig);
+ messageAcceptor.acceptWarning(
+ "Unreachable state/point of graph",
+ xpac.getOrig(toCheck).eContainer(), xpac.getOrig(toCheck).eContainingFeature(), idx,
+ DIAG_CODE_UNREACHABLE, toCheck.getName());
}
}
-
}
-
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "State Reachability Validator";
+ }
+
+ @Override
+ public String getDescription() {
+ return "This validator checks the reachability of state graph items.";
}
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/IRoomValidator.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/IRoomValidator.java
index b50fffebd..dc9558cbc 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/IRoomValidator.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/IRoomValidator.java
@@ -21,6 +21,8 @@ import org.eclipse.xtext.validation.ValidationMessageAcceptor;
*/
public interface IRoomValidator {
+ String getName();
+ String getDescription();
void validate(EObject object, ValidationMessageAcceptor messageAcceptor);
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java
index 76f99b71c..52a0ab67f 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java
@@ -39,6 +39,35 @@ import org.eclipse.xtext.validation.ValidationMessageAcceptor;
*/
public class ValidatorExtensionManager extends AbstractDeclarativeValidator {
+ public static class ValidatorInfo {
+ public static final String SEP = "@";
+
+ private IRoomValidator validator;
+ private String id;
+
+ public ValidatorInfo(IRoomValidator validator, String id) {
+ super();
+ this.validator = validator;
+ this.id = id;
+ }
+
+ public IRoomValidator getValidator() {
+ return validator;
+ }
+
+ public String getName() {
+ return validator.getName();
+ }
+
+ public String getDescription() {
+ return validator.getDescription();
+ }
+
+ public String getId() {
+ return id;
+ }
+ }
+
public static class Registry {
private static final String PACKAGE = RoomPackage.class.getPackage().getName()+".";
@@ -47,6 +76,8 @@ public class ValidatorExtensionManager extends AbstractDeclarativeValidator {
private HashMap<String, ArrayList<IRoomValidator>> fastClass2Ext = new HashMap<String, ArrayList<IRoomValidator>>();
private HashMap<String, ArrayList<IRoomValidator>> normalClass2Ext = new HashMap<String, ArrayList<IRoomValidator>>();
private HashMap<String, ArrayList<IRoomValidator>> expensiveClass2Ext = new HashMap<String, ArrayList<IRoomValidator>>();
+ private ArrayList<ValidatorInfo> infos = new ArrayList<ValidatorExtensionManager.ValidatorInfo>();
+ private HashSet<IRoomValidator> excluded = new HashSet<IRoomValidator>();
public static Registry getInstance() {
if (instance==null)
@@ -75,6 +106,11 @@ public class ValidatorExtensionManager extends AbstractDeclarativeValidator {
for (IConfigurationElement e : config) {
final Object ext = e.createExecutableExtension("class");
if (ext instanceof IRoomValidator) {
+ IRoomValidator validator = (IRoomValidator) ext;
+ infos.add(new ValidatorInfo(
+ validator,
+ e.getName()+ValidatorInfo.SEP+e.getNamespaceIdentifier()
+ ));
String mode = e.getAttribute("mode");
String classToCheck = e.getAttribute("classToCheck");
if (classToCheck.startsWith(PACKAGE))
@@ -101,9 +137,19 @@ public class ValidatorExtensionManager extends AbstractDeclarativeValidator {
}
}
- public void validate(EObject object, CheckMode checkMode,
- ValidationMessageAcceptor messageAcceptor) {
- HashSet<IRoomValidator> executed = new HashSet<IRoomValidator>();
+ public void exclude(ValidatorInfo info) {
+ excluded.add(info.getValidator());
+ }
+
+ public void include(ValidatorInfo info) {
+ excluded.remove(info.getValidator());
+ }
+
+ public void validate(EObject object, CheckMode checkMode, ValidationMessageAcceptor messageAcceptor) {
+
+ // we initialize the set of executed validators with the excluded ones
+ HashSet<IRoomValidator> executed = new HashSet<IRoomValidator>(excluded);
+
if (checkMode.shouldCheck(CheckType.FAST))
validate(object, messageAcceptor, fastClass2Ext, executed);
if (checkMode.shouldCheck(CheckType.NORMAL))

Back to the top