1 11 package org.eclipse.jdt.internal.debug.ui.variables; 12 13 import org.eclipse.core.runtime.IAdapterFactory; 14 import org.eclipse.debug.internal.ui.model.elements.ExpressionLabelProvider; 15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; 16 import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; 17 import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter; 18 import org.eclipse.jdt.debug.core.IJavaVariable; 19 import org.eclipse.jdt.internal.debug.ui.display.JavaInspectExpression; 20 import org.eclipse.jdt.internal.debug.ui.heapwalking.JavaWatchExpressionFilter; 21 22 33 public class JavaDebugElementAdapterFactory implements IAdapterFactory { 34 35 private static final IElementLabelProvider fgLPVariable = new JavaVariableLabelProvider(); 36 private static final IElementContentProvider fgCPVariable = new JavaVariableContentProvider(); 37 private static final IElementLabelProvider fgLPExpression = new ExpressionLabelProvider(); 38 private static final IElementContentProvider fgCPExpression = new JavaExpressionContentProvider(); 39 private static final IWatchExpressionFactoryAdapter fgWEVariable = new JavaWatchExpressionFilter(); 40 41 44 public Object getAdapter(Object adaptableObject, Class adapterType) { 45 if (IElementLabelProvider.class.equals(adapterType)) { 46 if (adaptableObject instanceof IJavaVariable) { 47 return fgLPVariable; 48 } 49 if (adaptableObject instanceof JavaInspectExpression) { 50 return fgLPExpression; 51 } 52 } 53 if (IElementContentProvider.class.equals(adapterType)) { 54 if (adaptableObject instanceof IJavaVariable) { 55 return fgCPVariable; 56 } 57 if (adaptableObject instanceof JavaInspectExpression) { 58 return fgCPExpression; 59 } 60 } 61 if (IWatchExpressionFactoryAdapter.class.equals(adapterType)) { 62 if (adaptableObject instanceof IJavaVariable) { 63 return fgWEVariable; 64 } 65 if (adaptableObject instanceof JavaInspectExpression) { 66 return fgCPExpression; 67 } 68 } 69 return null; 70 } 71 72 75 public Class [] getAdapterList() { 76 return new Class []{IElementLabelProvider.class,IElementContentProvider.class,IWatchExpressionFactoryAdapter.class}; 77 } 78 79 } 80 | Popular Tags |