Skip to content
Snippets Groups Projects
Commit 600d7ba2 authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Annotations: Editing seams to work

Editing of Enumeration values seams to work. But wrong value is
displayed, still.

Issue-Ref: 4014
Issue-Url: https://af3-developer.fortiss.org/issues/4014


Signed-off-by: default avatarAndreas Bayha <bayha@fortiss.org>
parent 255f14e8
No related branches found
No related tags found
1 merge request!1254014
......@@ -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 =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment