KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > ExecuteAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ui.actions;
12
13
14 import org.eclipse.jdt.debug.eval.IEvaluationResult;
15 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
16 import org.eclipse.jdt.internal.debug.ui.display.IDataDisplay;
17 import org.eclipse.jdt.internal.debug.ui.snippeteditor.JavaSnippetEditor;
18 import org.eclipse.swt.widgets.Display;
19 import org.eclipse.ui.IWorkbenchPart;
20
21 public class ExecuteAction extends EvaluateAction {
22
23     /**
24      * @see org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction#displayResult(org.eclipse.jdt.debug.eval.IEvaluationResult)
25      */

26     protected void displayResult(final IEvaluationResult result) {
27         if (result.hasErrors()) {
28             final Display display = JDIDebugUIPlugin.getStandardDisplay();
29             display.asyncExec(new Runnable JavaDoc() {
30                 public void run() {
31                     if (display.isDisposed()) {
32                         return;
33                     }
34                     reportErrors(result);
35                     evaluationCleanup();
36                 }
37             });
38         } else {
39             evaluationCleanup();
40         }
41     }
42
43     /**
44      * @see org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction#run()
45      */

46     protected void run() {
47         IWorkbenchPart part= getTargetPart();
48         if (part instanceof JavaSnippetEditor) {
49             ((JavaSnippetEditor)part).evalSelection(JavaSnippetEditor.RESULT_RUN);
50             return;
51         }
52         super.run();
53     }
54
55     /**
56      * @see org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction#getDataDisplay()
57      */

58     protected IDataDisplay getDataDisplay() {
59         return super.getDirectDataDisplay();
60     }
61
62 }
63
Popular Tags