Changeset 24308 in osm for applications/editors
- Timestamp:
- 2010-11-18T23:30:20+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java
r24300 r24308 27 27 import java.io.IOException; 28 28 29 import javax.imageio.ImageIO; 29 30 import javax.swing.JFileChooser; 30 31 import javax.swing.JOptionPane; … … 50 51 @Override 51 52 public boolean accept(File f) { 53 if ( f.isDirectory() ) 54 return true; 52 55 53 String ext3 = ( f.getName().length() > 4 ) ? f.getName().substring( f.getName().length() - 4 ).toLowerCase() : "";54 String ext4 = ( f.getName().length() > 5 ) ? f.getName().substring( f.getName().length() - 5 ).toLowerCase() : "";56 String fileExtension = f.getName().substring(f.getName().lastIndexOf('.')+1); 57 String[] supportedExtensions = ImageIO.getReaderFormatNames(); 55 58 56 // TODO: check what is supported by Java :) 57 return ( f.isDirectory() 58 || ext3.equals( ".jpg" ) 59 || ext4.equals( ".jpeg" ) 60 || ext3.equals( ".png" ) 61 ); 59 // Unfortunately, getReaderFormatNames does not always return ALL extensions in 60 // both lower and upper case, so we can not do a search in the array 61 for (String e: supportedExtensions) 62 if ( e.toLowerCase().equals(fileExtension) ) { 63 return true; 64 } 65 66 return false; 62 67 } 63 68 … … 65 70 @Override 66 71 public String getDescription() { 67 return tr(" Image files");72 return tr("Supported image files"); 68 73 } 69 74 -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java
r24300 r24308 129 129 Image image = createImage(); 130 130 if ( image == null ) { 131 throw new IOException(tr(" Image not created properly."));131 throw new IOException(tr("PicLayer failed to load or import the image.")); 132 132 } 133 133 // Convert to Buffered Image - not sure if this is the right way...
Note:
See TracChangeset
for help on using the changeset viewer.