Commit f3668dfd authored by Daniel Honsel's avatar Daniel Honsel
Browse files

fixed some output issues

parent 17138532
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -649,6 +649,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {

		var TTCN3Reference detailDef = null
		var notReferenced = false
		var boolean showEndLine = false

		if (definition.def instanceof ConstDef) {
			val constDefList = (definition.def as ConstDef).defs as ConstList
@@ -707,6 +708,7 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
				} else if (body.structured.port != null && body.structured.port instanceof PortDef) {
					notReferenced = body.structured.port.isUnreferenced(parentModule)
					detailDef = body.structured.port as PortDef
					showEndLine = true
				} else if (body.structured.component != null && body.structured.component instanceof ComponentDef) {
					notReferenced = body.structured.component.isUnreferenced(parentModule)
					detailDef = body.structured.component as ComponentDef
@@ -726,12 +728,18 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
			statistics.incrementCountStyle
			val message = "Definition for \"" + detailDef.name + "\" is never referenced!"
			val INode node = NodeModelUtils.getNode(detailDef)
			var endLine = ""
			if (showEndLine) {
				endLine = node.endLine.toString
			} else {
				endLine = node.startLine.toString
			}
			warning(
				message,
				null,
				MessageClass.STYLE.toString,
				node.startLine.toString,
				node.startLine.toString, // only show the starting line
				endLine,
				"6.17, " + MiscTools.getMethodName()
			);
		}
+7 −1
Original line number Diff line number Diff line
@@ -407,12 +407,18 @@ public class NamingConventionsValidator extends AbstractDeclarativeValidator {
		if (!regExp.regExpMatch(object.name)) {
			TTCN3StatisticsProvider.getInstance.increaseCountNaming
			val message = "\"" + object.name + "\" does not comply to the naming conventions for \"" + type + "\"!"
			var endLine = ""
			if (object instanceof TTCN3Module) {
				endLine = node.startLine.toString
			} else {
				endLine = node.endLine.toString
			}
			warning(
				message,
				null,
				MessageClass.NAMING.toString,
				node.startLine.toString, // only output the starting line of the considered definition
				node.startLine.toString,
				endLine,
				"2.1, " + regExp
			);
			return;
+17 −15
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import org.eclipse.xtext.validation.EValidatorRegistrar

import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.*
import static extension org.eclipse.xtext.EcoreUtil2.*
import org.eclipse.emf.ecore.EObject

class StructureOfDataValidator extends AbstractDeclarativeValidator {
	val ConfigTools configTools = ConfigTools.getInstance;
@@ -137,25 +138,26 @@ class StructureOfDataValidator extends AbstractDeclarativeValidator {
			val types = port.body.attribs.getAllContentsOfType(Type)
			val signatures = port.body.attribs.getAllContentsOfType(Signature)
			for (t : types) {
				val ref = t.ref
				val ref = t.ref.referencedType
				if (ref != null) {
					switch ref {
						SignatureDef: portReferencedTypeCHeck(port, ref, "Signature")
						RecordDefNamed: portReferencedTypeCHeck(port, ref, "Message type")
						SetDefNamed: portReferencedTypeCHeck(port, ref, "Message type")
						SubTypeDefNamed: portReferencedTypeCHeck(port, ref, "Message type")
						SignatureDef: portReferencedTypeCHeck(port, ref, "Message type", t)
						RecordDefNamed: portReferencedTypeCHeck(port, ref, "Message type", t)
						SetDefNamed: portReferencedTypeCHeck(port, ref, "Message type", t)
						SubTypeDefNamed: portReferencedTypeCHeck(port, ref, "Message type", t)
					}
				}
			}
			for (s : signatures) {
				portReferencedTypeCHeck(port, s.ref, "Signature")
				portReferencedTypeCHeck(port, s.ref, "Signature", s)
			}
		}
	}

	private def portReferencedTypeCHeck(PortDef port, ReferencedType type, String typeName) {
	private def portReferencedTypeCHeck(PortDef port, ReferencedType type, String typeName, EObject reference) {
		val INode nodePort = NodeModelUtils.getNode(port)
		val INode nodeType = NodeModelUtils.getNode(type)
		val INode nodeRef = NodeModelUtils.getNode(reference)
		val TTCN3Module parentModulePort = port.findDesiredParent(TTCN3Module)
		val TTCN3Module parentModuleType = type.findDesiredParent(TTCN3Module)
		val GroupDef parentGroupPort = port.findDesiredParent(GroupDef)
@@ -172,8 +174,8 @@ class StructureOfDataValidator extends AbstractDeclarativeValidator {
				message,
				TTCN3Package.eINSTANCE.TTCN3Reference_Name,
				MessageClass.STRUCTURE.toString,
				nodeType.startLine.toString,
				nodeType.endLine.toString,
				nodeRef.startLine.toString,
				nodeRef.endLine.toString,
				"4.2, " + "checkPortMessageGrouping"
			);
			return;
@@ -190,8 +192,8 @@ class StructureOfDataValidator extends AbstractDeclarativeValidator {
				message,
				TTCN3Package.eINSTANCE.TTCN3Reference_Name,
				MessageClass.STRUCTURE.toString,
				nodeType.startLine.toString,
				nodeType.endLine.toString,
				nodeRef.startLine.toString,
				nodeRef.endLine.toString,
				"4.2, " + "checkPortMessageGrouping"
			);
			return;
@@ -210,8 +212,8 @@ class StructureOfDataValidator extends AbstractDeclarativeValidator {
					message,
					TTCN3Package.eINSTANCE.TTCN3Reference_Name,
					MessageClass.STRUCTURE.toString,
					nodeType.startLine.toString,
					nodeType.endLine.toString,
					nodeRef.startLine.toString,
					nodeRef.endLine.toString,
					"4.2, " + "checkPortMessageGrouping",
					LogLevel.INFORMATION.toString
				);
@@ -226,8 +228,8 @@ class StructureOfDataValidator extends AbstractDeclarativeValidator {
					message,
					TTCN3Package.eINSTANCE.TTCN3Reference_Name,
					MessageClass.STRUCTURE.toString,
					nodeType.startLine.toString,
					nodeType.endLine.toString,
					nodeRef.startLine.toString,
					nodeRef.endLine.toString,
					"4.2, " + "checkPortMessageGrouping"
				);
				return;