1 | @Override | | 1 | @Override |
2 | protected void updateListeners(Object oldOwner, Object newOwner) { | | 2 | protected void updateListeners(Object oldOwner, Object newOwner) { |
3 | Set<Object[]> listeners = new HashSet<Object[]>(); | | 3 | Set<Object[]> l = new HashSet<Object[]>(); |
4 | /* Let's register for events from all modelelements | | 4 | |
5 | * that change the name or body text: | | 5 | if (newOwner != null) { |
6 | */ | | 6 | /* Don't listen to all property names |
7 | if (newOwner != null) { | | 7 | * We only need to listen to its "type", and "remove". */ |
8 | /* Register for name changes, added extensionPoints | | 8 | l.add(new Object[] {newOwner, new String[] {"type", "remove"}}); |
9 | * and abstract makes the text italic. | | 9 | // register for events from the type |
10 | * All Figs need to listen to "remove", too: */ | | 10 | Object type = Model.getFacade().getType(newOwner); |
11 | listeners.add(new Object[] {newOwner, | | 11 | if (Model.getFacade().isAClassifier(type)) { |
12 | new String[] {"remove", "name", "isAbstract", | | 12 | if (Model.getFacade().isAClassifierInState(type)) { |
13 | "extensionPoint", "stereotype"}}); | | 13 | Object classifier = Model.getFacade().getType(type); |
14 | | | 14 | l.add(new Object[] {classifier, "name"}); |
15 | // register for extension points: | | 15 | l.add(new Object[] {type, "inState"}); |
16 | for (Object ep : Model.getFacade().getExtensionPoints(newOwner)) { | | 16 | Collection states = Model.getFacade().getInStates(type); |
17 | listeners.add(new Object[] {ep, new String[] {"location", "name"}}); | | 17 | Iterator i = states.iterator(); |
18 | } | | 18 | while (i.hasNext()) { |
19 | | | 19 | l.add(new Object[] {i.next(), "name"}); |
20 | for (Object st : Model.getFacade().getStereotypes(newOwner)) { | | 20 | } |
21 | listeners.add(new Object[] {st, "name"}); | | 21 | } else { |
22 | } | | 22 | l.add(new Object[] {type, "name"}); |
23 | } | | 23 | } |
24 | updateElementListeners(listeners); | | 24 | } |
25 | } | | 25 | } |
| | | 26 | |
| | | 27 | updateElementListeners(l); |
| | | 28 | } |