1 11 package org.eclipse.debug.internal.ui.views.registers; 12 13 import org.eclipse.debug.core.DebugException; 14 import org.eclipse.debug.core.model.IRegisterGroup; 15 import org.eclipse.debug.core.model.IStackFrame; 16 import org.eclipse.debug.core.model.IVariable; 17 import org.eclipse.debug.internal.ui.DebugUIPlugin; 18 import org.eclipse.debug.internal.ui.views.IDebugExceptionHandler; 19 import org.eclipse.debug.internal.ui.views.variables.VariablesViewContentProvider; 20 import org.eclipse.debug.ui.IDebugView; 21 22 25 public class RegistersViewContentProvider extends VariablesViewContentProvider { 26 27 public RegistersViewContentProvider(IDebugView view) { 28 super(view); 29 } 30 31 34 public Object [] getChildren(Object parent) { 35 Object [] children= null; 36 try { 37 if (parent instanceof IStackFrame) { 38 children = ((IStackFrame)parent).getRegisterGroups(); 39 } else if (parent instanceof IRegisterGroup) { 40 children = ((IRegisterGroup)parent).getRegisters(); 41 } else if (parent instanceof IVariable) { 42 children = super.getChildren( parent ); 43 } 44 if (children != null) { 45 cache(parent, children); 46 return children; 47 } 48 } catch (DebugException de) { 49 if (getExceptionHandler() != null) { 50 getExceptionHandler().handleException(de); 51 } else { 52 DebugUIPlugin.log(de); 53 } 54 } 55 return new Object [0]; 56 } 57 58 61 public boolean hasChildren(Object element) { 62 try { 63 if (element instanceof IStackFrame) { 64 return ((IStackFrame)element).hasRegisterGroups(); 65 } 66 if (element instanceof IRegisterGroup) { 67 return ((IRegisterGroup)element).hasRegisters(); 68 } 69 } catch (DebugException de) { 70 DebugUIPlugin.log(de); 71 return false; 72 } 73 return super.hasChildren(element); 74 } 75 76 79 protected void setExceptionHandler(IDebugExceptionHandler handler) { 80 super.setExceptionHandler(handler); 81 } 82 } 83 | Popular Tags |