package hu.elte.txtuml.validation.common;

import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.dom.ASTNode;

/**
 * Base class for all txtUML validation problems.
 * <p>
 * By default, {@link #isError}, {@link #isWarning} and {@link isInfo} all
 * return false.
 */
public abstract class AbstractValidationProblem extends CategorizedProblem implements IValidationProblem {

	private final SourceInfo sourceInfo;
	private int sourceStart;
	private int sourceEnd;
	private int lineNumber;

	public AbstractValidationProblem(SourceInfo sourceInfo, ASTNode node) {
		this.sourceInfo = sourceInfo;
		this.sourceStart = node.getStartPosition();
		this.sourceEnd = node.getStartPosition() + node.getLength() - 1;
		this.lineNumber = sourceInfo.getSourceLineNumber(getSourceEnd());
	}

	@Override
	public String[] getArguments() {
		return new String[0];
	}

	@Override
	public char[] getOriginatingFileName() {
		return sourceInfo.getOriginatingFileName().toCharArray();
	}

	@Override
	public int getCategoryID() {
		return 0;
	}

	@Override
	public boolean isError() {
		return false;
	}

	@Override
	public boolean isWarning() {
		return false;
	}

	@Override
	public boolean isInfo() {
		return super.isInfo();
	}

	@Override
	public int getSourceStart() {
		return sourceStart;
	}

	@Override
	public int getSourceEnd() {
		return sourceEnd;
	}

	@Override
	public int getSourceLineNumber() {
		return lineNumber;
	}

	@Override
	public void setSourceStart(int sourceStart) {
		this.sourceStart = sourceStart;
	}

	@Override
	public void setSourceEnd(int sourceEnd) {
		this.sourceEnd = sourceEnd;
	}

	@Override
	public void setSourceLineNumber(int lineNumber) {
		this.lineNumber = lineNumber;
	}

}

@@ -133,16 +133,109 @@
 ASTNode;
+%0Aimport org.eclipse.jdt.core.dom.SimpleType;%0Aimport org.eclipse.jdt.core.dom.TypeDeclaration;
 %0A%0A/**%0A *
@@ -764,72 +764,390 @@
 ;%0A%09%09
-this.sourceEnd = node.getStartPosition() + node.getLength() - 1;
+if(ASTNode.nodeClassForType(node.getNodeType()) == TypeDeclaration.class)%7B%0A%09%09%09//identifier%0A%09%09%09this.sourceEnd = node.getStartPosition() + node.getLength() - 1;%0A%09%09%7Delse if(ASTNode.nodeClassForType(node.getNodeType()) ==  SimpleType.class)%7B%0A%09%09%09this.sourceEnd = node.getStartPosition() + node.getLength();%0A%09%09%7Delse%7B%0A%09%09%09this.sourceEnd = node.getStartPosition() + node.getLength() - 1;%0A%09%09%7D
 %0A%09%09t

Add an if statement for calculating error ending