KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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 import org.eclipse.debug.ui.DebugPopup;
14 import org.eclipse.debug.ui.InspectPopupDialog;
15 import org.eclipse.jdt.debug.eval.IEvaluationResult;
16 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
17 import org.eclipse.jdt.internal.debug.ui.display.JavaInspectExpression;
18 import org.eclipse.swt.custom.StyledText;
19 import org.eclipse.ui.IWorkbenchPart;
20
21 public class PopupInspectAction extends InspectAction {
22
23     public static final String JavaDoc ACTION_DEFININITION_ID = "org.eclipse.jdt.debug.ui.commands.Inspect"; //$NON-NLS-1$
24

25     JavaInspectExpression expression;
26
27     /**
28      * @see EvaluateAction#displayResult(IEvaluationResult)
29      */

30     protected void displayResult(final IEvaluationResult result) {
31         IWorkbenchPart part = getTargetPart();
32         final StyledText styledText = getStyledText(part);
33         if (styledText == null) {
34             super.displayResult(result);
35         } else {
36             expression = new JavaInspectExpression(result);
37             JDIDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable JavaDoc() {
38                 public void run() {
39                     showPopup(styledText);
40                 }
41             });
42         }
43
44         evaluationCleanup();
45     }
46
47     protected void showPopup(StyledText textWidget) {
48         DebugPopup displayPopup = new InspectPopupDialog(getShell(), getPopupAnchor(textWidget), ACTION_DEFININITION_ID, expression);
49         displayPopup.open();
50     }
51
52 }
53
Popular Tags