Lines 17-27
Link Here
|
17 |
|
17 |
|
18 |
import org.eclipse.core.commands.operations.IOperationHistory; |
18 |
import org.eclipse.core.commands.operations.IOperationHistory; |
19 |
import org.eclipse.core.commands.operations.OperationHistoryFactory; |
19 |
import org.eclipse.core.commands.operations.OperationHistoryFactory; |
|
|
20 |
import org.eclipse.emf.common.command.Command; |
20 |
import org.eclipse.emf.common.notify.AdapterFactory; |
21 |
import org.eclipse.emf.common.notify.AdapterFactory; |
21 |
import org.eclipse.emf.ecore.resource.ResourceSet; |
22 |
import org.eclipse.emf.ecore.resource.ResourceSet; |
22 |
import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
23 |
import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
|
|
24 |
import org.eclipse.emf.transaction.NotificationFilter; |
23 |
import org.eclipse.emf.transaction.ResourceSetChangeEvent; |
25 |
import org.eclipse.emf.transaction.ResourceSetChangeEvent; |
24 |
import org.eclipse.emf.transaction.ResourceSetListener; |
26 |
import org.eclipse.emf.transaction.ResourceSetListener; |
|
|
27 |
import org.eclipse.emf.transaction.ResourceSetListenerImpl; |
25 |
import org.eclipse.emf.transaction.RollbackException; |
28 |
import org.eclipse.emf.transaction.RollbackException; |
26 |
import org.eclipse.emf.transaction.Transaction; |
29 |
import org.eclipse.emf.transaction.Transaction; |
27 |
import org.eclipse.emf.transaction.TransactionalCommandStack; |
30 |
import org.eclipse.emf.transaction.TransactionalCommandStack; |
Lines 57-79
Link Here
|
57 |
// while handling a post-commit event. |
60 |
// while handling a post-commit event. |
58 |
private InternalTransaction originatingTransaction = null; |
61 |
private InternalTransaction originatingTransaction = null; |
59 |
private DiagramEventBroker deb = null; |
62 |
private DiagramEventBroker deb = null; |
|
|
63 |
private ResourceSetListener debWrapper = null; |
60 |
|
64 |
|
61 |
public void addResourceSetListener(ResourceSetListener l) { |
65 |
public void addResourceSetListener(ResourceSetListener l) { |
62 |
if (l.getClass() == DiagramEventBroker.class) { |
66 |
if (l.getClass() == DiagramEventBroker.class) { |
63 |
assert deb == null; |
67 |
assert deb == null; |
64 |
deb = (DiagramEventBroker)l; |
68 |
deb = (DiagramEventBroker)l; |
|
|
69 |
debWrapper = new ResourceSetListenerImpl() { |
70 |
public boolean isAggregatePrecommitListener() { |
71 |
return deb.isAggregatePrecommitListener(); |
72 |
} |
73 |
|
74 |
public boolean isPrecommitOnly() { |
75 |
return true; |
76 |
} |
77 |
|
78 |
public Command transactionAboutToCommit(ResourceSetChangeEvent event) |
79 |
throws RollbackException { |
80 |
return deb.transactionAboutToCommit(event); |
81 |
} |
82 |
|
83 |
public void resourceSetChanged(ResourceSetChangeEvent event) { |
84 |
deb.resourceSetChanged(event); |
85 |
} |
86 |
|
87 |
public NotificationFilter getFilter() { |
88 |
return deb.getFilter(); |
89 |
} |
90 |
|
91 |
public boolean isPostcommitOnly() { |
92 |
return false; |
93 |
} |
94 |
}; |
95 |
|
96 |
super.addResourceSetListener(debWrapper); |
97 |
} else { |
98 |
super.addResourceSetListener(l); |
65 |
} |
99 |
} |
66 |
|
|
|
67 |
super.addResourceSetListener(l); |
68 |
} |
100 |
} |
69 |
|
101 |
|
70 |
public void removeResourceSetListener(ResourceSetListener l) { |
102 |
public void removeResourceSetListener(ResourceSetListener l) { |
71 |
if (l.getClass() == DiagramEventBroker.class) { |
103 |
if (l.getClass() == DiagramEventBroker.class) { |
72 |
assert deb != null; |
104 |
assert deb != null; |
73 |
deb = null; |
105 |
deb = null; |
|
|
106 |
super.removeResourceSetListener(debWrapper); |
107 |
debWrapper = null; |
108 |
} else { |
109 |
super.removeResourceSetListener(l); |
74 |
} |
110 |
} |
75 |
|
|
|
76 |
super.removeResourceSetListener(l); |
77 |
} |
111 |
} |
78 |
|
112 |
|
79 |
public DiagramEditingDomain(AdapterFactory adapterFactory, ResourceSet resourceSet) { |
113 |
public DiagramEditingDomain(AdapterFactory adapterFactory, ResourceSet resourceSet) { |