Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r1804 r1828  
    1313import org.openstreetmap.josm.data.osm.RelationMember;
    1414import org.openstreetmap.josm.gui.ExtendedDialog;
    15 import org.openstreetmap.josm.gui.layer.Layer;
    1615import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1716
    1817public abstract class RelationEditor extends ExtendedDialog {
    1918
    20     /** keeps track of open relation editors */
    21     static private RelationDialogManager relationDialogManager;
     19    /** the list of registered relation editor classes */
     20    private static ArrayList<Class<RelationEditor>> editors = new ArrayList<Class<RelationEditor>>();
    2221
    2322    /**
    24      * Replies the singleton {@see RelationDialogManager}
     23     * Registers a relation editor class. Depending on the type of relation to be edited
     24     * {@see #getEditor(OsmDataLayer, Relation, Collection)} will create an instance of
     25     * this class.
    2526     *
    26      * @return the singleton {@see RelationDialogManager}
     27     * @param clazz the class
    2728     */
    28     static public RelationDialogManager getRelationDialogManager() {
    29         if (relationDialogManager == null) {
    30             relationDialogManager = new RelationDialogManager();
    31             Layer.listeners.add(relationDialogManager);
     29    public void registerRelationEditor(Class<RelationEditor> clazz) {
     30        if (clazz == null) return;
     31        if (!editors.contains(clazz)) {
     32            editors.add(clazz);
    3233        }
    33         return relationDialogManager;
    3434    }
    35 
    36     public static ArrayList<Class<RelationEditor>> editors = new ArrayList<Class<RelationEditor>>();
    3735
    3836    /**
     
    8179            }
    8280        }
    83         if (getRelationDialogManager().isOpenInEditor(layer, r))
    84             return getRelationDialogManager().getEditorForRelation(layer, r);
     81        if (RelationDialogManager.getRelationDialogManager().isOpenInEditor(layer, r))
     82            return RelationDialogManager.getRelationDialogManager().getEditorForRelation(layer, r);
    8583        else {
    8684            RelationEditor editor = new GenericRelationEditor(layer, r, selectedMembers);
    87             getRelationDialogManager().positionOnScreen(editor);
    88             getRelationDialogManager().register(layer, r, editor);
     85            RelationDialogManager.getRelationDialogManager().positionOnScreen(editor);
     86            RelationDialogManager.getRelationDialogManager().register(layer, r, editor);
    8987            return editor;
    9088        }
Note: See TracChangeset for help on using the changeset viewer.