| /** |
| * This file was copied and re-packaged automatically by |
| * org.eclipse.qvtd.doc.miniocl.build.MiniOCLBuildEverything |
| * from |
| * ..\..\plugins\org.eclipse.qvtd.cs2as.xtext.runtime\src\org\eclipse\qvtd\cs2as\xtext\runtime\CS2ASExceptionDiagnostic.java |
| * |
| * Do not edit this file. |
| */ |
| /******************************************************************************* |
| * Copyright (c) 2015, 2021 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.qvtd.doc.minioclcs.xtext.tx; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.xtext.diagnostics.ExceptionDiagnostic; |
| import org.eclipse.xtext.nodemodel.ICompositeNode; |
| import org.eclipse.xtext.nodemodel.util.NodeModelUtils; |
| |
| public class CS2ASExceptionDiagnostic extends ExceptionDiagnostic |
| { |
| protected final @NonNull EObject csObject; |
| |
| public CS2ASExceptionDiagnostic(@NonNull CS2ASException exception) { |
| super(exception); |
| csObject = exception.getCSObject(); |
| } |
| |
| @Override |
| public int getLength() { |
| ICompositeNode node = NodeModelUtils.getNode(csObject); |
| return node != null ? node.getLength() : 0; |
| } |
| |
| @Override |
| public int getOffset() { |
| ICompositeNode node = NodeModelUtils.getNode(csObject); |
| return node != null ? node.getOffset() : 0; |
| } |
| |
| @Override |
| public int getLine() { |
| ICompositeNode node = NodeModelUtils.getNode(csObject); |
| return node != null ? node.getStartLine()+1 : 1; |
| } |
| } |