KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > expression > ExpressionView


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.debug.internal.ui.views.expression;
12
13  
14 import org.eclipse.debug.core.DebugPlugin;
15 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
16 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
17 import org.eclipse.debug.internal.ui.views.variables.AvailableLogicalStructuresAction;
18 import org.eclipse.debug.internal.ui.views.variables.VariablesView;
19 import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
20 import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction;
21 import org.eclipse.debug.ui.IDebugUIConstants;
22 import org.eclipse.jface.action.IAction;
23 import org.eclipse.jface.action.IMenuManager;
24 import org.eclipse.jface.action.IToolBarManager;
25 import org.eclipse.jface.action.Separator;
26 import org.eclipse.jface.viewers.ISelection;
27 import org.eclipse.swt.SWT;
28 import org.eclipse.ui.IWorkbenchActionConstants;
29  
30 /**
31  * Displays expressions and their values with a detail
32  * pane.
33  */

34 public class ExpressionView extends VariablesView {
35     
36     /**
37      * @see AbstractDebugView#getHelpContextId()
38      */

39     protected String JavaDoc getHelpContextId() {
40         return IDebugHelpContextIds.EXPRESSION_VIEW;
41     }
42     
43     /**
44      * Initializes the viewer input on creation
45      */

46     protected void setInitialContent() {
47         getViewer().setInput(DebugPlugin.getDefault().getExpressionManager());
48     }
49     
50     /**
51      * Configures the toolBar.
52      *
53      * @param tbm The toolbar that will be configured
54      */

55     protected void configureToolBar(IToolBarManager tbm) {
56         super.configureToolBar(tbm);
57         tbm.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
58         tbm.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
59     }
60     
61    /**
62     * Adds items to the tree viewer's context menu including any extension defined
63     * actions.
64     *
65     * @param menu The menu to add the item to.
66     */

67     protected void fillContextMenu(IMenuManager menu) {
68
69         menu.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
70         menu.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
71         menu.add(getAction(VARIABLES_FIND_ELEMENT_ACTION));
72         menu.add(getAction("ChangeVariableValue")); //$NON-NLS-1$
73
menu.add(new Separator());
74         IAction action = new AvailableLogicalStructuresAction(this);
75         if (action.isEnabled()) {
76             menu.add(action);
77         }
78         action = new AvailableDetailPanesAction(this);
79         if (isDetailPaneVisible() && action.isEnabled()) {
80             menu.add(action);
81         }
82         menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
83         menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
84     }
85
86     protected void contextActivated(ISelection selection) {
87         if (!isVisible()) {
88             return;
89         }
90         // update actions
91
updateAction("ContentAssist"); //$NON-NLS-1$
92
updateAction(VARIABLES_FIND_ELEMENT_ACTION);
93         updateAction(FIND_ACTION);
94     }
95
96     /* (non-Javadoc)
97      * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getDetailPanePreferenceKey()
98      */

99     protected String JavaDoc getDetailPanePreferenceKey() {
100         return IDebugPreferenceConstants.EXPRESSIONS_DETAIL_PANE_ORIENTATION;
101     }
102
103     /* (non-Javadoc)
104      * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getToggleActionLabel()
105      */

106     protected String JavaDoc getToggleActionLabel() {
107         return VariablesViewMessages.ExpressionView_4;
108     }
109
110     /* (non-Javadoc)
111      * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#becomesVisible()
112      */

113     protected void becomesVisible() {
114         setInitialContent();
115         super.becomesVisible();
116     }
117     
118     /* (non-Javadoc)
119      * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getViewerStyle()
120      */

121     protected int getViewerStyle() {
122         return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL;
123     }
124
125     /* (non-Javadoc)
126      * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getPresentationContextId()
127      */

128     protected String JavaDoc getPresentationContextId() {
129         return IDebugUIConstants.ID_EXPRESSION_VIEW;
130     }
131     
132     
133 }
134
Popular Tags