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

- Prevent nested calls of selectionChanged() which could trigger a refresh of...

- Prevent nested calls of selectionChanged() which could trigger a refresh of the table before all column label providers / editing support has been initialized
refs 1841
parent cdac18a8
No related branches found
No related tags found
No related merge requests found
......@@ -21,4 +21,13 @@
</view>
</extension>
<!--extension point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider
migrationProvider="org.fortiss.tooling.base.ui.annotation.AnnotationInstantiationMigrationProvider">
<objectClass
objectClass="org.fortiss.tooling.kernel.extension.data.ITopLevelElement">
</objectClass>
</migrationProvider>
</extension-->
</plugin>
......@@ -74,6 +74,9 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
private Map<EObject, Collection<AnnotationEntry>> lastAnnotationEntriesMap =
new HashMap<EObject, Collection<AnnotationEntry>>();
/** Flag to prevent nested calls of {@link #selectionChanged(IWorkbenchPart, ISelection)}. */
private boolean processingSectionChanged = false;
/**
* {@link Adapter} to watch for the addition, removal or value change of model elements
* to/from/in elements visible in this {@link AnnotationViewPartBase} (to trigger according
......@@ -137,6 +140,11 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
/** {@inheritDoc} */
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if(processingSectionChanged) {
return;
}
processingSectionChanged = true;
currentlySelectedObject = null;
currentlySelectedObject = SelectionUtils.checkAndPickFirst(selection, IModelElement.class);
......@@ -149,14 +157,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
}
// Optimization: Do nothing if the same object as been selected again
if(currentlySelectedObject == lastSelectedObject) {
return;
}
if(currentlySelectedObject != null) {
if(currentlySelectedObject != lastSelectedObject && currentlySelectedObject != null) {
update(currentlySelectedObject);
lastSelectedObject = currentlySelectedObject;
}
processingSectionChanged = false;
}
/** Determines root element of the given model element. */
......
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