1 12 package org.eclipse.debug.internal.ui.views.breakpoints; 13 14 15 import java.lang.reflect.InvocationTargetException ; 16 import java.util.ArrayList ; 17 import java.util.Iterator ; 18 import java.util.List ; 19 20 import org.eclipse.core.runtime.CoreException; 21 import org.eclipse.core.runtime.IProgressMonitor; 22 import org.eclipse.core.runtime.IStatus; 23 import org.eclipse.core.runtime.Status; 24 import org.eclipse.core.runtime.jobs.Job; 25 import org.eclipse.debug.core.DebugPlugin; 26 import org.eclipse.debug.core.IBreakpointManagerListener; 27 import org.eclipse.debug.core.model.IBreakpoint; 28 import org.eclipse.debug.core.model.IStackFrame; 29 import org.eclipse.debug.core.model.IThread; 30 import org.eclipse.debug.internal.ui.DebugUIPlugin; 31 import org.eclipse.debug.internal.ui.DelegatingModelPresentation; 32 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 33 import org.eclipse.debug.internal.ui.LazyModelPresentation; 34 import org.eclipse.debug.internal.ui.actions.breakpointGroups.CopyBreakpointsAction; 35 import org.eclipse.debug.internal.ui.actions.breakpointGroups.PasteBreakpointsAction; 36 import org.eclipse.debug.internal.ui.actions.breakpointGroups.RemoveFromWorkingSetAction; 37 import org.eclipse.debug.internal.ui.actions.breakpoints.OpenBreakpointMarkerAction; 38 import org.eclipse.debug.internal.ui.actions.breakpoints.ShowSupportedBreakpointsAction; 39 import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsAction; 40 import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages; 41 import org.eclipse.debug.ui.AbstractDebugView; 42 import org.eclipse.debug.ui.IDebugModelPresentation; 43 import org.eclipse.debug.ui.IDebugUIConstants; 44 import org.eclipse.jface.action.IAction; 45 import org.eclipse.jface.action.IMenuManager; 46 import org.eclipse.jface.action.IToolBarManager; 47 import org.eclipse.jface.action.Separator; 48 import org.eclipse.jface.operation.IRunnableWithProgress; 49 import org.eclipse.jface.viewers.CheckStateChangedEvent; 50 import org.eclipse.jface.viewers.CheckboxTreeViewer; 51 import org.eclipse.jface.viewers.DoubleClickEvent; 52 import org.eclipse.jface.viewers.IBaseLabelProvider; 53 import org.eclipse.jface.viewers.ICheckStateListener; 54 import org.eclipse.jface.viewers.ISelection; 55 import org.eclipse.jface.viewers.IStructuredSelection; 56 import org.eclipse.jface.viewers.ITreeContentProvider; 57 import org.eclipse.jface.viewers.ITreeViewerListener; 58 import org.eclipse.jface.viewers.StructuredSelection; 59 import org.eclipse.jface.viewers.StructuredViewer; 60 import org.eclipse.jface.viewers.TreeExpansionEvent; 61 import org.eclipse.jface.viewers.Viewer; 62 import org.eclipse.swt.SWT; 63 import org.eclipse.swt.dnd.Clipboard; 64 import org.eclipse.swt.dnd.DND; 65 import org.eclipse.swt.dnd.Transfer; 66 import org.eclipse.swt.widgets.Composite; 67 import org.eclipse.swt.widgets.Display; 68 import org.eclipse.swt.widgets.Tree; 69 import org.eclipse.swt.widgets.TreeItem; 70 import org.eclipse.ui.IMemento; 71 import org.eclipse.ui.IPerspectiveDescriptor; 72 import org.eclipse.ui.IPerspectiveListener2; 73 import org.eclipse.ui.ISelectionListener; 74 import org.eclipse.ui.ISharedImages; 75 import org.eclipse.ui.IViewReference; 76 import org.eclipse.ui.IWorkbenchActionConstants; 77 import org.eclipse.ui.IWorkbenchPage; 78 import org.eclipse.ui.IWorkbenchPart; 79 import org.eclipse.ui.IWorkbenchPartReference; 80 import org.eclipse.ui.PlatformUI; 81 import org.eclipse.ui.XMLMemento; 82 import org.eclipse.ui.actions.ActionFactory; 83 import org.eclipse.ui.actions.SelectionListenerAction; 84 import org.eclipse.ui.contexts.IContextActivation; 85 import org.eclipse.ui.contexts.IContextService; 86 import org.eclipse.ui.progress.IProgressService; 87 import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; 88 import org.eclipse.ui.views.navigator.LocalSelectionTransfer; 89 90 import com.ibm.icu.text.MessageFormat; 91 92 95 public class BreakpointsView extends AbstractDebugView implements ISelectionListener, IBreakpointManagerListener, IPerspectiveListener2 { 96 97 private BreakpointsViewEventHandler fEventHandler; 98 private ICheckStateListener fCheckListener= new ICheckStateListener() { 99 public void checkStateChanged(CheckStateChangedEvent event) { 100 Object source = event.getElement(); 101 if (source instanceof BreakpointContainer) { 102 handleContainerChecked(event, (BreakpointContainer) source); 103 } else if (source instanceof IBreakpoint) { 104 handleBreakpointChecked(event, (IBreakpoint) source); 105 } 106 } 107 }; 108 private boolean fIsTrackingSelection= false; 109 private static String KEY_IS_TRACKING_SELECTION= "isTrackingSelection"; private static String KEY_VALUE="value"; private static final String ACTION_REMOVE_FROM_GROUP = "RemoveFromGroup"; private BreakpointsContentProvider fContentProvider; 114 private Clipboard fClipboard; 115 private IContextActivation fActivatedContext; 116 117 123 private static IMemento fgMemento; 124 125 128 public void createPartControl(Composite parent) { 129 super.createPartControl(parent); 130 DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this); 131 getSite().getWorkbenchWindow().addPerspectiveListener(this); 132 } 133 134 137 protected Viewer createViewer(Composite parent) { 138 fContentProvider= new BreakpointsContentProvider(); 139 CheckboxTreeViewer viewer = new BreakpointsViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK)); 140 setViewer(viewer); 141 viewer.setUseHashlookup(true); 142 viewer.setContentProvider(fContentProvider); 143 viewer.setComparator(new BreakpointsComparator()); 144 viewer.setInput(DebugPlugin.getDefault().getBreakpointManager()); 145 viewer.addCheckStateListener(fCheckListener); 146 viewer.addTreeListener(new ITreeViewerListener() { 147 public void treeExpanded(TreeExpansionEvent event) { 148 ((BreakpointsViewer)getViewer()).updateCheckedState(event.getElement()); 149 } 150 public void treeCollapsed(TreeExpansionEvent event) { 151 } 152 }); 153 viewer.setLabelProvider(new BreakpointsLabelProvider()); 154 getSite().setSelectionProvider(viewer); 156 initIsTrackingSelection(); 157 initBreakpointOrganizers(); 158 setEventHandler(new BreakpointsViewEventHandler(this)); 159 initDragAndDrop(); 160 return viewer; 161 } 162 163 166 private void initDragAndDrop() { 167 BreakpointsViewer viewer = (BreakpointsViewer) getViewer(); 168 int ops = DND.DROP_MOVE | DND.DROP_COPY; 169 viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer)); 171 viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer)); 173 } 174 175 179 private void initIsTrackingSelection() { 180 IMemento memento= getMemento(); 181 if (memento != null) { 182 IMemento node= memento.getChild(KEY_IS_TRACKING_SELECTION); 183 if (node != null) { 184 setTrackSelection(Boolean.valueOf(node.getString(KEY_VALUE)).booleanValue()); 185 return; 186 } 187 } 188 setTrackSelection(false); 189 } 190 191 194 private void initBreakpointOrganizers() { 195 IMemento memento = getMemento(); 196 if (memento != null) { 197 IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); 198 if (node == null) { 199 fContentProvider.setOrganizers(null); 200 } else { 201 String value = node.getString(KEY_VALUE); 202 if (value != null) { 203 String [] ids = value.split(","); BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault(); 205 List organziers= new ArrayList (); 206 for (int i = 0; i < ids.length; i++) { 207 IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]); 208 if (organizer != null) { 209 organziers.add(organizer); 210 } 211 } 212 fContentProvider.setOrganizers((IBreakpointOrganizer[]) organziers.toArray(new IBreakpointOrganizer[organziers.size()])); 213 } 214 } 215 } 216 } 217 218 221 protected IMemento getMemento() { 222 if (fgMemento != null) { 223 return fgMemento; 224 } 225 return super.getMemento(); 226 } 227 228 233 public void updateCheckedState(Object element) { 234 ((BreakpointsViewer)getViewer()).updateCheckedState(element); 235 } 236 237 241 public CheckboxTreeViewer getCheckboxViewer() { 242 return (CheckboxTreeViewer) getViewer(); 243 } 244 245 249 public ITreeContentProvider getTreeContentProvider() { 250 return fContentProvider; 251 } 252 253 257 private void handleBreakpointChecked(final CheckStateChangedEvent event, final IBreakpoint breakpoint) { 258 final boolean enable= event.getChecked(); 259 String jobName = enable ? DebugUIViewsMessages.BreakpointsView_0 : DebugUIViewsMessages.BreakpointsView_1; new Job(jobName) { 261 protected IStatus run(IProgressMonitor monitor) { 262 try { 263 breakpoint.setEnabled(enable); 264 return Status.OK_STATUS; 265 } catch (final CoreException e) { 266 Display.getDefault().asyncExec(new Runnable () { 267 public void run() { 268 String titleState= enable ? DebugUIViewsMessages.BreakpointsView_6 : DebugUIViewsMessages.BreakpointsView_7; String messageState= enable ? DebugUIViewsMessages.BreakpointsView_8 : DebugUIViewsMessages.BreakpointsView_9; DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_10, new String [] { titleState }), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_11, new String [] { messageState }), e); getCheckboxViewer().removeCheckStateListener(fCheckListener); 273 event.getCheckable().setChecked(breakpoint, !event.getChecked()); 274 getCheckboxViewer().addCheckStateListener(fCheckListener); 275 } 276 }); 277 } 278 return Status.CANCEL_STATUS; 279 } 280 }.schedule(); 281 } 282 283 287 private void handleContainerChecked(CheckStateChangedEvent event, BreakpointContainer container) { 288 final IBreakpoint[] breakpoints = container.getBreakpoints(); 289 final boolean enable= event.getChecked(); 290 IRunnableWithProgress runnable = new IRunnableWithProgress() { 291 public void run(IProgressMonitor monitor) { 292 try { 293 for (int i = 0; i < breakpoints.length; i++) { 294 IBreakpoint breakpoint = breakpoints[i]; 295 breakpoint.setEnabled(enable); 296 } 297 } catch (CoreException e) { 298 DebugUIPlugin.log(e); 299 } 300 } 301 }; 302 IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); 304 try { 305 progressService.busyCursorWhile(runnable); 306 } 307 catch (InvocationTargetException e) {} 308 catch (InterruptedException e) {} 309 } 310 311 314 protected String getHelpContextId() { 315 return IDebugHelpContextIds.BREAKPOINT_VIEW; 316 } 317 318 321 public void dispose() { 322 disposeAction(IWorkbenchActionDefinitionIds.COPY); 323 disposeAction(IWorkbenchActionDefinitionIds.PASTE); 324 disposeAction(ACTION_REMOVE_FROM_GROUP); 325 326 if (getCheckboxViewer() != null) { 327 getCheckboxViewer().removeCheckStateListener(fCheckListener); 328 } 329 IAction action= getAction("ShowBreakpointsForModel"); if (action != null) { 331 ((ShowSupportedBreakpointsAction)action).dispose(); 332 } 333 getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); 334 DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this); 335 super.dispose(); 336 337 if (getEventHandler() != null) { 338 getEventHandler().dispose(); 339 } 340 341 if (fClipboard != null) { 342 fClipboard.dispose(); 343 } 344 345 getSite().getWorkbenchWindow().removePerspectiveListener(this); 346 } 347 348 351 protected void createActions() { 352 IAction action = new OpenBreakpointMarkerAction(getViewer()); 353 setAction("GotoMarker", action); setAction(DOUBLE_CLICK_ACTION, action); 355 setAction("ShowBreakpointsForModel", new ShowSupportedBreakpointsAction(getStructuredViewer(),this)); setAction("SkipBreakpoints", new SkipAllBreakpointsAction()); 358 fClipboard= new Clipboard(getSite().getShell().getDisplay()); 359 360 PasteBreakpointsAction paste = new PasteBreakpointsAction(this); 361 configure(paste, IWorkbenchActionDefinitionIds.PASTE, ActionFactory.PASTE.getId(),ISharedImages.IMG_TOOL_PASTE); 362 SelectionListenerAction copy = new CopyBreakpointsAction(this, fClipboard, paste); 363 configure(copy, IWorkbenchActionDefinitionIds.COPY, ActionFactory.COPY.getId(), ISharedImages.IMG_TOOL_COPY); 364 365 SelectionListenerAction remove = new RemoveFromWorkingSetAction(this); 366 setAction(ACTION_REMOVE_FROM_GROUP, remove); 367 getViewer().addSelectionChangedListener(remove); 368 } 369 370 380 private void configure(SelectionListenerAction action, String defId, String globalId, String imgId) { 381 setAction(defId, action); 382 action.setActionDefinitionId(defId); 383 getViewSite().getActionBars().setGlobalActionHandler(globalId, action); 384 getViewer().addSelectionChangedListener(action); 385 action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId)); 386 } 387 388 393 private void disposeAction(String id) { 394 IAction action = getAction(id); 395 if (action instanceof SelectionListenerAction) { 396 SelectionListenerAction sla = (SelectionListenerAction) action; 397 if (getViewer() != null) { 398 getViewer().removeSelectionChangedListener(sla); 399 } 400 } 401 } 402 403 408 protected void fillContextMenu(IMenuManager menu) { 409 updateObjects(); 410 menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP)); 411 menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP)); 412 menu.add(getAction("GotoMarker")); menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP)); 414 menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP)); 415 menu.add(getAction(IWorkbenchActionDefinitionIds.COPY)); 416 menu.add(getAction(IWorkbenchActionDefinitionIds.PASTE)); 417 IAction action = getAction(ACTION_REMOVE_FROM_GROUP); 418 if (action.isEnabled()) { 419 menu.add(action); 420 } 421 menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP)); 422 menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP_GROUP)); 423 424 menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); 425 } 426 427 430 protected void configureToolBar(IToolBarManager tbm) { 431 tbm.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP)); 432 tbm.add(getAction("ShowBreakpointsForModel")); tbm.add(getAction("GotoMarker")); tbm.add(getAction("SkipBreakpoints")); tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP)); 436 } 437 438 443 protected BreakpointsViewEventHandler getEventHandler() { 444 return fEventHandler; 445 } 446 447 452 private void setEventHandler(BreakpointsViewEventHandler eventHandler) { 453 fEventHandler = eventHandler; 454 } 455 458 protected void becomesVisible() { 459 super.becomesVisible(); 460 CheckboxTreeViewer viewer = getCheckboxViewer(); 461 ISelection selection = viewer.getSelection(); 462 viewer.getControl().setRedraw(false); 463 ((BreakpointsContentProvider)viewer.getContentProvider()).reorganize(); 464 viewer.setSelection(new StructuredSelection(selection)); 465 viewer.getControl().setRedraw(true); 466 } 467 468 471 public void selectionChanged(IWorkbenchPart part, ISelection sel) { 472 if (sel.isEmpty() || !isTrackingSelection()) { 473 return; 474 } 475 IStructuredSelection selection= (IStructuredSelection) sel; 476 Iterator iter= selection.iterator(); 477 Object firstElement= iter.next(); 478 if (firstElement == null || iter.hasNext()) { 479 return; 480 } 481 IThread thread= null; 482 if (firstElement instanceof IStackFrame) { 483 thread= ((IStackFrame) firstElement).getThread(); 484 } else if (firstElement instanceof IThread) { 485 thread= (IThread) firstElement; 486 } else { 487 return; 488 } 489 IBreakpoint[] breakpoints= thread.getBreakpoints(); 490 getViewer().setSelection(new StructuredSelection(breakpoints), true); 491 } 492 493 500 public boolean isTrackingSelection() { 501 return fIsTrackingSelection; 502 } 503 504 511 public void setTrackSelection(boolean trackSelection) { 512 fIsTrackingSelection= trackSelection; 513 if (trackSelection) { 514 getSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); 515 } else { 516 getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); 517 } 518 } 519 520 523 public void saveState(IMemento memento) { 524 super.saveState(memento); 525 IMemento node= memento.createChild(KEY_IS_TRACKING_SELECTION); 526 node.putString(KEY_VALUE, String.valueOf(fIsTrackingSelection)); 527 528 StringBuffer buffer= new StringBuffer (); 529 IBreakpointOrganizer[] organizers = fContentProvider.getOrganizers(); 530 if (organizers != null) { 531 for (int i = 0; i < organizers.length; i++) { 532 IBreakpointOrganizer organizer = organizers[i]; 533 buffer.append(organizer.getIdentifier()); 534 if (i < (organizers.length - 1)) { 535 buffer.append(','); 536 } 537 } 538 node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); 539 node.putString(KEY_VALUE, buffer.toString()); 540 } 541 542 } 543 544 547 public void breakpointManagerEnablementChanged(boolean enabled) { 548 DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable () { 549 public void run() { 550 IAction action = getAction("SkipBreakpoints"); if (action != null) { 552 ((SkipAllBreakpointsAction) action).updateActionCheckedState(); 553 } 554 } 555 }); 556 } 557 558 561 public void doubleClick(DoubleClickEvent event) { 562 IStructuredSelection selection= (IStructuredSelection) event.getSelection(); 563 if (selection.size() == 1) { 564 Object element = selection.getFirstElement(); 565 if (element instanceof BreakpointContainer) { 566 getCheckboxViewer().setExpandedState(element, !getCheckboxViewer().getExpandedState(element)); 567 return; 568 } 569 } 570 super.doubleClick(event); 571 } 572 573 576 public void setBreakpointOrganizers(IBreakpointOrganizer[] organizers) { 577 Viewer viewer = getViewer(); 578 ISelection selection = viewer.getSelection(); 579 fContentProvider.setOrganizers(organizers); 580 viewer.setSelection(selection); 581 } 582 583 587 public IBreakpointOrganizer[] getBreakpointOrganizers() { 588 return fContentProvider.getOrganizers(); 589 } 590 591 594 public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) { 595 if (partRef instanceof IViewReference && changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) { 596 String id = ((IViewReference) partRef).getId(); 597 if (id.equals(getViewSite().getId())) { 598 fgMemento= XMLMemento.createWriteRoot("BreakpointsViewMemento"); saveState(fgMemento); 601 } 602 } 603 } 604 605 608 public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { 609 } 610 611 614 public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { 615 } 616 617 620 public IDebugModelPresentation getPresentation(String id) { 621 if (getViewer() instanceof StructuredViewer) { 622 IBaseLabelProvider lp = ((StructuredViewer)getViewer()).getLabelProvider(); 623 if (lp instanceof BreakpointsLabelProvider) { 624 BreakpointsLabelProvider blp = (BreakpointsLabelProvider) lp; 625 lp = blp.getPresentation(); 626 } 627 if (lp instanceof DelegatingModelPresentation) { 628 return ((DelegatingModelPresentation)lp).getPresentation(id); 629 } 630 if (lp instanceof LazyModelPresentation) { 631 if (((LazyModelPresentation)lp).getDebugModelIdentifier().equals(id)) { 632 return (IDebugModelPresentation)lp; 633 } 634 } 635 } 636 return null; 637 } 638 639 645 public void preserveSelection(IStructuredSelection selection) { 646 if(selection != null && !selection.isEmpty()) { 647 TreeItem item = (TreeItem) ((BreakpointsViewer)getCheckboxViewer()).searchItem(selection.getFirstElement()); 648 Object toselect = null; 649 if(item != null) { 650 TreeItem parent = item.getParentItem(); 651 if(parent != null) { 652 int idx = 0; 653 if(parent.getItemCount() == 1) { 654 toselect = parent.getData(); 655 } 656 idx = parent.indexOf(item); 657 if(idx == 0) { 658 if(parent.getItemCount() > 1) { 659 toselect = parent.getItem(1).getData(); 660 } 661 else { 662 toselect = parent.getItem(0).getData(); 663 } 664 } 665 if(idx > 0) { 666 toselect = parent.getItem(idx-1).getData(); 667 } 668 } 669 else { 670 Tree tree = item.getParent(); 671 TreeItem[] items = tree.getItems(); 672 for(int i = 0; i < items.length; i++) { 673 if(item.equals(items[i])) { 674 if(i - 1 < 0 && items.length > 1) { 675 toselect = items[i+1]; 676 break; 677 } 678 else if(items.length > 1){ 679 toselect = items[i-1].getData(); 680 break; 681 } 682 } 683 } 684 } 685 } 686 if(toselect != null) { 687 getViewer().setSelection(new StructuredSelection(toselect), true); 688 } 689 } 690 } 691 692 709 public boolean canPaste(Object target, ISelection selection) { 710 if(!(target instanceof BreakpointContainer)) { 711 return false; 712 } 713 if(selection.isEmpty()) { 714 return false; 715 } 716 IStructuredSelection ss = (IStructuredSelection) selection; 717 BreakpointContainer container = (BreakpointContainer) target; 718 IBreakpoint breakpoint = null; 719 Object element = null; 720 for(Iterator iter = ss.iterator(); iter.hasNext();) { 721 element = iter.next(); 722 if(!(element instanceof IBreakpoint)) { 723 return false; 724 } 725 breakpoint = (IBreakpoint) element; 726 if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) { 727 return false; 728 } 729 } 730 return true; 731 } 732 733 743 public boolean performPaste(Object target, ISelection selection) { 744 if (target instanceof BreakpointContainer && selection instanceof IStructuredSelection) { 745 BreakpointContainer container = (BreakpointContainer) target; 746 Object [] objects = ((IStructuredSelection)selection).toArray(); 747 for (int i = 0; i < objects.length; i++) { 748 container.getOrganizer().addBreakpoint((IBreakpoint)objects[i], container.getCategory()); 749 } 750 return true; 751 } 752 return false; 753 } 754 755 759 public boolean isShowingGroups() { 760 return fContentProvider.isShowingGroups(); 761 } 762 763 766 public void partActivated(IWorkbenchPart part) { 767 IContextService contextService = (IContextService)getSite().getService(IContextService.class); 768 fActivatedContext = contextService.activateContext(IDebugUIConstants.ID_BREAKPOINT_VIEW); 769 super.partActivated(part); 770 } 771 772 775 public void partDeactivated(IWorkbenchPart part) { 776 IContextService contextService = (IContextService)getSite().getService(IContextService.class); 777 contextService.deactivateContext(fActivatedContext); 778 super.partDeactivated(part); 779 } 780 } 781 | Popular Tags |