KickJava   Java API By Example, From Geeks To Geeks.

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


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.provisional.IAsynchronousContentAdapter;
15 import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousLabelAdapter;
16 import org.eclipse.debug.internal.ui.viewers.provisional.IModelProxyFactoryAdapter;
17 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
18 import org.eclipse.jdt.debug.core.IJavaThreadGroup;
19
20 /**
21  * @since 3.2
22  *
23  */

24 public class JavaDebugElementLabelAdapterFactory implements IAdapterFactory{
25     
26     private static IAsynchronousLabelAdapter fgThreadGroupLabelAdapter = new JavaThreadGroupLabelAdapter();
27     private static IAsynchronousContentAdapter fgThreadGroupTreeAdapter = new JavaThreadGroupContentAdapter();
28     private static IAsynchronousContentAdapter fgTargetTreeAdapter = new JavaDebugTargetContentAdapter();
29     private static IModelProxyFactoryAdapter fgJavaModelProxyFactory = new JavaModelProxyFactory();
30
31     /* (non-Javadoc)
32      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
33      */

34     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
35         if (adapterType.equals(IAsynchronousLabelAdapter.class)) {
36             if (adaptableObject instanceof IJavaThreadGroup) {
37                 return fgThreadGroupLabelAdapter;
38             }
39         }
40         if (adapterType.equals(IAsynchronousContentAdapter.class)) {
41             if (adaptableObject instanceof IJavaThreadGroup) {
42                 return fgThreadGroupTreeAdapter;
43             }
44             if (adaptableObject instanceof IJavaDebugTarget) {
45                 return fgTargetTreeAdapter;
46             }
47         }
48         if (adapterType.equals(IModelProxyFactoryAdapter.class)) {
49             if (adaptableObject instanceof IJavaDebugTarget) {
50                 return fgJavaModelProxyFactory;
51             }
52         }
53         return null;
54     }
55
56     /* (non-Javadoc)
57      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
58      */

59     public Class JavaDoc[] getAdapterList() {
60         return new Class JavaDoc[]{IAsynchronousLabelAdapter.class, IAsynchronousContentAdapter.class, IModelProxyFactoryAdapter.class};
61     }
62
63 }
64
Popular Tags