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

Ensure update of annotation view in case of external

 - renamings of model elements (e.g., in the properties view)
 - addition of new instances of multi-instance annotations

-> Use originator of the notification, and not the new value to trigger the update
refs 1841
parent 8163bfa0
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,8 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils; ...@@ -51,7 +51,8 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: 40FF672DC52B17062D1716341177D76A * @ConQAT.Rating YELLOW Hash: 40FF672DC52B17062D1716341177D76A
*/ */
public abstract class AnnotationViewPartBase extends ViewPart implements ISelectionListener, IAnnotationViewPart { public abstract class AnnotationViewPartBase extends ViewPart implements ISelectionListener,
IAnnotationViewPart {
/** the currently selected object */ /** the currently selected object */
private IModelElement currentlySelectedObject; private IModelElement currentlySelectedObject;
...@@ -70,9 +71,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect ...@@ -70,9 +71,12 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
@Override @Override
public void notifyChanged(Notification notification) { public void notifyChanged(Notification notification) {
if((notification.getEventType() == Notification.ADD) || if((notification.getEventType() == Notification.ADD) ||
(notification.getEventType() == Notification.REMOVE)) { (notification.getEventType() == Notification.REMOVE || (notification
if(notification.getNewValue() instanceof IModelElement) { .getEventType() == Notification.SET))) {
update((IModelElement)notification.getNewValue());
Object notifier = notification.getNotifier();
if(notifier instanceof IModelElement) {
update((IModelElement)notifier);
} }
} }
} }
......
...@@ -17,6 +17,8 @@ $Id$ ...@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/ +--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.view; package org.fortiss.tooling.base.ui.annotation.view;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.NotificationImpl;
import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.common.util.EMap;
import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.InputDialog;
...@@ -225,6 +227,16 @@ public class CreateAnnotationInstanceColumn extends ViewerColumn { ...@@ -225,6 +227,16 @@ public class CreateAnnotationInstanceColumn extends ViewerColumn {
((EMap<String, ?>)columnSpecAnnEntry ((EMap<String, ?>)columnSpecAnnEntry
.getSpecificationValue(columnSpec.getClass())).put( .getSpecificationValue(columnSpec.getClass())).put(
instanceKey, null); instanceKey, null);
// Inform others, e.g. the respective annotation view that a new
// instance of this annotation has been created.
columnSpecAnnEntry.getModelElement().eNotify(
new NotificationImpl(Notification.SET, null, null) {
@Override
public Object getNotifier() {
return columnSpecAnnEntry.getModelElement();
}
});
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
// e.printStackTrace(); // e.printStackTrace();
MessageDialog MessageDialog
......
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