1 11 package org.eclipse.debug.internal.ui.elements.adapters; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.core.model.IErrorReportingExpression; 15 import org.eclipse.debug.core.model.IExpression; 16 import org.eclipse.debug.core.model.IValue; 17 import org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext; 18 19 22 public class ExpressionContentAdapter extends VariableContentAdapter { 23 24 protected Object [] getChildren(Object parent, IPresentationContext context) throws CoreException { 25 if (parent instanceof IErrorReportingExpression) { 26 IErrorReportingExpression expression = (IErrorReportingExpression) parent; 27 if (expression.hasErrors()) { 28 return expression.getErrorMessages(); 29 } 30 } 31 32 if (parent instanceof IExpression) { 33 IExpression expression = (IExpression) parent; 34 IValue value = expression.getValue(); 35 if (value != null) { 36 return getValueChildren(expression, value, context); 37 } 38 } 39 40 return EMPTY; 41 } 42 43 protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { 44 if (element instanceof IErrorReportingExpression) { 45 IErrorReportingExpression expression = (IErrorReportingExpression) element; 46 if (expression.hasErrors()) { 47 return true; 48 } 49 } 50 51 if (element instanceof IExpression) { 52 IValue value = ((IExpression) element).getValue(); 53 if (value != null) { 54 return value.hasVariables(); 55 } 56 } 57 58 return false; 59 } 60 61 } 62 | Popular Tags |