Changeset 30810 in osm


Ignore:
Timestamp:
2014-11-18T23:23:20+01:00 (10 years ago)
Author:
donvip
Message:

[josm_commandline] see #josm10684 - remove hardcoded icon sizes

Location:
applications/editors/josm/plugins/CommandLine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/CommandLine/build.xml

    r30523 r30810  
    44    <property name="commit.message" value="JOSM/CommandLine: fix exception after JOSM update"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="7299"/>
     6    <property name="plugin.main.version" value="7687"/>
    77
    88    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandAction.java

    r29505 r30810  
    55 *
    66 */
    7 
    87package CommandLine;
    98
     
    2423        if (!parentCommand.icon.equals("")) {
    2524            try {
    26                 putValue(Action.SMALL_ICON, ImageProvider.get(CommandLine.pluginDir, parentCommand.icon));
    27                 putValue(Action.LARGE_ICON_KEY, ImageProvider.get(CommandLine.pluginDir, parentCommand.icon));
    28             }
    29             catch (NullPointerException e) {
    30                 putValue(Action.SMALL_ICON, ImageProvider.get("blankmenu"));
    31                 putValue(Action.LARGE_ICON_KEY, ImageProvider.get("blankmenu"));
    32             }
    33             catch (RuntimeException e) {
    34                 putValue(Action.SMALL_ICON, ImageProvider.get("blankmenu"));
    35                 putValue(Action.LARGE_ICON_KEY, ImageProvider.get("blankmenu"));
     25                putIcons(CommandLine.pluginDir, parentCommand.icon);
     26            } catch (RuntimeException e) {
     27                putIcons(null, "blankmenu");
    3628            }
    3729        }
     
    3931        this.parentCommand = parentCommand;
    4032        this.parentPlugin = parentPlugin;
     33    }
     34
     35    private void putIcons(String subdir, String name) {
     36        putValue(Action.SMALL_ICON, new ImageProvider(subdir, name).setSize(ImageProvider.ImageSizes.SMALLICON).get());
     37        putValue(Action.LARGE_ICON_KEY, new ImageProvider(subdir, name).setSize(ImageProvider.ImageSizes.LARGEICON).get());
    4138    }
    4239
Note: See TracChangeset for help on using the changeset viewer.