Ver código fonte

Merge pull request #651 from Yakindu/issue_544_545_567_571_599

Fix some spelling issues
DominikTesch 9 anos atrás
pai
commit
37e17ea2c2

+ 6 - 6
plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/validation/ExpressionsJavaValidator.java

@@ -38,22 +38,22 @@ public class ExpressionsJavaValidator extends org.yakindu.base.expressions.valid
 		implements IValidationIssueAcceptor {
 
 	public static final String WARNING_IS_RAW_CODE = "WarningRaw";
-	public static final String WARNING_IS_RAW_MSG = "%s is a raw type. References to generic type %s should be parameterized";
+	public static final String WARNING_IS_RAW_MSG = "%s is a raw type. References to generic type %s should be parameterized.";
 
 	public static final String ERROR_NOT_GENERIC_CODE = "TypeNotGeneric";
-	public static final String ERROR_NOT_GENERIC_MSG = "The type %s is not generic; it cannot be parameterized with arguments %s";
+	public static final String ERROR_NOT_GENERIC_MSG = "The type %s is not generic; it cannot be parameterized with arguments %s.";
 
 	public static final String ERROR_ARGUMENTED_SPECIFIER_INCORRECT_ARGUMENT_NR_CODE = "IncorrectNrOfArguments";
-	public static final String ERROR_ARGUMENTED_SPECIFIER_INCORRECT_ARGUMENT_NR_MSG = "Incorrect number of arguments for type %s; it cannot be parameterized with arguments %s";
+	public static final String ERROR_ARGUMENTED_SPECIFIER_INCORRECT_ARGUMENT_NR_MSG = "Incorrect number of arguments for type %s; it cannot be parameterized with arguments %s.";
 
 	public static final String ERROR_BOUND_MISSMATCH_CODE = "TypeParameterBoundMissmatch";
-	public static final String ERROR_BOUND_MISSMATCH_MSG = "Bound mismatch: The type %s is not a valid substitute for the bounded parameter %s of the type %s";
+	public static final String ERROR_BOUND_MISSMATCH_MSG = "Bound mismatch: The type %s is not a valid substitute for the bounded parameter %s of the type %s.";
 
 	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_CODE = "DuplicateTypeParameter";
-	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_MSG = "Duplicate Type Parameter %s";
+	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_MSG = "Duplicate Type Parameter %s.";
 
 	public static final String ERROR_CYCLE_DETECTED_CODE = "TypeExtendsItself";
-	public static final String ERROR_CYCLE_DETECTED_MSG = "Cycle detected: the type %s cannot extend itself";
+	public static final String ERROR_CYCLE_DETECTED_MSG = "Cycle detected: the type %s cannot extend itself.";
 
 	@Inject
 	private GenericsPrettyPrinter printer;

+ 393 - 393
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/validation/SGraphJavaValidator.java

@@ -1,393 +1,393 @@
-/**
- * Copyright (c) 2012-2016 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.model.sgraph.validation;
-
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.areOrthogonal;
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.collectAncestors;
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.commonAncestor;
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.findCommonAncestor;
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.sources;
-import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.targets;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.EcoreUtil2;
-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.CompositeElement;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.EntryKind;
-import org.yakindu.sct.model.sgraph.Exit;
-import org.yakindu.sct.model.sgraph.FinalState;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Synchronization;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Vertex;
-
-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
- * @author antony
- */
-public class SGraphJavaValidator extends AbstractDeclarativeValidator {
-
-	public static final String ISSUE_STATE_WITHOUT_NAME = "A state must have a name.";
-	public static final String ISSUE_NODE_NOT_REACHABLE = "Node is not reachable.";
-	public static final String ISSUE_FINAL_STATE_OUTGOING_TRANSITION = "A final state should have no outgoing transition.";
-	public static final String ISSUE_STATE_WITHOUT_OUTGOING_TRANSITION = "A state should have at least one outgoing transition.";
-	public static final String ISSUE_INITIAL_ENTRY_WITH_IN_TRANS = "Initial entry should have no incoming transition.";
-	public static final String ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS = "Initial entry should have a single outgoing transition";
-	public static final String ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS = "Entries must not have more than one outgoing transition";
-	public static final String ISSUE_ENTRY_WITH_TRIGGER = "Outgoing Transitions from Entries can not have a Trigger or Guard.";
-	public static final String ISSUE_EXIT_WITH_OUT_TRANS = "Exit node should have no outgoing transition.";
-	public static final String ISSUE_EXIT_WITHOUT_IN_TRANS = "Exit node should have at least one incoming transition";
-	public static final String ISSUE_EXIT_ON_STATECHART = "Exit node in top level region not supported - use final states instead.";
-	public static final String ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION = "A choice must have at least one outgoing transition.";
-	public static final String ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NO_DEFAULT_ENTRY = "The region can't be entered using the shallow history. Add a default entry node.";
-	public static final String ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NON_CONNECTED_DEFAULT_ENTRY = "The region can't be entered using the shallow history. Add a transition from default entry to a state.";
-	public static final String ISSUE_SUBMACHINE_UNRESOLVABLE = "Referenced substate machine '%s'does not exist!";
-	public static final String ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL = "The target states of a synchronization must be orthogonal!";
-	public static final String ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE = "The target states of a synchronization have to be contained in the same parent state within different regions!";
-	public static final String ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_ORTHOGONAL = "The source states of a synchronization must be orthogonal!";
-	public static final String ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_WITHIN_SAME_PARENTSTATE = "The source states of a synchronization have to be contained in the same parent state within different regions!";
-	public static final String ISSUE_SYNCHRONIZATION_TRANSITION_COUNT = "A synchronization should have at least two incoming or two outgoing transitions";
-	public static final String ISSUE_TRANSITION_ORTHOGONAL = "Source and target of a transition must not be located in orthogonal regions!";
-	public static final String ISSUE_INITIAL_ENTRY_WITH_TRANSITION_TO_CONTAINER = "Outgoing Transitions from Entries can only target to sibling or inner states.";
-
-	@Check(CheckType.FAST)
-	public void vertexNotReachable(final Vertex vertex) {
-		if (!(vertex instanceof Entry)) {
-
-			final Set<Object> stateScopeSet = new HashSet<Object>();
-			for (EObject obj : EcoreUtil2.eAllContents(vertex)) {
-				stateScopeSet.add(obj);
-			}
-			stateScopeSet.add(vertex);
-
-			final List<Object> externalPredecessors = new ArrayList<Object>();
-
-			DFS dfs = new DFS() {
-
-				@Override
-				public Iterator<Object> getElementLinks(Object element) {
-					List<Object> elements = new ArrayList<Object>();
-
-					if (element instanceof org.yakindu.sct.model.sgraph.State) {
-						if (!stateScopeSet.contains(element)) {
-							externalPredecessors.add(element);
-						} else {
-							elements.addAll(((org.yakindu.sct.model.sgraph.State) element)
-									.getRegions());
-							elements.addAll(((org.yakindu.sct.model.sgraph.State) element)
-									.getIncomingTransitions());
-						}
-
-					} else if (element instanceof Region) {
-						elements.addAll(((Region) element).getVertices());
-					} else if (element instanceof Entry) {
-						if (!stateScopeSet.contains(element)) {
-							externalPredecessors.add(element);
-						} else {
-							elements.addAll(((Entry) element)
-									.getIncomingTransitions());
-						}
-
-					} else if (element instanceof Vertex) {
-						elements.addAll(((Vertex) element)
-								.getIncomingTransitions());
-
-					} else if (element instanceof Transition) {
-						elements.add(((Transition) element).getSource());
-
-					}
-
-					return elements.iterator();
-				}
-			};
-
-			dfs.perform(vertex);
-
-			if (externalPredecessors.size() == 0) {
-				error(ISSUE_NODE_NOT_REACHABLE, vertex, null, -1);
-			}
-		}
-	}
-
-	/**
-	 * Calculates all predecessor states
-	 */
-
-	@Check(CheckType.FAST)
-	public void finalStateWithOutgoingTransition(FinalState finalState) {
-		if ((finalState.getOutgoingTransitions().size() > 0)) {
-			warning(ISSUE_FINAL_STATE_OUTGOING_TRANSITION, finalState, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void nameIsNotEmpty(org.yakindu.sct.model.sgraph.State state) {
-		if ((state.getName() == null || state.getName().trim().length() == 0)
-				&& !(state instanceof FinalState)) {
-			error(ISSUE_STATE_WITHOUT_NAME, state, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void choiceWithoutOutgoingTransition(Choice choice) {
-		// Choice without outgoing transition
-		if (choice.getOutgoingTransitions().size() == 0) {
-			error(ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION, choice, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void disallowTrigger(Entry entry) {
-		for (Transition transition : entry.getOutgoingTransitions()) {
-			if (transition.getTrigger() != null) {
-				error(ISSUE_ENTRY_WITH_TRIGGER, entry, null, -1);
-			}
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void initialEntryWithoutIncomingTransitions(Entry entry) {
-		if (entry.getIncomingTransitions().size() > 0
-				&& entry.getKind().equals(EntryKind.INITIAL)) {
-			warning(ISSUE_INITIAL_ENTRY_WITH_IN_TRANS, entry, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void initialEntryWithoutOutgoingTransition(Entry entry) {
-		if (entry.getOutgoingTransitions().size() == 0
-				&& ((Entry) entry).getKind().equals(EntryKind.INITIAL)) {
-			warning(ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS, entry, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void initialEntryWithMultipleOutgoingTransition(Entry entry) {
-		if (entry.getOutgoingTransitions().size() > 1) {
-			error(ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS, entry, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void exitWithoutIncomingTransition(Exit exit) {
-		if (exit.getIncomingTransitions().size() == 0) {
-			warning(ISSUE_EXIT_WITHOUT_IN_TRANS, exit, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void exitWithOutgoingTransition(Exit exit) {
-		if (exit.getOutgoingTransitions().size() > 0) {
-			error(ISSUE_EXIT_WITH_OUT_TRANS, exit, null, -1);
-		}
-	}
-
-	/**
-	 * Exit nodes in top level regions are not supported.
-	 * 
-	 * @param exit
-	 */
-	@Check(CheckType.FAST)
-	public void exitOnStatechart(Exit exit) {
-		if (exit.getParentRegion().getComposite() instanceof Statechart) {
-			error(ISSUE_EXIT_ON_STATECHART, exit, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void synchronizationTransitionCount(Synchronization sync) {
-		if (sync.getIncomingTransitions().size() < 2
-				&& sync.getOutgoingTransitions().size() < 2) {
-			warning(ISSUE_SYNCHRONIZATION_TRANSITION_COUNT, sync, null, -1);
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void initialEntryWithTransitionToContainer(Transition t) {
-		if (t.getSource() instanceof Entry
-				&& !isChildOrSibling(t.getSource(), t.getTarget())) {
-			error(ISSUE_INITIAL_ENTRY_WITH_TRANSITION_TO_CONTAINER, t, null, -1);
-		}
-	}
-
-	private boolean isChildOrSibling(Vertex source, Vertex target) {
-		TreeIterator<EObject> iter = source.getParentRegion().eAllContents();
-		while (iter.hasNext()) {
-			if (target == iter.next()) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Checks if all composite states that are siblings of a shallow history can
-	 * enter their regions.
-	 * 
-	 * @param e
-	 */
-	@Check(CheckType.FAST)
-	public void regionCantBeEnteredUsingShallowHistory(Entry e) {
-
-		if (e.getKind() == EntryKind.SHALLOW_HISTORY) {
-
-			// get all regions off all sibling states
-			List<Region> regions = new ArrayList<Region>();
-			for (Vertex v : e.getParentRegion().getVertices()) {
-				if (v instanceof org.yakindu.sct.model.sgraph.State) {
-					org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) v;
-					regions.addAll(state.getRegions());
-				}
-			}
-
-			// check each region
-			for (Region r : regions) {
-
-				// first determine if the region contains a default entry
-				Entry defaultEntry = null;
-				for (Vertex v : r.getVertices()) {
-					if (v instanceof Entry) {
-						String name = v.getName().trim().toLowerCase();
-						if (name != null || "".equals(name)
-								|| "default".equals(name)) {
-							defaultEntry = (Entry) v;
-							break;
-						}
-					}
-				}
-
-				// now check error conditions
-				if (defaultEntry == null) {
-					error(ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NO_DEFAULT_ENTRY,
-							r, null, -1);
-				} else if (defaultEntry.getOutgoingTransitions().size() != 1) {
-					error(ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NON_CONNECTED_DEFAULT_ENTRY,
-							r, null, -1);
-				}
-			}
-
-		}
-
-	}
-
-	@Check public void orthogonalTransition(Transition transition) {
-		
-		Vertex source = transition.getSource();
-		Vertex target = transition.getTarget();
-		
-		if ( (source instanceof Synchronization) || (target instanceof Synchronization) ) return; // ... the check does not apply.
-		
-		EObject commonAncestor = commonAncestor(source, target);
-		
-		if (commonAncestor instanceof CompositeElement) {
-			
-			error(ISSUE_TRANSITION_ORTHOGONAL, transition, null, -1);	
-		}
-	}
-	
-	
-	@Check public void orthogonalSourceStates(Synchronization sync) {
-		
-		List<Vertex> sourceVertices = sources(sync.getIncomingTransitions());
-		
-		if ( ! areOrthogonal(sourceVertices) ) {
-			error(ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_ORTHOGONAL, sync, null, -1);
-		}
-	}
-
-	
-
-	@Check public void orthogonalTargetStates(Synchronization sync) {
-		
-		List<Vertex> sourceVertices = targets(sync.getOutgoingTransitions());
-		
-		if ( ! areOrthogonal(sourceVertices) ) {
-			error(ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL, sync, null, -1);
-		}
-	}
-
-
-
-	@Check public void orthogonalSynchronizedTransition(Synchronization sync) {
-		
-		List<Transition> incoming = sync.getIncomingTransitions();		
-		List<List<EObject>> inAncestorsList = new ArrayList<List<EObject>>();
-		for (Transition trans : incoming) { inAncestorsList.add(collectAncestors(trans.getSource(), new ArrayList<EObject>())); }
-
-		List<Transition> outgoing = sync.getOutgoingTransitions();
-		List<List<EObject>> outAncestorsList = new ArrayList<List<EObject>>(); 
-		for (Transition trans : outgoing) { outAncestorsList.add(collectAncestors(trans.getTarget(), new ArrayList<EObject>())); }
-				
-		
-		Set<Transition> inOrthogonal = new HashSet<Transition>(incoming);
-		Set<Transition> outOrthogonal = new HashSet<Transition>(outgoing);
-		
-		for ( int i=0; i<incoming.size(); i++) {
-			for ( int j=0; j<outgoing.size(); j++ ) {
-				
-				EObject commonAncestor = findCommonAncestor(inAncestorsList.get(i), outAncestorsList.get(j));
-
-				if ( commonAncestor instanceof Region ) {					
-					inOrthogonal.remove(incoming.get(i));
-					outOrthogonal.remove(outgoing.get(j));
-				}
-			}
-		}
-
-		for ( Transition trans : inOrthogonal ) {
-			error(ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_WITHIN_SAME_PARENTSTATE, trans, null, -1);				
-		}
-		
-		for ( Transition trans : outOrthogonal ) {
-			error(ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE, trans, null, -1);				
-		}
-		
-	}
-	
-	
-	
-
-
-	@Override
-	public boolean isLanguageSpecific() {
-		return false;
-	}
-
-	@Inject
-	public void register(EValidatorRegistrar registrar) {
-		// Do not register because this validator is only a composite #398987
-	}
-}
+/**
+ * Copyright (c) 2012-2016 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.model.sgraph.validation;
+
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.areOrthogonal;
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.collectAncestors;
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.commonAncestor;
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.findCommonAncestor;
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.sources;
+import static org.yakindu.sct.model.sgraph.util.SGgraphUtil.targets;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.EcoreUtil2;
+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.CompositeElement;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.Exit;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Region;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.Synchronization;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.sgraph.Vertex;
+
+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
+ * @author antony
+ */
+public class SGraphJavaValidator extends AbstractDeclarativeValidator {
+
+	public static final String ISSUE_STATE_WITHOUT_NAME = "A state must have a name.";
+	public static final String ISSUE_NODE_NOT_REACHABLE = "Node is not reachable.";
+	public static final String ISSUE_FINAL_STATE_OUTGOING_TRANSITION = "A final state should have no outgoing transition.";
+	public static final String ISSUE_STATE_WITHOUT_OUTGOING_TRANSITION = "A state should have at least one outgoing transition.";
+	public static final String ISSUE_INITIAL_ENTRY_WITH_IN_TRANS = "Initial entry should have no incoming transition.";
+	public static final String ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS = "Initial entry should have a single outgoing transition.";
+	public static final String ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS = "Entries must not have more than one outgoing transition.";
+	public static final String ISSUE_ENTRY_WITH_TRIGGER = "Outgoing Transitions from Entries can not have a Trigger or Guard.";
+	public static final String ISSUE_EXIT_WITH_OUT_TRANS = "Exit node should have no outgoing transition.";
+	public static final String ISSUE_EXIT_WITHOUT_IN_TRANS = "Exit node should have at least one incoming transition.";
+	public static final String ISSUE_EXIT_ON_STATECHART = "Exit node in top level region not supported - use final states instead.";
+	public static final String ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION = "A choice must have at least one outgoing transition.";
+	public static final String ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NO_DEFAULT_ENTRY = "The region can't be entered using the shallow history. Add a default entry node.";
+	public static final String ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NON_CONNECTED_DEFAULT_ENTRY = "The region can't be entered using the shallow history. Add a transition from default entry to a state.";
+	public static final String ISSUE_SUBMACHINE_UNRESOLVABLE = "Referenced substate machine '%s'does not exist!";
+	public static final String ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL = "The target states of a synchronization must be orthogonal!";
+	public static final String ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE = "The target states of a synchronization have to be contained in the same parent state within different regions!";
+	public static final String ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_ORTHOGONAL = "The source states of a synchronization must be orthogonal!";
+	public static final String ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_WITHIN_SAME_PARENTSTATE = "The source states of a synchronization have to be contained in the same parent state within different regions!";
+	public static final String ISSUE_SYNCHRONIZATION_TRANSITION_COUNT = "A synchronization should have at least two incoming or two outgoing transitions.";
+	public static final String ISSUE_TRANSITION_ORTHOGONAL = "Source and target of a transition must not be located in orthogonal regions!";
+	public static final String ISSUE_INITIAL_ENTRY_WITH_TRANSITION_TO_CONTAINER = "Outgoing Transitions from Entries can only target to sibling or inner states.";
+
+	@Check(CheckType.FAST)
+	public void vertexNotReachable(final Vertex vertex) {
+		if (!(vertex instanceof Entry)) {
+
+			final Set<Object> stateScopeSet = new HashSet<Object>();
+			for (EObject obj : EcoreUtil2.eAllContents(vertex)) {
+				stateScopeSet.add(obj);
+			}
+			stateScopeSet.add(vertex);
+
+			final List<Object> externalPredecessors = new ArrayList<Object>();
+
+			DFS dfs = new DFS() {
+
+				@Override
+				public Iterator<Object> getElementLinks(Object element) {
+					List<Object> elements = new ArrayList<Object>();
+
+					if (element instanceof org.yakindu.sct.model.sgraph.State) {
+						if (!stateScopeSet.contains(element)) {
+							externalPredecessors.add(element);
+						} else {
+							elements.addAll(((org.yakindu.sct.model.sgraph.State) element)
+									.getRegions());
+							elements.addAll(((org.yakindu.sct.model.sgraph.State) element)
+									.getIncomingTransitions());
+						}
+
+					} else if (element instanceof Region) {
+						elements.addAll(((Region) element).getVertices());
+					} else if (element instanceof Entry) {
+						if (!stateScopeSet.contains(element)) {
+							externalPredecessors.add(element);
+						} else {
+							elements.addAll(((Entry) element)
+									.getIncomingTransitions());
+						}
+
+					} else if (element instanceof Vertex) {
+						elements.addAll(((Vertex) element)
+								.getIncomingTransitions());
+
+					} else if (element instanceof Transition) {
+						elements.add(((Transition) element).getSource());
+
+					}
+
+					return elements.iterator();
+				}
+			};
+
+			dfs.perform(vertex);
+
+			if (externalPredecessors.size() == 0) {
+				error(ISSUE_NODE_NOT_REACHABLE, vertex, null, -1);
+			}
+		}
+	}
+
+	/**
+	 * Calculates all predecessor states
+	 */
+
+	@Check(CheckType.FAST)
+	public void finalStateWithOutgoingTransition(FinalState finalState) {
+		if ((finalState.getOutgoingTransitions().size() > 0)) {
+			warning(ISSUE_FINAL_STATE_OUTGOING_TRANSITION, finalState, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void nameIsNotEmpty(org.yakindu.sct.model.sgraph.State state) {
+		if ((state.getName() == null || state.getName().trim().length() == 0)
+				&& !(state instanceof FinalState)) {
+			error(ISSUE_STATE_WITHOUT_NAME, state, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void choiceWithoutOutgoingTransition(Choice choice) {
+		// Choice without outgoing transition
+		if (choice.getOutgoingTransitions().size() == 0) {
+			error(ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION, choice, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void disallowTrigger(Entry entry) {
+		for (Transition transition : entry.getOutgoingTransitions()) {
+			if (transition.getTrigger() != null) {
+				error(ISSUE_ENTRY_WITH_TRIGGER, entry, null, -1);
+			}
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void initialEntryWithoutIncomingTransitions(Entry entry) {
+		if (entry.getIncomingTransitions().size() > 0
+				&& entry.getKind().equals(EntryKind.INITIAL)) {
+			warning(ISSUE_INITIAL_ENTRY_WITH_IN_TRANS, entry, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void initialEntryWithoutOutgoingTransition(Entry entry) {
+		if (entry.getOutgoingTransitions().size() == 0
+				&& ((Entry) entry).getKind().equals(EntryKind.INITIAL)) {
+			warning(ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS, entry, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void initialEntryWithMultipleOutgoingTransition(Entry entry) {
+		if (entry.getOutgoingTransitions().size() > 1) {
+			error(ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS, entry, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void exitWithoutIncomingTransition(Exit exit) {
+		if (exit.getIncomingTransitions().size() == 0) {
+			warning(ISSUE_EXIT_WITHOUT_IN_TRANS, exit, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void exitWithOutgoingTransition(Exit exit) {
+		if (exit.getOutgoingTransitions().size() > 0) {
+			error(ISSUE_EXIT_WITH_OUT_TRANS, exit, null, -1);
+		}
+	}
+
+	/**
+	 * Exit nodes in top level regions are not supported.
+	 * 
+	 * @param exit
+	 */
+	@Check(CheckType.FAST)
+	public void exitOnStatechart(Exit exit) {
+		if (exit.getParentRegion().getComposite() instanceof Statechart) {
+			error(ISSUE_EXIT_ON_STATECHART, exit, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void synchronizationTransitionCount(Synchronization sync) {
+		if (sync.getIncomingTransitions().size() < 2
+				&& sync.getOutgoingTransitions().size() < 2) {
+			warning(ISSUE_SYNCHRONIZATION_TRANSITION_COUNT, sync, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void initialEntryWithTransitionToContainer(Transition t) {
+		if (t.getSource() instanceof Entry
+				&& !isChildOrSibling(t.getSource(), t.getTarget())) {
+			error(ISSUE_INITIAL_ENTRY_WITH_TRANSITION_TO_CONTAINER, t, null, -1);
+		}
+	}
+
+	private boolean isChildOrSibling(Vertex source, Vertex target) {
+		TreeIterator<EObject> iter = source.getParentRegion().eAllContents();
+		while (iter.hasNext()) {
+			if (target == iter.next()) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Checks if all composite states that are siblings of a shallow history can
+	 * enter their regions.
+	 * 
+	 * @param e
+	 */
+	@Check(CheckType.FAST)
+	public void regionCantBeEnteredUsingShallowHistory(Entry e) {
+
+		if (e.getKind() == EntryKind.SHALLOW_HISTORY) {
+
+			// get all regions off all sibling states
+			List<Region> regions = new ArrayList<Region>();
+			for (Vertex v : e.getParentRegion().getVertices()) {
+				if (v instanceof org.yakindu.sct.model.sgraph.State) {
+					org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) v;
+					regions.addAll(state.getRegions());
+				}
+			}
+
+			// check each region
+			for (Region r : regions) {
+
+				// first determine if the region contains a default entry
+				Entry defaultEntry = null;
+				for (Vertex v : r.getVertices()) {
+					if (v instanceof Entry) {
+						String name = v.getName().trim().toLowerCase();
+						if (name != null || "".equals(name)
+								|| "default".equals(name)) {
+							defaultEntry = (Entry) v;
+							break;
+						}
+					}
+				}
+
+				// now check error conditions
+				if (defaultEntry == null) {
+					error(ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NO_DEFAULT_ENTRY,
+							r, null, -1);
+				} else if (defaultEntry.getOutgoingTransitions().size() != 1) {
+					error(ISSUE_REGION_CANT_BE_ENTERED_USING_SHALLOW_HISTORY_NON_CONNECTED_DEFAULT_ENTRY,
+							r, null, -1);
+				}
+			}
+
+		}
+
+	}
+
+	@Check public void orthogonalTransition(Transition transition) {
+		
+		Vertex source = transition.getSource();
+		Vertex target = transition.getTarget();
+		
+		if ( (source instanceof Synchronization) || (target instanceof Synchronization) ) return; // ... the check does not apply.
+		
+		EObject commonAncestor = commonAncestor(source, target);
+		
+		if (commonAncestor instanceof CompositeElement) {
+			
+			error(ISSUE_TRANSITION_ORTHOGONAL, transition, null, -1);	
+		}
+	}
+	
+	
+	@Check public void orthogonalSourceStates(Synchronization sync) {
+		
+		List<Vertex> sourceVertices = sources(sync.getIncomingTransitions());
+		
+		if ( ! areOrthogonal(sourceVertices) ) {
+			error(ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_ORTHOGONAL, sync, null, -1);
+		}
+	}
+
+	
+
+	@Check public void orthogonalTargetStates(Synchronization sync) {
+		
+		List<Vertex> sourceVertices = targets(sync.getOutgoingTransitions());
+		
+		if ( ! areOrthogonal(sourceVertices) ) {
+			error(ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL, sync, null, -1);
+		}
+	}
+
+
+
+	@Check public void orthogonalSynchronizedTransition(Synchronization sync) {
+		
+		List<Transition> incoming = sync.getIncomingTransitions();		
+		List<List<EObject>> inAncestorsList = new ArrayList<List<EObject>>();
+		for (Transition trans : incoming) { inAncestorsList.add(collectAncestors(trans.getSource(), new ArrayList<EObject>())); }
+
+		List<Transition> outgoing = sync.getOutgoingTransitions();
+		List<List<EObject>> outAncestorsList = new ArrayList<List<EObject>>(); 
+		for (Transition trans : outgoing) { outAncestorsList.add(collectAncestors(trans.getTarget(), new ArrayList<EObject>())); }
+				
+		
+		Set<Transition> inOrthogonal = new HashSet<Transition>(incoming);
+		Set<Transition> outOrthogonal = new HashSet<Transition>(outgoing);
+		
+		for ( int i=0; i<incoming.size(); i++) {
+			for ( int j=0; j<outgoing.size(); j++ ) {
+				
+				EObject commonAncestor = findCommonAncestor(inAncestorsList.get(i), outAncestorsList.get(j));
+
+				if ( commonAncestor instanceof Region ) {					
+					inOrthogonal.remove(incoming.get(i));
+					outOrthogonal.remove(outgoing.get(j));
+				}
+			}
+		}
+
+		for ( Transition trans : inOrthogonal ) {
+			error(ISSUE_SYNCHRONIZATION_SOURCE_STATES_NOT_WITHIN_SAME_PARENTSTATE, trans, null, -1);				
+		}
+		
+		for ( Transition trans : outOrthogonal ) {
+			error(ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE, trans, null, -1);				
+		}
+		
+	}
+	
+	
+	
+
+
+	@Override
+	public boolean isLanguageSpecific() {
+		return false;
+	}
+
+	@Inject
+	public void register(EValidatorRegistrar registrar) {
+		// Do not register because this validator is only a composite #398987
+	}
+}

+ 122 - 122
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/inferrer/STextTypeInferrer.java

@@ -1,122 +1,122 @@
-/**
- * Copyright (c) 2014 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.model.stext.inferrer;
-
-import static org.yakindu.base.types.typesystem.ITypeSystem.BOOLEAN;
-import static org.yakindu.base.types.typesystem.ITypeSystem.INTEGER;
-import static org.yakindu.base.types.typesystem.ITypeSystem.VOID;
-
-import org.eclipse.emf.ecore.EObject;
-import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
-import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.base.expressions.expressions.FeatureCall;
-import org.yakindu.base.expressions.inferrer.ExpressionsTypeInferrer;
-import org.yakindu.base.types.Event;
-import org.yakindu.base.types.Type;
-import org.yakindu.sct.model.sgraph.Scope;
-import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression;
-import org.yakindu.sct.model.stext.stext.EventDefinition;
-import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
-import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression;
-import org.yakindu.sct.model.stext.stext.Guard;
-import org.yakindu.sct.model.stext.stext.TimeEventSpec;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class STextTypeInferrer extends ExpressionsTypeInferrer {
-
-	public static final String VARIABLE_DEFINITION = "Cannot assign a value of type %s to a variable of type %s.";
-	public static final String EVENT_DEFINITION = "Cannot assign a value of type %s to an event of type %s.";
-	public static final String GUARD = "The evaluation result of a guard expression must be of type boolean";
-	public static final String TIME_SPEC = "The evaluation result of a time expression must be of type integer";
-	public static final String MISSING_VALUE = "Need to assign a value to an event of type %s.";
-
-	public Object infer(VariableDefinition e) {
-		Type type = inferTypeDispatch(e.getType());
-		assertNotType(type, VARIABLE_VOID_TYPE, getType(VOID));
-		if (e.getInitialValue() == null)
-			return inferTypeDispatch(type);
-		Type type2 = inferTypeDispatch(e.getInitialValue());
-		assertAssignable(type, type2, String.format(VARIABLE_DEFINITION, type2, type));
-		return inferTypeDispatch(type);
-	}
-
-	public Object infer(Event e) {
-		// if an event is used within an expression, the type is boolean and the
-		// value indicates if the event is raised or not
-		return getType(BOOLEAN);
-	}
-
-	public Object infer(Guard e) {
-		Type type = inferTypeDispatch(e.getExpression());
-		assertIsSupertype(type, getType(BOOLEAN), GUARD);
-		return inferTypeDispatch(type);
-	}
-
-	public Object infer(TimeEventSpec e) {
-		Type type = inferTypeDispatch(e.getValue());
-		assertCompatible(type, getType(INTEGER), TIME_SPEC);
-		return inferTypeDispatch(type);
-	}
-
-	public Object infer(Scope scope) {
-		return getType(VOID);
-	}
-
-	public Object infer(EventValueReferenceExpression e) {
-		EventDefinition definition = deresolve(e.getValue());
-		if (definition != null)
-			return inferTypeDispatch(definition.getType() != null ? definition.getType() : getType(VOID));
-		return inferTypeDispatch(e.getValue());
-	}
-
-	public Object infer(EventRaisingExpression e) {
-		EventDefinition event = deresolve(e.getEvent());
-		Type type1 = null;
-		if(event != null)
-			type1 = event.getType();
-		type1 = type1 != null ? type1 : getType(VOID);
-		if (e.getValue() == null) {
-			assertSame(type1, getType(VOID), String.format(MISSING_VALUE, type1));
-			return getType(VOID);
-		}
-		Type type2 = inferTypeDispatch(e.getValue());
-		assertAssignable(type1, type2, String.format(EVENT_DEFINITION, type2, type1));
-		return inferTypeDispatch(e.getValue());
-
-	}
-
-	protected EventDefinition deresolve(Expression e) {
-		// TODO This is ugly -> reuse the TypeTrace to determine the context in
-		// infer(EventDefinition)
-		if (e instanceof ElementReferenceExpression) {
-			EObject reference = ((ElementReferenceExpression) e).getReference();
-			if (reference instanceof EventDefinition) {
-				return (EventDefinition) reference;
-			}
-		}
-		if (e instanceof FeatureCall) {
-			EObject reference = ((FeatureCall) e).getFeature();
-			if (reference instanceof EventDefinition) {
-				return (EventDefinition) reference;
-			}
-		}
-		return null;
-	}
-
-	public Object infer(ActiveStateReferenceExpression e) {
-		return getType(BOOLEAN);
-	}
-
-}
+/**
+ * Copyright (c) 2014 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.stext.inferrer;
+
+import static org.yakindu.base.types.typesystem.ITypeSystem.BOOLEAN;
+import static org.yakindu.base.types.typesystem.ITypeSystem.INTEGER;
+import static org.yakindu.base.types.typesystem.ITypeSystem.VOID;
+
+import org.eclipse.emf.ecore.EObject;
+import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
+import org.yakindu.base.expressions.expressions.Expression;
+import org.yakindu.base.expressions.expressions.FeatureCall;
+import org.yakindu.base.expressions.inferrer.ExpressionsTypeInferrer;
+import org.yakindu.base.types.Event;
+import org.yakindu.base.types.Type;
+import org.yakindu.sct.model.sgraph.Scope;
+import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression;
+import org.yakindu.sct.model.stext.stext.EventDefinition;
+import org.yakindu.sct.model.stext.stext.EventRaisingExpression;
+import org.yakindu.sct.model.stext.stext.EventValueReferenceExpression;
+import org.yakindu.sct.model.stext.stext.Guard;
+import org.yakindu.sct.model.stext.stext.TimeEventSpec;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class STextTypeInferrer extends ExpressionsTypeInferrer {
+
+	public static final String VARIABLE_DEFINITION = "Cannot assign a value of type %s to a variable of type %s.";
+	public static final String EVENT_DEFINITION = "Cannot assign a value of type %s to an event of type %s.";
+	public static final String GUARD = "The evaluation result of a guard expression must be of type boolean.";
+	public static final String TIME_SPEC = "The evaluation result of a time expression must be of type integer.";
+	public static final String MISSING_VALUE = "Need to assign a value to an event of type %s.";
+
+	public Object infer(VariableDefinition e) {
+		Type type = inferTypeDispatch(e.getType());
+		assertNotType(type, VARIABLE_VOID_TYPE, getType(VOID));
+		if (e.getInitialValue() == null)
+			return inferTypeDispatch(type);
+		Type type2 = inferTypeDispatch(e.getInitialValue());
+		assertAssignable(type, type2, String.format(VARIABLE_DEFINITION, type2, type));
+		return inferTypeDispatch(type);
+	}
+
+	public Object infer(Event e) {
+		// if an event is used within an expression, the type is boolean and the
+		// value indicates if the event is raised or not
+		return getType(BOOLEAN);
+	}
+
+	public Object infer(Guard e) {
+		Type type = inferTypeDispatch(e.getExpression());
+		assertIsSupertype(type, getType(BOOLEAN), GUARD);
+		return inferTypeDispatch(type);
+	}
+
+	public Object infer(TimeEventSpec e) {
+		Type type = inferTypeDispatch(e.getValue());
+		assertCompatible(type, getType(INTEGER), TIME_SPEC);
+		return inferTypeDispatch(type);
+	}
+
+	public Object infer(Scope scope) {
+		return getType(VOID);
+	}
+
+	public Object infer(EventValueReferenceExpression e) {
+		EventDefinition definition = deresolve(e.getValue());
+		if (definition != null)
+			return inferTypeDispatch(definition.getType() != null ? definition.getType() : getType(VOID));
+		return inferTypeDispatch(e.getValue());
+	}
+
+	public Object infer(EventRaisingExpression e) {
+		EventDefinition event = deresolve(e.getEvent());
+		Type type1 = null;
+		if(event != null)
+			type1 = event.getType();
+		type1 = type1 != null ? type1 : getType(VOID);
+		if (e.getValue() == null) {
+			assertSame(type1, getType(VOID), String.format(MISSING_VALUE, type1));
+			return getType(VOID);
+		}
+		Type type2 = inferTypeDispatch(e.getValue());
+		assertAssignable(type1, type2, String.format(EVENT_DEFINITION, type2, type1));
+		return inferTypeDispatch(e.getValue());
+
+	}
+
+	protected EventDefinition deresolve(Expression e) {
+		// TODO This is ugly -> reuse the TypeTrace to determine the context in
+		// infer(EventDefinition)
+		if (e instanceof ElementReferenceExpression) {
+			EObject reference = ((ElementReferenceExpression) e).getReference();
+			if (reference instanceof EventDefinition) {
+				return (EventDefinition) reference;
+			}
+		}
+		if (e instanceof FeatureCall) {
+			EObject reference = ((FeatureCall) e).getFeature();
+			if (reference instanceof EventDefinition) {
+				return (EventDefinition) reference;
+			}
+		}
+		return null;
+	}
+
+	public Object infer(ActiveStateReferenceExpression e) {
+		return getType(BOOLEAN);
+	}
+
+}

+ 6 - 6
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -518,7 +518,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			EList<Parameter> parameters = operation.getParameters();
 			EList<Expression> args = call.getArgs();
 			if (parameters.size() != args.size()) {
-				error("Wrong number of arguments, expected " + parameters, null);
+				error("Wrong number of arguments, expected " + parameters + ".", null);
 			}
 		}
 	}
@@ -530,7 +530,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			EList<Parameter> parameters = operation.getParameters();
 			EList<Expression> args = call.getArgs();
 			if (parameters.size() != args.size()) {
-				error("Wrong number of arguments, expected " + parameters, null);
+				error("Wrong number of arguments, expected " + parameters + ".", null);
 			}
 		}
 	}
@@ -574,7 +574,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			return;
 		}
 		if (call.getFeature() instanceof Scope) {
-			error("A variable, event or operation is required", ExpressionsPackage.Literals.FEATURE_CALL__FEATURE,
+			error("A variable, event or operation is required.", ExpressionsPackage.Literals.FEATURE_CALL__FEATURE,
 					INSIGNIFICANT_INDEX, FEATURE_CALL_TO_SCOPE);
 		}
 	}
@@ -585,7 +585,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			return;
 		}
 		if (call.getReference() instanceof Scope) {
-			error("A variable, event or operation is required",
+			error("A variable, event or operation is required.",
 					ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
 					FEATURE_CALL_TO_SCOPE);
 		}
@@ -596,7 +596,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		for (EventSpec eventSpec : reactionTrigger.getTriggers()) {
 			if (!(reactionTrigger.eContainer() instanceof LocalReaction)
 					&& (eventSpec instanceof EntryEvent || eventSpec instanceof ExitEvent)) {
-				error("entry and exit events are allowed as local reactions only.",
+				error("Entry and exit events are allowed as local reactions only.",
 						StextPackage.Literals.REACTION_TRIGGER__TRIGGERS, INSIGNIFICANT_INDEX,
 						LOCAL_REACTIONS_NOT_ALLOWED);
 			}
@@ -790,7 +790,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 	public void checkImportExists(Import importDef) {
 		String importedNamespace = importDef.getImportedNamespace();
 		if (!checkImportedNamespaceExists(importDef.getImportedNamespace(), getResource(importDef))) {
-			error("The import " + importedNamespace + " cannot be resolved", importDef,
+			error("The import " + importedNamespace + " cannot be resolved.", importDef,
 					StextPackage.Literals.IMPORT__IMPORTED_NAMESPACE, IMPORT_NOT_RESOLVED);
 		}
 	}

+ 18 - 18
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java

@@ -19,22 +19,22 @@ package org.yakindu.sct.model.stext.validation;
  */
 public interface STextValidationMessages {
 
-	public static final String CHOICE_ONE_OUTGOING_DEFAULT_TRANSITION = "A choice should have one outgoing default transition";
-	public static final String FEATURE_CALL_HAS_NO_EFFECT = "FeatureCall has no effect";
-	public static final String ENTRY_EXIT_TRIGGER_NOT_ALLOWED = "Entry/Exit trigger not allowed";
-	public static final String LOCAL_REACTIONS_NOT_ALLOWED = "Local reactions not allowed";
-	public static final String FEATURE_CALL_TO_SCOPE = "FEATURE_CALL_TO_SCOPE";
+	public static final String CHOICE_ONE_OUTGOING_DEFAULT_TRANSITION = "A choice should have one outgoing default transition.";
+	public static final String FEATURE_CALL_HAS_NO_EFFECT = "FeatureCall has no effect.";
+	public static final String ENTRY_EXIT_TRIGGER_NOT_ALLOWED = "Entry/Exit trigger not allowed.";
+	public static final String LOCAL_REACTIONS_NOT_ALLOWED = "Local reactions not allowed.";
+	public static final String FEATURE_CALL_TO_SCOPE = "FEATURE_CALL_TO_SCOPE.";
 	public static final String ONLY_ONE_INTERFACE = "Only one default/unnamed interface is allowed.";
 	public static final String IN_OUT_DECLARATIONS = "In/Out declarations are not allowed in internal scope.";
 	public static final String LOCAL_DECLARATIONS = "Local declarations are not allowed in interface scope.";
-	public static final String TIME_EXPRESSION = "The evaluation result of a time expression must be of type integer";
-	public static final String GUARD_EXPRESSION = "The evaluation result of a guard expression must be of type boolean";
-	public static final String ASSIGNMENT_EXPRESSION = "No nested assignment of the same variable allowed (different behavior in various programming languages)";
-	public static final String TRANSITION_ENTRY_SPEC_NOT_COMPOSITE = "Target state isn't composite";
-	public static final String TRANSITION_EXIT_SPEC_NOT_COMPOSITE = "Source state isn't composite";
+	public static final String TIME_EXPRESSION = "The evaluation result of a time expression must be of type integer.";
+	public static final String GUARD_EXPRESSION = "The evaluation result of a guard expression must be of type boolean.";
+	public static final String ASSIGNMENT_EXPRESSION = "No nested assignment of the same variable allowed (different behavior in various programming languages).";
+	public static final String TRANSITION_ENTRY_SPEC_NOT_COMPOSITE = "Target state isn't composite.";
+	public static final String TRANSITION_EXIT_SPEC_NOT_COMPOSITE = "Source state isn't composite.";
 	public static final String TRANSITION_UNBOUND_DEFAULT_ENTRY_POINT = "Target state has regions without 'default' entries.";
 	public static final String TRANSITION_UNBOUND_NAMED_ENTRY_POINT = "Target state has regions without named entries: ";
-	public static final String TRANSITION_NOT_EXISTING_NAMED_EXIT_POINT = "Source State needs at least one region with the named exit point";
+	public static final String TRANSITION_NOT_EXISTING_NAMED_EXIT_POINT = "Source State needs at least one region with the named exit point.";
 	public static final String TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY = "Entry of top level region have to be a default entry.";
 	public static final String REGION_UNBOUND_DEFAULT_ENTRY_POINT = "Region must have a 'default' entry.";
 	public static final String REGION_UNBOUND_NAMED_ENTRY_POINT = "Region should have a named entry to support transitions entry specification: ";
@@ -42,12 +42,12 @@ public interface STextValidationMessages {
 	public static final String EXIT_UNUSED = "The named exit is not used by outgoing transitions.";
 	public static final String EXIT_DEFAULT_UNUSED = "The parent composite state has no 'default' exit transition.";
 	public static final String TRANSITION_EXIT_SPEC_ON_MULTIPLE_SIBLINGS = "ExitPointSpec can't be used on transition siblings.";
-	public static final String LEFT_HAND_ASSIGNMENT = "The left-hand side of an assignment must be a variable";
-	public static final String ISSUE_TRANSITION_WITHOUT_TRIGGER = "Missing trigger. Transition is never taken. Use 'oncycle' or 'always' instead";
-	public static final String IMPORT_NOT_RESOLVED = "Import cannot be resolved";
+	public static final String LEFT_HAND_ASSIGNMENT = "The left-hand side of an assignment must be a variable.";
+	public static final String ISSUE_TRANSITION_WITHOUT_TRIGGER = "Missing trigger. Transition is never taken. Use 'oncycle' or 'always' instead.";
+	public static final String IMPORT_NOT_RESOLVED = "Import cannot be resolved.";
 	public static final String EXITPOINTSPEC_WITH_TRIGGER = "Transitions with an exit point spec does not have a trigger or guard.";
-	public static final String ASSIGNMENT_TO_VALUE = "Assignment constant not allowed";
-	public static final String REFERENCE_TO_VARIABLE = "Cannot reference a variable in a constant initialization";
-	public static final String REFERENCE_CONSTANT_BEFORE_DEFINED = "Cannot reference a constant from different scope or before it is defined";	
-	public static final String INTERNAL_DECLARATION_UNUSED = "Internal declaration is not used in statechart";
+	public static final String ASSIGNMENT_TO_VALUE = "Assignment constant not allowed.";
+	public static final String REFERENCE_TO_VARIABLE = "Cannot reference a variable in a constant initialization.";
+	public static final String REFERENCE_CONSTANT_BEFORE_DEFINED = "Cannot reference a constant from different scope or before it is defined.";	
+	public static final String INTERNAL_DECLARATION_UNUSED = "Internal declaration is not used in statechart.";
 }

+ 305 - 305
plugins/org.yakindu.sct.simulation.ui.sexec/src/org/yakindu/sct/simulation/ui/sexec/launch/tabs/StatechartLaunchConfigurationTab.java

@@ -1,305 +1,305 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.simulation.ui.sexec.launch.tabs;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchTab;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
-import org.yakindu.sct.commons.WorkspaceClassLoaderFactory;
-import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
-import org.yakindu.sct.simulation.ui.SimulationImages;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StatechartLaunchConfigurationTab extends JavaLaunchTab implements ISCTLaunchParameters {
-
-
-	public static final String LAUNCH_TAB_ID = "org.yakindu.sct.simulation.sexec.launchTab";
-	
-	
-	private Text modelfile;
-	private Text cyclePeriod;
-	private Text operationClass;
-	private Button btnCycle;
-	private Button btnEvent;
-
-	public void createControl(Composite parent) {
-		Composite comp = new Composite(parent, SWT.NONE);
-		setControl(comp);
-		comp.setLayout(new GridLayout(1, true));
-		createFileSelectionGroup(comp);
-		new Label(comp, SWT.NONE);
-	}
-
-	private void createFileSelectionGroup(Composite comp) {
-		createModelFileGroup(comp);
-		createOperationClassGroup(comp);
-		createExecutionTypeControls(comp);
-		createCyclePeriodGroup(comp);
-	}
-
-	private void createOperationClassGroup(Composite parent) {
-		Group propertyGroup = new Group(parent, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
-		propertyGroup.setText("Operation Class:");
-		propertyGroup.setLayout(new GridLayout(1, false));
-		operationClass = new Text(propertyGroup, SWT.BORDER);
-		operationClass.addListener(SWT.Modify, new UpdateListener());
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(operationClass);
-	}
-
-	private void createExecutionTypeControls(Composite parent) {
-		Group propertyGroup = new Group(parent, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
-		propertyGroup.setText("Execution Type:");
-		propertyGroup.setLayout(new GridLayout(1, true));
-		btnCycle = new Button(propertyGroup, SWT.RADIO);
-		btnCycle.setText("cycle based");
-		btnCycle.addListener(SWT.Selection, new UpdateListener());
-		btnCycle.addListener(SWT.Selection, new EnableStateListener());
-		GridDataFactory.fillDefaults().applyTo(btnCycle);
-		btnEvent = new Button(propertyGroup, SWT.RADIO);
-		btnEvent.setText("event driven");
-		btnEvent.addListener(SWT.Selection, new UpdateListener());
-		btnCycle.addListener(SWT.Selection, new EnableStateListener());
-		GridDataFactory.fillDefaults().applyTo(btnEvent);
-	}
-
-	private void createCyclePeriodGroup(Composite parent) {
-		Group propertyGroup = new Group(parent, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
-		propertyGroup.setText("Cycle Period:");
-		propertyGroup.setLayout(new GridLayout(2, false));
-		cyclePeriod = new Text(propertyGroup, SWT.BORDER);
-		cyclePeriod.addListener(SWT.Modify, new UpdateListener());
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(cyclePeriod);
-		Label lblMs = new Label(propertyGroup, SWT.NONE);
-		lblMs.setText("ms");
-		GridDataFactory.fillDefaults().applyTo(lblMs);
-	}
-
-	private void createModelFileGroup(Composite comp) {
-		Group fileGroup = new Group(comp, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(fileGroup);
-		fileGroup.setText("Model file:");
-		fileGroup.setLayout(new GridLayout(2, false));
-
-		modelfile = new Text(fileGroup, SWT.BORDER);
-		modelfile.addListener(SWT.Modify, new UpdateListener());
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(modelfile);
-
-		Button browse = new Button(fileGroup, SWT.NONE);
-		browse.setText("Search");
-		browse.addSelectionListener(new SelectionAdapter() {
-			public void widgetSelected(SelectionEvent e) {
-				ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(),
-						getStatechartResources()) {
-					@Override
-					protected String adjustPattern() {
-						String pattern = super.adjustPattern();
-						if (pattern.equals("")) {
-							return "*";
-						}
-						return pattern;
-					}
-				};
-				dialog.setTitle("Select Statechart model");
-				dialog.setMessage("Please select the YAKINDU statechart model file you want to execute.");
-				if (dialog.open() == 0) {
-					Object[] files = dialog.getResult();
-					IFile file = (IFile) files[0];
-					modelfile.setText((file.getFullPath().toString()));
-				}
-			}
-
-			private IResource[] getStatechartResources() {
-				final List<IResource> resources = new ArrayList<IResource>();
-				try {
-					ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
-						public boolean visit(IResource resource) throws CoreException {
-							if ("sct".equalsIgnoreCase(resource.getFileExtension())) {
-								resources.add(resource);
-							}
-							return true;
-						}
-					});
-				} catch (CoreException e) {
-					e.printStackTrace();
-				}
-				return resources.toArray(new IResource[0]);
-			}
-		});
-		GridDataFactory.fillDefaults().applyTo(browse);
-	}
-
-	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
-	}
-
-	public void initializeFrom(ILaunchConfiguration configuration) {
-		try {
-			modelfile.setText(configuration.getAttribute(FILE_NAME, DEFAULT_FILE_NAME));
-			operationClass.setText(configuration.getAttribute(OPERATION_CLASS, DEFAULT_OPERATION_CLASS));
-			cyclePeriod.setText(String.valueOf(configuration.getAttribute(CYCLE_PERIOD, DEFAULT_CYCLE_PERIOD)));
-			btnCycle.setSelection(configuration.getAttribute(IS_CYCLE_BASED, DEFAULT_IS_CYCLE_BASED));
-			btnEvent.setSelection(configuration.getAttribute(IS_EVENT_DRIVEN, DEFAULT_IS_EVENT_DRIVEN));
-			cyclePeriod.setEnabled(btnCycle.getSelection());
-		} catch (CoreException e) {
-			e.printStackTrace();
-		}
-	}
-
-	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
-		configuration.setAttribute(FILE_NAME, modelfile.getText());
-		configuration.setAttribute(OPERATION_CLASS, operationClass.getText());
-		if (isCyclePeriodValid()) {
-			configuration.setAttribute(CYCLE_PERIOD, getCyclePeriod());
-		}
-		configuration.setAttribute(IS_CYCLE_BASED, btnCycle.getSelection());
-		configuration.setAttribute(IS_EVENT_DRIVEN, btnEvent.getSelection());
-	}
-
-	private int getCyclePeriod() {
-		return Integer.parseInt(cyclePeriod.getText());
-	}
-
-	public String getName() {
-		return "Main";
-	}
-
-	@Override
-	public Image getImage() {
-		return SimulationImages.LAUNCHER_ICON.image();
-	}
-
-	protected Set<String> getOperationClasses() {
-		String operationClasses = this.operationClass.getText();
-		Set<String> result = new HashSet<String>();
-		if (operationClasses.trim().length() > 0) {
-			String[] split = operationClasses.split(",");
-			for (String string : split) {
-				result.add(string.trim());
-			}
-		}
-		return result;
-	}
-
-	@Override
-	public boolean isValid(ILaunchConfiguration launchConfig) {
-		setMessage(null);
-		setErrorMessage(null);
-		String model = this.modelfile.getText().trim();
-		if (model.length() > 0)
-			if (ResourcesPlugin.getWorkspace().getRoot().findMember(model) == null) {
-				setErrorMessage("file " + model + " does not exist!");
-				return false;
-			}
-		String cyclePeriod = this.cyclePeriod.getText();
-		if (cyclePeriod.length() == 0) {
-			setErrorMessage("Empty cycle period!");
-			return false;
-		} else if (!isCyclePeriodValid()) {
-			setErrorMessage("Cycle Period must be a number!");
-			return false;
-		}
-		Set<String> operationClasses = getOperationClasses();
-		if (operationClasses.size() > 0) {
-			for (String clazz : operationClasses) {
-				// check if class exists
-				IProject project = ResourcesPlugin.getWorkspace().getRoot().findMember(model).getProject();
-				if (project != null) {
-					ClassLoader classLoader = new WorkspaceClassLoaderFactory().createClassLoader(project, getClass()
-							.getClassLoader());
-					try {
-						Class<?> loadClass = classLoader.loadClass(clazz);
-						loadClass.newInstance();
-					} catch (ClassNotFoundException e) {
-						setErrorMessage("Class " + clazz + " not found in project " + project.getName() + "!");
-						return false;
-					} catch (InstantiationException e) {
-						setErrorMessage("Could not instantiate class " + clazz
-								+ "! (No default constructor available?) ");
-						return false;
-					} catch (IllegalAccessException e) {
-						setErrorMessage("Could not access class constructor for class" + clazz + "!");
-						return false;
-					}catch(Throwable t){
-						setErrorMessage(t.getMessage());
-						return false;
-					}
-				}
-			}
-		}
-		// check for default c'tor
-		return super.isValid(launchConfig);
-	}
-
-	private boolean isCyclePeriodValid() {
-		try {
-			getCyclePeriod();
-		} catch (NumberFormatException ex) {
-			return false;
-		}
-		return true;
-	}
-	
-	
-	
-
-	@Override
-	public String getId() {
-		return LAUNCH_TAB_ID;
-	}
-
-
-
-
-	private class EnableStateListener implements Listener {
-		public void handleEvent(Event event) {
-			cyclePeriod.setEnabled(btnCycle.getSelection());
-		}
-	}
-
-	private class UpdateListener implements Listener {
-
-		public void handleEvent(Event event) {
-			StatechartLaunchConfigurationTab.this.updateLaunchConfigurationDialog();
-		}
-
-	}
-
-}
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.simulation.ui.sexec.launch.tabs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchTab;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
+import org.yakindu.sct.commons.WorkspaceClassLoaderFactory;
+import org.yakindu.sct.simulation.core.sexec.launch.ISCTLaunchParameters;
+import org.yakindu.sct.simulation.ui.SimulationImages;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class StatechartLaunchConfigurationTab extends JavaLaunchTab implements ISCTLaunchParameters {
+
+
+	public static final String LAUNCH_TAB_ID = "org.yakindu.sct.simulation.sexec.launchTab";
+	
+	
+	private Text modelfile;
+	private Text cyclePeriod;
+	private Text operationClass;
+	private Button btnCycle;
+	private Button btnEvent;
+
+	public void createControl(Composite parent) {
+		Composite comp = new Composite(parent, SWT.NONE);
+		setControl(comp);
+		comp.setLayout(new GridLayout(1, true));
+		createFileSelectionGroup(comp);
+		new Label(comp, SWT.NONE);
+	}
+
+	private void createFileSelectionGroup(Composite comp) {
+		createModelFileGroup(comp);
+		createOperationClassGroup(comp);
+		createExecutionTypeControls(comp);
+		createCyclePeriodGroup(comp);
+	}
+
+	private void createOperationClassGroup(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Operation class:");
+		propertyGroup.setLayout(new GridLayout(1, false));
+		operationClass = new Text(propertyGroup, SWT.BORDER);
+		operationClass.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(operationClass);
+	}
+
+	private void createExecutionTypeControls(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Execution type:");
+		propertyGroup.setLayout(new GridLayout(1, true));
+		btnCycle = new Button(propertyGroup, SWT.RADIO);
+		btnCycle.setText("cycle-based");
+		btnCycle.addListener(SWT.Selection, new UpdateListener());
+		btnCycle.addListener(SWT.Selection, new EnableStateListener());
+		GridDataFactory.fillDefaults().applyTo(btnCycle);
+		btnEvent = new Button(propertyGroup, SWT.RADIO);
+		btnEvent.setText("event-driven");
+		btnEvent.addListener(SWT.Selection, new UpdateListener());
+		btnCycle.addListener(SWT.Selection, new EnableStateListener());
+		GridDataFactory.fillDefaults().applyTo(btnEvent);
+	}
+
+	private void createCyclePeriodGroup(Composite parent) {
+		Group propertyGroup = new Group(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(propertyGroup);
+		propertyGroup.setText("Cycle period:");
+		propertyGroup.setLayout(new GridLayout(2, false));
+		cyclePeriod = new Text(propertyGroup, SWT.BORDER);
+		cyclePeriod.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(cyclePeriod);
+		Label lblMs = new Label(propertyGroup, SWT.NONE);
+		lblMs.setText("ms");
+		GridDataFactory.fillDefaults().applyTo(lblMs);
+	}
+
+	private void createModelFileGroup(Composite comp) {
+		Group fileGroup = new Group(comp, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(fileGroup);
+		fileGroup.setText("Model file:");
+		fileGroup.setLayout(new GridLayout(2, false));
+
+		modelfile = new Text(fileGroup, SWT.BORDER);
+		modelfile.addListener(SWT.Modify, new UpdateListener());
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(modelfile);
+
+		Button browse = new Button(fileGroup, SWT.NONE);
+		browse.setText("Search");
+		browse.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(),
+						getStatechartResources()) {
+					@Override
+					protected String adjustPattern() {
+						String pattern = super.adjustPattern();
+						if (pattern.equals("")) {
+							return "*";
+						}
+						return pattern;
+					}
+				};
+				dialog.setTitle("Select Statechart model");
+				dialog.setMessage("Please select the YAKINDU statechart model file you want to execute.");
+				if (dialog.open() == 0) {
+					Object[] files = dialog.getResult();
+					IFile file = (IFile) files[0];
+					modelfile.setText((file.getFullPath().toString()));
+				}
+			}
+
+			private IResource[] getStatechartResources() {
+				final List<IResource> resources = new ArrayList<IResource>();
+				try {
+					ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
+						public boolean visit(IResource resource) throws CoreException {
+							if ("sct".equalsIgnoreCase(resource.getFileExtension())) {
+								resources.add(resource);
+							}
+							return true;
+						}
+					});
+				} catch (CoreException e) {
+					e.printStackTrace();
+				}
+				return resources.toArray(new IResource[0]);
+			}
+		});
+		GridDataFactory.fillDefaults().applyTo(browse);
+	}
+
+	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
+	}
+
+	public void initializeFrom(ILaunchConfiguration configuration) {
+		try {
+			modelfile.setText(configuration.getAttribute(FILE_NAME, DEFAULT_FILE_NAME));
+			operationClass.setText(configuration.getAttribute(OPERATION_CLASS, DEFAULT_OPERATION_CLASS));
+			cyclePeriod.setText(String.valueOf(configuration.getAttribute(CYCLE_PERIOD, DEFAULT_CYCLE_PERIOD)));
+			btnCycle.setSelection(configuration.getAttribute(IS_CYCLE_BASED, DEFAULT_IS_CYCLE_BASED));
+			btnEvent.setSelection(configuration.getAttribute(IS_EVENT_DRIVEN, DEFAULT_IS_EVENT_DRIVEN));
+			cyclePeriod.setEnabled(btnCycle.getSelection());
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+		configuration.setAttribute(FILE_NAME, modelfile.getText());
+		configuration.setAttribute(OPERATION_CLASS, operationClass.getText());
+		if (isCyclePeriodValid()) {
+			configuration.setAttribute(CYCLE_PERIOD, getCyclePeriod());
+		}
+		configuration.setAttribute(IS_CYCLE_BASED, btnCycle.getSelection());
+		configuration.setAttribute(IS_EVENT_DRIVEN, btnEvent.getSelection());
+	}
+
+	private int getCyclePeriod() {
+		return Integer.parseInt(cyclePeriod.getText());
+	}
+
+	public String getName() {
+		return "Main";
+	}
+
+	@Override
+	public Image getImage() {
+		return SimulationImages.LAUNCHER_ICON.image();
+	}
+
+	protected Set<String> getOperationClasses() {
+		String operationClasses = this.operationClass.getText();
+		Set<String> result = new HashSet<String>();
+		if (operationClasses.trim().length() > 0) {
+			String[] split = operationClasses.split(",");
+			for (String string : split) {
+				result.add(string.trim());
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public boolean isValid(ILaunchConfiguration launchConfig) {
+		setMessage(null);
+		setErrorMessage(null);
+		String model = this.modelfile.getText().trim();
+		if (model.length() > 0)
+			if (ResourcesPlugin.getWorkspace().getRoot().findMember(model) == null) {
+				setErrorMessage("file " + model + " does not exist!");
+				return false;
+			}
+		String cyclePeriod = this.cyclePeriod.getText();
+		if (cyclePeriod.length() == 0) {
+			setErrorMessage("Empty cycle period!");
+			return false;
+		} else if (!isCyclePeriodValid()) {
+			setErrorMessage("Cycle Period must be a number!");
+			return false;
+		}
+		Set<String> operationClasses = getOperationClasses();
+		if (operationClasses.size() > 0) {
+			for (String clazz : operationClasses) {
+				// check if class exists
+				IProject project = ResourcesPlugin.getWorkspace().getRoot().findMember(model).getProject();
+				if (project != null) {
+					ClassLoader classLoader = new WorkspaceClassLoaderFactory().createClassLoader(project, getClass()
+							.getClassLoader());
+					try {
+						Class<?> loadClass = classLoader.loadClass(clazz);
+						loadClass.newInstance();
+					} catch (ClassNotFoundException e) {
+						setErrorMessage("Class " + clazz + " not found in project " + project.getName() + "!");
+						return false;
+					} catch (InstantiationException e) {
+						setErrorMessage("Could not instantiate class " + clazz
+								+ "! (No default constructor available?) ");
+						return false;
+					} catch (IllegalAccessException e) {
+						setErrorMessage("Could not access class constructor for class" + clazz + "!");
+						return false;
+					}catch(Throwable t){
+						setErrorMessage(t.getMessage());
+						return false;
+					}
+				}
+			}
+		}
+		// check for default c'tor
+		return super.isValid(launchConfig);
+	}
+
+	private boolean isCyclePeriodValid() {
+		try {
+			getCyclePeriod();
+		} catch (NumberFormatException ex) {
+			return false;
+		}
+		return true;
+	}
+	
+	
+	
+
+	@Override
+	public String getId() {
+		return LAUNCH_TAB_ID;
+	}
+
+
+
+
+	private class EnableStateListener implements Listener {
+		public void handleEvent(Event event) {
+			cyclePeriod.setEnabled(btnCycle.getSelection());
+		}
+	}
+
+	private class UpdateListener implements Listener {
+
+		public void handleEvent(Event event) {
+			StatechartLaunchConfigurationTab.this.updateLaunchConfigurationDialog();
+		}
+
+	}
+
+}

+ 109 - 109
plugins/org.yakindu.sct.simulation.ui/plugin.xml

@@ -1,109 +1,109 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-	<!-- Editor Highlighting Adapter -->
-   <extension
-         point="org.eclipse.core.runtime.adapters">
-      <factory
-            adaptableType="org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor"
-            class="org.yakindu.sct.simulation.ui.model.presenter.IHighlightingSupportAdapterFactory">
-         <adapter
-               type="org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport">
-         </adapter>
-      </factory>
-   </extension>
-	
-<!-- Session Listener -->
- <extension
-       point="org.eclipse.ui.views">
-    <category 
-           id="org.yakindu.sct.category"
-           name="YAKINDU SCT"/>
-    <view
-    	  category="org.yakindu.sct.category"
-          allowMultiple="false"
-          class="org.yakindu.sct.simulation.ui.view.SimulationView"
-          icon="icons/Declarations-View-16.gif"
-          id="org.yakindu.sct.simulation.ui.declarationview"
-          name="Simulation View"
-          restorable="true">
-    </view>
- </extension>
- <extension
-       point="org.eclipse.debug.core.statusHandlers">
-    <statusHandler
-          class="org.yakindu.sct.simulation.ui.handler.GenericStatusHandler"
-          code="200"
-          id="org.yakindu.sct.simulation.ui.statushandler"
-          plugin="org.yakindu.sct.simulation.core">
-    </statusHandler>
- </extension>
-  <extension
-       point="org.eclipse.debug.core.statusHandlers">
-    <statusHandler
-          class="org.yakindu.sct.simulation.ui.handler.TerminateLaunchStatusHandler"
-          code="765"
-          id="org.yakindu.sct.simulation.ui.statushandler"
-          plugin="org.yakindu.sct.simulation.core">
-    </statusHandler>
- </extension>
- 
- <!-- Source Display Adapter factory -->
- <extension
-       point="org.eclipse.core.runtime.adapters">
-    <factory
-          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTStackFrame"
-          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
-       <adapter
-             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
-       </adapter>
-    </factory>
-     <factory
-          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTDebugThread"
-          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
-       <adapter
-             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
-       </adapter>
-    </factory>
-     <factory
-          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTDebugTarget"
-          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
-       <adapter
-             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
-       </adapter>
-    </factory>
-     <factory
-          adaptableType="org.eclipse.debug.core.Launch"
-          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
-       <adapter
-             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
-       </adapter>
-    </factory>
- </extension>
- <extension
-       point="org.eclipse.ui.preferencePages">
-    <page
-          class="org.yakindu.sct.simulation.ui.preferences.SimulationPreferencePage"
-          id="org.yakindu.sct.simulation.ui.preferences.SimulationPreferencePage"
-          name="Simulation"
-          category="org.yakindu.sct.ui.preferences.root">
-    </page>
- </extension>
- <extension
-       point="org.eclipse.core.runtime.preferences">
-    <initializer
-          class="org.yakindu.sct.simulation.ui.preferences.PreferenceInitializer">
-    </initializer>
- </extension>
- <extension
-       point="org.eclipse.ui.startup">
-    <startup
-          class="org.yakindu.sct.simulation.ui.SimulationActivator"></startup>
- </extension>
-    <!-- Decoration Providers -->
-   <extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders"> 
-		<decoratorProvider class="org.yakindu.sct.simulation.ui.view.decorator.HighlightingSubmachineDecorationProvider"> 
-			<Priority name="Medium" />
- 		</decoratorProvider> 
- </extension> 
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+	<!-- Editor Highlighting Adapter -->
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+      <factory
+            adaptableType="org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor"
+            class="org.yakindu.sct.simulation.ui.model.presenter.IHighlightingSupportAdapterFactory">
+         <adapter
+               type="org.yakindu.base.gmf.runtime.highlighting.IHighlightingSupport">
+         </adapter>
+      </factory>
+   </extension>
+	
+<!-- Session Listener -->
+ <extension
+       point="org.eclipse.ui.views">
+    <category 
+           id="org.yakindu.sct.category"
+           name="YAKINDU SCT"/>
+    <view
+    	  category="org.yakindu.sct.category"
+          allowMultiple="false"
+          class="org.yakindu.sct.simulation.ui.view.SimulationView"
+          icon="icons/Declarations-View-16.gif"
+          id="org.yakindu.sct.simulation.ui.declarationview"
+          name="Simulation"
+          restorable="true">
+    </view>
+ </extension>
+ <extension
+       point="org.eclipse.debug.core.statusHandlers">
+    <statusHandler
+          class="org.yakindu.sct.simulation.ui.handler.GenericStatusHandler"
+          code="200"
+          id="org.yakindu.sct.simulation.ui.statushandler"
+          plugin="org.yakindu.sct.simulation.core">
+    </statusHandler>
+ </extension>
+  <extension
+       point="org.eclipse.debug.core.statusHandlers">
+    <statusHandler
+          class="org.yakindu.sct.simulation.ui.handler.TerminateLaunchStatusHandler"
+          code="765"
+          id="org.yakindu.sct.simulation.ui.statushandler"
+          plugin="org.yakindu.sct.simulation.core">
+    </statusHandler>
+ </extension>
+ 
+ <!-- Source Display Adapter factory -->
+ <extension
+       point="org.eclipse.core.runtime.adapters">
+    <factory
+          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTStackFrame"
+          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
+       <adapter
+             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
+       </adapter>
+    </factory>
+     <factory
+          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTDebugThread"
+          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
+       <adapter
+             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
+       </adapter>
+    </factory>
+     <factory
+          adaptableType="org.yakindu.sct.simulation.core.debugmodel.SCTDebugTarget"
+          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
+       <adapter
+             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
+       </adapter>
+    </factory>
+     <factory
+          adaptableType="org.eclipse.debug.core.Launch"
+          class="org.yakindu.sct.simulation.ui.model.presenter.SCTSourceDisplayAdapterFactory">
+       <adapter
+             type="org.eclipse.debug.ui.sourcelookup.ISourceDisplay">
+       </adapter>
+    </factory>
+ </extension>
+ <extension
+       point="org.eclipse.ui.preferencePages">
+    <page
+          class="org.yakindu.sct.simulation.ui.preferences.SimulationPreferencePage"
+          id="org.yakindu.sct.simulation.ui.preferences.SimulationPreferencePage"
+          name="Simulation"
+          category="org.yakindu.sct.ui.preferences.root">
+    </page>
+ </extension>
+ <extension
+       point="org.eclipse.core.runtime.preferences">
+    <initializer
+          class="org.yakindu.sct.simulation.ui.preferences.PreferenceInitializer">
+    </initializer>
+ </extension>
+ <extension
+       point="org.eclipse.ui.startup">
+    <startup
+          class="org.yakindu.sct.simulation.ui.SimulationActivator"></startup>
+ </extension>
+    <!-- Decoration Providers -->
+   <extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders"> 
+		<decoratorProvider class="org.yakindu.sct.simulation.ui.view.decorator.HighlightingSubmachineDecorationProvider"> 
+			<Priority name="Medium" />
+ 		</decoratorProvider> 
+ </extension> 
+</plugin>

+ 1 - 1
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/DomainWizardPage.java

@@ -61,7 +61,7 @@ public class DomainWizardPage extends WizardPage {
 		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
 		GridLayoutFactory.fillDefaults().applyTo(composite);
 		final Group domainSelectionGroup = new Group(composite, SWT.NONE);
-		domainSelectionGroup.setText("Select the Statechart domain:");
+		domainSelectionGroup.setText("Select the statechart domain:");
 
 		GridLayoutFactory.fillDefaults().numColumns(2).applyTo(domainSelectionGroup);
 		GridDataFactory.fillDefaults().grab(true, true).applyTo(domainSelectionGroup);