Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mbarbero
Last active December 15, 2015 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarbero/e8aafb2c0754dccdd45b to your computer and use it in GitHub Desktop.
Save mbarbero/e8aafb2c0754dccdd45b to your computer and use it in GitHub Desktop.
package fr.obeo.emf.edit.econ2013.live;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.emf.examples.extlibrary.Book;
import org.eclipse.emf.examples.extlibrary.EXTLibraryFactory;
import org.eclipse.emf.examples.extlibrary.Library;
import org.eclipse.emf.examples.extlibrary.Writer;
public class NotifyExample {
public static void main(String[] args) {
Library library = EXTLibraryFactory.eINSTANCE.createLibrary();
library.eAdapters().add(new EContentAdapter() {
@Override
public void notifyChanged(Notification msg) {
super.notifyChanged(msg);
System.out.println(msg);
}
});
library.setName("My library");
Book book = EXTLibraryFactory.eINSTANCE.createBook();
library.getBooks().add(book);
book.setTitle("The two towers");
Writer writer = EXTLibraryFactory.eINSTANCE.createWriter();
library.getWriters().add(writer);
writer.setName("JRR Tolkien");
book.setAuthor(writer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment