Changeset 30566 in osm for applications/editors/josm/plugins
- Timestamp:
- 2014-08-06T09:53:24+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/geotools/data/shapefile/files/TabFiles.java
r30310 r30566 57 57 * key is the type of file 58 58 */ 59 private final Map<ShpFileType, URL> urls = new ConcurrentHashMap< ShpFileType, URL>();59 private final Map<ShpFileType, URL> urls = new ConcurrentHashMap<>(); 60 60 61 61 /** … … 68 68 * the locks 69 69 */ 70 private final Map<Thread, Collection<ShpFilesLocker>> lockers = new ConcurrentHashMap< Thread, Collection<ShpFilesLocker>>();70 private final Map<Thread, Collection<ShpFilesLocker>> lockers = new ConcurrentHashMap<>(); 71 71 72 72 /** … … 144 144 if (isLocalTab()) { 145 145 Set<Entry<ShpFileType, URL>> entries = urls.entrySet(); 146 Map<ShpFileType, URL> toUpdate = new HashMap< ShpFileType, URL>();146 Map<ShpFileType, URL> toUpdate = new HashMap<>(); 147 147 for (Entry<ShpFileType, URL> entry : entries) { 148 148 if( !existsTab(entry.getKey()) ){ … … 222 222 */ 223 223 public Map<ShpFileType, String> getFileNames() { 224 Map<ShpFileType, String> result = new HashMap< ShpFileType, String>();224 Map<ShpFileType, String> result = new HashMap<>(); 225 225 Set<Entry<ShpFileType, URL>> entries = urls.entrySet(); 226 226 … … 342 342 URL url = urls.get(type); 343 343 if (url == null) { 344 return new Result< URL, State>(null, State.NOT_EXIST);344 return new Result<>(null, State.NOT_EXIST); 345 345 } 346 346 347 347 boolean locked = readWriteLock.readLock().tryLock(); 348 348 if (!locked) { 349 return new Result< URL, State>(null, State.LOCKED);349 return new Result<>(null, State.LOCKED); 350 350 } 351 351 352 352 getCurrentThreadLockers().add(new ShpFilesLocker(url, requestor)); 353 353 354 return new Result< URL, State>(url, State.GOOD);354 return new Result<>(url, State.GOOD); 355 355 } 356 356 … … 390 390 } 391 391 392 Collection threadLockers = getCurrentThreadLockers();392 Collection<ShpFilesLocker> threadLockers = getCurrentThreadLockers(); 393 393 boolean removed = threadLockers.remove(new ShpFilesLocker(url, requestor)); 394 394 if (!removed) { … … 489 489 URL url = urls.get(type); 490 490 if (url == null) { 491 return new Result< URL, State>(null, State.NOT_EXIST);491 return new Result<>(null, State.NOT_EXIST); 492 492 } 493 493 … … 500 500 if(locked == false) { 501 501 regainReadLocks(threadLockers); 502 return new Result< URL, State>(null, State.LOCKED);502 return new Result<>(null, State.LOCKED); 503 503 } 504 504 } 505 505 506 506 threadLockers.add(new ShpFilesLocker(url, requestor)); 507 return new Result< URL, State>(url, State.GOOD);507 return new Result<>(url, State.GOOD); 508 508 } 509 509 … … 568 568 Collection<ShpFilesLocker> threadLockers = lockers.get(Thread.currentThread()); 569 569 if(threadLockers == null) { 570 threadLockers = new ArrayList< ShpFilesLocker>();570 threadLockers = new ArrayList<>(); 571 571 lockers.put(Thread.currentThread(), threadLockers); 572 572 } … … 771 771 File file = DataUtilities.urlToFile(url); 772 772 773 @SuppressWarnings("resource") 773 774 RandomAccessFile raf = new RandomAccessFile(file, "r"); 774 775 channel = new FileChannelDecorator(raf.getChannel(), this, url, … … 828 829 File file = DataUtilities.urlToFile(url); 829 830 831 @SuppressWarnings("resource") 830 832 RandomAccessFile raf = new RandomAccessFile(file, "rw"); 831 833 channel = new FileChannelDecorator(raf.getChannel(), this, url, -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r30532 r30566 5 5 6 6 import java.awt.Component; 7 import java.awt.GraphicsEnvironment; 7 8 import java.io.BufferedReader; 8 9 import java.io.File; … … 89 90 if (desc != null && desc.getCoordinateReferenceSystem() != null) { 90 91 crs = desc.getCoordinateReferenceSystem(); 91 } else {92 } else if (!GraphicsEnvironment.isHeadless()) { 92 93 GuiHelper.runInEDTAndWait(new Runnable() { 93 94 @Override
Note:
See TracChangeset
for help on using the changeset viewer.