diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/annotation/view/fx/AnnotationViewFXController.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/annotation/view/fx/AnnotationViewFXController.java index 2b53d3297b77bb321a29a17500136eb1dbe9e09e..a049f21ca0b722fe78238ed0d764a941db924aac 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/annotation/view/fx/AnnotationViewFXController.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/annotation/view/fx/AnnotationViewFXController.java @@ -51,7 +51,9 @@ import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeCon import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableUIProviderBase; import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer; import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase; +import org.fortiss.tooling.kernel.extension.data.ITopLevelElement; import org.fortiss.tooling.kernel.model.INamedCommentedElement; +import org.fortiss.tooling.kernel.service.IPersistencyService; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -189,17 +191,6 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP Callback<TreeTableColumn<AnnotationEntry, String>, TreeTableCell<AnnotationEntry, String>> comboCellFactory = ComboBoxTreeTableCell.forTreeTableColumn(items); column.setCellFactory(comboCellFactory); - // column.setCellFactory( - // new Callback<TreeTableColumn<AnnotationEntry, String>, TreeTableCell<AnnotationEntry, - // String>>() { - // @Override - // public TreeTableCell<AnnotationEntry, String> - // call(TreeTableColumn<AnnotationEntry, String> param) { - // Object userData = param.getUserData(); - // return new ComboBoxTreeTableCell<AnnotationEntry, String>("Foobar", - // "Foo"); - // } - // }); column.setEditable(true); column.setOnEditStart(event -> { @@ -218,21 +209,25 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP EList<EEnumLiteral> allLiterals = ((EEnum)type).getELiterals(); items.clear(); - items.addAll(allLiterals.stream().map(l -> l.getName()).collect(toList())); + items.addAll(allLiterals.stream().map(l -> l.getLiteral()).collect(toList())); } + }); + column.setOnEditCommit(event -> { + TreeItem<AnnotationEntry> treeItem = event.getRowValue(); + AnnotationEntry rowEntry = treeItem.getValue(); - // Collection<String> choices = annotationValueProvider.getCurrentInputChoice(); - // if(choices == null || choices.isEmpty()) { - // IModelElement rowModelElement = rowEntry.getModelElement(); - // annotationValueProvider.updateInputChoice(rowModelElement, annotationClass); - // - // choices = annotationValueProvider.getCurrentInputChoice(); - // } - // - // items.clear(); - // items.addAll(choices); - // - // System.out.println(event.toString()); + ITopLevelElement tle = + IPersistencyService.getInstance().getTopLevelElementFor(selectedElement); + + tle.runAsCommand(() -> { + try { + rowEntry.setSpecificationValue(event.getNewValue(), + specification.getClass()); + } catch(Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + }); }); } @@ -263,6 +258,7 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP } return ""; default: + // entry.getAnnotationValueProvider(colIdxAnnotationMap.get(column)); ColumnHandle<IAnnotatedSpecification> colHandle = colIdxAnnotationMap.get(column); IAnnotationValueProvider<IAnnotatedSpecification> valProvider =