source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditorHooks.java @ 14027

Last change on this file since 14027 was 14027, checked in by michael2402, 5 months ago

See #16388: New mechanism for plugins to register relation editor actions.

File size: 1.4 KB
Line 
1package org.openstreetmap.josm.gui.dialogs.relation;
2
3import java.util.Collections;
4import java.util.List;
5import java.util.concurrent.CopyOnWriteArrayList;
6
7import org.openstreetmap.josm.gui.dialogs.relation.actions.IRelationEditorActionGroup;
8
9/**
10 * This class allows to hook into the relation editor. It can be used to overwrite specific behavior.
11 *
12 * @author Michael Zangl
13 * @since 14027
14 */
15public class RelationEditorHooks {
16       
17        private static final CopyOnWriteArrayList<IRelationEditorActionGroup> memberActions = new CopyOnWriteArrayList<>();
18        private static final CopyOnWriteArrayList<IRelationEditorActionGroup> selectionActions = new CopyOnWriteArrayList<>();
19
20        private RelationEditorHooks() {
21                // only static methods.
22        }
23       
24        /**
25         * Adds actions to the members action toolbar
26         * @param group The group to add
27         */
28        public static void addActionsToMembers(IRelationEditorActionGroup group) {
29                memberActions.add(group);
30        }
31       
32        /**
33         * Adds actions to the selection action toolbar
34         * @param group The group to add
35         */
36        public static void addActionsToSelectio(IRelationEditorActionGroup group) {
37                selectionActions.add(group);
38        }
39       
40        /* package */ static List<IRelationEditorActionGroup> getMemberActions() {
41                return Collections.unmodifiableList(memberActions);
42        }
43       
44        /* package */ static List<IRelationEditorActionGroup> getSelectActions() {
45                return Collections.unmodifiableList(selectionActions);
46        }
47       
48}
Note: See TracBrowser for help on using the repository browser.