Changeset 28288 in osm


Ignore:
Timestamp:
2012-04-14T12:14:57+02:00 (12 years ago)
Author:
stoecker
Message:

fix Java7 code, cleanup build file

Location:
applications/editors/josm/plugins/routing
Files:
3 edited

Legend:

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

    r27952 r28288  
    2626-->
    2727<project name="routing" default="dist" basedir=".">
     28
     29    <!-- enter the SVN commit message -->
    2830    <property name="commit.message" value="added one-way support in roundabouts"/>
     31    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    2932    <property name="plugin.main.version" value="4980"/>
    30     <!-- Define some properties -->
    31     <property name="josm" location="../../core/dist/josm-custom.jar"/>
    32     <property name="plugin.dist.dir" value="../../dist"/>
    33     <property name="plugin.build.dir" value="build"/>
    34     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    35     <property name="libdir" location="lib"/>
    36     <property name="jgrapht" value="${libdir}/jgrapht-jdk1.5.jar"/>
    37     <property name="log4j" value="${libdir}/log4j-1.2.15.jar"/>
    38     <property name="ant.build.javac.target" value="1.5"/>
    39     <!-- Some initializations for several other targets -->
    40     <target name="init">
    41         <mkdir dir="${plugin.dist.dir}"/>
    42         <mkdir dir="${plugin.build.dir}"/>
    43     </target>
    44     <!-- Compile sources -->
    45     <target name="compile" depends="init" description="Compile sources">
    46         <echo message="creating ${plugin.jar}"/>
    47         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
     33
     34    <!--
     35    **********************************************************
     36    ** include targets that all plugins have in common
     37    **********************************************************
     38    -->
     39    <import file="../build-common.xml"/>
     40
     41    <!-- classpath -->
     42    <path id="classpath">
     43        <fileset dir="${plugin.lib.dir}" includes="**/*.jar"/>
     44        <pathelement path="${josm}"/>
     45    </path>
     46    <!--
     47    **********************************************************
     48    ** compile - complies the source tree
     49    ** Overrides the target from build-common.xml
     50    **********************************************************
     51    -->
     52    <target name="compile" depends="init">
     53        <echo message="compiling sources for ${plugin.jar} ..."/>
     54        <javac srcdir="src" classpathref="classpath" debug="true" destdir="${plugin.build.dir}">
    4855            <compilerarg value="-Xlint:deprecation"/>
    4956            <compilerarg value="-Xlint:unchecked"/>
    50             <classpath>
    51                 <pathelement location="${josm}"/>
    52                 <pathelement location="${jgrapht}"/>
    53                 <pathelement location="${log4j}"/>
    54             </classpath>
    5557        </javac>
    5658    </target>
     59
    5760    <!-- Generate distribution -->
    5861    <target name="dist" depends="compile,revision" description="Generate distribution">
    59         <unjar dest="${plugin.build.dir}" src="${jgrapht}"/>
    60         <unjar dest="${plugin.build.dir}" src="${log4j}"/>
    61         <copy todir="${plugin.build.dir}/">
    62             <fileset dir="resources">
    63                 <include name="*.xml"/>
    64             </fileset>
    65         </copy>
    6662        <copy todir="${plugin.build.dir}/images">
    6763            <fileset dir="images"/>
     
    7066            <fileset dir="data"/>
    7167        </copy>
     68        <copy todir="${plugin.build.dir}/">
     69            <fileset dir="resources">
     70                <include name="*.xml"/>
     71            </fileset>
     72        </copy>
    7273        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     74        <!--
     75        ************************************************
     76        ** configure these properties. Most of them will be copied to the plugins
     77        ** manifest file. Property values will also show up in the list available
     78        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
     79        **
     80        ************************************************
     81        -->
    7382            <manifest>
    7483                <attribute name="Author" value="Jose Vidal &lt;vidalfree@gmail.com&gt;, Juangui Jordán &lt;juangui@gmail.com&gt;, Hassan S &lt;hassan.sabirin@gmail.com&gt;"/>
     
    8291                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    8392            </manifest>
     93            <zipfileset src="${plugin.lib.dir}/jgrapht-jdk1.5.jar"/>
     94            <zipfileset src="${plugin.lib.dir}/log4j-1.2.15.jar"/>
    8495        </jar>
    8596    </target>
    86     <target name="revision">
    87         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    88             <env key="LANG" value="C"/>
    89             <arg value="info"/>
    90             <arg value="--xml"/>
    91             <arg value="."/>
    92         </exec>
    93         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    94         <delete file="REVISION"/>
    95     </target>
    96     <target name="clean">
    97         <delete dir="${plugin.build.dir}"/>
    98         <delete file="${plugin.jar}"/>
    99     </target>
    100     <target name="install" depends="dist">
    101         <property environment="env"/>
    102         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    103             <and>
    104                 <os family="windows"/>
    105             </and>
    106         </condition>
    107         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    108     </target>
    109     <!--
    110          ************************** Publishing the plugin ***********************************
    111         -->
    112     <!--
    113         ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    114         ** property ${coreversion.info.entry.revision}
    115         **
    116         -->
    117     <target name="core-info">
    118         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    119             <env key="LANG" value="C"/>
    120             <arg value="info"/>
    121             <arg value="--xml"/>
    122             <arg value="../../core"/>
    123         </exec>
    124         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    125         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    126         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    127         <delete file="core.info.xml"/>
    128     </target>
    129     <!--
    130         ** commits the source tree for this plugin
    131         -->
    132     <target name="commit-current">
    133         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    134         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    135             <env key="LANG" value="C"/>
    136             <arg value="commit"/>
    137             <arg value="-m '${commit.message}'"/>
    138             <arg value="."/>
    139         </exec>
    140     </target>
    141     <!--
    142         ** updates (svn up) the source tree for this plugin
    143         -->
    144     <target name="update-current">
    145         <echo>Updating plugin source ...</echo>
    146         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    147             <env key="LANG" value="C"/>
    148             <arg value="up"/>
    149             <arg value="."/>
    150         </exec>
    151         <echo>Updating ${plugin.jar} ...</echo>
    152         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    153             <env key="LANG" value="C"/>
    154             <arg value="up"/>
    155             <arg value="../dist/${plugin.jar}"/>
    156         </exec>
    157     </target>
    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     <!-- ** make sure svn is present as a command line tool ** -->
    180     <target name="ensure-svn-present">
    181         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    182             <env key="LANG" value="C"/>
    183             <arg value="--version"/>
    184         </exec>
    185         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    186             <!-- return code not set at all? Most likely svn isn't installed -->
    187             <condition>
    188                 <not>
    189                     <isset property="svn.exit.code"/>
    190                 </not>
    191             </condition>
    192         </fail>
    193         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    194             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    195             <condition>
    196                 <isfailure code="${svn.exit.code}"/>
    197             </condition>
    198         </fail>
    199     </target>
    200     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    201     </target>
    20297</project>
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java

    r28138 r28288  
    5252public class RoutingDialog extends ToggleDialog {
    5353
    54         private final DefaultListModel<String> model;
    55         private JList<String> jList = null;
     54        private final DefaultListModel model;
     55        private JList jList = null;
    5656        private JScrollPane jScrollPane = null;
    5757
     
    6464                super(tr("Routing"), "routing", tr("Open a list of routing nodes"),
    6565                                Shortcut.registerShortcut("subwindow:routing", tr("Toggle: {0}", tr("Routing")), KeyEvent.VK_R, Shortcut.ALT_CTRL_SHIFT), 150);
    66                 model = new DefaultListModel<String>();
     66                model = new DefaultListModel();
    6767                createLayout(getJScrollPane(), false, null);
    6868        }
     
    8888         * @return javax.swing.JList
    8989         */
    90         private JList<String> getJList() {
     90        private JList getJList() {
    9191                if (jList == null) {
    92                         jList = new JList<String>();
     92                        jList = new JList();
    9393                        jList.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    9494                        jList.setModel(model);
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.java

    r28138 r28288  
    110110                                JPanel p = new JPanel(new GridBagLayout());
    111111                                p.add(new JLabel(tr("Weight")), GBC.std().insets(0, 0, 5, 0));
    112                                 JComboBox<String> key = new JComboBox<String>();
     112                                JComboBox key = new JComboBox();
    113113                                for (OsmWayTypes pk : OsmWayTypes.values())
    114114                                        key.addItem(pk.getTag());
Note: See TracChangeset for help on using the changeset viewer.