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 @@ ...@@ -21,4 +21,13 @@
</view> </view>
</extension> </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> </plugin>
...@@ -74,6 +74,9 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect ...@@ -74,6 +74,9 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
private Map<EObject, Collection<AnnotationEntry>> lastAnnotationEntriesMap = private Map<EObject, Collection<AnnotationEntry>> lastAnnotationEntriesMap =
new HashMap<EObject, Collection<AnnotationEntry>>(); 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 * {@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 * to/from/in elements visible in this {@link AnnotationViewPartBase} (to trigger according
...@@ -137,6 +140,11 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect ...@@ -137,6 +140,11 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) { public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if(processingSectionChanged) {
return;
}
processingSectionChanged = true;
currentlySelectedObject = null; currentlySelectedObject = null;
currentlySelectedObject = SelectionUtils.checkAndPickFirst(selection, IModelElement.class); currentlySelectedObject = SelectionUtils.checkAndPickFirst(selection, IModelElement.class);
...@@ -149,14 +157,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect ...@@ -149,14 +157,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
} }
// Optimization: Do nothing if the same object as been selected again // Optimization: Do nothing if the same object as been selected again
if(currentlySelectedObject == lastSelectedObject) { if(currentlySelectedObject != lastSelectedObject && currentlySelectedObject != null) {
return;
}
if(currentlySelectedObject != null) {
update(currentlySelectedObject); update(currentlySelectedObject);
lastSelectedObject = currentlySelectedObject; lastSelectedObject = currentlySelectedObject;
} }
processingSectionChanged = false;
} }
/** Determines root element of the given model element. */ /** 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