- Timestamp:
- 2012-02-19T16:30:47+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r4982 r4996 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.io.BufferedReader; 10 11 import java.io.File; 12 import java.io.FileReader; 11 13 import java.io.IOException; 12 14 import java.util.ArrayList; … … 19 21 import java.util.List; 20 22 import java.util.Set; 23 import java.util.regex.Matcher; 24 import java.util.regex.Pattern; 21 25 22 26 import javax.swing.JFileChooser; … … 43 47 */ 44 48 public class OpenFileAction extends DiskAccessAction { 49 50 public static final ExtensionFileFilter urlFileFilter = new ExtensionFileFilter("url", "url", tr("URL Files") + " (*.url)"); 45 51 46 52 /** … … 237 243 MultiMap<FileImporter, File> importerMap = new MultiMap<FileImporter, File>(); 238 244 List<File> filesWithUnknownImporter = new LinkedList<File>(); 245 List<File> urlFiles = new LinkedList<File>(); 239 246 FILES: for (File f : files) { 240 247 for (FileImporter importer : ExtensionFileFilter.importers) { … … 244 251 } 245 252 } 246 filesWithUnknownImporter.add(f); 253 if (urlFileFilter.accept(f)) { 254 urlFiles.add(f); 255 } else { 256 filesWithUnknownImporter.add(f); 257 } 247 258 } 248 259 if (!filesWithUnknownImporter.isEmpty()) { … … 271 282 failedAll.add(f.getCanonicalPath()); 272 283 } 284 } 285 } 286 287 for (File urlFile: urlFiles) { 288 try { 289 BufferedReader reader = new BufferedReader(new FileReader(urlFile)); 290 String line; 291 while ((line = reader.readLine()) != null) { 292 Matcher m = Pattern.compile(".*(http://.*)").matcher(line); 293 if (m.matches()) { 294 String url = m.group(1); 295 Main.main.menu.openLocation.openUrl(false, url); 296 } 297 } 298 reader.close(); 299 } catch (Exception e) { 300 System.err.println(e.getMessage()); 273 301 } 274 302 } -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r4982 r4996 25 25 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmChangeTask; 26 26 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 27 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmUrlTask; 27 28 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask; 28 29 import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler; … … 53 54 addDownloadTaskClass(DownloadGpsTask.class); 54 55 addDownloadTaskClass(DownloadOsmChangeTask.class); 56 addDownloadTaskClass(DownloadOsmUrlTask.class); 55 57 } 56 58
Note:
See TracChangeset
for help on using the changeset viewer.