KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > eval > ast > instructions > ThrowInstruction


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.eval.ast.instructions;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.jdt.debug.core.IJavaObject;
16 import org.eclipse.jdt.debug.core.IJavaThread;
17
18 /**
19  * Represent a throw instruction.
20  */

21 public class ThrowInstruction extends CompoundInstruction {
22
23     /**
24      * @param start
25      */

26     public ThrowInstruction(int start) {
27         super(start);
28     }
29
30     /**
31      * @see org.eclipse.jdt.internal.debug.eval.ast.instructions.Instruction#execute()
32      */

33     public void execute() throws CoreException {
34         IJavaObject exception= (IJavaObject)popValue();
35         final IJavaThread javaThread = getContext().getThread();
36         javaThread.stop(exception);
37         javaThread.queueRunnable(new Runnable JavaDoc() {
38             public void run() {
39                 try {
40                     javaThread.resume();
41                 } catch (DebugException e) {
42                     e.printStackTrace();
43                 }
44             }
45         });
46         stop();
47     }
48
49 }
50
Popular Tags