KickJava   Java API By Example, From Geeks To Geeks.

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


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.IAdapterFactory;
14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
16 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
17
18 /**
19  * Adapter factory for Java debug target.
20  *
21  * @since 3.3
22  */

23 public class TargetAdapterFactory implements IAdapterFactory{
24     
25     private static IModelProxyFactory fgJavaModelProxyFactory = new JavaModelProxyFactory();
26     private static IElementContentProvider fgCPTarget = new JavaDebugTargetContentProvider();
27
28     /* (non-Javadoc)
29      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
30      */

31     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
32         if (adapterType.equals(IModelProxyFactory.class)) {
33             if (adaptableObject instanceof IJavaDebugTarget) {
34                 return fgJavaModelProxyFactory;
35             }
36         }
37         if (adapterType.equals(IElementContentProvider.class)) {
38             if (adaptableObject instanceof IJavaDebugTarget) {
39                 return fgCPTarget;
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                 IModelProxyFactory.class,
51                 IElementContentProvider.class};
52     }
53
54 }
55
Popular Tags