| /******************************************************************************* |
| * Copyright (c) 2004-2008 Akos Horvath, Gergely Varro and Daniel Varro |
| * 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: |
| * Akos Horvath, Gergely Varro - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.gtasm.patternmatcher.exceptions; |
| |
| import java.util.ArrayList; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.viatra2.gtasm.interpreter.exception.GTASMException; |
| import org.eclipse.viatra2.gtasm.interpreter.exception.ViatraTransformationException; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.AnnotatedElement; |
| |
| /**Runtime exception for the pattern matcher |
| * @author Akos Horvath |
| * |
| */ |
| public class PatternMatcherRuntimeException extends PatternMatcherException { |
| |
| private static final long serialVersionUID = 1232944439371423778L; |
| |
| public PatternMatcherRuntimeException(String msg, String[] context, AnnotatedElement element) { |
| super(msg, context, element); |
| } |
| |
| public PatternMatcherRuntimeException(ViatraTransformationException e,AnnotatedElement element) { |
| super(e.getMessage(),null,null); |
| if(e instanceof GTASMException) |
| { |
| GTASMException exception = (GTASMException)e; |
| ArrayList<StackTraceElement> trace = new ArrayList<StackTraceElement>(exception.getStackTraceCollection()); |
| this.interpreterStackTrace.addAll(trace); |
| } |
| } |
| |
| @Override |
| public PatternMatcherRuntimeException addNewStackElement(EObject element) { |
| if(element != null && element instanceof AnnotatedElement) |
| { |
| StackTraceElement _ste = createStackTraceElement((AnnotatedElement)element); |
| interpreterStackTrace.add(_ste); |
| } |
| return this; |
| } |
| }
|