Ignore:
Timestamp:
2010-01-13T15:17:42+01:00 (15 years ago)
Author:
guggis
Message:

'Changed the constructor signature of the plugin main class'

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

Legend:

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

    r18503 r19479  
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!--
     3** This is the build file for the surveyor plugin.
     4**
     5** Maintaining versions
     6** ====================
     7** see README.template
     8**
     9** Usage
     10** =====
     11** To build it run
     12**
     13**    > ant  dist
     14**
     15** To install the generated plugin locally (in you default plugin directory) run
     16**
     17**    > ant  install
     18**
     19** The generated plugin jar is not automatically available in JOSMs plugin configuration
     20** dialog. You have to check it in first.
     21**
     22** Use the ant target 'publish' to check in the plugin and make it available to other
     23** JOSM users:
     24**    set the properties commit.message and plugin.main.version
     25** and run
     26**    > ant  publish
     27**
     28**
     29-->
    130<project name="surveyor" default="dist" basedir=".">
    2     <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
    3     <property name="plugin.dist.dir"        value="../../dist"/>
    4     <property name="plugin.build.dir"       value="build"/>
    5     <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    6     <property name="livegpsplugin.jar"      value="${plugin.dist.dir}/livegps.jar"/>
    7     <property name="ant.build.javac.target" value="1.5"/>
    8     <target name="init">
    9         <mkdir dir="${plugin.build.dir}"/>
    10     </target>
    11     <target name="compile" depends="init">
    12         <echo message="creating ${plugin.jar}"/>
    13         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
    14             <compilerarg value="-Xlint:deprecation"/>
    15             <compilerarg value="-Xlint:unchecked"/>
    16             <classpath>
    17                 <pathelement location="${josm}"/>
    18                 <pathelement location="${livegpsplugin.jar}"/>
    19             </classpath>
    20         </javac>
    21     </target>
    22     <target name="dist" depends="compile,revision">
    23         <copy todir="${plugin.build.dir}/">
    24             <fileset dir="resources">
    25                 <include name="*.xml"/>
    26                 <include name="audio/*"/>
    27             </fileset>
    28         </copy>
    29         <copy todir="${plugin.build.dir}/images">
    30             <fileset dir="images"/>
    31         </copy>
    32         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    33             <manifest>
    34                 <attribute name="Author" value="Christof Dallermassl"/>
    35                 <attribute name="Plugin-Class" value="at.dallermassl.josm.plugin.surveyor.SurveyorPlugin"/>
    36                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    37                 <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions."/>
    38                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Surveyor"/>
    39                 <attribute name="Plugin-Mainversion" value="2401"/>
    40                 <attribute name="Plugin-Requires" value="livegps"/>
    41                 <attribute name="Plugin-Stage" value="60"/>
    42                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    43             </manifest>
    44         </jar>
    45     </target>
    46     <target name="revision">
    47         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    48             <env key="LANG" value="C"/>
    49             <arg value="info"/>
    50             <arg value="--xml"/>
    51             <arg value="."/>
    52         </exec>
    53         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    54         <delete file="REVISION"/>
    55     </target>
    56     <target name="clean">
    57         <delete dir="${plugin.build.dir}"/>
    58         <delete file="${plugin.jar}"/>
    59     </target>
    60     <target name="install" depends="dist">
    61         <property environment="env"/>
    62         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    63             <and>
    64                 <os family="windows"/>
    65             </and>
    66         </condition>
    67         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    68     </target>
     31
     32        <!-- enter the SVN commit message -->
     33        <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
     34        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     35        <property name="plugin.main.version" value="2830" />
     36
     37
     38        <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
     39        <property name="plugin.dist.dir"        value="../../dist"/>
     40        <property name="plugin.build.dir"       value="build"/>
     41        <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
     42        <property name="livegpsplugin.jar"      value="${plugin.dist.dir}/livegps.jar"/>
     43        <property name="ant.build.javac.target" value="1.5"/>
     44        <target name="init">
     45                <mkdir dir="${plugin.build.dir}"/>
     46        </target>
     47        <target name="compile" depends="init">
     48                <echo message="creating ${plugin.jar}"/>
     49                <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
     50                        <compilerarg value="-Xlint:deprecation"/>
     51                        <compilerarg value="-Xlint:unchecked"/>
     52                        <classpath>
     53                                <pathelement location="${josm}"/>
     54                                <pathelement location="${livegpsplugin.jar}"/>
     55                        </classpath>
     56                </javac>
     57        </target>
     58        <target name="dist" depends="compile,revision">
     59                <copy todir="${plugin.build.dir}/">
     60                        <fileset dir="resources">
     61                                <include name="*.xml"/>
     62                                <include name="audio/*"/>
     63                        </fileset>
     64                </copy>
     65                <copy todir="${plugin.build.dir}/images">
     66                        <fileset dir="images"/>
     67                </copy>
     68                <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     69                        <manifest>
     70                                <attribute name="Author" value="Christof Dallermassl"/>
     71                                <attribute name="Plugin-Class" value="at.dallermassl.josm.plugin.surveyor.SurveyorPlugin"/>
     72                                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     73                                <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions."/>
     74                                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Surveyor"/>
     75                                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
     76                                <attribute name="Plugin-Requires" value="livegps"/>
     77                                <attribute name="Plugin-Stage" value="60"/>
     78                                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     79                        </manifest>
     80                </jar>
     81        </target>
     82        <target name="revision">
     83                <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     84                        <env key="LANG" value="C"/>
     85                        <arg value="info"/>
     86                        <arg value="--xml"/>
     87                        <arg value="."/>
     88                </exec>
     89                <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
     90                <delete file="REVISION"/>
     91        </target>
     92        <target name="clean">
     93                <delete dir="${plugin.build.dir}"/>
     94                <delete file="${plugin.jar}"/>
     95        </target>
     96        <target name="install" depends="dist">
     97                <property environment="env"/>
     98                <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
     99                        <and>
     100                                <os family="windows"/>
     101                        </and>
     102                </condition>
     103                <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     104        </target>
     105
     106        <!--
     107                ************************** Publishing the plugin ***********************************
     108                -->
     109        <!--
     110                        ** extracts the JOSM release for the JOSM version in ../core and saves it in the
     111                        ** property ${coreversion.info.entry.revision}
     112                        **
     113                        -->
     114        <target name="core-info">
     115                <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
     116                        <env key="LANG" value="C"/>
     117                        <arg value="info"/>
     118                        <arg value="--xml"/>
     119                        <arg value="../../core"/>
     120                </exec>
     121                <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     122                <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
     123                <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     124                <delete file="core.info.xml" />
     125        </target>
     126
     127        <!--
     128                        ** commits the source tree for this plugin
     129                        -->
     130        <target name="commit-current">
     131                <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
     132                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     133                        <env key="LANG" value="C"/>
     134                        <arg value="commit"/>
     135                        <arg value="-m '${commit.message}'"/>
     136                        <arg value="."/>
     137                </exec>
     138        </target>
     139
     140        <!--
     141                        ** updates (svn up) the source tree for this plugin
     142                        -->
     143        <target name="update-current">
     144                <echo>Updating plugin source ...</echo>
     145                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     146                        <env key="LANG" value="C"/>
     147                        <arg value="up"/>
     148                        <arg value="."/>
     149                </exec>
     150                <echo>Updating ${plugin.jar} ...</echo>
     151                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     152                        <env key="LANG" value="C"/>
     153                        <arg value="up"/>
     154                        <arg value="../dist/${plugin.jar}"/>
     155                </exec>
     156        </target>
     157
     158        <!--
     159                        ** commits the plugin.jar
     160                        -->
     161        <target name="commit-dist">
     162                <echo>
     163                ***** Properties of published ${plugin.jar} *****
     164                Commit message    : '${commit.message}'                                 
     165                Plugin-Mainversion: ${plugin.main.version}
     166                JOSM build version: ${coreversion.info.entry.revision}
     167                Plugin-Version    : ${version.entry.commit.revision}
     168                ***** / Properties of published ${plugin.jar} *****                                     
     169                                                       
     170                Now commiting ${plugin.jar} ...
     171                </echo>
     172                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     173                        <env key="LANG" value="C"/>
     174                        <arg value="-m '${commit.message}'"/>
     175                        <arg value="commit"/>
     176                        <arg value="${plugin.jar}"/>
     177                </exec>
     178        </target>
     179
     180        <!-- ** make sure svn is present as a command line tool ** -->
     181        <target name="ensure-svn-present">
     182                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
     183                        <env key="LANG" value="C" />
     184                        <arg value="--version" />
     185                </exec>
     186                <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
     187                        <!-- return code not set at all? Most likely svn isn't installed -->
     188                        <condition>
     189                                <not>
     190                                        <isset property="svn.exit.code" />
     191                                </not>
     192                        </condition>
     193                </fail>
     194                <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
     195                        <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
     196                        <condition>
     197                                <isfailure code="${svn.exit.code}" />
     198                        </condition>
     199                </fail>
     200        </target>
     201
     202        <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
     203        </target>
    69204</project>
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java

    r14120 r19479  
    77import static org.openstreetmap.josm.tools.I18n.tr;
    88
    9 import java.util.Iterator;
    10 
    11 import javax.swing.AbstractAction;
    129import javax.swing.JCheckBoxMenuItem;
    1310import javax.swing.JFrame;
    1411import javax.swing.JMenu;
    15 import javax.swing.JOptionPane;
    16 import javax.swing.KeyStroke;
    17 import java.awt.event.KeyEvent;
    1812
    1913import livegps.LiveGpsPlugin;
    2014
    21 import org.openstreetmap.josm.Main;
    2215import org.openstreetmap.josm.gui.MainMenu;
    2316import org.openstreetmap.josm.plugins.PluginHandler;
     17import org.openstreetmap.josm.plugins.PluginInformation;
    2418
    2519/**
     
    4034     *
    4135     */
    42     public SurveyorPlugin() {
    43         super();
     36    public SurveyorPlugin(PluginInformation info) {
    4437
    4538        LiveGpsPlugin gpsPlugin = (LiveGpsPlugin) PluginHandler.getPlugin("livegps");
Note: See TracChangeset for help on using the changeset viewer.