Changeset 5055 in josm for trunk


Ignore:
Timestamp:
2012-03-08T12:31:59+01:00 (8 years ago)
Author:
bastiK
Message:

remove unnecessary overloading (probably breaks external code)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r5054 r5055  
    9898    protected int maxHeight = -1;
    9999    protected boolean optional;
     100    protected boolean suppressWarnings;
     101    protected Collection<ClassLoader> additionalClassLoaders;
    100102
    101103    private static SVGUniverse svgUniverse;
     
    220222
    221223    /**
     224     * Suppresses warning on the command line in case the image cannot be found.
     225     *
     226     * In combination with setOptional(true);
     227     */
     228    public ImageProvider setSuppressWarning(boolean suppressWarnings) {
     229        this.suppressWarnings = suppressWarnings;
     230        return this;
     231    }
     232
     233    /**
     234     * Add a collection of additional class loaders to search image for.
     235     */
     236    public ImageProvider setAdditionalClassLoaders(Collection<ClassLoader> additionalClassLoaders) {
     237        this.additionalClassLoaders = additionalClassLoaders;
     238        return this;
     239    }
     240
     241    /**
    222242     * Execute the image request.
    223243     */
    224244    public ImageIcon get() {
    225         return get(true);
    226     }
    227 
    228     /**
    229      * Execute the image request.
    230      * @param warn If the requested image has been set as optional and is not found, prints an error message on System.err.
    231      */
    232     public ImageIcon get(boolean warn) {
    233         return get(warn, null);
    234     }
    235 
    236     /**
    237      * Execute the image request.
    238      * @param additionalClassLoaders A collection of additional class loaders to search image for.
    239      */
    240     public ImageIcon get(Collection<ClassLoader> additionalClassLoaders) {
    241         return get(true, additionalClassLoaders);
    242     }
    243 
    244     /**
    245      * Execute the image request.
    246      * @param warn If the requested image has been set as optional and is not found, prints an error message on System.err.
    247      * @param additionalClassLoaders A collection of additional class loaders to search image for.
    248      */
    249     public ImageIcon get(boolean warn, Collection<ClassLoader> additionalClassLoaders) {
    250245        ImageResource ir = getIfAvailableImpl(additionalClassLoaders);
    251246        if (ir == null) {
     
    254249                throw new RuntimeException(tr("Fatal: failed to locate image ''{0}''. This is a serious configuration problem. JOSM will stop working.", name + ext));
    255250            } else {
    256                 if (warn) {
     251                if (!suppressWarnings) {
    257252                    System.err.println(tr("Failed to locate image ''{0}''", name));
    258253                }
Note: See TracChangeset for help on using the changeset viewer.