Changeset 29762 in osm for applications/editors


Ignore:
Timestamp:
2013-07-18T20:49:34+02:00 (11 years ago)
Author:
akks
Message:

'[josm_tagging_preset_tester] #josm8853: listen for list selection, support standalone mode (ant run)'

Location:
applications/editors/josm/plugins/tagging-preset-tester
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tagging-preset-tester/build.xml

    r29760 r29762  
    2626-->
    2727<project name="tagging-preset-tester" default="dist" basedir=".">
    28     <property name="commit.message" value="[josm_tagging_preset_tester] fix #josm8853: use preset seach panel in the plugin instead of the compbobox"/>
    29     <property name="plugin.main.version" value="6071"/>
     28    <property name="commit.message" value="[josm_tagging_preset_tester] #josm8853: listen for list selection, support standalone mode (ant run)"/>
     29    <property name="plugin.main.version" value="6072"/>
    3030    <property name="josm" location="../../core/dist/josm-custom.jar"/>
    3131    <property name="plugin.dist.dir" value="../../dist"/>
     
    4242            <compilerarg value="-Xlint:unchecked"/>
    4343        </javac>
     44    </target>
     45    <target name="run" depends="install">
     46        <echo message="creating ${plugin.jar}"/>
     47        <java classpath="${josm};${plugin.jar}" classname="org.openstreetmap.josm.plugins.taggingpresettester.TaggingPresetTester"/>
    4448    </target>
    4549    <target name="dist" depends="compile,revision">
  • applications/editors/josm/plugins/tagging-preset-tester/src/org/openstreetmap/josm/plugins/taggingpresettester/TaggingPresetTester.java

    r29760 r29762  
    66import java.awt.Dimension;
    77import java.awt.GridBagLayout;
    8 import java.awt.GridLayout;
    98import java.awt.event.ActionEvent;
    109import java.awt.event.ActionListener;
     
    1514import javax.swing.BorderFactory;
    1615import javax.swing.JButton;
    17 import javax.swing.JComboBox;
    1816import javax.swing.JFileChooser;
    1917import javax.swing.JFrame;
     
    2119
    2220import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.data.Preferences;
    2322import org.openstreetmap.josm.data.coor.LatLon;
    2423import org.openstreetmap.josm.data.osm.Node;
     
    5251            return;
    5352        Collection<OsmPrimitive> x;
    54         if (Main.main.hasEditLayer()) {
     53        if (Main.main!=null && Main.main.hasEditLayer()) {
    5554            x = Main.main.getCurrentDataSet().getSelected();
    5655        } else {
     
    7574        panel.add(taggingPresets, GBC.std(0,0).fill(GBC.BOTH));
    7675        panel.add(taggingPresetPanel, GBC.std(1,0).fill(GBC.BOTH));
    77         taggingPresets.setClickListener(new ActionListener(){
     76        taggingPresets.addSelectionListener(new ActionListener(){
    7877            @Override
    7978            public void actionPerformed(ActionEvent e) {
    80                 reselect();
     79                if (taggingPresets.getSelectedPreset()!=null)
     80                    reselect();
    8181            }
    8282        });
     
    105105            args = new String[]{c.getSelectedFile().getPath()};
    106106        }
    107         JFrame f = new TaggingPresetTester(args);
    108         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     107        if (args!=null) {
     108            Main.pref = new Preferences();
     109            System.out.println("Opening file "+args[0]);
     110            JFrame f = new TaggingPresetTester(args);
     111            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     112            f.setVisible(true);
     113        }
    109114    }
    110115
Note: See TracChangeset for help on using the changeset viewer.