1 11 package org.eclipse.debug.internal.ui.views.variables; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.PlatformObject; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.debug.core.DebugException; 17 import org.eclipse.debug.core.ILaunch; 18 import org.eclipse.debug.core.model.IDebugElement; 19 import org.eclipse.debug.core.model.IDebugTarget; 20 import org.eclipse.debug.core.model.IIndexedValue; 21 import org.eclipse.debug.core.model.IValue; 22 import org.eclipse.debug.core.model.IVariable; 23 import org.eclipse.debug.ui.IDebugUIConstants; 24 25 29 public class IndexedVariablePartition extends PlatformObject implements IVariable { 30 31 private int fOffset; 33 34 private int fLength; 36 37 private IDebugElement fOriginalVariable; 39 40 private IIndexedValue fOriginalValue; 42 43 private IIndexedValue fValuePartition; 45 46 private String fName = null; 47 48 56 public IndexedVariablePartition(IDebugElement variable, IIndexedValue value, int offset, int length) { 57 fOriginalVariable = variable; 58 fOriginalValue = value; 59 fOffset = offset; 60 fLength = length; 61 fValuePartition = new IndexedValuePartition(value, offset, length); 62 } 63 64 67 public IValue getValue() { 68 return fValuePartition; 69 } 70 71 74 public String getName() { 75 if (fName == null) { 76 StringBuffer buf = new StringBuffer (); 77 buf.append("["); buf.append(fOffset); 79 buf.append("..."); buf.append(fOffset + fLength - 1); 81 buf.append("]"); fName = buf.toString(); 83 } 84 return fName; 85 } 86 87 90 public String getReferenceTypeName() throws DebugException { 91 if (fOriginalVariable instanceof IVariable) { 92 IVariable variable = (IVariable) fOriginalVariable; 93 return variable.getReferenceTypeName(); 94 } 95 return ""; } 97 98 101 public boolean hasValueChanged() { 102 return false; 103 } 104 105 108 public String getModelIdentifier() { 109 return fOriginalValue.getModelIdentifier(); 110 } 111 112 115 public IDebugTarget getDebugTarget() { 116 return fOriginalValue.getDebugTarget(); 117 } 118 119 122 public ILaunch getLaunch() { 123 return fOriginalValue.getLaunch(); 124 } 125 126 129 public void setValue(String expression) throws DebugException { 130 throw new DebugException(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, VariablesViewMessages.IndexedVariablePartition_4, null)); 131 } 132 133 136 public void setValue(IValue value) throws DebugException { 137 throw new DebugException(new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, VariablesViewMessages.IndexedVariablePartition_4, null)); 138 } 139 140 143 public boolean supportsValueModification() { 144 return false; 145 } 146 147 150 public boolean verifyValue(String expression) { 151 return false; 152 } 153 154 157 public boolean verifyValue(IValue value) { 158 return false; 159 } 160 161 164 public boolean equals(Object obj) { 165 if (obj instanceof IndexedVariablePartition) { 166 IndexedVariablePartition partition = (IndexedVariablePartition)obj; 167 return fOriginalVariable.equals(partition.fOriginalVariable) && 168 fOffset == partition.fOffset && fLength == partition.fLength; 169 } 170 return false; 171 } 172 173 176 public int hashCode() { 177 return fOriginalVariable.hashCode() + fOffset; 178 } 179 180 } 181 | Popular Tags |