Changeset 18287 in osm for applications/editors/josm
- Timestamp:
- 2009-10-27T10:35:31+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/agpifoj
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/agpifoj/build.xml
r17707 r18287 34 34 <attribute name="Plugin-Early" value="false"/> 35 35 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/AgPifoJ"/> 36 <attribute name="Plugin-Mainversion" value="2 166"/>36 <attribute name="Plugin-Mainversion" value="2322"/> 37 37 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 38 38 </manifest> -
applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java
r16941 r18287 21 21 import java.util.Date; 22 22 import java.util.HashSet; 23 import java.util.LinkedHashSet; 23 24 import java.util.List; 24 25 25 26 import javax.swing.Icon; 26 27 import javax.swing.JMenuItem; 28 import javax.swing.JOptionPane; 27 29 import javax.swing.JSeparator; 28 30 … … 102 104 private final File[] selection; 103 105 private HashSet<String> loadedDirectories = new HashSet<String>(); 104 private String errorMessage = ""; 105 106 private LinkedHashSet<String> errorMessages; 107 108 protected void rememberError(String message) { 109 this.errorMessages.add(message); 110 } 111 106 112 public Loader(File[] selection) { 107 113 super(tr("Extracting GPS locations from EXIF")); 108 114 this.selection = selection; 115 errorMessages = new LinkedHashSet<String>(); 109 116 } 110 117 … … 115 122 try { 116 123 addRecursiveFiles(files, selection); 117 } catch(NullPointerException npe) { 118 errorMessage +=tr("One of the selected files was null!!!");124 } catch(NullPointerException npe) { 125 rememberError(tr("One of the selected files was null")); 119 126 } 120 127 … … 156 163 layer = new AgpifojLayer(data); 157 164 files.clear(); 158 if (errorMessage != null && ! errorMessage.trim().equals("")) {159 progressMonitor.setErrorMessage(errorMessage);160 }161 165 } 162 166 … … 179 183 } catch (IOException e) { 180 184 e.printStackTrace(); 181 errorMessage +=tr("Unable to get canonical path for directory {0}\n",182 f.getAbsolutePath()); 185 rememberError(tr("Unable to get canonical path for directory {0}\n", 186 f.getAbsolutePath())); 183 187 } 184 188 … … 196 200 } catch(NullPointerException npe) { 197 201 npe.printStackTrace(); 198 errorMessage += tr("Found null file in directory {0}\n", f.getPath()); 202 203 rememberError(tr("Found null file in directory {0}\n", f.getPath())); 199 204 } 200 205 } else { 201 errorMessage +=tr("Error while getting files from directory {0}\n", f.getPath());206 rememberError(tr("Error while getting files from directory {0}\n", f.getPath())); 202 207 } 203 208 … … 212 217 } 213 218 219 protected String formatErrorMessages() { 220 StringBuffer sb = new StringBuffer(); 221 sb.append("<html>"); 222 if (errorMessages.size() == 1) { 223 sb.append(errorMessages.iterator().next()); 224 } else { 225 sb.append("<ul>"); 226 for (String msg: errorMessages) { 227 sb.append("<li>").append(msg).append("</li>"); 228 } 229 sb.append("/ul>"); 230 } 231 sb.append("</html>"); 232 return sb.toString(); 233 } 234 214 235 @Override protected void finish() { 236 if (!errorMessages.isEmpty()) { 237 JOptionPane.showMessageDialog( 238 Main.parent, 239 formatErrorMessages(), 240 tr("Error"), 241 JOptionPane.ERROR_MESSAGE 242 ); 243 } 215 244 if (layer != null) { 216 245 Main.main.addLayer(layer);
Note:
See TracChangeset
for help on using the changeset viewer.