Community
Participate
Working Groups
ode in the AbstractModelerPropertySection#isCurrentSelection() method uses obsolete assumptions regarding the container for deleted annotations. In the code there is a conditional block commented as //the annotation has been removed - check the old owner. There are two problems with this code: 1. The 'eventObject' in this case (the container of the EAnnotation) will not be null in 2.x but rather will be the change recorder (this is a side-effect of moving to use the change recorder in 2.x) 2. This code doesn't check to see if the notification in question is actually on the container feature for the EAnnotation before checking the old value in the notification. Both of these may cause incorrect behavior in properties sections. A verson of the code that fixes both of these problems is pasted below: /** * Determines if the page is displaying properties for this element * * @param notification * The notification * @param element * The element to be tested * @return 'true' if the page is displaying properties for this element */ protected boolean isCurrentSelection(Notification notification, EObject element) { if (element == null) return false; if (eObjectList.contains(element)) return true; if (eObjectList.size() > 0) { EObject eventObject = element; // check for annotations if (element instanceof EAnnotation) { eventObject = element.eContainer(); } else { EObject container = element.eContainer(); if (container != null && container instanceof EAnnotation) { eventObject = container.eContainer(); } } if (notification.getFeature() == EcorePackage.Literals.EANNOTATION__EMODEL_ELEMENT) { Object oldObj = notification.getOldValue(); Object newObj = notification.getNewValue(); if (oldObj instanceof EObject && newObj == null) { // the annotation has been removed - check the old owner eventObject = (EObject) oldObj; } } if (eventObject != element) { return eObjectList.contains(eventObject); } } return false; }
Committed to R2_0_maintenance and HEAD
[GMF Restructure] Bug 319140 : product GMF and component Runtime was the original product and component for this bug