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

Avoid NPE when switching model to be displayed in the annotation view

* Dispose columns created for previous model before setting the editor
  input.
* Otherwise, the old label providers might try to access annotations
  that are not presented in the new model

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



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 858a3ee2
No related branches found
No related tags found
1 merge request!543696: Memory Modeling
ColumnHandle.java 8fc5f04cbb0127e5df8c7a9e3b2620502bf93716 GREEN
GenericAnnotationView.java 3986c6ab6f1b5f9ec04780c3d6256e7c70b91c1d GREEN
GenericAnnotationView.java 494cbcade7fd5d66b9629b86549eb25d4d4c93dd YELLOW
......@@ -220,11 +220,6 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
// Minimize flickering while updating the table
tableViewer.getTable().setRedraw(false);
// Input must be set before the construction of the columns, since the editing support
// for a given cell might need to query the contents of other model elements (e.g., in
// order to aggregate a set of admissible choices for its value).
tableViewer.setInput(annotationEntries);
// Sorted set of {@link ColumnHandle} used to instantiate this {@link
// GenericAnnotationView}'s columns in the right order.
Set<ColumnHandle<?>> sortedColumnHandles = new TreeSet<ColumnHandle<?>>();
......@@ -236,6 +231,11 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
column.dispose();
}
// Input must be set before the construction of the columns, since the editing support
// for a given cell might need to query the contents of other model elements (e.g., in
// order to aggregate a set of admissible choices for its value).
tableViewer.setInput(annotationEntries);
// Aggregate required columns. Column order is defined by ColumnHandle.compareTo().
for(AnnotationEntry entry : annotationEntries) {
for(IAnnotatedSpecification spec : entry.getSpecificationsList()) {
......
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