Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6e441acac519d0077f22a52f3bb4cac5e5423266 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
 *****************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.debug.ui.IDebugUIConstants;

/**
 * This class contains the list of container or a list of breakpoint, elements are sorted according to rules
 * in the comparator.
 */
public class BreakpointContainer extends ElementContentProvider implements IAdaptable, IBreakpointContainer {
	/**
	 * Child breakpoints - inserting new element into this collection should use the insertBreakpoint method
	 */
	final private List<IBreakpoint> fBreakpoints = new ArrayList<>();

    /**
     * Child containers - inserting new element into this container should use the insertChildContainer method
     */
	final private List<BreakpointContainer> fChildContainers = new ArrayList<>();

    /**
     * The category for this container
     */
    private IAdaptable fCategory;

    /**
     * The breakpoint organizer for this container
     */
    private IBreakpointOrganizer fOrganizer;

    /**
     * The nested breakpoint organizer
     */
    private IBreakpointOrganizer[] fNesting;

    /**
     * A flag to indicate this is the default container
     */
    private boolean fDefaultContainer;

    /**
     * Parent container
     */
    private BreakpointContainer fParent;

    /**
     * The comparator, will be use to compare the order for inserting new element into this container
     */
    private ElementComparator fComparator;

    /**
     * Constructor, intended to be call when creating the root container.
     *
     * @param organizers the breakpoint organizer for this container
     * @param comparator the element comparator, can be <code>null</code>. If <code>null</code> than new element
     * will be added to the end of the list.
     */
    public BreakpointContainer(IBreakpointOrganizer[] organizers, ElementComparator comparator) {
    	fNesting = organizers;
    	fComparator = comparator;
    }

    /**
     * Constructor, intended to be call within this class only.
     *
     * @param parent the parent breakpoint container
     * @param category the category for this container
     * @param organizer the organizer for this container
     * @param comparator the element comparator
     * @param nesting the nested breakpoint organizer
     */
    private BreakpointContainer(BreakpointContainer parent, IAdaptable category, IBreakpointOrganizer organizer,
    		ElementComparator comparator, IBreakpointOrganizer[] nesting) {
    	this(category, organizer, nesting);
    	fParent = parent;
    	fComparator = comparator;
    }

    /**
     * Constructor, intended to be call when reorganizing the content.
     *
     * @param category the breakpoint category
     * @param organizer the breakpoint organizer
     * @param nesting the nested breakpoint organizer
     */
    BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
    	fCategory = category;
    	fOrganizer = organizer;
    	fNesting = nesting;
    }

    /**
     * Initialize the default containers.
     *
     * @param parentDelta the parent delta, addition child delta will be added to the parent
     */
    public void initDefaultContainers(ModelDelta parentDelta) {
    	// seed with all nested categories
    	if (fNesting != null && fNesting.length > 0) {
    		IAdaptable[] emptyCategories = fNesting[0].getCategories();
    		if (emptyCategories != null) {
    			for (int i = 0; i < emptyCategories.length; i++) {
    				IAdaptable empty = emptyCategories[i];
    				BreakpointContainer container = findExistingContainer(fChildContainers, empty);
    				if (container == null) {
    					IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1];
    					System.arraycopy(fNesting, 1, siblings, 0, siblings.length);
    					container = new BreakpointContainer(this, empty, fNesting[0], fComparator, siblings);
    					insertChildContainer(container);
    					container.fDefaultContainer = true;

    					int size = container.getChildren().length;
    					parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size);

    				}
    			}
    		}
    	}
    }

    /**
     * Insert the breakpoint to this container.
     *
     * @param breakpoint the new breakpoint
     * @return the index of the breakpoint in the cache, -1 if the breakpoint already exist
     */
    private int insertBreakpoint(IBreakpoint breakpoint) {
    	if (fBreakpoints.contains(breakpoint) || breakpoint == null) {
    		return -1;
    	}
    	int index = fBreakpoints.size();
    	for (; fComparator != null && index > 0; index--) {
    		if (fComparator.compare(fBreakpoints.get(index-1), breakpoint) < 0) {
				break;
			}
    	}
    	if (index < 0) {
    		index = 0;
    	}
    	fBreakpoints.add(index, breakpoint);
    	return index;
    }

    /**
     * Insert the child container this container.
     *
     * @param container the child container
     * @return the index of the container in the cache, -1 if the child container already exist
     */
    private int insertChildContainer(BreakpointContainer container) {
    	int index = fChildContainers.size();
    	for (; fComparator != null && index > 0; index--) {
    		if (fComparator.compare(fChildContainers.get(index-1), container) < 0) {
				break;
			}
    	}

    	if (index < 0) {
			index = 0;
		}
    	fChildContainers.add(index, container);

    	return index;
    }


    /**
     * Returns the element comparator.
     *
     * @return the element comparator
     */
    public ElementComparator getElementComparator() {
    	return fComparator;
    }

    /**
     * Returns the parent container, can be <code>null</code>.
     *
     * @return the parent container
     */
    public BreakpointContainer getParent() {
    	return fParent;
    }

    /**
     * Determine whether there is any nested container.
     *
     * @return true if has nested container
     */
    private boolean hasNesting() {
    	return fNesting != null && fNesting.length > 0;
    }

    /**
     * Get the categories for the breakpoint with the given organizer.
     *
     * @param breakpoint the breakpoint
     * @param organizer the organizer
     * @return the categories
     */
    private static IAdaptable[] getCategories(IBreakpoint breakpoint, IBreakpointOrganizer organizer) {
    	IAdaptable[] categories = organizer.getCategories(breakpoint);
    	if (categories == null || categories.length == 0) {
			categories = OtherBreakpointCategory.getCategories(organizer);
		}
    	return categories;
    }

    /**
     * Find existing breakpoint container in the container array the given category.
     *
     * @param containers the container array
     * @param category the category
     * @return the breakpoint container, can be <code>null</code>.
     */
	private static BreakpointContainer findExistingContainer(List<BreakpointContainer> containers, IAdaptable category) {
		for (BreakpointContainer c : containers) {
    		if (category.equals(c.getCategory())) {
				return c;
			}
    	}
    	return null;
    }

    // TODO [pchuong]: can be remove if BreakpointsContentProvider no longer uses this class
    void addBreakpoint(IBreakpoint breakpoint) {
    	addBreakpoint(breakpoint, new ModelDelta(null, IModelDelta.NO_CHANGE));
    }

    /**
     * Add a breakpoint to the container, additional delta will be added to the root delta.
     *
     * @param breakpoint the breakpoint to added
     * @param rootDelta the root delta of this container
     * @see #removeBreakpoint
     */
    public void addBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
    	final int bpIndex = insertBreakpoint(breakpoint);
    	if (bpIndex < 0) {
			return;
		}

        if (hasNesting()) {
            IBreakpointOrganizer organizer = fNesting[0];

            // get the breakpoint categories from the organizer
            IAdaptable[] categories = getCategories(breakpoint, organizer);

            for (int i = 0; i < categories.length; ++i) {
            	ModelDelta childDelta = null;
            	IAdaptable category = categories[i];
            	BreakpointContainer container = findExistingContainer(fChildContainers, category);

            	// create a new container if it doesn't exist
            	if (container == null) {
            		IBreakpointOrganizer[] nesting = null;
            		if (fNesting.length > 1) {
            			 nesting = new IBreakpointOrganizer[fNesting.length - 1];
                         System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
            		}
            		container = new BreakpointContainer(this, category, organizer, fComparator, nesting);
            		insertChildContainer(container);
            		childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSERTED|IModelDelta.INSTALL, -1);

            	} else {
					childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.STATE, -1);
            	}

           		container.addBreakpoint(breakpoint, childDelta);
           		childDelta.setChildCount(container.getChildren().length);
            }

        } else {
        	// TODO [pchuong]: There seems to be some kind of problem when the INSERTED flag is used,
        	//				   there is a additional checkbox added to the end of the tree.
        	//				   Also the tree seems to have a strange visual effect when using the INSERTED
        	//				   flag for the child node instead of ADDED flag. Note: all breakpoint delta
        	//				   is using the ADDED flag in this class.
       		rootDelta.addNode(breakpoint, bpIndex, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
       		// rootDelta.addNode(breakpoint, bpIndex, IModelDelta.INSERTED|IModelDelta.INSTALL, 0);

        	rootDelta.setFlags(rootDelta.getFlags() | IModelDelta.EXPAND);
        }
    }

    /**
     * Remove a breakpoint from the container, additional delta will be added to the root delta.
     *
     * @param breakpoint the breakpoint to remove
     * @param rootDelta the root delta of this container
     * @return if the breakpoint was successfully removed
     * @see #addBreakpoint
     */
    public boolean removeBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
    	boolean removed = fBreakpoints.remove(breakpoint);

    	if (removed) {
    		boolean addRemoveBpDelta = getContainers().length == 0;

			Iterator<BreakpointContainer> it = fChildContainers.iterator();
    		while (it.hasNext()) {
    			BreakpointContainer container = it.next();
				// if the breakpoint contains in the container and it is the only breakpoint,
				// than remove the container from the collection
    			if (container.contains(breakpoint)) {
    				ModelDelta childDelta = null;
    				if ((!container.isDefaultContainer()) && (container.getBreakpoints().length <= 1)) {
	    				it.remove();
	    				childDelta = rootDelta.addNode(container, IModelDelta.REMOVED|IModelDelta.UNINSTALL);

	    			} else {
	    				childDelta = rootDelta.addNode(container, IModelDelta.STATE);
	    			}
    				// remove the breakpoint from the nested containers
	    			container.removeBreakpoint(breakpoint, childDelta);
    			}
    		}

    		if (addRemoveBpDelta) {
    			rootDelta.addNode(breakpoint, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
    		}
    	}
    	return removed;
    }

    /**
     * A helper method to copy the organizers between two containers.
     *
     * @param destContainer the destination container
     * @param sourceContainer the source container
     */
    public static void copyOrganizers(BreakpointContainer destContainer, BreakpointContainer sourceContainer) {
    	destContainer.fNesting = sourceContainer.fNesting;
    	destContainer.fOrganizer = sourceContainer.fOrganizer;
		destContainer.fCategory = sourceContainer.fCategory;
    }

    /**
     * A helper method to update the breakpoint cache of the container and it's ancestors.
     *
     * @param container the breakpoint container
     * @param breakpoints the breakpoint to update
     * @param add true if breakpoint should be added to the cache, otherwise remove the breakpoint from the cache
     */
	private static void updateSelfAndAncestorsBreakpointCache(BreakpointContainer container, List<IBreakpoint> breakpoints, boolean add) {
    	if (container != null) {
    		container.fBreakpoints.removeAll(breakpoints);
    		if (add) {
				container.fBreakpoints.addAll(breakpoints);
			}
    		updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, add);
    	}
    }

    /**
     * A helper method to add a breakpoint to an existing container.
     *
     * @param destContainer the destination container
     * @param breakpoint the breakpoint to add
     * @param destContainerDelta the destination container delta, additional delta will be added to this delta
     */
    static public void addBreakpoint(BreakpointContainer destContainer, IBreakpoint breakpoint, ModelDelta destContainerDelta) {
    	int index = destContainer.insertBreakpoint(breakpoint);
    	Assert.isTrue(index >= 0);

		List<IBreakpoint> breakpoints = destContainer.fBreakpoints;
    	destContainerDelta.addNode(breakpoint, index/*breakpoints.indexOf(breakpoint)*/, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
    	destContainerDelta.setFlags(destContainerDelta.getFlags() | IModelDelta.EXPAND);

    	// add the breakpoints to the parent containers.
    	updateSelfAndAncestorsBreakpointCache(destContainer.getParent(), breakpoints, true);
    }

    /**
     * A helper method to add a child container to an existing container.
     *
     * @param destContainer the destination container
     * @param sourceContainer the source container
     * @param destContainerDelta the delta of the destination container, additional delta will be added to this delta
     */
    static public void addChildContainer(BreakpointContainer destContainer, BreakpointContainer sourceContainer, ModelDelta destContainerDelta) {
    	destContainer.insertChildContainer(sourceContainer);
    	sourceContainer.fParent = destContainer;

    	// add the breakpoints to the parent containers.
		List<IBreakpoint> breakpoints = Arrays.asList(sourceContainer.getBreakpoints());
    	updateSelfAndAncestorsBreakpointCache(destContainer, breakpoints, true);

    	int index = destContainer.fChildContainers.indexOf(sourceContainer);
    	int size = sourceContainer.getChildren().length;
    	ModelDelta childDelta  = destContainerDelta.addNode(sourceContainer, index, IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND, size);

    	appendContainerDelta(sourceContainer, childDelta);
    }

    /**
     * A helper method to append delta to the breakpoint container. This method is used by addContainer only.
     *
     * @param container the container to append child delta
     * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
     */
    static private void appendContainerDelta(BreakpointContainer container, ModelDelta containerDelta) {
    	Object[] children = container.getChildren();
    	for (int i = 0; i < children.length; ++i) {
    		boolean isBreakpoint = children[0] instanceof IBreakpoint;
    		int numChild =  isBreakpoint ? 0 : children.length;
    		int flag = isBreakpoint ? IModelDelta.ADDED|IModelDelta.INSTALL
    				: IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND;
    		ModelDelta childDelta = containerDelta.addNode(children[i], i, flag, numChild);

    		if (children[i] instanceof BreakpointContainer) {
    			BreakpointContainer childContainer = (BreakpointContainer) children[i];
    			appendContainerDelta(childContainer, childDelta);
    		}
    	}
    }

    /**
     * A helper method to remove the breakpoint from the container.
     *
     * @param container the container to remove the breakpoint
     * @param breakpoint the breakpoint to remove
     * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
     */
    static public void removeBreakpoint(BreakpointContainer container, IBreakpoint breakpoint, ModelDelta containerDelta) {
    	container.removeBreakpoint(breakpoint, containerDelta);
		List<IBreakpoint> breakpoints = new ArrayList<>();
    	breakpoints.add(breakpoint);
    	updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
    }

    /**
     * Remove all child elements including the given container itself.
     *
     * @param container the breakpoint container
     * @param delta the parent delta
     */
    static public void removeAll(BreakpointContainer container, ModelDelta delta) {
    	BreakpointContainer parent = container.getParent();
    	if (parent != null) {
    		parent.fChildContainers.remove(container);
    		delta = delta.addNode(container, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
    	}

    	if (container.fChildContainers.size() == 0) {
			List<IBreakpoint> breakpoints = new ArrayList<>();
			Iterator<IBreakpoint> iterator = container.fBreakpoints.iterator();
    		while (iterator.hasNext()) {
				IBreakpoint obj = iterator.next();
				breakpoints.add(obj);
				delta.addNode(obj, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
				iterator.remove();
    		}

	    	// remove the breakpoints from the parent containers.
			updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
    		return;
    	}

		Iterator<BreakpointContainer> iterator = container.fChildContainers.iterator();
    	while (iterator.hasNext()) {
    		BreakpointContainer childContainer = iterator.next();
    		ModelDelta childDelta = delta.addNode(childContainer, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
    		iterator.remove();
    		removeAll(childContainer, childDelta);
    	}
    }

    /**
     * Returns whether this is the default container.
     *
     * @return true if it is a default container
     */
    boolean isDefaultContainer() {
    	return fDefaultContainer;
    }

    /**
     * Returns the breakpoints in this container
     *
     * @return the breakpoints in this container
     */
    @Override
	public IBreakpoint[] getBreakpoints() {
        return fBreakpoints.toArray(new IBreakpoint[fBreakpoints.size()]);
    }

    /**
     * Returns this container's category.
     *
     * @return container category
     */
    @Override
	public IAdaptable getCategory() {
        return fCategory;
    }

    /**
     * Returns children as breakpoints or nested containers.
     *
     * @return children as breakpoints or nested containers
     */
    public Object[] getChildren() {
        if (fChildContainers.isEmpty()) {
            return getBreakpoints();
        }
        return getContainers();
    }

    /**
     * Returns the index of the given child element (breakpoint or container.
     *
     * @param child Child to calculate index of.
     * @return index of child
     */
    public int getChildIndex(Object child) {
        if (fChildContainers.isEmpty()) {
            return fBreakpoints.indexOf(child);
        }
        return fChildContainers.indexOf(child);
    }

    /**
     * Returns the containers nested in this container, possibly empty.
     *
     * @return the containers nested in this container, can be empty.
     */
    public BreakpointContainer[] getContainers() {
        return fChildContainers.toArray(new BreakpointContainer[fChildContainers.size()]);
    }

    /**
     * Returns this container's organizer.
     *
     * @return this container's organizer
     */
    @Override
	public IBreakpointOrganizer getOrganizer() {
        return fOrganizer;
    }

    /**
     * Returns whether this container contains the given breakpoint.
     *
     * @param breakpoint the breakpoint to check
     * @return true if this container contains the given breakpoint
     */
    @Override
	public boolean contains(IBreakpoint breakpoint) {
        return fBreakpoints.contains(breakpoint);
    }

    /**
     * Returns the child containers for the given breakpoint.
     *
     * @param breakpoint the breakpoint to get containers for
     * @return child containers
     */
    public BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
        if (contains(breakpoint)) {
        	BreakpointContainer[] containers = getContainers();
            if (containers.length == 0) {
                return new BreakpointContainer[]{this};
            }
			ArrayList<BreakpointContainer> list = new ArrayList<>();
            for (int i = 0; i < containers.length; i++) {
            	BreakpointContainer container = containers[i];
            	BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
                if (subcontainers != null) {
                    for (int j = 0; j < subcontainers.length; j++) {
                        list.add(subcontainers[j]);
                    }
                }
            }
            return list.toArray(new BreakpointContainer[list.size()]);
        }
        return new BreakpointContainer[0];
    }

	@Override
	public boolean equals(Object obj) {
        if (obj instanceof BreakpointContainer) {
        	BreakpointContainer container = (BreakpointContainer) obj;
            // With Group by "Advanced" the same category can contain a different subset of breakpoints,
            // therefore to have the same category is not enough to be equal.
            if (! (fParent != null && container.fParent != null && fParent.equals(container.fParent) ||
            		fParent == null && container.fParent == null) ) {
                return false;
            }
        	if (getCategory() != null && container.getCategory() != null) {
        		return getCategory().equals(container.getCategory());
        	} else {
        		return true;
        	}
        }
        return super.equals(obj);
	}

	@Override
	protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
		return getChildren().length;
	}

	@Override
	protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
		return getElements(getChildren(), index, length);
	}

	@Override
	protected boolean supportsContextId(String id) {
		return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
	}

	@Override
	public <T> T getAdapter(Class<T> adapter) {
		return Platform.getAdapterManager().getAdapter(this, adapter);
	}
}

Back to the top