Pārlūkot izejas kodu

Added validation rule for empty names

Andreas Mülder 14 gadi atpakaļ
vecāks
revīzija
a510946e7b

+ 1 - 0
plugins/org.yakindu.sct.model.statechart/build.properties

@@ -15,3 +15,4 @@ bin.includes = .,\
 jars.compile.order = .
 source.. = src/
 output.. = bin/
+jre.compilation.profile = J2SE-1.5

+ 0 - 1
plugins/org.yakindu.sct.model.statechart/src/org/yakindu/model/sct/statechart/impl/StatechartFactoryImpl.java

@@ -16,7 +16,6 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.impl.EFactoryImpl;
 import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.yakindu.model.sct.statechart.*;
 import org.yakindu.model.sct.statechart.Choice;
 import org.yakindu.model.sct.statechart.Entry;
 import org.yakindu.model.sct.statechart.EntryKind;

+ 0 - 1
plugins/org.yakindu.sct.model.statechart/src/org/yakindu/model/sct/statechart/util/StatechartAdapterFactory.java

@@ -14,7 +14,6 @@ import org.eclipse.emf.common.notify.Adapter;
 import org.eclipse.emf.common.notify.Notifier;
 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
 import org.eclipse.emf.ecore.EObject;
-import org.yakindu.model.sct.statechart.*;
 import org.yakindu.model.sct.statechart.Choice;
 import org.yakindu.model.sct.statechart.Declaration;
 import org.yakindu.model.sct.statechart.Effect;

+ 0 - 1
plugins/org.yakindu.sct.model.statechart/src/org/yakindu/model/sct/statechart/util/StatechartSwitch.java

@@ -13,7 +13,6 @@ package org.yakindu.model.sct.statechart.util;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.util.Switch;
-import org.yakindu.model.sct.statechart.*;
 import org.yakindu.model.sct.statechart.Choice;
 import org.yakindu.model.sct.statechart.Declaration;
 import org.yakindu.model.sct.statechart.Effect;

+ 6 - 16
plugins/org.yakindu.sct.model.statechart/src/org/yakindu/model/sct/statechart/util/StatechartValidator.java

@@ -19,7 +19,6 @@ import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.ResourceLocator;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.util.EObjectValidator;
-import org.yakindu.model.sct.statechart.*;
 import org.yakindu.model.sct.statechart.Choice;
 import org.yakindu.model.sct.statechart.Declaration;
 import org.yakindu.model.sct.statechart.Effect;
@@ -369,25 +368,16 @@ public class StatechartValidator extends EObjectValidator {
 	 * Validates the NameIsNotEmpty constraint of '<em>State</em>'. <!--
 	 * begin-user-doc --> <!-- end-user-doc -->
 	 * 
-	 * @generated
+	 * @generated NOT
 	 */
 	public boolean validateState_NameIsNotEmpty(State state,
 			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		// TODO implement the constraint
-		// -> specify the condition that violates the constraint
-		// -> verify the diagnostic details, including severity, code, and message
-		// Ensure that you remove @generated or mark it @generated NOT
-		if (false) {
+		if (state.getName() == null || state.getName().length() == 0) {
 			if (diagnostics != null) {
-				diagnostics.add
-					(createDiagnostic
-						(Diagnostic.ERROR,
-						 DIAGNOSTIC_SOURCE,
-						 0,
-						 "_UI_GenericConstraint_diagnostic",
-						 new Object[] { "NameIsNotEmpty", getObjectLabel(state, context) },
-						 new Object[] { state },
-						 context));
+				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
+						DIAGNOSTIC_SOURCE, 0,
+						"A state should have a name.",
+						new Object[] { state }));
 			}
 			return false;
 		}