1 11 package org.eclipse.debug.internal.ui.elements.adapters; 12 13 import org.eclipse.debug.core.DebugException; 14 import org.eclipse.debug.core.model.IVariable; 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.DefaultLabelProvider; 17 import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneAssignValueAction; 18 import org.eclipse.jface.viewers.ICellModifier; 19 20 24 public class DefaultVariableCellModifier implements ICellModifier { 25 26 29 public boolean canModify(Object element, String property) { 30 if (VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals(property)) { 31 if (element instanceof IVariable) { 32 return ((IVariable) element).supportsValueModification(); 33 } 34 } 35 return false; 36 } 37 38 41 public Object getValue(Object element, String property) { 42 if (VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals(property)) { 43 if (element instanceof IVariable) { 44 IVariable variable = (IVariable) element; 45 try { 46 return DefaultLabelProvider.escapeSpecialChars(variable.getValue().getValueString()); 47 } catch (DebugException e) { 48 DebugUIPlugin.log(e); 49 } 50 } 51 } 52 return null; 53 } 54 55 58 public void modify(Object element, String property, Object value) { 59 Object oldValue = getValue(element, property); 60 if (!value.equals(oldValue)) { 61 if (VariableColumnPresentation.COLUMN_VARIABLE_VALUE.equals(property)) { 62 if (element instanceof IVariable) { 63 if (value instanceof String ) { 64 String valueExpression = DefaultLabelProvider.encodeEsacpedChars((String )value); 66 IVariable variable = (IVariable) element; 67 DetailPaneAssignValueAction.assignValue(DebugUIPlugin.getShell(), variable, valueExpression); 68 } 69 } 70 } 71 } 72 } 73 74 } 75 | Popular Tags |