Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/AbstractExecutionValidator.java27
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java11
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java64
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidatorExtensionManager.java3
5 files changed, 51 insertions, 55 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
index dc5107b5a..de2f484d9 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/META-INF/MANIFEST.MF
@@ -14,3 +14,4 @@ Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
org.eclipse.xtext.ui;bundle-version="2.1.1"
Bundle-Activator: org.eclipse.etrice.abstractexec.behavior.Activator
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.etrice.abstractexec.behavior;x-friends:="org.eclipse.etrice.abstractexec.behavior.tests"
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 5288a4d30..c87cd53f2 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
@@ -10,7 +10,6 @@
*
*******************************************************************************/
-
package org.eclipse.etrice.abstractexec.behavior;
import java.util.List;
@@ -43,6 +42,12 @@ import org.eclipse.xtext.validation.ValidationMessageAcceptor;
*/
public class AbstractExecutionValidator implements IRoomValidator {
+ // c&p in tests
+ public static String DIAG_CODE_VIOLATION_TRIGGER = "etrice.violation_trigger";
+ public static String DIAG_CODE_VIOLATION_MESSAGESEND = "etrice.violation_messagesend";
+ public static String DIAG_CODE_MISSING_TRIGGER = "etrice.receive_message";
+ public static String DIAG_CODE_MISSING_MESSAGESEND = "etrice.send_message";
+
private static boolean traceExec = false;
private static String traceName = "";
static {
@@ -72,11 +77,12 @@ public class AbstractExecutionValidator implements IRoomValidator {
if (!(object instanceof ActorClass))
return;
ActorClass ac = (ActorClass) object;
- if (traceExec && !ac.getName().equals(traceName))
- return;
- if (traceExec)
+ if (traceExec) {
+ if (!(traceName.isEmpty() || ac.getName().equals(traceName)))
+ return;
System.out.println("AbstractExecutionValidator checking class "
+ ac.getName());
+ }
boolean oneProtocolsWithSemantics = false;
List<InterfaceItem> ifItems = RoomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : ifItems) {
@@ -137,6 +143,9 @@ public class AbstractExecutionValidator implements IRoomValidator {
.println("AbstractExecutionValidator done checking class "
+ ac.getName());
}
+ else
+ if(traceExec)
+ System.out.println("No checking because internal generation failed");
}
}
@@ -164,16 +173,16 @@ public class AbstractExecutionValidator implements IRoomValidator {
messageAcceptor.acceptWarning("State should handle the message "
+ msg.getMessage().getName() + " from port "
+ msg.getFrom().getName() + " ", container,
- orig.eContainingFeature(), idx, "Receive message",
+ orig.eContainingFeature(), idx, DIAG_CODE_MISSING_TRIGGER,
st.getName());
}
List<MessageFromIf> outgoing = propGen.getOutgoingProposals();
for (MessageFromIf msg : outgoing) {
- messageAcceptor.acceptInfo("State could send the message "
+ messageAcceptor.acceptInfo("State should send the message "
+ msg.getMessage().getName() + " to port "
+ msg.getFrom().getName() + " ", container,
- orig.eContainingFeature(), idx, "Send message",
+ orig.eContainingFeature(), idx, DIAG_CODE_MISSING_MESSAGESEND,
st.getName());
}
@@ -212,7 +221,7 @@ public class AbstractExecutionValidator implements IRoomValidator {
mif.eContainingFeature(),
trig.getMsgFromIfPairs()
.indexOf(trig),
- "VIOLATION", trigger
+ DIAG_CODE_VIOLATION_TRIGGER, trigger
.getMsg().getName());
}
}
@@ -225,7 +234,7 @@ public class AbstractExecutionValidator implements IRoomValidator {
"The message violates the semantic rule",
orig.eContainer(), orig.eContainingFeature(),
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
- "VIOLATION");
+ DIAG_CODE_VIOLATION_MESSAGESEND);
}
}
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
index dabe29ce7..9d2152cd7 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ActiveRules.java
@@ -142,12 +142,13 @@ public class ActiveRules {
.getActorClass());
for (InterfaceItem ifitem : portList) {
GeneralProtocolClass gpc = ifitem.getGeneralProtocol();
- if (gpc instanceof ProtocolClass
- && ((ProtocolClass) gpc).getSemantics() != null)
- rules.put(ifitem, ((ProtocolClass) gpc).getSemantics()
- .getRules());
+ if (gpc instanceof ProtocolClass) {
+ ProtocolClass pc = (ProtocolClass) gpc;
+ if (pc.getSemantics() != null)
+ rules.put(ifitem, new ArrayList<SemanticsRule>(pc
+ .getSemantics().getRules()));
+ }
}
-
}
public void print() {
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
index 61eede315..d41ccb0e2 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ProposalGenerator.java
@@ -21,8 +21,8 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.etrice.core.genmodel.etricegen.ActiveTrigger;
import org.eclipse.etrice.core.genmodel.etricegen.ExpandedActorClass;
import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.MessageFromIf;
-import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.SemanticsRule;
import org.eclipse.etrice.core.room.State;
@@ -57,7 +57,6 @@ public class ProposalGenerator {
return outgoingProposal;
}
-
public void createProposals(State st) {
ActiveRules rules = checker.getActiveRules(st);
@@ -65,49 +64,36 @@ public class ProposalGenerator {
if (rules == null)
return;
+ // ignore substates
+ if (RoomHelpers.hasDirectSubStructure(st))
+ return;
+
outgoingProposal.clear();
incomingProposal.clear();
- Set<SemanticsRule> rulesToIgnore = new HashSet<SemanticsRule>();
-
- for (ActiveTrigger trigger : xpac.getActiveTriggers(st)) {
- SemanticsRule match = null;
- Port port = (Port) trigger.getIfitem();
- if (rules.getPortList().contains(port)) {
- List<SemanticsRule> ruleList = rules.getRulesForPort(port);
- for (SemanticsRule curRule : ruleList) {
- if (curRule.getMsg() == trigger.getMsg()) {
- match = curRule;
- break;
+ for (InterfaceItem port : rules.getPortList()) {
+ // collect all messages from active triggers
+ Set<Message> messages = new HashSet<Message>();
+ for (ActiveTrigger t : xpac.getActiveTriggers(st))
+ if (t.getIfitem().equals(port))
+ messages.add(t.getMsg());
+ // check if every rule has its messages
+ if (rules.getPortList().contains(port)) {
+ for (SemanticsRule curRule : rules.getRulesForPort(port)) {
+ if (!messages.contains(curRule.getMsg())) {
+ MessageFromIf mif = RoomFactory.eINSTANCE
+ .createMessageFromIf();
+ mif.setFrom(port);
+ mif.setMessage(curRule.getMsg());
+ boolean isOutgoing = RoomHelpers.getMessageListDeep(
+ port, true).contains(curRule.getMsg());
+ if (isOutgoing) {
+ outgoingProposal.add(mif);
+ } else {
+ incomingProposal.add(mif);
}
}
}
- if (match != null) {
- // mark this rule for ignoring while generating proposals
- // as they have already been taken care of
- rulesToIgnore.add(match);
- }
- }
-
- // now start generating proposals by listing all the rules and ignoring
- // the ones
- // marked above
- for (InterfaceItem item : rules.getPortList()) {
- for (SemanticsRule ruleToCheck : rules.getRulesForPort(item)) {
- if (!rulesToIgnore.contains(ruleToCheck)) {
- MessageFromIf mif = RoomFactory.eINSTANCE
- .createMessageFromIf();
- mif.setFrom(item);
- mif.setMessage(ruleToCheck.getMsg());
- boolean isOutgoing = RoomHelpers.getMessageListDeep(item, true)
- .contains(ruleToCheck.getMsg());
- if (isOutgoing) {
- outgoingProposal.add(mif);
- } else {
- incomingProposal.add(mif);
- }
-
- }
}
}
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 85da62161..03a06da30 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
@@ -25,7 +25,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
import org.eclipse.xtext.validation.Check;
@@ -212,7 +211,7 @@ public class ValidatorExtensionManager extends AbstractDeclarativeValidator {
ISafeRunnable runnable = new ISafeRunnable() {
@Override
public void handleException(Throwable exception) {
- System.out.println("Exception in IRoomValidator");
+ System.out.println("Exception in IRoomValidator " + validator.getName());
}
@Override

Back to the top