blob: c37c8fb07a55a04b54209728112b2089f57da930 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 IBM Corporation and others.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// Contributors:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
/**
*
*/
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);
}
}