Changeset 13332 in osm


Ignore:
Timestamp:
2009-01-23T22:36:04+01:00 (16 years ago)
Author:
stoecker
Message:

fixes for new plugin handling

Location:
applications/editors/josm/plugins
Files:
7 edited

Legend:

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

    r13315 r13332  
    2121        <ant antfile="build.xml" target="dist" dir="osmarender"/>
    2222        <ant antfile="build.xml" target="dist" dir="plastic_laf"/>
    23         <ant antfile="build.xml" target="dist" dir="pluginmanager"/>
    2423        <ant antfile="build.xml" target="dist" dir="remotecontrol"/>
    2524        <ant antfile="build.xml" target="dist" dir="slippymap"/>
     
    3736        <ant antfile="build.xml" target="dist" dir="grid"/>
    3837        <ant antfile="build.xml" target="dist" dir="navigator"/>
     38        <ant antfile="build.xml" target="dist" dir="pluginmanager"/>
    3939    </target>
    4040    <target name="clean">
  • applications/editors/josm/plugins/surveyor/build.xml

    r12780 r13332  
    11<project name="surveyor" default="dist" basedir=".">
    2 <!-- josm "user home" directory depends on the platform used (windows has a different place than unix/linux) -->
    3     <property environment="env"/>
    4     <condition property="josm.home.dir" value="${env.APPDATA}/JOSM" else="${user.home}/.josm">
    5         <and>
    6             <os family="windows"/>
    7         </and>
    8     </condition>
    9 <!-- compilation properties -->
    10     <property name="josm.build.dir"   value="../../core"/>
    11     <property name="josm.plugins.dir" value="${josm.home.dir}/plugins"/>
    12     <property name="josm"         location="../../core/dist/josm-custom.jar" />
    13     <property name="plugin.build.dir" value="build"/>
    14     <property name="plugin.dist.dir"  value="../../dist"/>
    15     <property name="plugin.name"      value="${ant.project.name}"/>
    16     <property name="plugin.jar"       value="../../dist/${plugin.name}.jar"/>
    17     <property name="livegpsplugin.jar" value="../../dist/livegps.jar"/>
    18     <property name="plugin.description" value="Allow adding markers/nodes on current gps positions."/>
    19     <property name="plugin.stage" value="60"/>
    20     <property name="plugin.class" value="at.dallermassl.josm.plugin.surveyor.SurveyorPlugin"/>
     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"/>
    217    <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" destdir="${plugin.build.dir}" debug="true">
     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>
    2222    <target name="dist" depends="compile">
    2323        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     
    2929        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    3030        <delete file="REVISION"/>
    31 <!-- images -->
    3231        <copy todir="${plugin.build.dir}/">
    3332            <fileset dir="resources">
     
    3635            </fileset>
    3736        </copy>
    38 <!-- create jar file -->
     37        <copy todir="${plugin.build.dir}/images" >
     38            <fileset dir="images" />
     39        </copy>
    3940        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    4041            <manifest>
    41                 <attribute name="Plugin-Class" value="${plugin.class}" />
    42                 <attribute name="Plugin-Description" value="${plugin.description}" />
    43                 <attribute name="Plugin-Stage" value="${plugin.stage}" />
     42                <attribute name="Plugin-Class" value="at.dallermassl.josm.plugin.surveyor.SurveyorPlugin" />
     43                <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions." />
     44                <attribute name="Plugin-Stage" value="60" />
    4445                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    4546                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    46                 <attribute name="Plugin-Mainversion" value="1180" />
     47                <attribute name="Plugin-Mainversion" value="1326" />
     48                <attribute name="Plugin-Requires" value="livegps" />
    4749            </manifest>
    4850        </jar>
    49     </target>
    50     <target name="compile" depends="init">
    51         <echo message="creating ${plugin.jar}"/>
    52         <mkdir dir="${plugin.build.dir}"/>
    53         <copy todir="build/images" >
    54             <fileset dir="images" />
    55         </copy>
    56         <javac srcdir="src" destdir="${plugin.build.dir}" debug="true" source="1.5" target="1.5">
    57             <compilerarg value="-Xlint:deprecation"/>
    58             <compilerarg value="-Xlint:unchecked"/>
    59             <classpath>
    60                 <pathelement path="${josm.build.dir}/build"/>
    61                 <fileset dir="${josm.build.dir}/lib">
    62                     <include name="**/*.jar"/>
    63                 </fileset>
    64                 <pathelement location="${livegpsplugin.jar}"/>
    65             </classpath>
    66         </javac>
    67     </target>
    68     <target name="install" depends="dist">
    69         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    70     </target>
    71     <target name="init">
    72         <echo>java version: ${java.version}</echo>
    7351    </target>
    7452    <target name="clean">
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java

    r12778 r13332  
    2222import org.openstreetmap.josm.Main;
    2323import org.openstreetmap.josm.gui.MainMenu;
    24 import org.openstreetmap.josm.plugins.PluginProxy;
     24import org.openstreetmap.josm.plugins.PluginHandler;
    2525
    2626/**
     
    4444        super();
    4545
    46         // try to determine if the livegps plugin was already loaded:
    47 //        PluginInformation pluginInfo = PluginInformation.getLoaded("livegps");
    48 //        if (pluginInfo == null) {
    49 //          JOptionPane.showMessageDialog(null, "Please install wmsplugin");
    50 //          return;
    51 //        }
    52 //        if (!pluginInfo.version.equals("2")) {
    53 //          JOptionPane.showMessageDialog(null, "livegps Version 2 required.");
    54 //          return;
    55 //        }
    56         try {
    57             Class.forName("livegps.LiveGpsPlugin");
    58         } catch(ClassNotFoundException cnfe) {
    59             String message =
    60                 tr("SurveyorPlugin depends on LiveGpsPlugin!") + "\n" +
    61                 tr("LiveGpsPlugin not found, please install and activate.") + "\n" +
    62                 tr("SurveyorPlugin is disabled for the moment");
    63             JOptionPane.showMessageDialog(Main.parent, message, tr("SurveyorPlugin"), JOptionPane.ERROR_MESSAGE);
    64             return;
    65         }
    66 
    67 
    68         LiveGpsPlugin gpsPlugin = null;
    69         Iterator<PluginProxy> proxyIter = Main.plugins.iterator();
    70         while(proxyIter.hasNext()) {
    71             Object plugin = proxyIter.next().plugin;
    72             if(plugin instanceof LiveGpsPlugin) {
    73                 gpsPlugin = (LiveGpsPlugin) plugin;
    74                 break;
    75             }
    76         }
     46        LiveGpsPlugin gpsPlugin = (LiveGpsPlugin) PluginHandler.getPlugin("livegps");
    7747        if(gpsPlugin == null)
    7848            throw new IllegalStateException(tr("SurveyorPlugin needs LiveGpsPlugin, but could not find it!"));
  • applications/editors/josm/plugins/validator/build.xml

    r12780 r13332  
    11<project name="validator" default="dist" basedir=".">
    2 <!-- compilation properties -->
    3     <property name="josm.build.dir"   value="../../core"/>
    4     <property name="josm.home.dir"    value="${user.home}/.josm"/>
    5     <property name="plugin.build.dir" value="build"/>
    6     <property name="plugin.dist.dir"  value="../../dist"/>
    7     <property name="plugin.name"      value="${ant.project.name}"/>
    8     <property name="plugin.jar"       value="../../dist/${plugin.name}.jar"/>
    9 <!-- point to your JOSM directory -->
    10     <property name="josm" location="../../core/dist/josm-custom.jar" />
     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"/>
    116    <property name="ant.build.javac.target" value="1.5"/>
    127    <target name="init">
     
    1510    <target name="compile" depends="init">
    1611        <echo message="creating ${plugin.jar}"/>
    17         <javac srcdir="src" classpath="${josm}" destdir="build" debug="true" encoding="UTF-8">
     12        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" encoding="UTF-8">
     13            <compilerarg value="-Xlint:deprecation"/>
     14            <compilerarg value="-Xlint:unchecked"/>
    1815            <include name="**/*.java" />
    1916        </javac>
    2017    </target>
    21     <target name="dist" depends="clean, compile">
    22         <copy todir="build/images">
     18    <target name="dist" depends="compile">
     19        <copy todir="${plugin.build.dir}/images">
    2320            <fileset dir="images"/>
    2421        </copy>
     
    3128        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    3229        <delete file="REVISION"/>
    33         <jar destfile="${plugin.jar}" basedir="build">
     30        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    3431            <manifest>
    3532                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.validator.OSMValidatorPlugin"/>
     
    4239        </jar>
    4340    </target>
    44 <!-- clean target -->
    4541    <target name="clean">
    4642        <delete dir="${plugin.build.dir}" />
    4743        <delete file="${plugin.jar}" />
    4844    </target>
    49     <target name="install" depends="dist">
    50         <copy file="${plugin.jar}" todir="${user.home}/.josm/plugins"/>
    51     </target>
    52     <target name="test" depends="install">
    53         <java jar="${josm}" fork="true"></java>
    54     </target>
    5545</project>
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java

    r12991 r13332  
    1616import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    1717import org.openstreetmap.josm.plugins.validator.util.Util;
    18 import org.openstreetmap.josm.plugins.validator.util.Util.Version;
    1918import org.openstreetmap.josm.tools.GBC;
    2019
     
    8988        testPane.setBorder(null);
    9089
    91         Version ver = Util.getVersion();
    9290        String description = tr("An OSM data validator that checks for common errors made by users and editor programs.");
    93         if( ver != null )
    94             description += "<br>" + tr("Version {0} - Last change at {1}", ver.revision, ver.time);
    9591        JPanel tab = gui.createPreferenceTab("validator", tr("Data validator"), description);
    9692        tab.add(testPane, GBC.eol().fill(GBC.BOTH));
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java

    r12778 r13332  
    3030    {
    3131        return Main.pref.getPreferencesDir() + "plugins/validator/";
    32     }
    33 
    34     /**
    35      * Returns the version
    36      * @return The version of the application
    37      */
    38     public static Version getVersion()
    39     {
    40         PluginInformation info = PluginInformation.getLoaded("validator");
    41         if( info == null )
    42             return null;
    43 
    44         return new Version(info.version, info.attr.get("Plugin-Date"));
    45     }
    46 
    47     /**
    48      * Utility class for displaying versions
    49      *
    50      * @author frsantos
    51      */
    52     public static class Version
    53     {
    54         /** The revision */
    55         public String revision;
    56         /** The build time */
    57         public String time;
    58 
    59         /**
    60          * Constructor
    61          * @param revision
    62          * @param time
    63          */
    64         public Version(String revision, String time)
    65         {
    66             this.revision = revision;
    67             this.time = time;
    68         }
    6932    }
    7033
  • applications/editors/josm/plugins/wmsplugin/build.xml

    r12910 r13332  
    1010    <target name="compile" depends="init">
    1111        <echo message="creating ${plugin.jar}"/>
    12         <javac srcdir="src" classpath="${josm}" debug="true" destdir="build">
     12        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
    1313            <compilerarg value="-Xlint:deprecation"/>
    1414            <compilerarg value="-Xlint:unchecked"/>
Note: See TracChangeset for help on using the changeset viewer.