KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > threadgroups > JavaDebugTargetContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.threadgroups;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
16 import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
17 import org.eclipse.debug.ui.IDebugUIConstants;
18 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
19 import org.eclipse.jdt.internal.debug.ui.monitors.JavaElementContentProvider;
20
21 /**
22  * @since 3.3
23  */

24 public class JavaDebugTargetContentProvider extends DebugTargetContentProvider {
25
26     /* (non-Javadoc)
27      * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext)
28      */

29     protected int getChildCount(Object JavaDoc element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
30         if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
31             if (JavaElementContentProvider.isDisplayThreadGroups()) {
32                 IJavaDebugTarget debugTarget = (IJavaDebugTarget)element;
33                 if (debugTarget.isDisconnected() || debugTarget.isTerminated()) {
34                     return 0;
35                 }
36                 return debugTarget.getRootThreadGroups().length;
37             }
38         }
39         return super.getChildCount(element, context, monitor);
40     }
41
42     /* (non-Javadoc)
43      * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext)
44      */

45     protected Object JavaDoc[] getChildren(Object JavaDoc parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
46         if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
47             if (JavaElementContentProvider.isDisplayThreadGroups()) {
48                 return getElements(((IJavaDebugTarget)parent).getRootThreadGroups(), index, length);
49             }
50         }
51         return super.getChildren(parent, index, length, context, monitor);
52     }
53
54 }
55
Popular Tags