Ignore:
Timestamp:
2014-11-10T02:07:41+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10739 - Improve note input dialogs (patch by ToeBee)

File:
1 edited

Legend:

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

    r7699 r7720  
    3535import org.openstreetmap.josm.gui.MapView;
    3636import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
     37import org.openstreetmap.josm.gui.NoteInputDialog;
    3738import org.openstreetmap.josm.gui.SideButton;
    3839import org.openstreetmap.josm.gui.layer.Layer;
     
    294295                return;
    295296            }
    296             Object userInput = JOptionPane.showInputDialog(Main.map,
    297                     tr("Add comment to note:"),
    298                     tr("Add comment"),
    299                     JOptionPane.QUESTION_MESSAGE,
    300                     ICON_COMMENT,
    301                     null,null);
    302             if (userInput == null) { //user pressed cancel
     297            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Comment on note"), tr("Add comment"));
     298            dialog.showNoteDialog(tr("Add comment to note:"), NoteDialog.ICON_COMMENT);
     299            if (dialog.getValue() != 1) {
     300                Main.debug("User aborted note reopening");
    303301                return;
    304302            }
    305             noteData.addCommentToNote(note, userInput.toString());
     303            noteData.addCommentToNote(note, dialog.getInputText());
    306304        }
    307305    }
     
    317315        @Override
    318316        public void actionPerformed(ActionEvent e) {
    319             Object userInput = JOptionPane.showInputDialog(Main.map,
    320                     tr("Close note with message:"),
    321                     tr("Close Note"),
    322                     JOptionPane.QUESTION_MESSAGE,
    323                     ICON_CLOSED,
    324                     null,null);
    325             if (userInput == null) { //user pressed cancel
     317            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Close note"), tr("Close note"));
     318            dialog.showNoteDialog(tr("Close note with message:"), NoteDialog.ICON_CLOSED);
     319            if (dialog.getValue() != 1) {
     320                Main.debug("User aborted note closing");
    326321                return;
    327322            }
    328323            Note note = displayList.getSelectedValue();
    329             noteData.closeNote(note, userInput.toString());
     324            noteData.closeNote(note, dialog.getInputText());
    330325        }
    331326    }
     
    358353        @Override
    359354        public void actionPerformed(ActionEvent e) {
    360             Object userInput = JOptionPane.showInputDialog(Main.map,
    361                     tr("Reopen note with message:"),
    362                     tr("Reopen note"),
    363                     JOptionPane.QUESTION_MESSAGE,
    364                     ICON_OPEN,
    365                     null,null);
    366             if (userInput == null) { //user pressed cancel
     355            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Reopen note"), tr("Reopen note"));
     356            dialog.showNoteDialog(tr("Reopen note with message:"), NoteDialog.ICON_OPEN);
     357            if (dialog.getValue() != 1) {
     358                Main.debug("User aborted note reopening");
    367359                return;
    368360            }
     361
    369362            Note note = displayList.getSelectedValue();
    370             noteData.reOpenNote(note, userInput.toString());
     363            noteData.reOpenNote(note, dialog.getInputText());
    371364        }
    372365    }
Note: See TracChangeset for help on using the changeset viewer.