Skip to content
Snippets Groups Projects
Commit 7d5f379e authored by Simon Barner's avatar Simon Barner
Browse files

Get annotation value provider based on columns annotation type


Issue-Ref: 4140
Issue-Url: #4140

Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent fd9b3539
No related branches found
No related tags found
1 merge request!1444140: Remove AnnotationInstSpec.getAnnotatedSpecification()
AnnotationFxViewPart.java ca1548c49aa3842a9436262531464ba345b83688 GREEN
AnnotationTreeTableUIProvider.java 4d9ea9f5267e1a04985c5f67e748f34474c97e0f GREEN
AnnotationTreeTableUIProvider.java 8a6be639582f761db85908cca42533ab9289808d YELLOW
AnnotationViewFXController.java 87d70534cde579cbd5f6470e729783306a139324 GREEN
AnnotationsFXUtils.java 754152735e037da59a4c40fa045602c3ed85a40f GREEN
ColumnHandle.java 761c2517b3f3e4725feb7ce7e8d5927ba191a4bb GREEN
......
......@@ -19,6 +19,7 @@ import static org.fortiss.tooling.base.ui.annotation.view.fx.AnnotationsFXUtils.
import static org.fortiss.tooling.base.ui.annotation.view.fx.AnnotationsFXUtils.getBackgroundColorForEntry;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -97,12 +98,21 @@ import javafx.scene.paint.Color;
/** {@inheritDoc} */
@Override
public boolean isEditable(int column, AnnotationEntry element) {
public boolean isEditable(int column, AnnotationEntry ae) {
if(column > 1 && this.viewController.colIdxAnnotationMap.containsKey(column)) {
ColumnHandle<IAnnotatedSpecification> columnHandle =
this.viewController.colIdxAnnotationMap.get(column);
// Get annotation value provider for specification associated to given annotation entry
Class<IAnnotatedSpecification> specType = columnHandle.getAnnotatedSpecificationType();
IAnnotationValueService as = IAnnotationValueService.getInstance();
IAnnotatedSpecification spec =
this.viewController.colIdxAnnotationMap.get(column).getAnnotatedSpecification();
as.getAnnotationEntry(ae.getModelElement()).getSpecification(specType);
// Check 'editable' predicate for specification/annotation contained by model element
// associated to given annotation entry (if it exists)
IAnnotationValueProvider<IAnnotatedSpecification> valueProvider =
element.getAnnotationValueProvider(spec.getClass());
spec != null ? ae.getAnnotationValueProvider(spec.getClass()) : null;
return valueProvider != null && valueProvider.canEdit(spec);
}
......
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