Changeset 14748 in osm for applications/editors/josm
- Timestamp:
- 2009-04-25T23:15:22+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui
- Files:
-
- 10 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/AddCommentAction.java
r13497 r14748 31 31 32 32 import java.awt.event.ActionEvent; 33 34 import javax.swing.JOptionPane; 33 import java.util.List; 35 34 36 35 import org.openstreetmap.josm.Main; 36 import org.openstreetmap.josm.plugins.osb.OsbPlugin; 37 37 import org.openstreetmap.josm.plugins.osb.api.EditAction; 38 import org.openstreetmap.josm.plugins.osb.gui.dialogs.TextInputDialog; 39 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.HistoryChangedListener; 40 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.StringUtils; 38 41 39 42 public class AddCommentAction extends OsbAction { … … 49 52 @Override 50 53 protected void doActionPerformed(ActionEvent e) throws Exception { 51 String comment = JOptionPane.showInputDialog(Main.parent, tr("Enter your comment")); 54 List<String> history = StringUtils.stringToList(Main.pref.get("osb.comment.history"), "§§§"); 55 HistoryChangedListener l = new HistoryChangedListener() { 56 public void historyChanged(List<String> history) { 57 Main.pref.put("osb.comment.history", StringUtils.listToString(history, "§§§")); 58 } 59 }; 60 String comment = TextInputDialog.showDialog( 61 Main.map, 62 tr("Add a comment"), 63 tr("Enter your comment"), 64 OsbPlugin.loadIcon("add_comment22.png"), 65 history, l); 66 52 67 if(comment != null) { 53 68 comment = addMesgInfo(comment); -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/CloseIssueAction.java
r14471 r14748 31 31 32 32 import java.awt.event.ActionEvent; 33 34 import javax.swing.JOptionPane; 33 import java.util.List; 35 34 36 35 import org.openstreetmap.josm.Main; 36 import org.openstreetmap.josm.plugins.osb.OsbPlugin; 37 37 import org.openstreetmap.josm.plugins.osb.api.CloseAction; 38 import org.openstreetmap.josm.plugins.osb.api.EditAction; 39 import org.openstreetmap.josm.plugins.osb.gui.dialogs.TextInputDialog; 40 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.HistoryChangedListener; 41 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.StringUtils; 38 42 39 43 public class CloseIssueAction extends OsbAction { … … 42 46 43 47 private CloseAction closeAction = new CloseAction(); 48 private EditAction commentAction = new EditAction(); 44 49 45 50 public CloseIssueAction() { … … 49 54 @Override 50 55 protected void doActionPerformed(ActionEvent e) throws Exception { 51 int closeOk = JOptionPane.showConfirmDialog(Main.parent, 52 tr("Really mark this issue as ''done''?"), 56 List<String> history = StringUtils.stringToList(Main.pref.get("osb.comment.history"), "§§§"); 57 HistoryChangedListener l = new HistoryChangedListener() { 58 public void historyChanged(List<String> history) { 59 Main.pref.put("osb.comment.history", StringUtils.listToString(history, "§§§")); 60 } 61 }; 62 String comment = TextInputDialog.showDialog(Main.map, 53 63 tr("Really close?"), 54 JOptionPane.YES_NO_OPTION); 64 tr("<html>Really mark this issue as ''done''?<br><br>You may add an optional comment:</html>"), 65 OsbPlugin.loadIcon("icon_valid22.png"), 66 history, l); 55 67 56 if(closeOk == JOptionPane.YES_OPTION) { 57 int addComment = JOptionPane.showConfirmDialog(Main.parent, 58 tr("Do you want to add a comment?"), 59 tr("Add comment?"), 60 JOptionPane.YES_NO_OPTION); 61 if(addComment == JOptionPane.YES_OPTION) { 62 new AddCommentAction().doActionPerformed(new ActionEvent(this, 0, "add_comment")); 68 if(comment != null) { 69 if(comment.length() > 0) { 70 commentAction.execute(getSelectedNode(), comment); 63 71 } 64 72 closeAction.execute(getSelectedNode()); -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/NewIssueAction.java
r13497 r14748 35 35 import java.awt.event.MouseListener; 36 36 import java.io.IOException; 37 import java.util.List; 37 38 38 39 import javax.swing.JOptionPane; … … 44 45 import org.openstreetmap.josm.plugins.osb.OsbPlugin; 45 46 import org.openstreetmap.josm.plugins.osb.api.NewAction; 47 import org.openstreetmap.josm.plugins.osb.gui.dialogs.TextInputDialog; 48 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.HistoryChangedListener; 49 import org.openstreetmap.josm.plugins.osb.gui.historycombobox.StringUtils; 46 50 47 51 public class NewIssueAction extends OsbAction implements MouseListener { … … 93 97 94 98 private void addNewIssue(MouseEvent e) { 95 // get the comment 96 String result = JOptionPane.showInputDialog(Main.parent, 99 List<String> history = StringUtils.stringToList(Main.pref.get("osb.new.history"), "§§§"); 100 HistoryChangedListener l = new HistoryChangedListener() { 101 public void historyChanged(List<String> history) { 102 Main.pref.put("osb.new.history", StringUtils.listToString(history, "§§§")); 103 } 104 }; 105 String result = TextInputDialog.showDialog( 106 Main.map, 107 tr("Create issue"), 97 108 tr("Describe the problem precisely"), 98 tr("Create issue"),99 JOptionPane.QUESTION_MESSAGE);109 OsbPlugin.loadIcon("icon_error_add22.png"), 110 history, l); 100 111 101 112 if(result != null && result.length() > 0) {
Note:
See TracChangeset
for help on using the changeset viewer.