| /** |
| * |
| */ |
| package org.eclipse.epf.diagramming.base.util; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.Notifier; |
| import org.eclipse.emf.common.notify.impl.AdapterImpl; |
| import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| import org.eclipse.epf.uma.Activity; |
| import org.eclipse.epf.uma.MethodElement; |
| import org.eclipse.gmf.runtime.notation.Diagram; |
| |
| /** |
| * DiagramChangeListener listens to the Notification of Notifier (mainly {@link Activity} |
| * Similar to the GEF based ActivityDiagram {@link org.eclipse.epf.diagram.model.util.IDiagramChangeListener} |
| * @author Shashidhar Kannoori |
| */ |
| public class DiagramChangeListener extends AdapterImpl implements IDiagramChangeListener { |
| |
| private MethodElement object; |
| private Diagram diagram; |
| |
| public DiagramChangeListener(TransactionalEditingDomain domain, |
| MethodElement object, Diagram diagram) { |
| this.object = object; |
| this.diagram = diagram; |
| } |
| |
| public DiagramChangeListener(MethodElement object, Diagram diagram) { |
| this.object = object; |
| this.diagram = diagram; |
| } |
| public Diagram getDiagram() { |
| return diagram; |
| } |
| |
| public Notifier getTarget() { |
| return object; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object) |
| */ |
| public boolean isAdapterForType(Object type) { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification) |
| */ |
| public void notifyChanged(Notification msg) { |
| // if (!notificationEnabled ) |
| // return; |
| // notificationEnabled = false; |
| // try { |
| // //Object obj; |
| // switch (msg.getFeatureID(Activity.class)) { |
| // case UmaPackage.ACTIVITY__BREAKDOWN_ELEMENTS: |
| // switch (msg.getEventType()) { |
| // case Notification.ADD: |
| // System.out.println("Notification Add"); |
| // break; |
| // case Notification.REMOVE: |
| // System.out.println("Notification Add"); |
| // break; |
| // case Notification.ADD_MANY: |
| // System.out.println("Notification Add"); |
| // break; |
| // case Notification.REMOVE_MANY: |
| // System.out.println("Notification Add"); |
| // break; |
| // case Notification.MOVE: |
| // System.out.println("Notification Add"); |
| // break; |
| // } |
| // break; |
| // } |
| // } |
| // finally { |
| // notificationEnabled = true; |
| // } |
| super.notifyChanged(msg); |
| } |
| } |