Changeset 14027 in josm


Ignore:
Timestamp:
2018-07-12T23:02:02+02:00 (2 months ago)
Author:
michael2402
Message:

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

Location:
trunk
Files:
4 added
32 edited

Legend:

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

    r13761 r14027  
    2424import java.awt.event.WindowEvent;
    2525import java.util.ArrayList;
     26import java.util.Arrays;
    2627import java.util.Collection;
    2728import java.util.Collections;
     
    4950
    5051import org.openstreetmap.josm.Main;
    51 import org.openstreetmap.josm.actions.ExpertToggleAction;
    5252import org.openstreetmap.josm.actions.JosmAction;
    5353import org.openstreetmap.josm.command.ChangeCommand;
     
    7676import org.openstreetmap.josm.gui.dialogs.relation.actions.DuplicateRelationAction;
    7777import org.openstreetmap.josm.gui.dialogs.relation.actions.EditAction;
     78import org.openstreetmap.josm.gui.dialogs.relation.actions.IRelationEditorActionAccess;
     79import org.openstreetmap.josm.gui.dialogs.relation.actions.IRelationEditorActionGroup;
    7880import org.openstreetmap.josm.gui.dialogs.relation.actions.MoveDownAction;
    7981import org.openstreetmap.josm.gui.dialogs.relation.actions.MoveUpAction;
     
    9395import org.openstreetmap.josm.gui.help.HelpUtil;
    9496import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     97import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    9598import org.openstreetmap.josm.gui.tagging.TagEditorPanel;
    9699import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
     
    221224        selectionTable.setRowHeight(ce.getEditor().getPreferredSize().height);
    222225
    223         leftButtonToolbar = new LeftButtonToolbar(memberTable, memberTableModel, this);
     226        leftButtonToolbar = new LeftButtonToolbar(new RelationEditorActionAccess());
    224227        tfRole = buildRoleTextField(this);
    225228
    226229        JSplitPane pane = buildSplitPane(
    227230                buildTagEditorPanel(tagEditorPanel),
    228                 buildMemberEditorPanel(memberTable, memberTableModel, selectionTable, selectionTableModel, this, leftButtonToolbar, tfRole),
     231                buildMemberEditorPanel(leftButtonToolbar, new RelationEditorActionAccess()),
    229232                this);
    230233        pane.setPreferredSize(new Dimension(100, 100));
     
    248251            }
    249252        });
    250 
    251         refreshAction = new RefreshAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this);
    252         applyAction = new ApplyAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this);
    253         selectAction = new SelectAction(getLayer(), this);
    254         duplicateAction = new DuplicateRelationAction(memberTableModel, tagEditorPanel.getModel(), getLayer());
    255         deleteAction = new DeleteCurrentRelationAction(getLayer(), this);
     253       
     254        IRelationEditorActionAccess actionAccess = new RelationEditorActionAccess();
     255
     256        refreshAction = new RefreshAction(actionAccess);
     257        applyAction = new ApplyAction(actionAccess);
     258        selectAction = new SelectAction(actionAccess);
     259        duplicateAction = new DuplicateRelationAction(actionAccess);
     260        deleteAction = new DeleteCurrentRelationAction(actionAccess);
    256261        addPropertyChangeListener(deleteAction);
    257262
    258         okAction = new OKAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole);
    259         cancelAction = new CancelAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole);
     263        okAction = new OKAction(actionAccess);
     264        cancelAction = new CancelAction(actionAccess);
    260265
    261266        getContentPane().add(buildToolBar(refreshAction, applyAction, selectAction, duplicateAction, deleteAction), BorderLayout.NORTH);
     
    288293        if (key != null) {
    289294            // handle uncommon situation, that user has no keystroke assigned to paste
    290             registerCopyPasteAction(new PasteMembersAction(memberTable, getLayer(), this) {
    291                 @Override
     295            registerCopyPasteAction(new PasteMembersAction(actionAccess) {
     296                                private static final long serialVersionUID = 1L;
     297
     298                                @Override
    292299                public void actionPerformed(ActionEvent e) {
    293300                    super.actionPerformed(e);
     
    299306        if (key != null) {
    300307            // handle uncommon situation, that user has no keystroke assigned to copy
    301             registerCopyPasteAction(new CopyMembersAction(memberTableModel, getLayer(), this),
     308            registerCopyPasteAction(new CopyMembersAction(actionAccess),
    302309                    "COPY_MEMBERS", key, getRootPane(), memberTable, selectionTable);
    303310        }
     
    447454    /**
    448455     * builds the panel for the relation member editor
    449      * @param memberTable member table
    450      * @param memberTableModel member table model
    451      * @param selectionTable selection table
    452      * @param selectionTableModel selection table model
    453      * @param re relation editor
    454456     * @param leftButtonToolbar left button toolbar
    455      * @param tfRole role text field
     457     * @param editorAccess The relation editor
    456458     *
    457459     * @return the panel for the relation member editor
    458460     */
    459     protected static JPanel buildMemberEditorPanel(final MemberTable memberTable, MemberTableModel memberTableModel,
    460             SelectionTable selectionTable, SelectionTableModel selectionTableModel, IRelationEditor re,
    461             LeftButtonToolbar leftButtonToolbar, final AutoCompletingTextField tfRole) {
     461    protected static JPanel buildMemberEditorPanel(
     462            LeftButtonToolbar leftButtonToolbar, IRelationEditorActionAccess editorAccess) {
    462463        final JPanel pnl = new JPanel(new GridBagLayout());
    463         final JScrollPane scrollPane = new JScrollPane(memberTable);
     464        final JScrollPane scrollPane = new JScrollPane(editorAccess.getMemberTable());
    464465
    465466        GridBagConstraints gc = new GridBagConstraints();
     
    495496        JPanel p3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    496497        p3.add(new JLabel(tr("Apply Role:")));
    497         p3.add(tfRole);
    498         SetRoleAction setRoleAction = new SetRoleAction(memberTable, memberTableModel, tfRole);
    499         memberTableModel.getSelectionModel().addListSelectionListener(setRoleAction);
    500         tfRole.getDocument().addDocumentListener(setRoleAction);
    501         tfRole.addActionListener(setRoleAction);
    502         memberTableModel.getSelectionModel().addListSelectionListener(
    503                 e -> tfRole.setEnabled(memberTable.getSelectedRowCount() > 0)
     498        p3.add(editorAccess.getTextFieldRole());
     499        SetRoleAction setRoleAction = new SetRoleAction(editorAccess);
     500        editorAccess.getMemberTableModel().getSelectionModel().addListSelectionListener(setRoleAction);
     501        editorAccess.getTextFieldRole().getDocument().addDocumentListener(setRoleAction);
     502        editorAccess.getTextFieldRole().addActionListener(setRoleAction);
     503        editorAccess.getMemberTableModel().getSelectionModel().addListSelectionListener(
     504                e -> editorAccess.getTextFieldRole().setEnabled(editorAccess.getMemberTable().getSelectedRowCount() > 0)
    504505        );
    505         tfRole.setEnabled(memberTable.getSelectedRowCount() > 0);
     506        editorAccess.getTextFieldRole().setEnabled(editorAccess.getMemberTable().getSelectedRowCount() > 0);
    506507        JButton btnApply = new JButton(setRoleAction);
    507508        btnApply.setPreferredSize(new Dimension(20, 20));
     
    537538        gc.weightx = 0.0;
    538539        gc.weighty = 1.0;
    539         pnl2.add(new ScrollViewport(buildSelectionControlButtonToolbar(memberTable, memberTableModel, selectionTableModel, re),
     540        pnl2.add(new ScrollViewport(buildSelectionControlButtonToolbar(editorAccess),
    540541                ScrollViewport.VERTICAL_DIRECTION), gc);
    541542
     
    545546        gc.weighty = 1.0;
    546547        gc.fill = GridBagConstraints.BOTH;
    547         pnl2.add(buildSelectionTablePanel(selectionTable), gc);
     548        pnl2.add(buildSelectionTablePanel(editorAccess.getSelectionTable()), gc);
    548549
    549550        final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     
    551552        splitPane.setRightComponent(pnl2);
    552553        splitPane.setOneTouchExpandable(false);
    553         if (re instanceof Window) {
    554             ((Window) re).addWindowListener(new WindowAdapter() {
     554        if (editorAccess.getEditor() instanceof Window) {
     555            ((Window) editorAccess.getEditor()).addWindowListener(new WindowAdapter() {
    555556                @Override
    556557                public void windowOpened(WindowEvent e) {
     
    608609     */
    609610    static class LeftButtonToolbar extends JToolBar {
    610 
    611         /**
    612          * Button for performing the {@link org.openstreetmap.josm.gui.dialogs.relation.actions.SortBelowAction}.
    613          */
    614         final JButton sortBelowButton;
    615 
    616         /**
     611                private static final long serialVersionUID = 1L;
     612
     613                /**
    617614         * Constructs a new {@code LeftButtonToolbar}.
    618          * @param memberTable member table
    619          * @param memberTableModel member table model
    620615         * @param re relation editor
    621616         */
    622         LeftButtonToolbar(MemberTable memberTable, MemberTableModel memberTableModel, IRelationEditor re) {
     617        LeftButtonToolbar(IRelationEditorActionAccess editorAccess) {
    623618            setOrientation(JToolBar.VERTICAL);
    624619            setFloatable(false);
    625620
    626             // -- move up action
    627             MoveUpAction moveUpAction = new MoveUpAction(memberTable, memberTableModel, "moveUp");
    628             memberTableModel.getSelectionModel().addListSelectionListener(moveUpAction);
    629             add(moveUpAction);
    630 
    631             // -- move down action
    632             MoveDownAction moveDownAction = new MoveDownAction(memberTable, memberTableModel, "moveDown");
    633             memberTableModel.getSelectionModel().addListSelectionListener(moveDownAction);
    634             add(moveDownAction);
    635 
    636             addSeparator();
    637 
    638             // -- edit action
    639             EditAction editAction = new EditAction(memberTable, memberTableModel, re.getLayer());
    640             memberTableModel.getSelectionModel().addListSelectionListener(editAction);
    641             add(editAction);
    642 
    643             // -- delete action
    644             RemoveAction removeSelectedAction = new RemoveAction(memberTable, memberTableModel, "removeSelected");
    645             memberTable.getSelectionModel().addListSelectionListener(removeSelectedAction);
    646             add(removeSelectedAction);
    647 
    648             addSeparator();
    649             // -- sort action
    650             SortAction sortAction = new SortAction(memberTable, memberTableModel);
    651             memberTableModel.addTableModelListener(sortAction);
    652             add(sortAction);
    653             final SortBelowAction sortBelowAction = new SortBelowAction(memberTable, memberTableModel);
    654             memberTableModel.addTableModelListener(sortBelowAction);
    655             memberTableModel.getSelectionModel().addListSelectionListener(sortBelowAction);
    656             sortBelowButton = add(sortBelowAction);
    657 
    658             // -- reverse action
    659             ReverseAction reverseAction = new ReverseAction(memberTable, memberTableModel);
    660             memberTableModel.addTableModelListener(reverseAction);
    661             add(reverseAction);
    662 
    663             addSeparator();
    664 
    665             // -- download action
    666             DownloadIncompleteMembersAction downloadIncompleteMembersAction = new DownloadIncompleteMembersAction(
    667                     memberTable, memberTableModel, "downloadIncomplete", re.getLayer(), re);
    668             memberTable.getModel().addTableModelListener(downloadIncompleteMembersAction);
    669             add(downloadIncompleteMembersAction);
    670 
    671             // -- download selected action
    672             DownloadSelectedIncompleteMembersAction downloadSelectedIncompleteMembersAction = new DownloadSelectedIncompleteMembersAction(
    673                     memberTable, memberTableModel, null, re.getLayer(), re);
    674             memberTable.getModel().addTableModelListener(downloadSelectedIncompleteMembersAction);
    675             memberTable.getSelectionModel().addListSelectionListener(downloadSelectedIncompleteMembersAction);
    676             add(downloadSelectedIncompleteMembersAction);
    677 
    678             InputMap inputMap = memberTable.getInputMap(MemberTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    679             inputMap.put((KeyStroke) removeSelectedAction.getValue(AbstractAction.ACCELERATOR_KEY), "removeSelected");
    680             inputMap.put((KeyStroke) moveUpAction.getValue(AbstractAction.ACCELERATOR_KEY), "moveUp");
    681             inputMap.put((KeyStroke) moveDownAction.getValue(AbstractAction.ACCELERATOR_KEY), "moveDown");
    682             inputMap.put((KeyStroke) downloadIncompleteMembersAction.getValue(AbstractAction.ACCELERATOR_KEY), "downloadIncomplete");
     621            List<IRelationEditorActionGroup> groups = new ArrayList<>();
     622            // Move
     623            groups.add(buildNativeGroup(10,
     624                        new MoveUpAction(editorAccess, "moveUp"),
     625                        new MoveDownAction(editorAccess, "moveDown")
     626                        ));
     627            // Edit
     628            groups.add(buildNativeGroup(20,
     629                        new EditAction(editorAccess),
     630                        new RemoveAction(editorAccess, "removeSelected")
     631                        ));
     632            // Sort
     633            groups.add(buildNativeGroup(30,
     634                        new SortAction(editorAccess),
     635                        new SortBelowAction(editorAccess)
     636                        ));
     637            // Reverse
     638            groups.add(buildNativeGroup(40,
     639                        new ReverseAction(editorAccess)
     640                        ));
     641            // Download
     642            groups.add(buildNativeGroup(50,
     643                        new DownloadIncompleteMembersAction(editorAccess, "downloadIncomplete"),
     644                        new DownloadSelectedIncompleteMembersAction(editorAccess)
     645                        ));
     646            groups.addAll(RelationEditorHooks.getMemberActions());
     647           
     648            IRelationEditorActionGroup.fillToolbar(this, groups, editorAccess);
     649           
     650
     651            InputMap inputMap = editorAccess.getMemberTable().getInputMap(MemberTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
     652            inputMap.put((KeyStroke) new RemoveAction(editorAccess, "removeSelected").getValue(AbstractAction.ACCELERATOR_KEY), "removeSelected");
     653            inputMap.put((KeyStroke) new MoveUpAction(editorAccess, "moveUp").getValue(AbstractAction.ACCELERATOR_KEY), "moveUp");
     654            inputMap.put((KeyStroke) new MoveDownAction(editorAccess, "moveDown").getValue(AbstractAction.ACCELERATOR_KEY), "moveDown");
     655            inputMap.put((KeyStroke) new DownloadIncompleteMembersAction(
     656                        editorAccess, "downloadIncomplete").getValue(AbstractAction.ACCELERATOR_KEY), "downloadIncomplete");
    683657        }
    684658    }
     
    693667     * @return control buttons panel for selection/members
    694668     */
    695     protected static JToolBar buildSelectionControlButtonToolbar(MemberTable memberTable,
    696             MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor re) {
     669    protected static JToolBar buildSelectionControlButtonToolbar(IRelationEditorActionAccess editorAccess) {
    697670        JToolBar tb = new JToolBar(JToolBar.VERTICAL);
    698671        tb.setFloatable(false);
    699672
    700         // -- add at start action
    701         AddSelectedAtStartAction addSelectionAction = new AddSelectedAtStartAction(
    702                 memberTableModel, selectionTableModel, re);
    703         selectionTableModel.addTableModelListener(addSelectionAction);
    704         tb.add(addSelectionAction);
    705 
    706         // -- add before selected action
    707         AddSelectedBeforeSelection addSelectedBeforeSelectionAction = new AddSelectedBeforeSelection(
    708                 memberTableModel, selectionTableModel, re);
    709         selectionTableModel.addTableModelListener(addSelectedBeforeSelectionAction);
    710         memberTableModel.getSelectionModel().addListSelectionListener(addSelectedBeforeSelectionAction);
    711         tb.add(addSelectedBeforeSelectionAction);
    712 
    713         // -- add after selected action
    714         AddSelectedAfterSelection addSelectedAfterSelectionAction = new AddSelectedAfterSelection(
    715                 memberTableModel, selectionTableModel, re);
    716         selectionTableModel.addTableModelListener(addSelectedAfterSelectionAction);
    717         memberTableModel.getSelectionModel().addListSelectionListener(addSelectedAfterSelectionAction);
    718         tb.add(addSelectedAfterSelectionAction);
    719 
    720         // -- add at end action
    721         AddSelectedAtEndAction addSelectedAtEndAction = new AddSelectedAtEndAction(
    722                 memberTableModel, selectionTableModel, re);
    723         selectionTableModel.addTableModelListener(addSelectedAtEndAction);
    724         tb.add(addSelectedAtEndAction);
    725 
    726         tb.addSeparator();
    727 
    728         // -- select members action
    729         SelectedMembersForSelectionAction selectMembersForSelectionAction = new SelectedMembersForSelectionAction(
    730                 memberTableModel, selectionTableModel, re.getLayer());
    731         selectionTableModel.addTableModelListener(selectMembersForSelectionAction);
    732         memberTableModel.addTableModelListener(selectMembersForSelectionAction);
    733         tb.add(selectMembersForSelectionAction);
    734 
    735         // -- select action
    736         SelectPrimitivesForSelectedMembersAction selectAction = new SelectPrimitivesForSelectedMembersAction(
    737                 memberTable, memberTableModel, re.getLayer());
    738         memberTable.getSelectionModel().addListSelectionListener(selectAction);
    739         tb.add(selectAction);
    740 
    741         tb.addSeparator();
    742 
    743         // -- remove selected action
    744         RemoveSelectedAction removeSelectedAction = new RemoveSelectedAction(memberTableModel, selectionTableModel, re.getLayer());
    745         selectionTableModel.addTableModelListener(removeSelectedAction);
    746         tb.add(removeSelectedAction);
    747 
     673                List<IRelationEditorActionGroup> groups = new ArrayList<>();
     674                groups.add(buildNativeGroup(10,
     675                                new AddSelectedAtStartAction(editorAccess),
     676                                new AddSelectedBeforeSelection(editorAccess),
     677                                new AddSelectedAfterSelection(editorAccess),
     678                                new AddSelectedAtEndAction(editorAccess)
     679                                ));
     680                groups.add(buildNativeGroup(20,
     681                                new SelectedMembersForSelectionAction(editorAccess),
     682                                new SelectPrimitivesForSelectedMembersAction(editorAccess)
     683                                ));
     684                groups.add(buildNativeGroup(30,
     685                                new RemoveSelectedAction(editorAccess)
     686                                ));
     687                groups.addAll(RelationEditorHooks.getSelectActions());
     688       
     689        IRelationEditorActionGroup.fillToolbar(tb, groups, editorAccess);
    748690        return tb;
     691    }
     692   
     693    private static IRelationEditorActionGroup buildNativeGroup(int order, AbstractRelationEditorAction... actions) {
     694        return new IRelationEditorActionGroup() {
     695                @Override
     696                public int order() {
     697                        return order;
     698                }
     699               
     700                        @Override
     701                        public List<AbstractRelationEditorAction> getActions(IRelationEditorActionAccess editorAccess) {
     702                                return Arrays.asList(actions);
     703                        }
     704                };
    749705    }
    750706
     
    765721        Clipboard clipboard = ClipboardUtils.getClipboard();
    766722        if (visible) {
    767             leftButtonToolbar.sortBelowButton.setVisible(ExpertToggleAction.isExpert());
    768723            RelationDialogManager.getRelationDialogManager().positionOnScreen(this);
    769724            if (windowMenuItem == null) {
     
    806761                tr("Focus Relation Editor with relation ''{0}'' in layer ''{1}''", name, layerName),
    807762                null, false, false) {
    808             @Override
     763                        private static final long serialVersionUID = 1L;
     764
     765                        @Override
    809766            public void actionPerformed(ActionEvent e) {
    810767                ((RelationEditor) getValue("relationEditor")).setVisible(true);
     
    988945        public void mouseClicked(MouseEvent e) {
    989946            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
    990                 new EditAction(memberTable, memberTableModel, getLayer()).actionPerformed(null);
    991             }
    992         }
     947                new EditAction(new RelationEditorActionAccess()).actionPerformed(null);
     948            }
     949        }
     950    }
     951   
     952    private class RelationEditorActionAccess implements IRelationEditorActionAccess {
     953
     954                @Override
     955                public MemberTable getMemberTable() {
     956                        return memberTable;
     957                }
     958
     959                @Override
     960                public MemberTableModel getMemberTableModel() {
     961                        return memberTableModel;
     962                }
     963
     964                @Override
     965                public SelectionTable getSelectionTable() {
     966                        return selectionTable;
     967                }
     968
     969                @Override
     970                public SelectionTableModel getSelectionTableModel() {
     971                        return selectionTableModel;
     972                }
     973
     974                @Override
     975                public IRelationEditor getEditor() {
     976                        return GenericRelationEditor.this;
     977                }
     978
     979                @Override
     980                public TagEditorModel getTagModel() {
     981                        return tagEditorPanel.getModel();
     982                }
     983
     984                @Override
     985                public AutoCompletingTextField getTextFieldRole() {
     986                        return tfRole;
     987                }
     988       
    993989    }
    994990}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r12620 r14027  
    66import java.beans.PropertyChangeListener;
    77import java.beans.PropertyChangeSupport;
    8 import java.lang.reflect.Method;
    9 import java.util.ArrayList;
    108import java.util.Collection;
    11 import java.util.List;
    129
    1310import org.openstreetmap.josm.Main;
     
    1714import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1815import org.openstreetmap.josm.tools.CheckParameterUtil;
    19 import org.openstreetmap.josm.tools.Logging;
    2016
    2117/**
     
    2420 */
    2521public abstract class RelationEditor extends ExtendedDialog implements IRelationEditor {
     22        private static final long serialVersionUID = 1L;
    2623
    27     /** the property name for the current relation.
     24        /** the property name for the current relation.
    2825     * @see #setRelation(Relation)
    2926     * @see #getRelation()
     
    3532     */
    3633    public static final String RELATION_SNAPSHOT_PROP = RelationEditor.class.getName() + ".relationSnapshot";
    37 
    38     /** the list of registered relation editor classes */
    39     private static List<Class<RelationEditor>> editors = new ArrayList<>();
    4034
    4135    /** The relation that this editor is working on. */
     
    7165
    7266    /**
    73      * Registers a relation editor class. Depending on the type of relation to be edited
    74      * {@link #getEditor(OsmDataLayer, Relation, Collection)} will create an instance of
    75      * this class.
    76      *
    77      * @param clazz the class
    78      */
    79     public void registerRelationEditor(Class<RelationEditor> clazz) {
    80         if (clazz != null && !editors.contains(clazz)) {
    81             editors.add(clazz);
    82         }
    83     }
    84 
    85     /**
    8667     * This is a factory method that creates an appropriate RelationEditor instance suitable for editing the relation
    8768     * that was passed in as an argument.
    8869     *
    89      * This method is guaranteed to return a working RelationEditor. If no specific editor has been registered for the
    90      * type of relation, then a generic editor will be returned.
    91      *
    92      * Editors can be registered by adding their class to the static list "editors" in the RelationEditor class.
    93      * When it comes to editing a relation, all registered editors are queried via their static "canEdit" method whether
    94      * they feel responsible for that kind of relation, and if they return true then an instance of that class will be used.
     70     * This method is guaranteed to return a working RelationEditor.
    9571     *
    9672     * @param layer the data layer the relation is a member of
     
    10076     */
    10177    public static RelationEditor getEditor(OsmDataLayer layer, Relation r, Collection<RelationMember> selectedMembers) {
    102         for (Class<RelationEditor> e : editors) {
    103             try {
    104                 Method m = e.getMethod("canEdit", Relation.class);
    105                 Boolean canEdit = (Boolean) m.invoke(null, r);
    106                 if (canEdit) {
    107                     return e.getConstructor(Relation.class, Collection.class).newInstance(layer, r, selectedMembers);
    108                 }
    109             } catch (ReflectiveOperationException ex) {
    110                 Logging.warn(ex);
    111             }
    112         }
    11378        if (RelationDialogManager.getRelationDialogManager().isOpenInEditor(layer, r))
    11479            return RelationDialogManager.getRelationDialogManager().getEditorForRelation(layer, r);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java

    r13559 r14027  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.dialogs.relation.actions;
     3
     4import java.beans.PropertyChangeEvent;
     5import java.beans.PropertyChangeListener;
     6import java.util.Objects;
    37
    48import javax.swing.AbstractAction;
     
    1418import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1519import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
     20import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable;
     21import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1622import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     23import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    1724import org.openstreetmap.josm.io.OnlineResource;
    1825
    1926/**
    2027 * Abstract superclass of relation editor actions.
     28 *
    2129 * @since 9496
    2230 */
    23 public abstract class AbstractRelationEditorAction extends AbstractAction implements TableModelListener, ListSelectionListener {
    24     protected final MemberTable memberTable;
    25     protected final MemberTableModel memberTableModel;
    26     protected final transient OsmDataLayer layer;
    27     protected final transient IRelationEditor editor;
     31public abstract class AbstractRelationEditorAction extends AbstractAction
     32                implements TableModelListener, ListSelectionListener, PropertyChangeListener {
     33        private static final long serialVersionUID = 1L;
     34        protected final transient IRelationEditorActionAccess editorAccess;
    2835
    29     protected AbstractRelationEditorAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey) {
    30         this(memberTable, memberTableModel, actionMapKey, null, null);
    31     }
     36        /**
     37         * Create a new relation editor action
     38         *
     39         * @param editorAccess
     40         *            The editor this action is for
     41         * @param actionMapKey
     42         *            The key for the member table action map.
     43         * @param updateOn
     44         *            The events that may cause the enabled state of this button to
     45         *            change.
     46         */
     47        protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess,
     48                        IRelationEditorUpdateOn... updateOn) {
     49                Objects.requireNonNull(editorAccess, "editorAccess");
     50                Objects.requireNonNull(updateOn, "updateOn");
     51                this.editorAccess = editorAccess;
     52                for (IRelationEditorUpdateOn u : updateOn) {
     53                        u.register(editorAccess, this);
     54                }
     55        }
    3256
    33     protected AbstractRelationEditorAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    34             OsmDataLayer layer, IRelationEditor editor) {
    35         this.memberTable = memberTable;
    36         this.memberTableModel = memberTableModel;
    37         this.layer = layer;
    38         this.editor = editor;
    39         if (actionMapKey != null) {
    40             this.memberTable.getActionMap().put(actionMapKey, this);
    41         }
    42     }
     57        /**
     58         * Create a new relation editor action
     59         *
     60         * @param editorAccess
     61         *            The editor this action is for
     62         * @param actionMapKey
     63         *            The key for the member table action map.
     64         * @param updateOn
     65         *            The events that may cause the enabled state of this button to
     66         *            change.
     67         */
     68        protected AbstractRelationEditorAction(IRelationEditorActionAccess editorAccess, String actionMapKey,
     69                        IRelationEditorUpdateOn... updateOn) {
     70                this(editorAccess, updateOn);
     71                Objects.requireNonNull(actionMapKey, "actionMapKey");
     72
     73                this.editorAccess.addMemberTableAction(actionMapKey, this);
     74        }
     75
     76        @Override
     77        public void tableChanged(TableModelEvent e) {
     78                updateEnabledState();
     79        }
     80
     81        @Override
     82        public void valueChanged(ListSelectionEvent e) {
     83                updateEnabledState();
     84        }
    4385
    4486    @Override
    45     public void tableChanged(TableModelEvent e) {
     87    public void propertyChange(PropertyChangeEvent evt) {
    4688        updateEnabledState();
    4789    }
    4890
    49     @Override
    50     public void valueChanged(ListSelectionEvent e) {
    51         updateEnabledState();
    52     }
     91        protected abstract void updateEnabledState();
    5392
    54     protected abstract void updateEnabledState();
     93        protected final boolean canDownload() {
     94                if (editorAccess.getEditor().getRelation() == null)
     95                        return false;
     96                DataSet ds = editorAccess.getEditor().getRelation().getDataSet();
     97                return !Main.isOffline(OnlineResource.OSM_API) && ds != null && !ds.isLocked()
     98                                && !DownloadPolicy.BLOCKED.equals(ds.getDownloadPolicy());
     99        }
    55100
    56     protected final boolean canDownload() {
    57         if (editor.getRelation() == null)
    58             return false;
    59         DataSet ds = editor.getRelation().getDataSet();
    60         return !Main.isOffline(OnlineResource.OSM_API)
    61             && ds != null && !ds.isLocked() && !DownloadPolicy.BLOCKED.equals(ds.getDownloadPolicy());
    62     }
     101        protected MemberTable getMemberTable() {
     102                return editorAccess.getMemberTable();
     103        }
     104
     105        protected MemberTableModel getMemberTableModel() {
     106                return editorAccess.getMemberTableModel();
     107        }
     108
     109        protected SelectionTable getSelectionTable() {
     110                return editorAccess.getSelectionTable();
     111        }
     112
     113        protected SelectionTableModel getSelectionTableModel() {
     114                return editorAccess.getSelectionTableModel();
     115        }
     116
     117        protected IRelationEditor getEditor() {
     118                return editorAccess.getEditor();
     119        }
     120
     121        protected TagEditorModel getTagModel() {
     122                return editorAccess.getTagModel();
     123        }
     124
     125        protected OsmDataLayer getLayer() {
     126                return editorAccess.getEditor().getLayer();
     127        }
     128
     129        public boolean isExpertOnly() {
     130                return false;
     131        }
    63132}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddFromSelectionAction.java

    r13849 r14027  
    1111import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
    1212import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    13 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    14 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    15 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    16 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable;
    17 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1913
    2014/**
     
    2317 */
    2418abstract class AddFromSelectionAction extends AbstractRelationEditorAction {
     19        private static final long serialVersionUID = 1L;
    2520
    26     protected final SelectionTable selectionTable;
    27     protected final SelectionTableModel selectionTableModel;
    28 
    29     protected AddFromSelectionAction(MemberTable memberTable, MemberTableModel memberTableModel, SelectionTable selectionTable,
    30             SelectionTableModel selectionTableModel, String actionMapKey, OsmDataLayer layer, IRelationEditor editor) {
    31         super(memberTable, memberTableModel, actionMapKey, layer, editor);
    32         this.selectionTable = selectionTable;
    33         this.selectionTableModel = selectionTableModel;
     21    protected AddFromSelectionAction(IRelationEditorActionAccess editorAccess,
     22                        IRelationEditorUpdateOn... updateOn) {
     23        super(editorAccess, updateOn);
    3424    }
    3525
    3626    protected boolean isPotentialDuplicate(OsmPrimitive primitive) {
    37         return memberTableModel.hasMembersReferringTo(Collections.singleton(primitive));
     27        return editorAccess.getMemberTableModel().hasMembersReferringTo(Collections.singleton(primitive));
    3828    }
    3929
     
    4434        ConditionalOptionPaneUtil.startBulkOperation("add_primitive_to_relation");
    4535        for (OsmPrimitive primitive : primitives) {
    46             if (primitive instanceof Relation && editor.getRelation() != null && editor.getRelation().equals(primitive)) {
     36            if (primitive instanceof Relation && editorAccess.getEditor().getRelation() != null && editorAccess.getEditor().getRelation().equals(primitive)) {
    4737                GenericRelationEditor.warnOfCircularReferences(primitive);
    4838                continue;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAfterSelection.java

    r13130 r14027  
    77
    88import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    129import org.openstreetmap.josm.tools.ImageProvider;
    1310import org.openstreetmap.josm.tools.Logging;
     
    1815 */
    1916public class AddSelectedAfterSelection extends AddFromSelectionAction {
     17        private static final long serialVersionUID = 1L;
    2018
    2119    /**
     
    2523     * @param editor relation editor
    2624     */
    27     public AddSelectedAfterSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    28         super(null, memberTableModel, null, selectionTableModel, null, null, editor);
     25    public AddSelectedAfterSelection(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
    2927        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset after the last selected member"));
    3028        new ImageProvider("dialogs/conflict", "copyaftercurrentright").getResource().attachImageIcon(this, true);
     
    3432    @Override
    3533    protected void updateEnabledState() {
    36         setEnabled(selectionTableModel.getRowCount() > 0 && memberTableModel.getSelectionModel().getMinSelectionIndex() >= 0);
     34                setEnabled(getSelectionTableModel().getRowCount() > 0
     35                                && getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
    3736    }
    3837
     
    4039    public void actionPerformed(ActionEvent e) {
    4140        try {
    42             memberTableModel.addMembersAfterIdx(filterConfirmedPrimitives(selectionTableModel.getSelection()),
    43                     memberTableModel.getSelectionModel().getMaxSelectionIndex());
     41                getMemberTableModel().addMembersAfterIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
     42                                getMemberTableModel().getSelectionModel().getMaxSelectionIndex());
    4443        } catch (AddAbortException ex) {
    4544            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtEndAction.java

    r13130 r14027  
    77
    88import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    129import org.openstreetmap.josm.tools.ImageProvider;
    1310import org.openstreetmap.josm.tools.Logging;
     
    1815 */
    1916public class AddSelectedAtEndAction extends AddFromSelectionAction {
     17        private static final long serialVersionUID = 1L;
    2018
    2119    /**
     
    2523     * @param editor relation editor
    2624     */
    27     public AddSelectedAtEndAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    28         super(null, memberTableModel, null, selectionTableModel, null, null, editor);
     25    public AddSelectedAtEndAction(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
    2927        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset after the last member"));
    3028        new ImageProvider("dialogs/conflict", "copyendright").getResource().attachImageIcon(this, true);
     
    3432    @Override
    3533    protected void updateEnabledState() {
    36         setEnabled(selectionTableModel.getRowCount() > 0);
     34        setEnabled(getSelectionTableModel().getRowCount() > 0);
    3735    }
    3836
     
    4038    public void actionPerformed(ActionEvent e) {
    4139        try {
    42             memberTableModel.addMembersAtEnd(filterConfirmedPrimitives(selectionTableModel.getSelection()));
     40                getMemberTableModel().addMembersAtEnd(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
    4341        } catch (AddAbortException ex) {
    4442            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtStartAction.java

    r13130 r14027  
    77
    88import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    129import org.openstreetmap.josm.tools.ImageProvider;
    1310import org.openstreetmap.josm.tools.Logging;
     
    1815 */
    1916public class AddSelectedAtStartAction extends AddFromSelectionAction {
     17        private static final long serialVersionUID = 1L;
    2018
    2119    /**
     
    2523     * @param editor relation editor
    2624     */
    27     public AddSelectedAtStartAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    28         super(null, memberTableModel, null, selectionTableModel, null, null, editor);
     25    public AddSelectedAtStartAction(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
    2927        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset before the first member"));
    3028        new ImageProvider("dialogs/conflict", "copystartright").getResource().attachImageIcon(this, true);
     
    3432    @Override
    3533    protected void updateEnabledState() {
    36         setEnabled(selectionTableModel.getRowCount() > 0);
     34        setEnabled(getSelectionTableModel().getRowCount() > 0);
    3735    }
    3836
     
    4038    public void actionPerformed(ActionEvent e) {
    4139        try {
    42             memberTableModel.addMembersAtBeginning(filterConfirmedPrimitives(selectionTableModel.getSelection()));
     40                getMemberTableModel().addMembersAtBeginning(filterConfirmedPrimitives(getSelectionTableModel().getSelection()));
    4341        } catch (AddAbortException ex) {
    4442            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedBeforeSelection.java

    r13130 r14027  
    77
    88import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    129import org.openstreetmap.josm.tools.ImageProvider;
    1310import org.openstreetmap.josm.tools.Logging;
     
    1815 */
    1916public class AddSelectedBeforeSelection extends AddFromSelectionAction {
     17        private static final long serialVersionUID = 1L;
    2018
    2119    /**
     
    2523     * @param editor relation editor
    2624     */
    27     public AddSelectedBeforeSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    28         super(null, memberTableModel, null, selectionTableModel, null, null, editor);
     25    public AddSelectedBeforeSelection(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
    2927        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset before the first selected member"));
    3028        new ImageProvider("dialogs/conflict", "copybeforecurrentright").getResource().attachImageIcon(this, true);
     
    3432    @Override
    3533    protected void updateEnabledState() {
    36         setEnabled(selectionTableModel.getRowCount() > 0 && memberTableModel.getSelectionModel().getMinSelectionIndex() >= 0);
     34                setEnabled(getSelectionTableModel().getRowCount() > 0
     35                                && editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex() >= 0);
    3736    }
    3837
     
    4039    public void actionPerformed(ActionEvent e) {
    4140        try {
    42             memberTableModel.addMembersBeforeIdx(filterConfirmedPrimitives(selectionTableModel.getSelection()),
    43                     memberTableModel.getSelectionModel().getMinSelectionIndex());
     41                editorAccess.getMemberTableModel().addMembersBeforeIdx(filterConfirmedPrimitives(getSelectionTableModel().getSelection()),
     42                                editorAccess.getMemberTableModel().getSelectionModel().getMinSelectionIndex());
    4443        } catch (AddAbortException ex) {
    4544            Logging.trace(ex);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java

    r13130 r14027  
    55
    66import java.awt.event.ActionEvent;
    7 import java.beans.PropertyChangeEvent;
    8 import java.beans.PropertyChangeListener;
    97
    10 import javax.swing.event.TableModelEvent;
    11 
    12 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    13 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    14 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    15 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    178import org.openstreetmap.josm.tools.ImageProvider;
    189
     
    2112 * @since 9496
    2213 */
    23 public class ApplyAction extends SavingAction implements PropertyChangeListener {
     14public class ApplyAction extends SavingAction {
     15        private static final long serialVersionUID = 1L;
    2416
    2517    /**
     
    3123     * @param tagModel tag editor model
    3224     */
    33     public ApplyAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    34             IRelationEditor editor) {
    35         super(memberTable, memberTableModel, tagModel, layer, editor, null);
     25    public ApplyAction(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.TAG_CHANGE);
    3627        putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
    3728        new ImageProvider("save").getResource().attachImageIcon(this, true);
    3829        putValue(NAME, tr("Apply"));
    39         updateEnabledState();
    40         memberTableModel.addTableModelListener(this);
    41         tagModel.addPropertyChangeListener(this);
     30        updateEnabledState();       
    4231    }
    4332
     
    4534    public void actionPerformed(ActionEvent e) {
    4635        if (applyChanges()) {
    47             editor.reloadDataFromRelation();
     36                editorAccess.getEditor().reloadDataFromRelation();
    4837        }
    4938    }
     
    5342        setEnabled(isEditorDirty());
    5443    }
    55 
    56     @Override
    57     public void propertyChange(PropertyChangeEvent evt) {
    58         updateEnabledState();
    59     }
    60 
    61     @Override
    62     public void tableChanged(TableModelEvent e) {
    63         updateEnabledState();
    64     }
    6544}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java

    r13842 r14027  
    1313import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    1414import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    15 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    16 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    17 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    18 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    19 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    20 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    2115import org.openstreetmap.josm.spi.preferences.Config;
    2216import org.openstreetmap.josm.tools.ImageProvider;
     
    2822 */
    2923public class CancelAction extends SavingAction {
     24        private static final long serialVersionUID = 1L;
    3025
    3126    /**
     
    3833     * @param tfRole role text field
    3934     */
    40     public CancelAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    41             IRelationEditor editor, AutoCompletingTextField tfRole) {
    42         super(memberTable, memberTableModel, tagModel, layer, editor, tfRole);
     35    public CancelAction(IRelationEditorActionAccess editorAccess) {
     36        super(editorAccess);
    4337        putValue(SHORT_DESCRIPTION, tr("Cancel the updates and close the dialog"));
    4438        new ImageProvider("cancel").getResource().attachImageIcon(this);
    4539        putValue(NAME, tr("Cancel"));
    4640
    47         if (editor instanceof RootPaneContainer) {
    48             InputMapUtils.addEscapeAction(((RootPaneContainer) editor).getRootPane(), this);
     41        if (getEditor() instanceof RootPaneContainer) {
     42            InputMapUtils.addEscapeAction(((RootPaneContainer) getEditor()).getRootPane(), this);
    4943        }
    5044        setEnabled(true);
     
    5347    @Override
    5448    public void actionPerformed(ActionEvent e) {
    55         memberTable.stopHighlighting();
    56         Relation snapshot = editor.getRelationSnapshot();
    57         if ((!memberTableModel.hasSameMembersAs(snapshot) || tagModel.isDirty())
    58          && !(snapshot == null && tagModel.getTags().isEmpty())) {
     49        getMemberTable().stopHighlighting();
     50        Relation snapshot = getEditor().getRelationSnapshot();
     51        if ((!getMemberTableModel().hasSameMembersAs(snapshot) || getTagModel().isDirty())
     52         && !(snapshot == null && getTagModel().getTags().isEmpty())) {
    5953            //give the user a chance to save the changes
    6054            int ret = confirmClosingByCancel();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CopyMembersAction.java

    r10604 r14027  
    88import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    99import org.openstreetmap.josm.gui.datatransfer.RelationMemberTransferable;
    10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    12 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1310
    1411/**
     
    1714 */
    1815public class CopyMembersAction extends AddFromSelectionAction {
     16        private static final long serialVersionUID = 1L;
    1917
    2018    /**
     
    2422     * @param editor relation editor
    2523     */
    26     public CopyMembersAction(MemberTableModel memberTableModel, OsmDataLayer layer, IRelationEditor editor) {
    27         super(null, memberTableModel, null, null, null, layer, editor);
     24    public CopyMembersAction(IRelationEditorActionAccess editorAccess) {
     25        super(editorAccess);
    2826    }
    2927
    3028    @Override
    3129    public void actionPerformed(ActionEvent e) {
    32         final Collection<RelationMember> members = memberTableModel.getSelectedMembers();
     30        final Collection<RelationMember> members = getMemberTableModel().getSelectedMembers();
    3331
    3432        if (!members.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java

    r13130 r14027  
    1111import org.openstreetmap.josm.data.osm.Relation;
    1212import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
    13 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    14 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1513import org.openstreetmap.josm.tools.ImageProvider;
    1614
     
    2018 */
    2119public class DeleteCurrentRelationAction extends AbstractRelationEditorAction implements PropertyChangeListener {
     20        private static final long serialVersionUID = 1L;
    2221
    2322    /**
     
    2625     * @param editor relation editor
    2726     */
    28     public DeleteCurrentRelationAction(OsmDataLayer layer, IRelationEditor editor) {
    29         super(null, null, null, layer, editor);
     27    public DeleteCurrentRelationAction(IRelationEditorActionAccess editorAccess) {
     28        super(editorAccess);
    3029        putValue(SHORT_DESCRIPTION, tr("Delete the currently edited relation"));
    3130        new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this, true);
     
    3635    @Override
    3736    public void actionPerformed(ActionEvent e) {
    38         Relation toDelete = editor.getRelation();
     37        Relation toDelete = getEditor().getRelation();
    3938        if (toDelete == null)
    4039            return;
    41         DeleteAction.deleteRelation(layer, toDelete);
     40        DeleteAction.deleteRelation(getLayer(), toDelete);
    4241    }
    4342
    4443    @Override
    4544    protected void updateEnabledState() {
    46         setEnabled(editor.getRelationSnapshot() != null);
     45        setEnabled(getEditor().getRelationSnapshot() != null);
    4746    }
    4847
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadIncompleteMembersAction.java

    r13761 r14027  
    1111import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
    13 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    14 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    15 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    16 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1713import org.openstreetmap.josm.tools.ImageProvider;
    1814import org.openstreetmap.josm.tools.Shortcut;
     
    2319 */
    2420public class DownloadIncompleteMembersAction extends AbstractRelationEditorAction {
     21        private static final long serialVersionUID = 1L;
    2522
    2623    /**
     
    3229     * @param editor relation editor
    3330     */
    34     public DownloadIncompleteMembersAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    35             OsmDataLayer layer, IRelationEditor editor) {
    36         super(memberTable, memberTableModel, actionMapKey, layer, editor);
     31    public DownloadIncompleteMembersAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
     32        super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
    3733        Shortcut sc = Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
    3834            KeyEvent.VK_HOME, Shortcut.ALT);
     
    4945            return;
    5046        MainApplication.worker.submit(new DownloadRelationMemberTask(
    51                 editor.getRelation(),
    52                 memberTableModel.getIncompleteMemberPrimitives(),
    53                 layer,
    54                 (Dialog) editor)
     47                        getEditor().getRelation(),
     48                getMemberTableModel().getIncompleteMemberPrimitives(),
     49                getLayer(),
     50                (Dialog) getEditor())
    5551        );
    5652    }
     
    5854    @Override
    5955    protected void updateEnabledState() {
    60         setEnabled(memberTableModel.hasIncompleteMembers() && canDownload());
     56        setEnabled(getMemberTableModel().hasIncompleteMembers() && canDownload());
    6157    }
    6258}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadSelectedIncompleteMembersAction.java

    r13761 r14027  
    99import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask;
    11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    12 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    13 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    14 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1511import org.openstreetmap.josm.tools.ImageProvider;
    1612
     
    2016 */
    2117public class DownloadSelectedIncompleteMembersAction extends AbstractRelationEditorAction {
     18        private static final long serialVersionUID = 1L;
    2219
    2320    /**
     
    2926     * @param editor relation editor
    3027     */
    31     public DownloadSelectedIncompleteMembersAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    32             OsmDataLayer layer, IRelationEditor editor) {
    33         super(memberTable, memberTableModel, actionMapKey, layer, editor);
     28    public DownloadSelectedIncompleteMembersAction(IRelationEditorActionAccess editorAccess) {
     29        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    3430        putValue(SHORT_DESCRIPTION, tr("Download selected incomplete members"));
    3531        new ImageProvider("dialogs/relation", "downloadincompleteselected").getResource().attachImageIcon(this, true);
     
    4339            return;
    4440        MainApplication.worker.submit(new DownloadRelationMemberTask(
    45                 editor.getRelation(),
    46                 memberTableModel.getSelectedIncompleteMemberPrimitives(),
    47                 layer,
    48                 (Dialog) editor)
     41                        getEditor().getRelation(),
     42                getMemberTableModel().getSelectedIncompleteMemberPrimitives(),
     43                getLayer(),
     44                (Dialog) getEditor())
    4945        );
    5046    }
     
    5248    @Override
    5349    protected void updateEnabledState() {
    54         setEnabled(memberTableModel.hasIncompleteSelectedMembers() && canDownload());
     50        setEnabled(getMemberTableModel().hasIncompleteSelectedMembers() && canDownload());
    5551    }
    5652}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DuplicateRelationAction.java

    r13130 r14027  
    88
    99import org.openstreetmap.josm.data.osm.Relation;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1110import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    12 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    13 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    1411import org.openstreetmap.josm.tools.ImageProvider;
    1512
     
    1916 */
    2017public class DuplicateRelationAction extends AbstractRelationEditorAction {
    21 
    22     private final transient TagEditorModel tagEditorModel;
     18        private static final long serialVersionUID = 1L;
    2319
    2420    /**
     
    2824     * @param layer OSM data layer
    2925     */
    30     public DuplicateRelationAction(MemberTableModel memberTableModel, TagEditorModel tagEditorModel, OsmDataLayer layer) {
    31         super(null, memberTableModel, null, layer, null);
    32         this.tagEditorModel = tagEditorModel;
     26    public DuplicateRelationAction(IRelationEditorActionAccess editorAccess) {
     27        super(editorAccess);
    3328        putValue(SHORT_DESCRIPTION, tr("Create a copy of this relation and open it in another editor window"));
    3429        // FIXME provide an icon
     
    4136    public void actionPerformed(ActionEvent e) {
    4237        Relation copy = new Relation();
    43         tagEditorModel.applyToPrimitive(copy);
    44         memberTableModel.applyToRelation(copy);
     38        getTagModel().applyToPrimitive(copy);
     39        editorAccess.getMemberTableModel().applyToRelation(copy);
    4540        if (!GraphicsEnvironment.isHeadless()) {
    46             RelationEditor.getEditor(layer, copy, memberTableModel.getSelectedMembers()).setVisible(true);
     41            RelationEditor.getEditor(getLayer(), copy, editorAccess.getMemberTableModel().getSelectedMembers()).setVisible(true);
    4742        }
    4843    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/EditAction.java

    r13130 r14027  
    1111import org.openstreetmap.josm.data.osm.Relation;
    1212import org.openstreetmap.josm.data.osm.RelationMember;
    13 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    14 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1513import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    16 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1714import org.openstreetmap.josm.tools.ImageProvider;
    1815
     
    2219 */
    2320public class EditAction extends AbstractRelationEditorAction {
     21        private static final long serialVersionUID = 1L;
    2422
    2523    /**
     
    2927     * @param layer layer
    3028     */
    31     public EditAction(MemberTable memberTable, MemberTableModel memberTableModel, OsmDataLayer layer) {
    32         super(memberTable, memberTableModel, null, layer, null);
     29    public EditAction(IRelationEditorActionAccess editorAccess) {
     30        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    3331        putValue(SHORT_DESCRIPTION, tr("Edit the relation the currently selected relation member refers to"));
    3432        new ImageProvider("dialogs", "edit").getResource().attachImageIcon(this, true);
     
    3836    @Override
    3937    protected void updateEnabledState() {
    40         setEnabled(memberTable.getSelectedRowCount() == 1
    41                 && memberTableModel.isEditableRelation(memberTable.getSelectedRow()));
     38        setEnabled(editorAccess.getMemberTable().getSelectedRowCount() == 1
     39                                && editorAccess.getMemberTableModel()
     40                                                .isEditableRelation(editorAccess.getMemberTable().getSelectedRow()));
    4241    }
    4342
    4443    protected Collection<RelationMember> getMembersForCurrentSelection(Relation r) {
    4544        Collection<RelationMember> members = new HashSet<>();
    46         Collection<OsmPrimitive> selection = layer.data.getSelected();
     45        Collection<OsmPrimitive> selection = getLayer().data.getSelected();
    4746        for (RelationMember member: r.getMembers()) {
    4847            if (selection.contains(member.getMember())) {
     
    5756        if (!isEnabled())
    5857            return;
    59         int idx = memberTable.getSelectedRow();
     58        int idx = editorAccess.getMemberTable().getSelectedRow();
    6059        if (idx < 0)
    6160            return;
    62         OsmPrimitive primitive = memberTableModel.getReferredPrimitive(idx);
     61        OsmPrimitive primitive = editorAccess.getMemberTableModel().getReferredPrimitive(idx);
    6362        if (!(primitive instanceof Relation))
    6463            return;
     
    6766            return;
    6867
    69         RelationEditor.getEditor(layer, r, getMembersForCurrentSelection(r)).setVisible(true);
     68        RelationEditor.getEditor(getLayer(), r, getMembersForCurrentSelection(r)).setVisible(true);
    7069    }
    7170}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveDownAction.java

    r13130 r14027  
    88
    99import org.openstreetmap.josm.Main;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1210import org.openstreetmap.josm.tools.ImageProvider;
    1311import org.openstreetmap.josm.tools.Shortcut;
     
    1816 */
    1917public class MoveDownAction extends AbstractRelationEditorAction {
     18        private static final long serialVersionUID = 1L;
    2019
    2120    /**
     
    2524     * @param actionMapKey action map key
    2625     */
    27     public MoveDownAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey) {
    28         super(memberTable, memberTableModel, actionMapKey);
     26    public MoveDownAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
     27        super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    2928        new ImageProvider("dialogs", "movedown").getResource().attachImageIcon(this, true);
    3029        Shortcut sc = Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.ALT);
     
    3635    @Override
    3736    public void actionPerformed(ActionEvent e) {
    38         memberTableModel.moveDown(memberTable.getSelectedRows());
     37        editorAccess.getMemberTableModel().moveDown(editorAccess.getMemberTable().getSelectedRows());
    3938    }
    4039
    4140    @Override
    4241    protected void updateEnabledState() {
    43         setEnabled(memberTableModel.canMoveDown(memberTable.getSelectedRows()));
     42        setEnabled(editorAccess.getMemberTableModel().canMoveDown(editorAccess.getMemberTable().getSelectedRows()));
    4443    }
    4544}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveUpAction.java

    r13130 r14027  
    88
    99import org.openstreetmap.josm.Main;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1210import org.openstreetmap.josm.tools.ImageProvider;
    1311import org.openstreetmap.josm.tools.Shortcut;
     
    1816 */
    1917public class MoveUpAction extends AbstractRelationEditorAction {
     18        private static final long serialVersionUID = 1L;
    2019
    2120    /**
     
    2524     * @param actionMapKey key in table action map
    2625     */
    27     public MoveUpAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey) {
    28         super(memberTable, memberTableModel, actionMapKey);
     26    public MoveUpAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
     27        super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    2928        new ImageProvider("dialogs", "moveup").getResource().attachImageIcon(this, true);
    3029        Shortcut sc = Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"), KeyEvent.VK_UP, Shortcut.ALT);
     
    3635    @Override
    3736    public void actionPerformed(ActionEvent e) {
    38         memberTableModel.moveUp(memberTable.getSelectedRows());
     37        editorAccess.getMemberTableModel().moveUp(editorAccess.getMemberTable().getSelectedRows());
    3938    }
    4039
    4140    @Override
    4241    protected void updateEnabledState() {
    43         setEnabled(memberTableModel.canMoveUp(memberTable.getSelectedRows()));
     42        setEnabled(editorAccess.getMemberTableModel().canMoveUp(editorAccess.getMemberTable().getSelectedRows()));
    4443    }
    4544}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/OKAction.java

    r12846 r14027  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    12 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    13 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    148import org.openstreetmap.josm.spi.preferences.Config;
    159import org.openstreetmap.josm.tools.ImageProvider;
     
    1913 */
    2014public class OKAction extends SavingAction {
     15        private static final long serialVersionUID = 1L;
    2116
    2217    /**
     
    2924     * @param tfRole role text field
    3025     */
    31     public OKAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    32             IRelationEditor editor, AutoCompletingTextField tfRole) {
    33         super(memberTable, memberTableModel, tagModel, layer, editor, tfRole);
     26    public OKAction(IRelationEditorActionAccess editorAccess) {
     27        super(editorAccess);
    3428        putValue(SHORT_DESCRIPTION, tr("Apply the updates and close the dialog"));
    3529        new ImageProvider("ok").getResource().attachImageIcon(this);
     
    4135    public void actionPerformed(ActionEvent e) {
    4236        Config.getPref().put("relation.editor.generic.lastrole", tfRole.getText());
    43         memberTable.stopHighlighting();
     37        editorAccess.getMemberTable().stopHighlighting();
    4438        if (!applyChanges())
    4539            return;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersAction.java

    r12620 r14027  
    1010
    1111import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    12 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    13 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1412import org.openstreetmap.josm.gui.dialogs.relation.MemberTransferHandler;
    15 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1613import org.openstreetmap.josm.tools.Logging;
    1714
     
    2118 */
    2219public class PasteMembersAction extends AddFromSelectionAction implements FlavorListener {
     20        private static final long serialVersionUID = 1L;
    2321
    2422    /**
     
    2826     * @param editor relation editor
    2927     */
    30     public PasteMembersAction(MemberTable memberTable, OsmDataLayer layer, IRelationEditor editor) {
    31         super(memberTable, null, null, null, null, layer, editor);
     28    public PasteMembersAction(IRelationEditorActionAccess editorAccess) {
     29        super(editorAccess);
    3230        updateEnabledState();
    3331    }
     
    4341
    4442    private TransferSupport getSupport() {
    45         return new TransferSupport(memberTable, Optional.ofNullable(ClipboardUtils.getClipboardContent())
     43        return new TransferSupport(editorAccess.getMemberTable(), Optional.ofNullable(ClipboardUtils.getClipboardContent())
    4644                .orElseThrow(() -> new IllegalStateException("Failed to retrieve clipboard content")));
    4745    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java

    r13856 r14027  
    1616import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    1717import org.openstreetmap.josm.gui.MainApplication;
    18 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    19 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    20 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    21 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    22 import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    2318import org.openstreetmap.josm.tools.ImageProvider;
    2419import org.openstreetmap.josm.tools.Shortcut;
     
    2924 */
    3025public class RefreshAction extends SavingAction implements CommandQueueListener {
     26        private static final long serialVersionUID = 1L;
    3127
    3228    /**
     
    3834     * @param tagModel tag editor model
    3935     */
    40     public RefreshAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    41             IRelationEditor editor) {
    42         super(memberTable, memberTableModel, tagModel, layer, editor, null);
     36    public RefreshAction(IRelationEditorActionAccess editorAccess) {
     37        super(editorAccess);
    4338        // CHECKSTYLE.OFF: LineLength
    4439        Shortcut sc = Shortcut.registerShortcut("relationeditor:refresh", tr("Relation Editor: Refresh"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE);
     
    4742        new ImageProvider("dialogs/refresh").getResource().attachImageIcon(this, true);
    4843        putValue(NAME, tr("Refresh"));
    49         if (editor instanceof JComponent) {
    50             ((JComponent) editor).getRootPane().getActionMap().put("refresh", this);
    51             ((JComponent) editor).getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), "refresh");
     44        if (editorAccess.getEditor() instanceof JComponent) {
     45            ((JComponent) editorAccess.getEditor()).getRootPane().getActionMap().put("refresh", this);
     46            ((JComponent) editorAccess.getEditor()).getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), "refresh");
    5247        }
    5348        MainApplication.undoRedo.addCommandQueueListener(this);
     
    5752    @Override
    5853    public void actionPerformed(ActionEvent e) {
    59         Relation relation = editor.getRelation();
     54        Relation relation = editorAccess.getEditor().getRelation();
    6055        if (relation == null)
    6156            return;
     
    6863        if (isEditorDirty() && confirmDiscardDirtyData() != 0)
    6964            return;
    70         editor.reloadDataFromRelation();
     65        editorAccess.getEditor().reloadDataFromRelation();
    7166    }
    7267
    7368    @Override
    7469    public void updateEnabledState() {
    75         Relation relation = editor.getRelation();
    76         Relation snapshot = editor.getRelationSnapshot();
     70        Relation relation = editorAccess.getEditor().getRelation();
     71        Relation snapshot = editorAccess.getEditor().getRelationSnapshot();
    7772        setEnabled(snapshot != null && (
    7873            !relation.hasEqualTechnicalAttributes(snapshot) ||
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RemoveAction.java

    r13130 r14027  
    88
    99import org.openstreetmap.josm.Main;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1210import org.openstreetmap.josm.tools.ImageProvider;
    1311import org.openstreetmap.josm.tools.Shortcut;
     
    1816 */
    1917public class RemoveAction extends AbstractRelationEditorAction {
     18        private static final long serialVersionUID = 1L;
    2019
    2120    /**
     
    2524     * @param actionMapKey action map key
    2625     */
    27     public RemoveAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey) {
    28         super(memberTable, memberTableModel, actionMapKey);
     26    public RemoveAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
     27        super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    2928        new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this, true);
    3029        putValue(NAME, tr("Remove"));
     
    3736    @Override
    3837    public void actionPerformed(ActionEvent e) {
    39         memberTableModel.remove(memberTable.getSelectedRows());
     38        editorAccess.getMemberTableModel().remove(editorAccess.getMemberTable().getSelectedRows());
    4039    }
    4140
    4241    @Override
    4342    protected void updateEnabledState() {
    44         setEnabled(memberTableModel.canRemove(memberTable.getSelectedRows()));
     43        setEnabled(editorAccess.getMemberTableModel().canRemove(editorAccess.getMemberTable().getSelectedRows()));
    4544    }
    4645}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RemoveSelectedAction.java

    r13130 r14027  
    77
    88import org.openstreetmap.josm.data.osm.DataSet;
    9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    10 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    11 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    129import org.openstreetmap.josm.tools.ImageProvider;
    1310
     
    1714 */
    1815public class RemoveSelectedAction extends AddFromSelectionAction {
     16        private static final long serialVersionUID = 1L;
    1917
    2018    /**
     
    2422     * @param layer OSM data layer
    2523     */
    26     public RemoveSelectedAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, OsmDataLayer layer) {
    27         super(null, memberTableModel, null, selectionTableModel, null, layer, null);
     24    public RemoveSelectedAction(IRelationEditorActionAccess editorAccess) {
     25        super(editorAccess, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE);
    2826        putValue(SHORT_DESCRIPTION, tr("Remove all members referring to one of the selected objects"));
    2927        new ImageProvider("dialogs/relation", "deletemembers").getResource().attachImageIcon(this, true);
     
    3331    @Override
    3432    protected void updateEnabledState() {
    35         DataSet ds = layer.data;
     33        DataSet ds = getLayer().data;
    3634        if (ds == null || ds.selectionEmpty()) {
    3735            setEnabled(false);
     
    3937        }
    4038        // only enable the action if we have members referring to the selected primitives
    41         setEnabled(memberTableModel.hasMembersReferringTo(ds.getSelected()));
     39        setEnabled(editorAccess.getMemberTableModel().hasMembersReferringTo(ds.getSelected()));
    4240    }
    4341
    4442    @Override
    4543    public void actionPerformed(ActionEvent e) {
    46         memberTableModel.removeMembersReferringTo(selectionTableModel.getSelection());
     44        editorAccess.getMemberTableModel().removeMembersReferringTo(getSelectionTableModel().getSelection());
    4745    }
    4846}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ReverseAction.java

    r13130 r14027  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    108import org.openstreetmap.josm.tools.ImageProvider;
    119
     
    1513 */
    1614public class ReverseAction extends AbstractRelationEditorAction {
     15        private static final long serialVersionUID = 1L;
    1716
    1817    /**
    1918     * Constructs a new {@code ReverseAction}.
    20      * @param memberTable member table
    21      * @param memberTableModel member table model
     19     * @param editorAccess
    2220     */
    23     public ReverseAction(MemberTable memberTable, MemberTableModel memberTableModel) {
    24         super(memberTable, memberTableModel, null);
     21    public ReverseAction(IRelationEditorActionAccess editorAccess) {
     22        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
     23
    2524        putValue(SHORT_DESCRIPTION, tr("Reverse the order of the relation members"));
    2625        new ImageProvider("dialogs/relation", "reverse").getResource().attachImageIcon(this, true);
     
    3130    @Override
    3231    public void actionPerformed(ActionEvent e) {
    33         memberTableModel.reverse();
     32        editorAccess.getMemberTableModel().reverse();
    3433    }
    3534
    3635    @Override
    3736    protected void updateEnabledState() {
    38         setEnabled(memberTableModel.getRowCount() > 0);
     37        setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0);
    3938    }
    4039}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r13842 r14027  
    2222import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    2323import org.openstreetmap.josm.gui.MainApplication;
    24 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    25 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    26 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    2724import org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager;
    2825import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
    29 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3026import org.openstreetmap.josm.gui.tagging.TagEditorModel;
    3127import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
     
    3834 */
    3935abstract class SavingAction extends AbstractRelationEditorAction {
     36        private static final long serialVersionUID = 1L;
    4037
    41     protected final TagEditorModel tagModel;
    4238    protected final AutoCompletingTextField tfRole;
    4339
    44     protected SavingAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    45             IRelationEditor editor, AutoCompletingTextField tfRole) {
    46         super(memberTable, memberTableModel, null, layer, editor);
    47         this.tagModel = tagModel;
    48         this.tfRole = tfRole;
     40    protected SavingAction(IRelationEditorActionAccess editorAccess, IRelationEditorUpdateOn... updateOn) {
     41        super(editorAccess, updateOn);
     42        this.tfRole = editorAccess.getTextFieldRole();
    4943    }
    5044
     
    5650        final Relation newRelation = new Relation();
    5751        tagEditorModel.applyToPrimitive(newRelation);
    58         memberTableModel.applyToRelation(newRelation);
     52        getMemberTableModel().applyToRelation(newRelation);
    5953        List<RelationMember> newMembers = new ArrayList<>();
    6054        for (RelationMember rm: newRelation.getMembers()) {
     
    7367        if (newRelation.getMembersCount() == 0 && !newRelation.hasKeys())
    7468            return;
    75         MainApplication.undoRedo.add(new AddCommand(layer.getDataSet(), newRelation));
     69        MainApplication.undoRedo.add(new AddCommand(getLayer().getDataSet(), newRelation));
    7670
    7771        // make sure everybody is notified about the changes
    7872        //
    79         editor.setRelation(newRelation);
    80         if (editor instanceof RelationEditor) {
     73        getEditor().setRelation(newRelation);
     74        if (getEditor() instanceof RelationEditor) {
    8175            RelationDialogManager.getRelationDialogManager().updateContext(
    82                     layer, editor.getRelation(), (RelationEditor) editor);
     76                    getLayer(), getEditor().getRelation(), (RelationEditor) getEditor());
    8377        }
    8478        // Relation list gets update in EDT so selecting my be postponed to following EDT run
     
    9185     */
    9286    protected void applyExistingConflictingRelation(TagEditorModel tagEditorModel) {
    93         Relation editedRelation = new Relation(editor.getRelation());
     87        Relation editedRelation = new Relation(editorAccess.getEditor().getRelation());
    9488        tagEditorModel.applyToPrimitive(editedRelation);
    95         memberTableModel.applyToRelation(editedRelation);
    96         Conflict<Relation> conflict = new Conflict<>(editor.getRelation(), editedRelation);
    97         MainApplication.undoRedo.add(new ConflictAddCommand(layer.getDataSet(), conflict));
     89        editorAccess.getMemberTableModel().applyToRelation(editedRelation);
     90        Conflict<Relation> conflict = new Conflict<>(editorAccess.getEditor().getRelation(), editedRelation);
     91        MainApplication.undoRedo.add(new ConflictAddCommand(getLayer().getDataSet(), conflict));
    9892    }
    9993
     
    10397     */
    10498    protected void applyExistingNonConflictingRelation(TagEditorModel tagEditorModel) {
    105         Relation originRelation = editor.getRelation();
     99        Relation originRelation = editorAccess.getEditor().getRelation();
    106100        Relation editedRelation = new Relation(originRelation);
    107101        tagEditorModel.applyToPrimitive(editedRelation);
    108         memberTableModel.applyToRelation(editedRelation);
     102        getMemberTableModel().applyToRelation(editedRelation);
    109103        if (!editedRelation.hasEqualSemanticAttributes(originRelation, false)) {
    110104            MainApplication.undoRedo.add(new ChangeCommand(originRelation, editedRelation));
     
    153147                        + "''{1}''.<br>"
    154148                        + "Please resolve this conflict first, then try again.</html>",
    155                         Utils.escapeReservedCharactersHTML(layer.getName()),
    156                         Utils.escapeReservedCharactersHTML(editor.getRelation().getDisplayName(DefaultNameFormatter.getInstance()))
     149                        Utils.escapeReservedCharactersHTML(getLayer().getName()),
     150                        Utils.escapeReservedCharactersHTML(getEditor().getRelation().getDisplayName(DefaultNameFormatter.getInstance()))
    157151                ),
    158152                tr("Double conflict"),
     
    167161
    168162    protected boolean applyChanges() {
    169         if (editor.getRelation() == null) {
    170             applyNewRelation(tagModel);
     163        if (editorAccess.getEditor().getRelation() == null) {
     164            applyNewRelation(getTagModel());
    171165        } else if (isEditorDirty()) {
    172             if (editor.isDirtyRelation()) {
     166            if (editorAccess.getEditor().isDirtyRelation()) {
    173167                if (confirmClosingBecauseOfDirtyState()) {
    174                     if (layer.getConflicts().hasConflictForMy(editor.getRelation())) {
     168                    if (getLayer().getConflicts().hasConflictForMy(editorAccess.getEditor().getRelation())) {
    175169                        warnDoubleConflict();
    176170                        return false;
    177171                    }
    178                     applyExistingConflictingRelation(tagModel);
     172                    applyExistingConflictingRelation(getTagModel());
    179173                    hideEditor();
    180174                } else
    181175                    return false;
    182176            } else {
    183                 applyExistingNonConflictingRelation(tagModel);
     177                applyExistingNonConflictingRelation(getTagModel());
    184178            }
    185179        }
    186         editor.setRelation(editor.getRelation());
     180        editorAccess.getEditor().setRelation(editorAccess.getEditor().getRelation());
    187181        return true;
    188182    }
    189183
    190184    protected void hideEditor() {
    191         if (editor instanceof Component) {
    192             ((Component) editor).setVisible(false);
     185        if (editorAccess.getEditor() instanceof Component) {
     186            ((Component) editorAccess.getEditor()).setVisible(false);
    193187        }
    194188    }
    195189
    196190    protected boolean isEditorDirty() {
    197         Relation snapshot = editor.getRelationSnapshot();
    198         return (snapshot != null && !memberTableModel.hasSameMembersAs(snapshot)) || tagModel.isDirty();
     191        Relation snapshot = editorAccess.getEditor().getRelationSnapshot();
     192        return (snapshot != null && !getMemberTableModel().hasSameMembersAs(snapshot)) || getTagModel().isDirty();
    199193    }
    200194}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectAction.java

    r12933 r14027  
    77
    88import org.openstreetmap.josm.data.osm.Relation;
    9 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    10 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    119import org.openstreetmap.josm.tools.ImageProvider;
    1210
     
    1614 */
    1715public class SelectAction extends AbstractRelationEditorAction {
     16        private static final long serialVersionUID = 1L;
    1817
    1918    /**
     
    2221     * @param editor relation editor
    2322     */
    24     public SelectAction(OsmDataLayer layer, IRelationEditor editor) {
    25         super(null, null, null, layer, editor);
     23    public SelectAction(IRelationEditorActionAccess editorAccess) {
     24        super(editorAccess);
    2625        putValue(NAME, tr("Select"));
    2726        putValue(SHORT_DESCRIPTION, tr("Select the currently edited relation"));
     
    3231    @Override
    3332    public void actionPerformed(ActionEvent e) {
    34         Relation toSelect = editor.getRelation();
     33        Relation toSelect = editorAccess.getEditor().getRelation();
    3534        if (toSelect == null)
    3635            return;
    37         layer.data.setSelected(toSelect);
     36        getLayer().data.setSelected(toSelect);
    3837    }
    3938
    4039    @Override
    4140    protected void updateEnabledState() {
    42         setEnabled(editor.getRelationSnapshot() != null);
     41        setEnabled(editorAccess.getEditor().getRelationSnapshot() != null);
    4342    }
    4443}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectPrimitivesForSelectedMembersAction.java

    r13130 r14027  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    10 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    118import org.openstreetmap.josm.tools.ImageProvider;
    129
     
    1714 */
    1815public class SelectPrimitivesForSelectedMembersAction extends AbstractRelationEditorAction {
     16        private static final long serialVersionUID = 1L;
    1917
    2018    /**
     
    2422     * @param layer layer
    2523     */
    26     public SelectPrimitivesForSelectedMembersAction(MemberTable memberTable, MemberTableModel memberTableModel, OsmDataLayer layer) {
    27         super(memberTable, memberTableModel, null, layer, null);
     24    public SelectPrimitivesForSelectedMembersAction(IRelationEditorActionAccess editorAccess) {
     25        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    2826        putValue(SHORT_DESCRIPTION, tr("Select objects for selected relation members"));
    2927        new ImageProvider("dialogs/relation", "selectprimitives").getResource().attachImageIcon(this, true);
     
    3331    @Override
    3432    protected void updateEnabledState() {
    35         setEnabled(memberTable.getSelectedRowCount() > 0);
     33        setEnabled(editorAccess.getMemberTable().getSelectedRowCount() > 0);
    3634    }
    3735
    3836    @Override
    3937    public void actionPerformed(ActionEvent e) {
    40         layer.data.setSelected(memberTableModel.getSelectedChildPrimitives());
     38        getLayer().data.setSelected(editorAccess.getMemberTableModel().getSelectedChildPrimitives());
    4139    }
    4240}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectedMembersForSelectionAction.java

    r13130 r14027  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    9 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    10 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    118import org.openstreetmap.josm.tools.ImageProvider;
    129
     
    1613 */
    1714public class SelectedMembersForSelectionAction extends AddFromSelectionAction {
     15        private static final long serialVersionUID = 1L;
    1816
    1917    /**
     
    2321     * @param layer OSM data layer
    2422     */
    25     public SelectedMembersForSelectionAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, OsmDataLayer layer) {
    26         super(null, memberTableModel, null, selectionTableModel, null, layer, null);
     23    public SelectedMembersForSelectionAction(IRelationEditorActionAccess editorAccess) {
     24        super(editorAccess, IRelationEditorUpdateOn.SELECTION_TABLE_CHANGE, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
    2725        putValue(SHORT_DESCRIPTION, tr("Select relation members which refer to objects in the current selection"));
    2826        new ImageProvider("dialogs/relation", "selectmembers").getResource().attachImageIcon(this, true);
     
    3230    @Override
    3331    protected void updateEnabledState() {
    34         boolean enabled = selectionTableModel.getRowCount() > 0
    35         && !memberTableModel.getChildPrimitives(layer.data.getSelected()).isEmpty();
     32        boolean enabled = getSelectionTableModel().getRowCount() > 0
     33        && !editorAccess.getMemberTableModel().getChildPrimitives(getLayer().data.getSelected()).isEmpty();
    3634
    3735        if (enabled) {
    3836            putValue(SHORT_DESCRIPTION, tr("Select relation members which refer to {0} objects in the current selection",
    39                     memberTableModel.getChildPrimitives(layer.data.getSelected()).size()));
     37                        editorAccess.getMemberTableModel().getChildPrimitives(getLayer().data.getSelected()).size()));
    4038        } else {
    4139            putValue(SHORT_DESCRIPTION, tr("Select relation members which refer to objects in the current selection"));
     
    4644    @Override
    4745    public void actionPerformed(ActionEvent e) {
    48         memberTableModel.selectMembersReferringTo(layer.data.getSelected());
     46        editorAccess.getMemberTableModel().selectMembersReferringTo(getLayer().data.getSelected());
    4947    }
    5048}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SetRoleAction.java

    r10424 r14027  
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    15 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    16 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1715import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    1816import org.openstreetmap.josm.tools.ImageProvider;
     
    2321 */
    2422public class SetRoleAction extends AbstractRelationEditorAction implements DocumentListener {
     23        private static final long serialVersionUID = 1L;
    2524
    2625    private final transient AutoCompletingTextField tfRole;
     
    3231     * @param tfRole role text field
    3332     */
    34     public SetRoleAction(MemberTable memberTable, MemberTableModel memberTableModel, AutoCompletingTextField tfRole) {
    35         super(memberTable, memberTableModel, null);
    36         this.tfRole = tfRole;
     33    public SetRoleAction(IRelationEditorActionAccess editorAccess) {
     34        super(editorAccess);
     35        this.tfRole = editorAccess.getTextFieldRole();
    3736        putValue(SHORT_DESCRIPTION, tr("Sets a role for the selected members"));
    3837        new ImageProvider("apply").getResource().attachImageIcon(this);
     
    4342    @Override
    4443    protected void updateEnabledState() {
    45         setEnabled(memberTable.getSelectedRowCount() > 0);
     44        setEnabled(editorAccess.getMemberTable().getSelectedRowCount() > 0);
    4645    }
    4746
     
    8382    @Override
    8483    public void actionPerformed(ActionEvent e) {
    85         if (isEmptyRole() && !confirmSettingEmptyRole(memberTable.getSelectedRowCount())) {
     84        if (isEmptyRole() && !confirmSettingEmptyRole(editorAccess.getMemberTable().getSelectedRowCount())) {
    8685            return;
    8786        }
    88         memberTableModel.updateRole(memberTable.getSelectedRows(), tfRole.getText());
     87        editorAccess.getMemberTableModel().updateRole(editorAccess.getMemberTable().getSelectedRows(), tfRole.getText());
    8988    }
    9089
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortAction.java

    r13130 r14027  
    88
    99import org.openstreetmap.josm.Main;
    10 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    1210import org.openstreetmap.josm.tools.ImageProvider;
    1311import org.openstreetmap.josm.tools.Shortcut;
     
    1816 */
    1917public class SortAction extends AbstractRelationEditorAction {
     18        private static final long serialVersionUID = 1L;
    2019
    2120    /**
     
    2423     * @param memberTableModel member table model
    2524     */
    26     public SortAction(MemberTable memberTable, MemberTableModel memberTableModel) {
    27         super(memberTable, memberTableModel, null);
     25    public SortAction(IRelationEditorActionAccess editorAccess) {
     26        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
    2827        new ImageProvider("dialogs", "sort").getResource().attachImageIcon(this, true);
    2928        putValue(NAME, tr("Sort"));
     
    3635    @Override
    3736    public void actionPerformed(ActionEvent e) {
    38         memberTableModel.sort();
     37        editorAccess.getMemberTableModel().sort();
    3938    }
    4039
    4140    @Override
    4241    protected void updateEnabledState() {
    43         setEnabled(memberTableModel.getRowCount() > 0);
     42        setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0);
    4443    }
    4544}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortBelowAction.java

    r13130 r14027  
    66import java.awt.event.ActionEvent;
    77
    8 import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    9 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    108import org.openstreetmap.josm.tools.ImageProvider;
    119
     
    1513 */
    1614public class SortBelowAction extends AbstractRelationEditorAction {
     15        private static final long serialVersionUID = 1L;
    1716
    1817    /**
     
    2120     * @param memberTableModel member table model
    2221     */
    23     public SortBelowAction(MemberTable memberTable, MemberTableModel memberTableModel) {
    24         super(memberTable, memberTableModel, null);
     22    public SortBelowAction(IRelationEditorActionAccess editorAccess) {
     23        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
    2524        new ImageProvider("dialogs", "sort_below").getResource().attachImageIcon(this, true);
    2625        putValue(NAME, tr("Sort below"));
     
    3130    @Override
    3231    public void actionPerformed(ActionEvent e) {
    33         memberTableModel.sortBelow();
     32        editorAccess.getMemberTableModel().sortBelow();
    3433    }
    3534
    3635    @Override
    3736    protected void updateEnabledState() {
    38         setEnabled(memberTableModel.getRowCount() > 0 && !memberTableModel.getSelectionModel().isSelectionEmpty());
     37        setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0 && !editorAccess.getMemberTableModel().getSelectionModel().isSelectionEmpty());
     38    }
     39   
     40    @Override
     41    public boolean isExpertOnly() {
     42        return true;
    3943    }
    4044}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r13489 r14027  
    118118        SelectionTable selectionTable = new SelectionTable(selectionTableModel, memberTableModel);
    119119
    120         LeftButtonToolbar leftButtonToolbar = new LeftButtonToolbar(memberTable, memberTableModel, re);
    121         assertNotNull(leftButtonToolbar.sortBelowButton);
    122 
    123120        AutoCompletingTextField tfRole = GenericRelationEditor.buildRoleTextField(re);
    124121        assertNotNull(tfRole);
     
    127124
    128125        JPanel top = GenericRelationEditor.buildTagEditorPanel(tagEditorPanel);
    129         JPanel bottom = GenericRelationEditor.buildMemberEditorPanel(
    130                 memberTable, memberTableModel, selectionTable, selectionTableModel, re, leftButtonToolbar, tfRole);
    131126        assertNotNull(top);
    132         assertNotNull(bottom);
    133         assertNotNull(GenericRelationEditor.buildSplitPane(top, bottom, re));
    134 
    135127        TagEditorModel tagModel = tagEditorPanel.getModel();
    136128
    137         assertNotNull(GenericRelationEditor.buildOkCancelButtonPanel(
    138                 new OKAction(memberTable, memberTableModel, tagModel, layer, re, tfRole),
    139                 new CancelAction(memberTable, memberTableModel, tagModel, layer, re, tfRole)));
    140         assertNotNull(GenericRelationEditor.buildSelectionControlButtonToolbar(memberTable, memberTableModel, selectionTableModel, re));
    141         assertNotNull(GenericRelationEditor.buildSelectionTablePanel(selectionTable));
    142 
    143         assertNotNull(GenericRelationEditor.buildToolBar(
    144                 new RefreshAction(memberTable, memberTableModel, tagModel, layer, re),
    145                 new ApplyAction(memberTable, memberTableModel, tagModel, layer, re),
    146                 new SelectAction(layer, re),
    147                 new DuplicateRelationAction(memberTableModel, tagModel, layer),
    148                 new DeleteCurrentRelationAction(layer, re)));
    149129    }
    150130}
Note: See TracChangeset for help on using the changeset viewer.