1 11 package org.eclipse.debug.internal.ui.views.expression; 12 13 import org.eclipse.debug.core.DebugException; 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.core.model.IVariable; 18 import org.eclipse.debug.internal.ui.elements.adapters.DeferredExpressionLogicalStructure; 19 import org.eclipse.debug.internal.ui.views.RemoteTreeViewer; 20 import org.eclipse.debug.internal.ui.views.variables.RemoteVariableContentManager; 21 import org.eclipse.debug.internal.ui.views.variables.VariablesView; 22 import org.eclipse.jface.viewers.ITreeContentProvider; 23 import org.eclipse.ui.IWorkbenchPartSite; 24 import org.eclipse.ui.progress.IDeferredWorkbenchAdapter; 25 26 30 public class RemoteExpressionContentManager extends RemoteVariableContentManager { 31 32 private IDeferredWorkbenchAdapter fExpressionLogicalStructureAdapter = new DeferredExpressionLogicalStructure(); 33 34 37 public RemoteExpressionContentManager(ITreeContentProvider provider, RemoteTreeViewer viewer, IWorkbenchPartSite site, VariablesView view) { 38 super(provider, viewer, site, view); 39 } 40 41 44 protected IDeferredWorkbenchAdapter getAdapter(Object element) { 45 if (element instanceof IExpression && fView !=null && fView.isShowLogicalStructure()) { 46 return fExpressionLogicalStructureAdapter; 47 } 48 return super.getAdapter(element); 49 } 50 51 public boolean mayHaveChildren(Object element) { 52 if (element instanceof IErrorReportingExpression) { 53 IErrorReportingExpression iere = (IErrorReportingExpression) element; 54 if (iere.hasErrors()) { 55 return true; 57 } 58 } 59 60 if (element instanceof IExpression) { 61 IExpression expression = (IExpression) element; 62 IValue value = expression.getValue(); 63 if (value != null) { 64 try { 65 IVariable[] variables = value.getVariables(); 66 if (variables.length > 0) { 67 return true; 69 } 70 71 return false; 73 } catch (DebugException e) { 74 } 75 } 76 } 77 78 return super.mayHaveChildren(element); 80 } 81 82 83 84 } 85 | Popular Tags |