Ignore:
Timestamp:
24.01.2010 14:20:12 (2 years ago)
Author:
stoecker
Message:

close #4418 - support zip files for styles and presets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r2839 r2889  
    33import static org.openstreetmap.josm.tools.I18n.tr; 
    44 
     5import java.io.File; 
     6import java.io.InputStream; 
    57import java.io.IOException; 
    68import java.util.Collection; 
     
    2325    private static ElemStyles styles = new ElemStyles(); 
    2426    private static Collection<String> iconDirs; 
     27    private static File zipIcons; 
    2528 
    2629    public static ElemStyles getStyles() 
     
    4649            } 
    4750        } 
    48         ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name); 
     51        ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name, zipIcons); 
    4952        if(i == null) 
    5053        { 
     
    8790                xmlReader.setErrorHandler(handler); 
    8891                MirroredInputStream in = new MirroredInputStream(a[1]); 
    89                 xmlReader.parse(new InputSource(in)); 
     92                InputStream zip = in.getZipEntry("xml","style"); 
     93                if(zip != null) 
     94                { 
     95                    zipIcons = in.getFile(); 
     96                    xmlReader.parse(new InputSource(zip)); 
     97                } 
     98                else 
     99                    xmlReader.parse(new InputSource(in)); 
    90100            } catch(IOException e) { 
    91101                System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", a[1], e.toString())); 
     
    97107        } 
    98108        iconDirs = null; 
     109        zipIcons = null; 
    99110    } 
    100111} 
Note: See TracChangeset for help on using the changeset viewer.