1 11 package org.eclipse.debug.internal.ui.views.variables; 12 13 import org.eclipse.debug.internal.ui.DebugUIPlugin; 14 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 15 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 16 import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer; 17 import org.eclipse.debug.ui.DebugUITools; 18 import org.eclipse.jface.action.Action; 19 import org.eclipse.jface.action.IAction; 20 import org.eclipse.swt.custom.BusyIndicator; 21 import org.eclipse.ui.PlatformUI; 22 import org.eclipse.ui.texteditor.IUpdate; 23 24 30 public class ToggleShowColumnsAction extends Action implements IUpdate { 31 32 private TreeModelViewer fViewer; 33 34 public ToggleShowColumnsAction(TreeModelViewer viewew) { 35 super(VariablesViewMessages.ToggleShowColumnsAction_0, IAction.AS_CHECK_BOX); 36 fViewer = viewew; 37 setToolTipText(VariablesViewMessages.ToggleShowColumnsAction_1); 38 setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB)); 39 setId(DebugUIPlugin.getUniqueIdentifier() + ".ToggleShowColumsAction"); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.SHOW_COLUMNS_ACTION); 41 } 42 43 46 public void run() { 47 if (fViewer.getControl().isDisposed()) { 48 return; 49 } 50 BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable () { 51 public void run() { 52 fViewer.setShowColumns(isChecked()); 53 } 54 }); 55 } 56 57 60 public void update() { 61 setEnabled(fViewer.canToggleColumns()); 62 setChecked(fViewer.isShowColumns()); 63 } 64 65 66 } 67 | Popular Tags |