KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > variables > ToggleLogicalStructureAction


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.variables;
12
13 import org.eclipse.debug.internal.ui.DebugPluginImages;
14 import org.eclipse.debug.internal.ui.DebugUIPlugin;
15 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
16 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
17 import org.eclipse.jface.action.Action;
18 import org.eclipse.jface.action.IAction;
19 import org.eclipse.swt.custom.BusyIndicator;
20 import org.eclipse.ui.PlatformUI;
21
22 /**
23  * Action to toggle the use of contributed variables content providers on and off.
24  * When on, all registered variables content providers for the current debug model
25  * are used. When off, the default content provider (that shows all children)
26  * is used for all debug models.
27  */

28 public class ToggleLogicalStructureAction extends Action {
29     
30     private VariablesView fView;
31
32     public ToggleLogicalStructureAction(VariablesView view) {
33         super(null, IAction.AS_CHECK_BOX);
34         setView(view);
35         setToolTipText(VariablesViewMessages.ToggleObjectBrowsersAction_1);
36         setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_SHOW_LOGICAL_STRUCTURE));
37         setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_SHOW_LOGICAL_STRUCTURE));
38         setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SHOW_LOGICAL_STRUCTURE));
39         setId(DebugUIPlugin.getUniqueIdentifier() + ".ToggleObjectBrowsersAction"); //$NON-NLS-1$
40
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.VARIABLES_CONTENT_PROVIDERS_ACTION);
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.jface.action.Action#run()
45      */

46     public void run() {
47         if (!getView().isAvailable()) {
48             return;
49         }
50         getView().setShowLogicalStructure(isChecked());
51         BusyIndicator.showWhile(getView().getViewer().getControl().getDisplay(), new Runnable JavaDoc() {
52             public void run() {
53                 getView().getViewer().refresh();
54             }
55         });
56     }
57     
58     /* (non-Javadoc)
59      * @see org.eclipse.jface.action.Action#setChecked(boolean)
60      */

61     public void setChecked(boolean value) {
62         super.setChecked(value);
63     }
64     
65     protected VariablesView getView() {
66         return fView;
67     }
68
69     protected void setView(VariablesView view) {
70         fView = view;
71     }
72
73 }
74
Popular Tags