Changeset 9511 in josm for trunk/src


Ignore:
Timestamp:
2016-01-17T20:41:24+01:00 (4 years ago)
Author:
simon04
Message:

fix #12131 - Confirm closing relation editor window with x top right

File:
1 edited

Legend:

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

    r9496 r9511  
    127127     */
    128128    private JButton sortBelowButton;
     129    /**
     130     * Action for performing the {@link CancelAction}
     131     */
     132    private CancelAction cancelAction;
    129133
    130134    /**
     
    219223        setSize(findMaxDialogSize());
    220224
     225        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    221226        addWindowListener(
    222227                new WindowAdapter() {
     
    224229                    public void windowOpened(WindowEvent e) {
    225230                        cleanSelfReferences();
     231                    }
     232
     233                    @Override
     234                    public void windowClosing(WindowEvent e) {
     235                        cancel();
    226236                    }
    227237                }
     
    248258        memberTableModel.setSelectedMembers(selectedMembers);
    249259        HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/RelationEditor"));
     260    }
     261
     262    protected void cancel() {
     263        cancelAction.actionPerformed(null);
    250264    }
    251265
     
    274288        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
    275289        pnl.add(new SideButton(new OKAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole)));
    276         pnl.add(new SideButton(new CancelAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole)));
     290        cancelAction = new CancelAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole);
     291        pnl.add(new SideButton(cancelAction));
    277292        pnl.add(new SideButton(new ContextSensitiveHelpAction(ht("/Dialog/RelationEditor"))));
    278293        return pnl;
Note: See TracChangeset for help on using the changeset viewer.