Commit a98635d0 authored by Simon Barner's avatar Simon Barner
Browse files

More safe update of property section title

* Only react on EMF events when INamedElement::name is set
  (this is supposed to resolve the "SWT Widget is disposed" exception)
* Ensure that update is perform from the UI context. The underlying
  model change could be programmatic and triggered from a different
  thread (resolves "SWTException: Invalid thread access")

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

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 9f548455
......@@ -10,7 +10,7 @@ ModelEditorBindingBase.java 4c5ac569c0b6e7678fc8191096b26dfd09fdcb98 GREEN
ModelElementHandlerBase.java 384727748f125c9d43f19d9c0eba4ba1be5a7a26 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 02836dd112912771d99fe8845e0774e29381f724 GREEN
PropertySectionBase.java 7b893ca28d86a415d9fc7a818e65c04ed244e896 YELLOW
TutorialStepUIAtomicBase.java cea2a158158b476de2108d2309afcf47f217b6d9 GREEN
TutorialStepUIAtomicWithWhitelistBase.java a9788ae514f62d27169c737ef59fb583234b5d43 GREEN
TutorialStepUICompositeBase.java 8225210eacb5b88de47d78280c5819f572f00ffa GREEN
......
......@@ -52,11 +52,13 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage;
import org.fortiss.tooling.kernel.model.ILibraryElementReference;
import org.fortiss.tooling.kernel.service.ILibraryService;
......@@ -75,10 +77,15 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
/** {@inheritDoc} */
@Override
public void notifyChanged(org.eclipse.emf.common.notify.Notification msg) {
if(msg.getEventType() != Notification.REMOVING_ADAPTER) {
// Updates the tabbed property sheets title
tabbedPropertySheetPage.labelProviderChanged(null);
if(msg.getEventType() == Notification.SET &&
msg.getFeature() == FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME) {
// Model change could be programmatic: wrap the update into asyncExec().
Display.getDefault().asyncExec(() -> {
// Updates the tabbed property sheets title (no other API available)
tabbedPropertySheetPage.labelProviderChanged(null);
});
}
// System.out.println(msg.getEventType() + " @ " + msg.getNotifier());
}
/** Removes itself. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment