1 11 package org.eclipse.debug.internal.ui.actions.expressions; 12 13 14 import org.eclipse.debug.core.DebugPlugin; 15 import org.eclipse.debug.core.IExpressionManager; 16 import org.eclipse.debug.core.IExpressionsListener; 17 import org.eclipse.debug.core.model.IExpression; 18 import org.eclipse.debug.internal.ui.DebugUIPlugin; 19 import org.eclipse.debug.internal.ui.actions.AbstractRemoveAllActionDelegate; 20 import org.eclipse.debug.internal.ui.actions.ActionMessages; 21 import org.eclipse.jface.action.IAction; 22 import org.eclipse.jface.dialogs.MessageDialog; 23 import org.eclipse.ui.IWorkbenchWindow; 24 25 28 public class RemoveAllExpressionsAction extends AbstractRemoveAllActionDelegate implements IExpressionsListener { 29 30 33 public void run(IAction action) { 34 IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); 35 if (window != null) { 36 boolean proceed = MessageDialog.openQuestion(window.getShell(), ActionMessages.RemoveAllExpressionsAction_0, ActionMessages.RemoveAllExpressionsAction_1); 37 if (proceed) { 38 IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager(); 39 IExpression[] expressions= manager.getExpressions(); 40 manager.removeExpressions(expressions); 41 } 42 } 43 } 44 45 48 protected boolean isEnabled() { 49 return DebugPlugin.getDefault().getExpressionManager().hasExpressions(); 50 } 51 52 55 protected void initialize() { 56 DebugPlugin.getDefault().getExpressionManager().addExpressionListener(this); 57 } 58 59 62 public void dispose() { 63 DebugPlugin.getDefault().getExpressionManager().removeExpressionListener(this); 64 super.dispose(); 65 } 66 67 70 public void expressionsAdded(IExpression[] expressions) { 71 update(); 72 } 73 74 77 public void expressionsRemoved(IExpression[] expressions) { 78 update(); 79 } 80 81 84 public void expressionsChanged(IExpression[] expressions) {} 85 } 86 | Popular Tags |