|
Lines 85-95
Link Here
|
| 85 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
85 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
| 86 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
86 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
| 87 |
|
87 |
|
| 88 |
List notifications = listener.postcommitNotifications; |
88 |
List<Notification> notifications = listener.postcommitNotifications; |
| 89 |
assertNotNull(notifications); |
89 |
assertNotNull(notifications); |
| 90 |
assertEquals(1, notifications.size()); |
90 |
assertEquals(1, notifications.size()); |
| 91 |
|
91 |
|
| 92 |
Notification notification = (Notification) notifications.get(0); |
92 |
Notification notification = notifications.get(0); |
| 93 |
assertSame(book, notification.getNotifier()); |
93 |
assertSame(book, notification.getNotifier()); |
| 94 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
94 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 95 |
assertSame(newTitle, notification.getNewValue()); |
95 |
assertSame(newTitle, notification.getNewValue()); |
|
Lines 140-150
Link Here
|
| 140 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
140 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
| 141 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
141 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
| 142 |
|
142 |
|
| 143 |
List notifications = listener.postcommitNotifications; |
143 |
List<Notification> notifications = listener.postcommitNotifications; |
| 144 |
assertNotNull(notifications); |
144 |
assertNotNull(notifications); |
| 145 |
assertEquals(1, notifications.size()); |
145 |
assertEquals(1, notifications.size()); |
| 146 |
|
146 |
|
| 147 |
Notification notification = (Notification) notifications.get(0); |
147 |
Notification notification = notifications.get(0); |
| 148 |
assertSame(book, notification.getNotifier()); |
148 |
assertSame(book, notification.getNotifier()); |
| 149 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
149 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 150 |
assertSame(newTitle, notification.getNewValue()); |
150 |
assertSame(newTitle, notification.getNewValue()); |
|
Lines 196-216
Link Here
|
| 196 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
196 |
assertFalse(listener.postcommit.getTransaction().isActive()); |
| 197 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
197 |
assertSame(domain, listener.postcommit.getEditingDomain()); |
| 198 |
|
198 |
|
| 199 |
List notifications = listener.postcommitNotifications; |
199 |
List<Notification> notifications = listener.postcommitNotifications; |
| 200 |
assertNotNull(notifications); |
200 |
assertNotNull(notifications); |
| 201 |
assertEquals(3, notifications.size()); |
201 |
assertEquals(3, notifications.size()); |
| 202 |
|
202 |
|
| 203 |
Notification notification = (Notification) notifications.get(0); |
203 |
Notification notification = notifications.get(0); |
| 204 |
assertSame(book, notification.getNotifier()); |
204 |
assertSame(book, notification.getNotifier()); |
| 205 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Category(), notification.getFeature()); |
205 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Category(), notification.getFeature()); |
| 206 |
assertSame(BookCategory.BIOGRAPHY_LITERAL, notification.getNewValue()); |
206 |
assertSame(BookCategory.BIOGRAPHY_LITERAL, notification.getNewValue()); |
| 207 |
|
207 |
|
| 208 |
notification = (Notification) notifications.get(1); |
208 |
notification = notifications.get(1); |
| 209 |
assertSame(book, notification.getNotifier()); |
209 |
assertSame(book, notification.getNotifier()); |
| 210 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
210 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 211 |
assertSame(newTitle, notification.getNewValue()); |
211 |
assertSame(newTitle, notification.getNewValue()); |
| 212 |
|
212 |
|
| 213 |
notification = (Notification) notifications.get(2); |
213 |
notification = notifications.get(2); |
| 214 |
assertSame(book, notification.getNotifier()); |
214 |
assertSame(book, notification.getNotifier()); |
| 215 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Pages(), notification.getFeature()); |
215 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Pages(), notification.getFeature()); |
| 216 |
assertEquals(new Integer(500), notification.getNewValue()); |
216 |
assertEquals(new Integer(500), notification.getNewValue()); |
|
Lines 231-236
Link Here
|
| 231 |
commit(); |
231 |
commit(); |
| 232 |
|
232 |
|
| 233 |
TestListener testListener = new TestListener() { |
233 |
TestListener testListener = new TestListener() { |
|
|
234 |
@Override |
| 234 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
235 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
| 235 |
try { |
236 |
try { |
| 236 |
// can execute read operations |
237 |
// can execute read operations |
|
Lines 308-318
Link Here
|
| 308 |
assertFalse(listener.precommit.getTransaction().isActive()); |
309 |
assertFalse(listener.precommit.getTransaction().isActive()); |
| 309 |
assertSame(domain, listener.precommit.getEditingDomain()); |
310 |
assertSame(domain, listener.precommit.getEditingDomain()); |
| 310 |
|
311 |
|
| 311 |
List notifications = listener.precommitNotifications; |
312 |
List<Notification> notifications = listener.precommitNotifications; |
| 312 |
assertNotNull(notifications); |
313 |
assertNotNull(notifications); |
| 313 |
assertEquals(1, notifications.size()); |
314 |
assertEquals(1, notifications.size()); |
| 314 |
|
315 |
|
| 315 |
Notification notification = (Notification) notifications.get(0); |
316 |
Notification notification = notifications.get(0); |
| 316 |
assertSame(book, notification.getNotifier()); |
317 |
assertSame(book, notification.getNotifier()); |
| 317 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
318 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 318 |
assertSame(newTitle, notification.getNewValue()); |
319 |
assertSame(newTitle, notification.getNewValue()); |
|
Lines 397-407
Link Here
|
| 397 |
assertFalse(listener.precommit.getTransaction().isActive()); |
398 |
assertFalse(listener.precommit.getTransaction().isActive()); |
| 398 |
assertSame(domain, listener.precommit.getEditingDomain()); |
399 |
assertSame(domain, listener.precommit.getEditingDomain()); |
| 399 |
|
400 |
|
| 400 |
List notifications = listener.precommitNotifications; |
401 |
List<Notification> notifications = listener.precommitNotifications; |
| 401 |
assertNotNull(notifications); |
402 |
assertNotNull(notifications); |
| 402 |
assertEquals(1, notifications.size()); |
403 |
assertEquals(1, notifications.size()); |
| 403 |
|
404 |
|
| 404 |
Notification notification = (Notification) notifications.get(0); |
405 |
Notification notification = notifications.get(0); |
| 405 |
assertSame(book, notification.getNotifier()); |
406 |
assertSame(book, notification.getNotifier()); |
| 406 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
407 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 407 |
assertSame(newTitle, notification.getNewValue()); |
408 |
assertSame(newTitle, notification.getNewValue()); |
|
Lines 422-432
Link Here
|
| 422 |
assertFalse(listener.precommit.getTransaction().isActive()); |
423 |
assertFalse(listener.precommit.getTransaction().isActive()); |
| 423 |
assertSame(domain, listener.precommit.getEditingDomain()); |
424 |
assertSame(domain, listener.precommit.getEditingDomain()); |
| 424 |
|
425 |
|
| 425 |
List notifications = listener.precommitNotifications; |
426 |
List<Notification> notifications = listener.precommitNotifications; |
| 426 |
assertNotNull(notifications); |
427 |
assertNotNull(notifications); |
| 427 |
assertEquals(1, notifications.size()); |
428 |
assertEquals(1, notifications.size()); |
| 428 |
|
429 |
|
| 429 |
Notification notification = (Notification) notifications.get(0); |
430 |
Notification notification = notifications.get(0); |
| 430 |
assertSame(book, notification.getNotifier()); |
431 |
assertSame(book, notification.getNotifier()); |
| 431 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Category(), notification.getFeature()); |
432 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Category(), notification.getFeature()); |
| 432 |
assertSame(BookCategory.BIOGRAPHY_LITERAL, notification.getNewValue()); |
433 |
assertSame(BookCategory.BIOGRAPHY_LITERAL, notification.getNewValue()); |
|
Lines 447-452
Link Here
|
| 447 |
commit(); |
448 |
commit(); |
| 448 |
|
449 |
|
| 449 |
TestListener testListener = new TestListener() { |
450 |
TestListener testListener = new TestListener() { |
|
|
451 |
@Override |
| 450 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) { |
452 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) { |
| 451 |
try { |
453 |
try { |
| 452 |
// can execute read operations |
454 |
// can execute read operations |
|
Lines 515-520
Link Here
|
| 515 |
commit(); |
517 |
commit(); |
| 516 |
|
518 |
|
| 517 |
TestListener testListener = new TestListener() { |
519 |
TestListener testListener = new TestListener() { |
|
|
520 |
@Override |
| 518 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) { |
521 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) { |
| 519 |
try { |
522 |
try { |
| 520 |
// cannot commit the transaction while it is committing |
523 |
// cannot commit the transaction while it is committing |
|
Lines 581-587
Link Here
|
| 581 |
|
584 |
|
| 582 |
assertEquals("New Library", newLibrary.getName()); //$NON-NLS-1$ |
585 |
assertEquals("New Library", newLibrary.getName()); //$NON-NLS-1$ |
| 583 |
assertEquals(1, newLibrary.getBooks().size()); |
586 |
assertEquals(1, newLibrary.getBooks().size()); |
| 584 |
assertEquals("New Book", ((Book) newLibrary.getBooks().get(0)).getTitle()); //$NON-NLS-1$ |
587 |
assertEquals("New Book", newLibrary.getBooks().get(0).getTitle()); //$NON-NLS-1$ |
| 585 |
|
588 |
|
| 586 |
commit(); |
589 |
commit(); |
| 587 |
} |
590 |
} |
|
Lines 611-617
Link Here
|
| 611 |
|
614 |
|
| 612 |
// the book is created by the first trigger |
615 |
// the book is created by the first trigger |
| 613 |
assertEquals(1, newLibrary.getBooks().size()); |
616 |
assertEquals(1, newLibrary.getBooks().size()); |
| 614 |
Book book = (Book) newLibrary.getBooks().get(0); |
617 |
Book book = newLibrary.getBooks().get(0); |
| 615 |
assertEquals("New Book", book.getTitle()); //$NON-NLS-1$ |
618 |
assertEquals("New Book", book.getTitle()); //$NON-NLS-1$ |
| 616 |
|
619 |
|
| 617 |
// the publication date is created by the cascaded trigger |
620 |
// the publication date is created by the cascaded trigger |
|
Lines 665-677
Link Here
|
| 665 |
|
668 |
|
| 666 |
assertNotNull(listener.postcommit); |
669 |
assertNotNull(listener.postcommit); |
| 667 |
|
670 |
|
| 668 |
List notifications = listener.postcommitNotifications; |
671 |
List<Notification> notifications = listener.postcommitNotifications; |
| 669 |
assertNotNull(notifications); |
672 |
assertNotNull(notifications); |
| 670 |
|
673 |
|
| 671 |
// unbatched notifications are always singletons |
674 |
// unbatched notifications are always singletons |
| 672 |
assertEquals(1, notifications.size()); |
675 |
assertEquals(1, notifications.size()); |
| 673 |
|
676 |
|
| 674 |
Notification notification = (Notification) notifications.get(0); |
677 |
Notification notification = notifications.get(0); |
| 675 |
assertSame(domain.getResourceSet(), notification.getNotifier()); |
678 |
assertSame(domain.getResourceSet(), notification.getNotifier()); |
| 676 |
assertEquals(Notification.ADD, notification.getEventType()); |
679 |
assertEquals(Notification.ADD, notification.getEventType()); |
| 677 |
assertEquals(ResourceSet.RESOURCE_SET__RESOURCES, notification.getFeatureID(null)); |
680 |
assertEquals(ResourceSet.RESOURCE_SET__RESOURCES, notification.getFeatureID(null)); |
|
Lines 688-696
Link Here
|
| 688 |
try { |
691 |
try { |
| 689 |
class Listener extends ResourceSetListenerImpl { |
692 |
class Listener extends ResourceSetListenerImpl { |
| 690 |
ResourceSetChangeEvent lastEvent = null; |
693 |
ResourceSetChangeEvent lastEvent = null; |
| 691 |
List lastNotifications = null; |
694 |
List<Notification> lastNotifications = null; |
| 692 |
int count = 0; |
695 |
int count = 0; |
| 693 |
|
696 |
|
|
|
697 |
@Override |
| 694 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
698 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
| 695 |
count++; |
699 |
count++; |
| 696 |
|
700 |
|
|
Lines 730-735
Link Here
|
| 730 |
final Resource[] newRes = new Resource[1]; |
734 |
final Resource[] newRes = new Resource[1]; |
| 731 |
|
735 |
|
| 732 |
TestListener testListener = new TestListener() { |
736 |
TestListener testListener = new TestListener() { |
|
|
737 |
@Override |
| 733 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
738 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
| 734 |
// make sure that I only do this on the first time that I |
739 |
// make sure that I only do this on the first time that I |
| 735 |
// am invoked (from the new library notification) |
740 |
// am invoked (from the new library notification) |
|
Lines 760-772
Link Here
|
| 760 |
// caused more notifications to the listeners) |
765 |
// caused more notifications to the listeners) |
| 761 |
assertNotNull(listener.postcommit); |
766 |
assertNotNull(listener.postcommit); |
| 762 |
|
767 |
|
| 763 |
List notifications = listener.postcommitNotifications; |
768 |
List<Notification> notifications = listener.postcommitNotifications; |
| 764 |
assertNotNull(notifications); |
769 |
assertNotNull(notifications); |
| 765 |
|
770 |
|
| 766 |
// unbatched notifications are always singletons |
771 |
// unbatched notifications are always singletons |
| 767 |
assertEquals(1, notifications.size()); |
772 |
assertEquals(1, notifications.size()); |
| 768 |
|
773 |
|
| 769 |
Notification notification = (Notification) notifications.get(0); |
774 |
Notification notification = notifications.get(0); |
| 770 |
assertSame(domain.getResourceSet(), notification.getNotifier()); |
775 |
assertSame(domain.getResourceSet(), notification.getNotifier()); |
| 771 |
assertEquals(Notification.ADD, notification.getEventType()); |
776 |
assertEquals(Notification.ADD, notification.getEventType()); |
| 772 |
assertEquals(ResourceSet.RESOURCE_SET__RESOURCES, notification.getFeatureID(null)); |
777 |
assertEquals(ResourceSet.RESOURCE_SET__RESOURCES, notification.getFeatureID(null)); |
|
Lines 786-791
Link Here
|
| 786 |
class AggregatedListener extends TestListener { |
791 |
class AggregatedListener extends TestListener { |
| 787 |
int count = 0; |
792 |
int count = 0; |
| 788 |
|
793 |
|
|
|
794 |
@Override |
| 789 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) |
795 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) |
| 790 |
throws RollbackException { |
796 |
throws RollbackException { |
| 791 |
|
797 |
|
|
Lines 794-805
Link Here
|
| 794 |
return super.transactionAboutToCommit(event); |
800 |
return super.transactionAboutToCommit(event); |
| 795 |
} |
801 |
} |
| 796 |
|
802 |
|
|
|
803 |
@Override |
| 797 |
public void reset() { |
804 |
public void reset() { |
| 798 |
super.reset(); |
805 |
super.reset(); |
| 799 |
|
806 |
|
| 800 |
count = 0; |
807 |
count = 0; |
| 801 |
} |
808 |
} |
| 802 |
|
809 |
|
|
|
810 |
@Override |
| 803 |
public boolean isAggregatePrecommitListener() { |
811 |
public boolean isAggregatePrecommitListener() { |
| 804 |
return true; |
812 |
return true; |
| 805 |
} |
813 |
} |
|
Lines 835-851
Link Here
|
| 835 |
assertNotNull(localListener.precommit.getTransaction()); |
843 |
assertNotNull(localListener.precommit.getTransaction()); |
| 836 |
assertEquals(1, localListener.count); |
844 |
assertEquals(1, localListener.count); |
| 837 |
|
845 |
|
| 838 |
List notifications = localListener.precommitNotifications; |
846 |
List<Notification> notifications = localListener.precommitNotifications; |
| 839 |
assertNotNull(notifications); |
847 |
assertNotNull(notifications); |
| 840 |
assertEquals(2, notifications.size()); |
848 |
assertEquals(2, notifications.size()); |
| 841 |
|
849 |
|
| 842 |
// notifications came in the right order |
850 |
// notifications came in the right order |
| 843 |
Notification notification = (Notification) notifications.get(0); |
851 |
Notification notification = notifications.get(0); |
| 844 |
assertSame(book, notification.getNotifier()); |
852 |
assertSame(book, notification.getNotifier()); |
| 845 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
853 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 846 |
assertSame(newTitle1, notification.getNewValue()); |
854 |
assertSame(newTitle1, notification.getNewValue()); |
| 847 |
|
855 |
|
| 848 |
notification = (Notification) notifications.get(1); |
856 |
notification = notifications.get(1); |
| 849 |
assertSame(book, notification.getNotifier()); |
857 |
assertSame(book, notification.getNotifier()); |
| 850 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
858 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 851 |
assertSame(newTitle2, notification.getNewValue()); |
859 |
assertSame(newTitle2, notification.getNewValue()); |
|
Lines 866-871
Link Here
|
| 866 |
class AggregatedListener extends TestListener { |
874 |
class AggregatedListener extends TestListener { |
| 867 |
int count = 0; |
875 |
int count = 0; |
| 868 |
|
876 |
|
|
|
877 |
@Override |
| 869 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) |
878 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) |
| 870 |
throws RollbackException { |
879 |
throws RollbackException { |
| 871 |
|
880 |
|
|
Lines 874-884
Link Here
|
| 874 |
super.transactionAboutToCommit(event); |
883 |
super.transactionAboutToCommit(event); |
| 875 |
|
884 |
|
| 876 |
if (count < 2) { |
885 |
if (count < 2) { |
| 877 |
List notifications = event.getNotifications(); |
886 |
List<Notification> notifications = event.getNotifications(); |
| 878 |
assertNotNull(notifications); |
887 |
assertNotNull(notifications); |
| 879 |
assertEquals(1, notifications.size()); |
888 |
assertEquals(1, notifications.size()); |
| 880 |
|
889 |
|
| 881 |
Notification notification = (Notification) notifications.get(0); |
890 |
Notification notification = notifications.get(0); |
| 882 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
891 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 883 |
assertSame(newTitle1, notification.getNewValue()); |
892 |
assertSame(newTitle1, notification.getNewValue()); |
| 884 |
|
893 |
|
|
Lines 893-904
Link Here
|
| 893 |
return null; |
902 |
return null; |
| 894 |
} |
903 |
} |
| 895 |
|
904 |
|
|
|
905 |
@Override |
| 896 |
public void reset() { |
906 |
public void reset() { |
| 897 |
super.reset(); |
907 |
super.reset(); |
| 898 |
|
908 |
|
| 899 |
count = 0; |
909 |
count = 0; |
| 900 |
} |
910 |
} |
| 901 |
|
911 |
|
|
|
912 |
@Override |
| 902 |
public boolean isAggregatePrecommitListener() { |
913 |
public boolean isAggregatePrecommitListener() { |
| 903 |
return true; |
914 |
return true; |
| 904 |
} |
915 |
} |
|
Lines 924-934
Link Here
|
| 924 |
assertNotNull(localListener.precommit.getTransaction()); |
935 |
assertNotNull(localListener.precommit.getTransaction()); |
| 925 |
assertEquals(2, localListener.count); |
936 |
assertEquals(2, localListener.count); |
| 926 |
|
937 |
|
| 927 |
List notifications = localListener.precommitNotifications; |
938 |
List<Notification> notifications = localListener.precommitNotifications; |
| 928 |
assertNotNull(notifications); |
939 |
assertNotNull(notifications); |
| 929 |
assertEquals(1, notifications.size()); |
940 |
assertEquals(1, notifications.size()); |
| 930 |
|
941 |
|
| 931 |
Notification notification = (Notification) notifications.get(0); |
942 |
Notification notification = notifications.get(0); |
| 932 |
assertSame(book, notification.getNotifier()); |
943 |
assertSame(book, notification.getNotifier()); |
| 933 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
944 |
assertSame(EXTLibraryPackage.eINSTANCE.getBook_Title(), notification.getFeature()); |
| 934 |
assertSame(newTitle2, notification.getNewValue()); |
945 |
assertSame(newTitle2, notification.getNewValue()); |
|
Lines 946-951
Link Here
|
| 946 |
class ResourceListener extends DemultiplexingListener { |
957 |
class ResourceListener extends DemultiplexingListener { |
| 947 |
boolean wasCalled; |
958 |
boolean wasCalled; |
| 948 |
|
959 |
|
|
|
960 |
@Override |
| 949 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
961 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
| 950 |
wasCalled = true; |
962 |
wasCalled = true; |
| 951 |
} |
963 |
} |
|
Lines 994-999
Link Here
|
| 994 |
interestingBook = book; |
1006 |
interestingBook = book; |
| 995 |
} |
1007 |
} |
| 996 |
|
1008 |
|
|
|
1009 |
@Override |
| 997 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
1010 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
| 998 |
Object notifier = notification.getNotifier(); |
1011 |
Object notifier = notification.getNotifier(); |
| 999 |
|
1012 |
|
|
Lines 1048-1053
Link Here
|
| 1048 |
interestingBook = book; |
1061 |
interestingBook = book; |
| 1049 |
} |
1062 |
} |
| 1050 |
|
1063 |
|
|
|
1064 |
@Override |
| 1051 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
1065 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
| 1052 |
Object notifier = notification.getNotifier(); |
1066 |
Object notifier = notification.getNotifier(); |
| 1053 |
|
1067 |
|
|
Lines 1107-1112
Link Here
|
| 1107 |
interestingBook = book; |
1121 |
interestingBook = book; |
| 1108 |
} |
1122 |
} |
| 1109 |
|
1123 |
|
|
|
1124 |
@Override |
| 1110 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
1125 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
| 1111 |
Object notifier = notification.getNotifier(); |
1126 |
Object notifier = notification.getNotifier(); |
| 1112 |
|
1127 |
|
|
Lines 1163-1168
Link Here
|
| 1163 |
interestingBook = book; |
1178 |
interestingBook = book; |
| 1164 |
} |
1179 |
} |
| 1165 |
|
1180 |
|
|
|
1181 |
@Override |
| 1166 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
1182 |
protected void handleNotification(TransactionalEditingDomain domain, Notification notification) { |
| 1167 |
Object notifier = notification.getNotifier(); |
1183 |
Object notifier = notification.getNotifier(); |
| 1168 |
|
1184 |
|
|
Lines 1218-1230
Link Here
|
| 1218 |
public void test_recordingCommandsAsTriggers_bug157103() { |
1234 |
public void test_recordingCommandsAsTriggers_bug157103() { |
| 1219 |
// one trigger sets default library names |
1235 |
// one trigger sets default library names |
| 1220 |
domain.addResourceSetListener(new LibraryDefaultNameTrigger() { |
1236 |
domain.addResourceSetListener(new LibraryDefaultNameTrigger() { |
| 1221 |
protected Command trigger(TransactionalEditingDomain domain, Notification notification) { |
1237 |
@Override |
|
|
1238 |
protected Command trigger(TransactionalEditingDomain domain, Notification notification) { |
| 1222 |
Command result = null; |
1239 |
Command result = null; |
| 1223 |
|
1240 |
|
| 1224 |
final Library newLibrary = (Library) notification.getNewValue(); |
1241 |
final Library newLibrary = (Library) notification.getNewValue(); |
| 1225 |
if ((newLibrary.getName() == null) || (newLibrary.getName().length() == 0)) { |
1242 |
if ((newLibrary.getName() == null) || (newLibrary.getName().length() == 0)) { |
| 1226 |
result = new RecordingCommand(domain) { |
1243 |
result = new RecordingCommand(domain) { |
| 1227 |
protected void doExecute() { |
1244 |
@Override |
|
|
1245 |
protected void doExecute() { |
| 1228 |
newLibrary.setName("New Library"); //$NON-NLS-1$ |
1246 |
newLibrary.setName("New Library"); //$NON-NLS-1$ |
| 1229 |
}}; |
1247 |
}}; |
| 1230 |
} |
1248 |
} |
|
Lines 1236-1242
Link Here
|
| 1236 |
|
1254 |
|
| 1237 |
// add a new library. Our trigger will set a default name |
1255 |
// add a new library. Our trigger will set a default name |
| 1238 |
domain.getCommandStack().execute(new RecordingCommand(domain) { |
1256 |
domain.getCommandStack().execute(new RecordingCommand(domain) { |
| 1239 |
protected void doExecute() { |
1257 |
@Override |
|
|
1258 |
protected void doExecute() { |
| 1240 |
newLibrary[0] = EXTLibraryFactory.eINSTANCE.createLibrary(); |
1259 |
newLibrary[0] = EXTLibraryFactory.eINSTANCE.createLibrary(); |
| 1241 |
root.getBranches().add(newLibrary[0]); |
1260 |
root.getBranches().add(newLibrary[0]); |
| 1242 |
|
1261 |
|
|
Lines 1265-1270
Link Here
|
| 1265 |
// Fixture methods |
1284 |
// Fixture methods |
| 1266 |
// |
1285 |
// |
| 1267 |
|
1286 |
|
|
|
1287 |
@Override |
| 1268 |
protected void doSetUp() |
1288 |
protected void doSetUp() |
| 1269 |
throws Exception { |
1289 |
throws Exception { |
| 1270 |
|
1290 |
|
|
Lines 1280-1285
Link Here
|
| 1280 |
domain.addResourceSetListener(listener); |
1300 |
domain.addResourceSetListener(listener); |
| 1281 |
} |
1301 |
} |
| 1282 |
|
1302 |
|
|
|
1303 |
@Override |
| 1283 |
protected void doTearDown() |
1304 |
protected void doTearDown() |
| 1284 |
throws Exception { |
1305 |
throws Exception { |
| 1285 |
|
1306 |
|