| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. | 12 * the License. |
| 13 */ | 13 */ |
| 14 package com.google.dart.tools.debug.ui.internal.view; | 14 package com.google.dart.tools.debug.ui.internal.view; |
| 15 | 15 |
| 16 import com.google.dart.tools.debug.core.util.IDartDebugVariable; | 16 import com.google.dart.tools.debug.core.util.IDartDebugVariable; |
| 17 import com.google.dart.tools.internal.corext.refactoring.util.ReflectionUtils; | 17 import com.google.dart.tools.internal.corext.refactoring.util.ReflectionUtils; |
| 18 import com.google.dart.tools.ui.DartToolsPlugin; | 18 import com.google.dart.tools.ui.DartToolsPlugin; |
| 19 import com.google.dart.tools.ui.internal.util.SWTUtil; | 19 import com.google.dart.tools.ui.internal.util.SWTUtil; |
| 20 | 20 |
| 21 import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; | 21 import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; |
| 22 import org.eclipse.debug.internal.ui.views.variables.AvailableLogicalStructuresA
ction; |
| 22 import org.eclipse.debug.internal.ui.views.variables.VariablesView; | 23 import org.eclipse.debug.internal.ui.views.variables.VariablesView; |
| 24 import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPane
sAction; |
| 23 import org.eclipse.debug.internal.ui.views.variables.details.DetailPaneProxy; | 25 import org.eclipse.debug.internal.ui.views.variables.details.DetailPaneProxy; |
| 26 import org.eclipse.debug.ui.IDebugUIConstants; |
| 27 import org.eclipse.jface.action.IAction; |
| 28 import org.eclipse.jface.action.IMenuManager; |
| 24 import org.eclipse.jface.action.IToolBarManager; | 29 import org.eclipse.jface.action.IToolBarManager; |
| 30 import org.eclipse.jface.action.Separator; |
| 25 import org.eclipse.jface.preference.IPreferenceStore; | 31 import org.eclipse.jface.preference.IPreferenceStore; |
| 26 import org.eclipse.jface.util.IPropertyChangeListener; | 32 import org.eclipse.jface.util.IPropertyChangeListener; |
| 27 import org.eclipse.jface.util.PropertyChangeEvent; | 33 import org.eclipse.jface.util.PropertyChangeEvent; |
| 28 import org.eclipse.jface.viewers.ISelectionProvider; | 34 import org.eclipse.jface.viewers.ISelectionProvider; |
| 29 import org.eclipse.jface.viewers.StructuredSelection; | 35 import org.eclipse.jface.viewers.StructuredSelection; |
| 30 import org.eclipse.swt.SWT; | 36 import org.eclipse.swt.SWT; |
| 31 import org.eclipse.swt.custom.StyledText; | 37 import org.eclipse.swt.custom.StyledText; |
| 32 import org.eclipse.swt.widgets.Composite; | 38 import org.eclipse.swt.widgets.Composite; |
| 33 import org.eclipse.swt.widgets.Event; | 39 import org.eclipse.swt.widgets.Event; |
| 34 import org.eclipse.swt.widgets.Listener; | 40 import org.eclipse.swt.widgets.Listener; |
| 35 import org.eclipse.swt.widgets.Tree; | 41 import org.eclipse.swt.widgets.Tree; |
| 36 import org.eclipse.swt.widgets.TreeItem; | 42 import org.eclipse.swt.widgets.TreeItem; |
| 43 import org.eclipse.ui.IWorkbenchActionConstants; |
| 37 | 44 |
| 38 /** | 45 /** |
| 39 * This custom subclass of the debugger VariablesView allows us to customize the
actions that the | 46 * This custom subclass of the debugger VariablesView allows us to customize the
actions that the |
| 40 * view exposes, and override some visibility behavior that is necessary to embe
d this view in other | 47 * view exposes, and override some visibility behavior that is necessary to embe
d this view in other |
| 41 * views. | 48 * views. |
| 42 */ | 49 */ |
| 43 @SuppressWarnings("restriction") | 50 @SuppressWarnings("restriction") |
| 44 public class DartVariablesView extends VariablesView { | 51 public class DartVariablesView extends VariablesView { |
| 45 private boolean visible; | 52 private boolean visible; |
| 46 | 53 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 protected void configureToolBar(IToolBarManager tbm) { | 158 protected void configureToolBar(IToolBarManager tbm) { |
| 152 // tbm.add(new Separator(this.getClass().getName())); | 159 // tbm.add(new Separator(this.getClass().getName())); |
| 153 // tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP)); | 160 // tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP)); |
| 154 // | 161 // |
| 155 // //tbm.add(getAction("ShowTypeNames")); //$NON-NLS-1$ | 162 // //tbm.add(getAction("ShowTypeNames")); //$NON-NLS-1$ |
| 156 // tbm.add(getAction("ToggleContentProviders")); //$NON-NLS-1$ | 163 // tbm.add(getAction("ToggleContentProviders")); //$NON-NLS-1$ |
| 157 // //tbm.add(getAction("CollapseAll")); //$NON-NLS-1$ | 164 // //tbm.add(getAction("CollapseAll")); //$NON-NLS-1$ |
| 158 } | 165 } |
| 159 | 166 |
| 160 @Override | 167 @Override |
| 168 protected void fillContextMenu(IMenuManager menu) { |
| 169 menu.add(new Separator(IDebugUIConstants.EMPTY_VARIABLE_GROUP)); |
| 170 menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP)); |
| 171 menu.add(new Separator()); |
| 172 IAction action = new AvailableLogicalStructuresAction(this); |
| 173 if (action.isEnabled()) { |
| 174 menu.add(action); |
| 175 } |
| 176 action = new AvailableDetailPanesAction(this); |
| 177 if (isDetailPaneVisible() && action.isEnabled()) { |
| 178 menu.add(action); |
| 179 } |
| 180 menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP)); |
| 181 menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP)); |
| 182 menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); |
| 183 } |
| 184 |
| 185 @Override |
| 161 protected int[] getLastSashWeights() { | 186 protected int[] getLastSashWeights() { |
| 162 return new int[] {12, 4}; | 187 return new int[] {12, 4}; |
| 163 } | 188 } |
| 164 | 189 |
| 165 protected void updateColors() { | 190 protected void updateColors() { |
| 166 IPreferenceStore prefs = getPreferences(); | 191 IPreferenceStore prefs = getPreferences(); |
| 167 StyledText detailsText = getDetailsText(); | 192 StyledText detailsText = getDetailsText(); |
| 168 SWTUtil.setColors(treeViewer.getTree(), prefs); | 193 SWTUtil.setColors(treeViewer.getTree(), prefs); |
| 169 SWTUtil.setColors(detailsText, prefs); | 194 SWTUtil.setColors(detailsText, prefs); |
| 170 } | 195 } |
| 171 | 196 |
| 172 private void doPropertyChange(PropertyChangeEvent event) { | 197 private void doPropertyChange(PropertyChangeEvent event) { |
| 173 updateColors(); | 198 updateColors(); |
| 174 treeViewer.refresh(false); | 199 treeViewer.refresh(false); |
| 175 } | 200 } |
| 176 | 201 |
| 177 private StyledText getDetailsText() { | 202 private StyledText getDetailsText() { |
| 178 // Warning: fragile code! | 203 // Warning: fragile code! |
| 179 DetailPaneProxy detailProxy = ReflectionUtils.getFieldObject(this, "fDetailP
ane"); | 204 DetailPaneProxy detailProxy = ReflectionUtils.getFieldObject(this, "fDetailP
ane"); |
| 180 StyledText text = ReflectionUtils.getFieldObject(detailProxy, "fCurrentContr
ol"); | 205 StyledText text = ReflectionUtils.getFieldObject(detailProxy, "fCurrentContr
ol"); |
| 181 return text; | 206 return text; |
| 182 } | 207 } |
| 183 | 208 |
| 184 private IPreferenceStore getPreferences() { | 209 private IPreferenceStore getPreferences() { |
| 185 return preferences; | 210 return preferences; |
| 186 } | 211 } |
| 187 } | 212 } |
| OLD | NEW |