KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > variables > ColumnPresentationAdapterFactory


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.variables;
12
13 import org.eclipse.core.runtime.IAdapterFactory;
14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor;
16 import org.eclipse.jdt.debug.core.IJavaStackFrame;
17 import org.eclipse.jdt.debug.core.IJavaVariable;
18
19 /**
20  * Adapter factory.
21  *
22  * @since 3.2
23  */

24 public class ColumnPresentationAdapterFactory implements IAdapterFactory {
25     
26     private static final IColumnPresentationFactory fgColumnPresentation = new JavaVariableColumnPresentationFactory();
27     private static final IElementEditor fgEEJavaVariable = new JavaVariableEditor();
28
29     /* (non-Javadoc)
30      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
31      */

32     public Object JavaDoc getAdapter(Object JavaDoc adaptableObject, Class JavaDoc adapterType) {
33         if (adaptableObject instanceof IJavaVariable) {
34             if (IElementEditor.class.equals(adapterType)) {
35                 return fgEEJavaVariable;
36             }
37         }
38         if (adaptableObject instanceof IJavaStackFrame) {
39             if (IColumnPresentationFactory.class.equals(adapterType)) {
40                 return fgColumnPresentation;
41             }
42         }
43         return null;
44     }
45
46     /* (non-Javadoc)
47      * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
48      */

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