1 11 package org.eclipse.debug.internal.ui.actions.breakpointGroups; 12 13 import org.eclipse.debug.core.model.IBreakpoint; 14 import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; 15 import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; 16 import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer; 17 import org.eclipse.debug.ui.IDebugUIConstants; 18 import org.eclipse.jface.viewers.IStructuredSelection; 19 import org.eclipse.swt.widgets.Item; 20 21 24 public class RemoveFromWorkingSetAction extends BreakpointSelectionAction { 25 26 31 public RemoveFromWorkingSetAction(BreakpointsView view) { 32 super(BreakpointGroupMessages.RemoveFromWorkingSetAction_0, view); 33 } 34 35 38 public void run() { 39 BreakpointsViewer viewer = (BreakpointsViewer) getBreakpointsView().getViewer(); 40 Item[] items = viewer.getSelectedItems(); 41 IBreakpoint breakpoint = null; 42 BreakpointContainer container = null; 43 for(int i = 0; i < items.length; i++) { 44 if(items[i].getData() instanceof IBreakpoint) { 45 breakpoint = (IBreakpoint) items[i].getData(); 46 container = viewer.getRemovableContainer(items[i]); 47 if(container != null) { 48 container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory()); 49 } 50 } 51 } 52 } 53 54 57 protected boolean updateSelection(IStructuredSelection selection) { 58 Object element = selection.getFirstElement(); 59 if(element instanceof BreakpointContainer) { 60 return ((BreakpointContainer) element).getCategory().equals(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID); 61 } 62 return false; 63 } 64 } 65 | Popular Tags |