-
-
Save mbarbero/e8aafb2c0754dccdd45b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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