- Timestamp:
- 2015-11-02T21:04:09+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r8965 r8978 199 199 final Way wayToKeep = Strategy.keepLongestChunk().determineWayToKeep(newWays); 200 200 201 if (ExpertToggleAction.isExpert() && !selectedWay.isNew() && Main.pref.getBoolean("splitway.segment-selection-dialog", true)) {201 if (ExpertToggleAction.isExpert() && !selectedWay.isNew()) { 202 202 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()); 210 213 } 211 214 } … … 228 231 this.selection = selection; 229 232 this.list = new JList<>(newWays.toArray(new Way[newWays.size()])); 230 buildList();231 233 this.list.setSelectedValue(wayToKeep, true); 232 234 … … 238 240 } 239 241 240 private void buildList() {242 private void configureList() { 241 243 list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 242 244 list.addListSelectionListener(new ListSelectionListener() { … … 280 282 super.setVisible(visible); 281 283 if (visible) { 284 configureList(); // not in constructor to not highlight segments unless dialog is shown 282 285 list.setSelectedIndex(list.getSelectedIndex()); // highlight way segments 283 286 } else { … … 289 292 protected void buttonAction(int buttonIndex, ActionEvent evt) { 290 293 super.buttonAction(buttonIndex, evt); 294 toggleSaveState(); // necessary since #showDialog() does not handle it due to the non-modal dialog 291 295 if (getValue() == 1) { 292 296 final Way wayToKeep = list.getSelectedValue(); -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r8840 r8978 609 609 * writes the corresponding pref. 610 610 */ 611 pr ivatevoid toggleSaveState() {611 protected void toggleSaveState() { 612 612 if (!toggleable || 613 613 togglePanel == null ||
Note:
See TracChangeset
for help on using the changeset viewer.