1 13 14 package org.eclipse.jface.viewers; 15 16 import org.eclipse.core.runtime.Assert; 17 18 24 public abstract class EditingSupport { 25 26 private ColumnViewer viewer; 27 28 32 public EditingSupport(ColumnViewer viewer) { 33 Assert.isNotNull(viewer, "Viewer is not allowed to be null"); this.viewer = viewer; 35 } 36 37 44 protected abstract CellEditor getCellEditor(Object element); 45 46 53 protected abstract boolean canEdit(Object element); 54 55 62 protected abstract Object getValue(Object element); 63 64 76 protected abstract void setValue(Object element, Object value); 77 78 81 public ColumnViewer getViewer() { 82 return viewer; 83 } 84 85 94 protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) { 95 Object value = getValue(cell.getElement()); 96 cellEditor.setValue(value); 97 } 98 99 107 protected void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell) { 108 Object value = cellEditor.getValue(); 109 setValue(cell.getElement(), value); 110 } 111 112 boolean isLegacySupport() { 113 return false; 114 } 115 } 116 | Popular Tags |