KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2006 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.IAdapterFactory;
14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
16 import org.eclipse.jdt.debug.core.IJavaThreadGroup;
17
18 /**
19  * @since 3.3
20  */

21 public class ThreadGroupAdapterFactory implements IAdapterFactory{
22     
23     
24     private static IElementContentProvider fgCPThreadGroup = new JavaThreadGroupContentProvider();
25     private static IElementLabelProvider fgLPThreadGroup = new JavaThreadGroupLabelProvider();
26
27     /* (non-Javadoc)
28      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
29      */

30     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
31
32         if (adapterType.equals(IElementContentProvider.class)) {
33             if (adaptableObject instanceof IJavaThreadGroup) {
34                 return fgCPThreadGroup;
35             }
36         }
37         if (adapterType.equals(IElementLabelProvider.class)) {
38             if (adaptableObject instanceof IJavaThreadGroup) {
39                 return fgLPThreadGroup;
40             }
41         }
42         return null;
43     }
44
45     /* (non-Javadoc)
46      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
47      */

48     public Class JavaDoc[] getAdapterList() {
49         return new Class JavaDoc[]{
50                 IElementContentProvider.class,
51                 IElementLabelProvider.class};
52     }
53
54 }
55
Popular Tags