1 11 package org.eclipse.jdt.internal.debug.ui.variables; 12 13 import org.eclipse.core.runtime.IAdaptable; 14 import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; 15 import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; 16 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; 17 import org.eclipse.debug.ui.IDebugUIConstants; 18 import org.eclipse.jdt.debug.core.IJavaStackFrame; 19 20 24 public class JavaVariableColumnPresentationFactory implements IColumnPresentationFactory { 25 26 29 public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) { 30 if (isApplicable(context, element)) { 31 return new JavaVariableColumnPresentation(); 32 } 33 return null; 34 } 35 36 39 public String getColumnPresentationId(IPresentationContext context, Object element) { 40 if (isApplicable(context, element)) { 41 return JavaVariableColumnPresentation.JAVA_VARIABLE_COLUMN_PRESENTATION; 42 } 43 return null; 44 } 45 46 private boolean isApplicable(IPresentationContext context, Object element) { 47 IJavaStackFrame frame = null; 48 if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) { 49 if (element instanceof IAdaptable) { 50 IAdaptable adaptable = (IAdaptable)element; 51 frame = (IJavaStackFrame) adaptable.getAdapter(IJavaStackFrame.class); 52 } 53 } 54 return frame != null; 55 } 56 57 } 58 | Popular Tags |