Changeset 8978 in josm for trunk/src


Ignore:
Timestamp:
2015-11-02T21:04:09+01:00 (9 years ago)
Author:
simon04
Message:

fix #12028 - Hide/disable way splitting dialog

This drops preference key splitway.segment-selection-dialog and uses
"Do not show again" boxes instead.

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r8965 r8978  
    199199            final Way wayToKeep = Strategy.keepLongestChunk().determineWayToKeep(newWays);
    200200
    201             if (ExpertToggleAction.isExpert() && !selectedWay.isNew() && Main.pref.getBoolean("splitway.segment-selection-dialog", true)) {
     201            if (ExpertToggleAction.isExpert() && !selectedWay.isNew()) {
    202202                final ExtendedDialog dialog = new SegmentToKeepSelectionDialog(selectedWay, newWays, wayToKeep, sel);
    203                 dialog.setModal(false);
    204                 dialog.showDialog();
    205             } else {
    206                 final SplitWayResult result = doSplitWay(getEditLayer(), selectedWay, wayToKeep, newWays, sel);
    207                 Main.main.undoRedo.add(result.getCommand());
    208                 getCurrentDataSet().setSelected(result.getNewSelection());
    209             }
     203                dialog.toggleEnable("way.split.segment-selection-dialog");
     204                if (!dialog.toggleCheckState()) {
     205                    dialog.setModal(false);
     206                    dialog.showDialog();
     207                    return; // splitting is performed in SegmentToKeepSelectionDialog.buttonAction()
     208                }
     209            }
     210            final SplitWayResult result = doSplitWay(getEditLayer(), selectedWay, wayToKeep, newWays, sel);
     211            Main.main.undoRedo.add(result.getCommand());
     212            getCurrentDataSet().setSelected(result.getNewSelection());
    210213        }
    211214    }
     
    228231            this.selection = selection;
    229232            this.list = new JList<>(newWays.toArray(new Way[newWays.size()]));
    230             buildList();
    231233            this.list.setSelectedValue(wayToKeep, true);
    232234
     
    238240        }
    239241
    240         private void buildList() {
     242        private void configureList() {
    241243            list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    242244            list.addListSelectionListener(new ListSelectionListener() {
     
    280282            super.setVisible(visible);
    281283            if (visible) {
     284                configureList(); // not in constructor to not highlight segments unless dialog is shown
    282285                list.setSelectedIndex(list.getSelectedIndex()); // highlight way segments
    283286            } else {
     
    289292        protected void buttonAction(int buttonIndex, ActionEvent evt) {
    290293            super.buttonAction(buttonIndex, evt);
     294            toggleSaveState(); // necessary since #showDialog() does not handle it due to the non-modal dialog
    291295            if (getValue() == 1) {
    292296                final Way wayToKeep = list.getSelectedValue();
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r8840 r8978  
    609609     * writes the corresponding pref.
    610610     */
    611     private void toggleSaveState() {
     611    protected void toggleSaveState() {
    612612        if (!toggleable ||
    613613                togglePanel == null ||
Note: See TracChangeset for help on using the changeset viewer.