Ignore:
Timestamp:
2011-02-07T09:35:27+01:00 (13 years ago)
Author:
bastiK
Message:

extended mappaint style dialog

File:
1 edited

Legend:

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

    r3860 r3863  
    4242    public void loadStyleSource() {
    4343        rules.clear();
    44         hasError = false;
     44        clearErrors();
    4545        try {
    46             MirroredInputStream in = new MirroredInputStream(url);
    47             InputStream zip = in.getZipEntry("mapcss", "style");
    48             InputStream input;
    49             if (zip != null) {
    50                 input = zip;
    51                 zipIcons = in.getFile();
    52             } else {
    53                 input = in;
    54                 zipIcons = null;
    55             }
    56             MapCSSParser parser = new MapCSSParser(input, "UTF-8");
     46            MapCSSParser parser = new MapCSSParser(getSourceInputStream(), "UTF-8");
    5747            parser.sheet(this);
    5848            loadMeta();
     
    6050            System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    6151            e.printStackTrace();
    62             hasError = true;
     52            logError(e);
    6353        } catch (TokenMgrError e) {
    6454            System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    6555            e.printStackTrace();
    66             hasError = true;
     56            logError(e);
    6757        } catch (ParseException e) {
    6858            System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    6959            e.printStackTrace();
    70             hasError = true;
     60            logError(e);
     61        }
     62    }
     63
     64    public InputStream getSourceInputStream() throws IOException {
     65        MirroredInputStream in = new MirroredInputStream(url);
     66        InputStream zip = in.getZipEntry("mapcss", "style");
     67        if (zip != null) {
     68            zipIcons = in.getFile();
     69            return zip;
     70        } else {
     71            zipIcons = null;
     72            return in;
    7173        }
    7274    }
Note: See TracChangeset for help on using the changeset viewer.