Changeset 13477 in osm for applications/editors/josm/plugins
- Timestamp:
- 2009-02-01T14:23:24+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/AddCommentAction.java
r12778 r13477 35 35 36 36 import org.openstreetmap.josm.Main; 37 import org.openstreetmap.josm.plugins.osb.ConfigKeys;38 37 import org.openstreetmap.josm.plugins.osb.api.EditAction; 39 38 … … 50 49 @Override 51 50 protected void doActionPerformed(ActionEvent e) throws Exception { 52 // get the user nickname53 String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);54 if(nickname == null || nickname.length() == 0) {55 nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));56 if(nickname == null) {57 nickname = tr("NoName");58 } else {59 Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);60 }61 }62 63 51 String comment = JOptionPane.showInputDialog(Main.parent, tr("Enter your comment")); 64 52 if(comment != null) { 65 comment = comment.concat(" [").concat(nickname).concat("]");53 comment = addMesgInfo(comment); 66 54 editAction.execute(getSelectedNode(), comment); 67 55 } -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/NewIssueAction.java
r13212 r13477 93 93 94 94 private void addNewIssue(MouseEvent e) { 95 // get the user nickname96 String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME);97 if(nickname == null || nickname.length() == 0) {98 nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name"));99 if(nickname == null) {100 nickname = "NoName";101 } else {102 Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname);103 }104 }105 106 95 // get the comment 107 96 String result = JOptionPane.showInputDialog(Main.parent, … … 112 101 if(result != null && result.length() > 0) { 113 102 try { 114 result = result.concat(" [").concat(nickname).concat("]");103 result = addMesgInfo(result); 115 104 Node n = newAction.execute(e.getPoint(), result); 116 105 plugin.getDataSet().addPrimitive(n); -
applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/OsbAction.java
r12778 r13477 28 28 package org.openstreetmap.josm.plugins.osb.gui.action; 29 29 30 import static org.openstreetmap.josm.tools.I18n.tr; 31 30 32 import java.awt.event.ActionEvent; 33 import java.text.DateFormat; 31 34 import java.util.ArrayList; 35 import java.util.Date; 32 36 import java.util.List; 37 import java.util.Locale; 33 38 34 39 import javax.swing.AbstractAction; 40 import javax.swing.JOptionPane; 35 41 42 import org.openstreetmap.josm.Main; 36 43 import org.openstreetmap.josm.data.osm.Node; 44 import org.openstreetmap.josm.plugins.osb.ConfigKeys; 37 45 38 46 public abstract class OsbAction extends AbstractAction { … … 77 85 observers.remove(obs); 78 86 } 87 88 protected String addMesgInfo(String msg) { 89 // get the user nickname 90 String nickname = Main.pref.get(ConfigKeys.OSB_NICKNAME); 91 if(nickname == null || nickname.length() == 0) { 92 nickname = JOptionPane.showInputDialog(Main.parent, tr("Please enter a user name")); 93 if(nickname == null) { 94 nickname = "NoName"; 95 } else { 96 Main.pref.put(ConfigKeys.OSB_NICKNAME, nickname); 97 } 98 } 99 100 // concatenate nickname and date, if date should be included 101 String info = nickname; 102 if(Main.pref.getBoolean(ConfigKeys.OSB_INCLUDE_DATE)) { 103 // get the date 104 DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, Locale.getDefault()); 105 String date = df.format(new Date()); 106 107 // concatenate nickname and date 108 info = info.concat(", ").concat(date); 109 } 110 111 // add user and date info to the message 112 msg = msg.concat(" [").concat(info).concat("]"); 113 114 return msg; 115 } 79 116 }
Note:
See TracChangeset
for help on using the changeset viewer.