1 11 package org.eclipse.debug.internal.ui.actions; 12 13 import org.eclipse.debug.ui.IDebugView; 14 import org.eclipse.jface.action.IAction; 15 import org.eclipse.jface.viewers.Viewer; 16 import org.eclipse.swt.widgets.Control; 17 import org.eclipse.swt.widgets.Tree; 18 import org.eclipse.ui.IViewPart; 19 20 public abstract class SelectAllAction extends AbstractRemoveAllActionDelegate { 21 22 private IViewPart fView; 23 24 27 public void init(IViewPart view) { 28 fView = view; 29 IDebugView debugView = (IDebugView) getView().getAdapter(IDebugView.class); 30 if (debugView != null) { 31 debugView.setAction(getActionId(), getAction()); 32 } 33 super.init(view); 34 } 35 36 protected IViewPart getView() { 37 return fView; 38 } 39 40 protected abstract String getActionId(); 41 42 45 public void run(IAction action){ 46 if (!(getView() instanceof IDebugView)) { 47 return; 48 } 49 Viewer viewer = ((IDebugView) getView()).getViewer(); 50 Control control = viewer.getControl(); 51 if (control instanceof Tree) { 52 ((Tree)control).selectAll(); 53 } 54 } 55 56 } 57 | Popular Tags |