Changeset 2250 in josm
- Timestamp:
- 2009-10-05T21:39:15+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r2163 r2250 123 123 } else if (e.getActionCommand() == null) { 124 124 String topic = null; 125 Point mouse = Main.parent.getMousePosition(); 126 if (mouse != null) { 125 if (e.getSource() instanceof Component) { 126 Component c = SwingUtilities.getRoot((Component)e.getSource()); 127 Point mouse = c.getMousePosition(); 128 c = SwingUtilities.getDeepestComponentAt(c, mouse.x, mouse.y); 129 topic = contextSensitiveHelp(c); 130 } else { 131 Point mouse = Main.parent.getMousePosition(); 127 132 topic = contextSensitiveHelp(SwingUtilities.getDeepestComponentAt(Main.parent, mouse.x, mouse.y)); 128 133 } … … 143 148 */ 144 149 private String contextSensitiveHelp(Object c) { 150 if (c == null) 151 return null; 145 152 if (c instanceof Helpful) 146 153 return ((Helpful)c).helpTopic(); … … 159 166 if (c instanceof Action) 160 167 return (String)((Action)c).getValue("help"); 168 if (c instanceof JComponent && ((JComponent)c).getClientProperty("help") != null) 169 return (String)((JComponent)c).getClientProperty("help"); 161 170 if (c instanceof Component) 162 171 return contextSensitiveHelp(((Component)c).getParent()); -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r2198 r2250 152 152 } 153 153 154 public void uploadData(OsmDataLayer layer, APIDataSet apiData) { 155 if (apiData.isEmpty()) { 156 JOptionPane.showMessageDialog( 157 Main.parent, 158 tr("No changes to upload."), 159 tr("Warning"), 160 JOptionPane.INFORMATION_MESSAGE 161 ); 162 return; 163 } 164 if (!checkPreUploadConditions(layer, apiData)) 165 return; 166 Main.worker.execute( 167 createUploadTask( 168 layer, 169 apiData.getPrimitives(), 170 UploadDialog.getUploadDialog().getChangeset(), 171 UploadDialog.getUploadDialog().isDoCloseAfterUpload() 172 ) 173 ); 174 } 175 154 176 public void actionPerformed(ActionEvent e) { 155 177 if (!isEnabled()) … … 164 186 return; 165 187 } 166 167 188 APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet()); 168 if (apiData.isEmpty()) { 169 JOptionPane.showMessageDialog( 170 Main.parent, 171 tr("No changes to upload."), 172 tr("Warning"), 173 JOptionPane.INFORMATION_MESSAGE 174 ); 175 return; 176 } 177 if (!checkPreUploadConditions(Main.map.mapView.getEditLayer(), apiData)) 178 return; 179 Main.worker.execute( 180 createUploadTask( 181 Main.map.mapView.getEditLayer(), 182 apiData.getPrimitives(), 183 UploadDialog.getUploadDialog().getChangeset(), 184 UploadDialog.getUploadDialog().isDoCloseAfterUpload() 185 ) 186 ); 189 uploadData(Main.map.mapView.getEditLayer(), apiData); 187 190 } 188 191 -
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r2188 r2250 66 66 } 67 67 } 68 } 69 68 sortDeleted(); 69 } 70 71 /** 72 * Ensures that primitives are deleted in the following order: Relations, then Ways, 73 * then Nodes. 74 * 75 */ 76 protected void sortDeleted() { 77 Collections.sort( 78 toDelete, 79 new Comparator<OsmPrimitive>() { 80 public int compare(OsmPrimitive o1, OsmPrimitive o2) { 81 if (o1 instanceof Node && o2 instanceof Node) 82 return 0; 83 else if (o1 instanceof Node) 84 return 1; 85 else if (o2 instanceof Node) 86 return -1; 87 88 if (o1 instanceof Way && o2 instanceof Way) 89 return 0; 90 else if (o1 instanceof Way && o2 instanceof Relation) 91 return 1; 92 else if (o2 instanceof Way && o1 instanceof Relation) 93 return -1; 94 95 return 0; 96 } 97 } 98 ); 99 } 70 100 /** 71 101 * initializes the API data set with the modified primitives in <code>ds</code> … … 76 106 this(); 77 107 init(ds); 108 } 109 110 /** 111 * initializes the API data set with the primitives in <code>primitives</code> 112 * 113 * @param primitives the collection of primitives 114 */ 115 public APIDataSet(Collection<OsmPrimitive> primitives) { 116 this(); 117 toAdd.clear(); 118 toUpdate.clear(); 119 toDelete.clear(); 120 for (OsmPrimitive osm: primitives) { 121 if (osm.getId() == 0 && !osm.isDeleted()) { 122 toAdd.addLast(osm); 123 } else if (osm.isModified() && !osm.isDeleted()) { 124 toUpdate.addLast(osm); 125 } else if (osm.isDeleted() && osm.getId() != 0 && osm.isModified()) { 126 toDelete.addFirst(osm); 127 } 128 } 129 sortDeleted(); 78 130 } 79 131 -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r2115 r2250 66 66 import org.openstreetmap.josm.actions.UpdateSelectionAction; 67 67 import org.openstreetmap.josm.actions.UploadAction; 68 import org.openstreetmap.josm.actions.UploadSelectionAction; 68 69 import org.openstreetmap.josm.actions.ZoomInAction; 69 70 import org.openstreetmap.josm.actions.ZoomOutAction; … … 104 105 public final JosmAction updateSelection = new UpdateSelectionAction(); 105 106 public final JosmAction upload = new UploadAction(); 107 public final JosmAction uploadSelection = new UploadSelectionAction(); 106 108 public final JosmAction exit = new ExitAction(); 107 109 … … 206 208 add(fileMenu, downloadReferrers); 207 209 add(fileMenu, upload); 210 add(fileMenu, uploadSelection); 208 211 add(fileMenu, update); 209 212 add(fileMenu, updateSelection); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
r2243 r2250 96 96 97 97 pane.setOneTouchExpandable(true); 98 pane.setDividerLocation( 150);98 pane.setDividerLocation(200); 99 99 100 100 Dimension minimumSize = new Dimension(100, 50); -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r2243 r2250 7 7 import java.awt.GridBagConstraints; 8 8 import java.awt.GridBagLayout; 9 import java.io.UnsupportedEncodingException; 10 import java.net.URLEncoder; 9 11 import java.text.SimpleDateFormat; 10 12 import java.util.Observable; … … 108 110 String url = AbstractInfoAction.getBaseBrowseUrl() + "/changeset/" + getPrimitive().getChangesetId(); 109 111 lblChangeset.setUrl(url); 110 lblChangeset.setDescription( tr("{0}",getPrimitive().getChangesetId()));112 lblChangeset.setDescription(Long.toString(getPrimitive().getChangesetId())); 111 113 112 url = AbstractInfoAction.getBaseUserUrl() + "/" + getPrimitive().getUser(); 113 lblUser.setUrl(url); 114 lblUser.setDescription(tr("{0}", getPrimitive().getUser())); 114 try { 115 if (getPrimitive().getUid() != -1) { 116 url = AbstractInfoAction.getBaseUserUrl() + "/" + URLEncoder.encode(getPrimitive().getUser(), "UTF-8").replaceAll("\\+", "%20"); 117 lblUser.setUrl(url); 118 } else { 119 lblUser.setUrl(null); 120 } 121 } catch(UnsupportedEncodingException e) { 122 e.printStackTrace(); 123 lblUser.setUrl(null); 124 } 125 lblUser.setDescription(getPrimitive().getUser()); 115 126 } 116 127 } -
trunk/src/org/openstreetmap/josm/gui/history/VersionTableCellRenderer.java
r1709 r2250 59 59 sb.append(""); 60 60 } else { 61 sb.append(tr("Version {0}", Long.toString(primitive.getVersion()))); 61 String msg = tr( 62 "Version {0}, {1} (by {2})", 63 Long.toString(primitive.getVersion()), 64 new SimpleDateFormat().format(primitive.getTimestamp()), 65 primitive.getUser() 66 ); 67 sb.append(msg); 62 68 } 63 69 setText(sb.toString()); -
trunk/src/org/openstreetmap/josm/tools/UrlLabel.java
r2243 r2250 34 34 protected void refresh() { 35 35 setContentType("text/html"); 36 setText("<html><a href=\""+url+"\">"+description+"</a></html>"); 36 if (url != null) { 37 setText("<html><a href=\""+url+"\">"+description+"</a></html>"); 38 } else { 39 setText("<html>" + description + "</html>"); 40 } 37 41 setToolTipText(url); 38 42 }
Note:
See TracChangeset
for help on using the changeset viewer.