+ class ValuesEditingSupport extends EditingSupport {
+ private final TableViewer tableViewer;
+
+ public ValuesEditingSupport(ColumnViewer viewer) {
+ super(viewer);
+ tableViewer = (TableViewer) viewer;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ try {
+ Node specAttrNode = (Node) element;
+ if (specAttrNode
+ .isNodeType(SlcTypes.SLC_PRIMITIVE_SPEC_ATTRIBUTE))
+ return new TextCellEditor(tableViewer.getTable());
+ return null;
+ } catch (RepositoryException e) {
+ throw new SlcException("Cannot get celle editor", e);
+ }
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ try {
+ Node specAttrNode = (Node) element;
+ return !(specAttrNode.getProperty(SLC_IS_IMMUTABLE)
+ .getBoolean() || specAttrNode.getProperty(
+ SLC_IS_CONSTANT).getBoolean())
+ && specAttrNode
+ .isNodeType(SlcTypes.SLC_PRIMITIVE_SPEC_ATTRIBUTE);
+ } catch (RepositoryException e) {
+ throw new SlcException("Cannot check canEdit", e);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ Node specAttrNode = (Node) element;
+ try {
+ Object value = getAttributeSpecValue(specAttrNode);
+ if (value == null)
+ throw new SlcException("Unsupported attribute " + element);
+ if (specAttrNode
+ .isNodeType(SlcTypes.SLC_PRIMITIVE_SPEC_ATTRIBUTE))
+ return value.toString();
+ return value;
+ } catch (RepositoryException e) {
+ throw new SlcException("Cannot get value for " + element, e);
+ }
+ }