KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > sourcelookup > JavaDebugShowInAdapterFactory


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.sourcelookup;
12
13 import org.eclipse.core.runtime.IAdapterFactory;
14 import org.eclipse.jdt.debug.core.IJavaStackFrame;
15 import org.eclipse.ui.part.IShowInSource;
16 import org.eclipse.ui.part.IShowInTargetList;
17
18 /**
19  * @since 3.2
20  *
21  */

22 public class JavaDebugShowInAdapterFactory implements IAdapterFactory {
23
24     /* (non-Javadoc)
25      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
26      */

27     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
28         if (adapterType == IShowInSource.class) {
29             if (adaptableObject instanceof IJavaStackFrame) {
30                 IJavaStackFrame frame = (IJavaStackFrame) adaptableObject;
31                 return new StackFrameShowInSourceAdapter(frame);
32             }
33         }
34         if (adapterType == IShowInTargetList.class) {
35             if (adaptableObject instanceof IJavaStackFrame) {
36                 return new StackFrameShowInTargetListAdapter();
37             }
38         }
39         return null;
40     }
41
42     /* (non-Javadoc)
43      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
44      */

45     public Class JavaDoc[] getAdapterList() {
46         return new Class JavaDoc[]{IShowInSource.class, IShowInTargetList.class};
47     }
48
49 }
50
Popular Tags