Changeset 23895 in osm
- Timestamp:
- 2010-10-28T00:21:05+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed_fw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed_fw/build.xml
r23882 r23895 40 40 ** should not be necessary to change the following properties 41 41 --> 42 <property name="josm" location="../../core/dist/josm-custom.jar"/> 43 <property name="plugin.build.dir" value="build/"/> 44 <property name="plugin.src.dir" value="src/"/> 45 <property name="smed.dist.dir" value="dist/"/> 42 <property name="josm" location="../../core/dist/josm-custom.jar" /> 43 <property name="felix" location="core/dist/felix.jar"/> 44 <property name="plugin.build.dir" value="build/" /> 45 <property name="plugin.src.dir" value="src/" /> 46 <property name="smed_fw.dist.dir" value="dist/" /> 46 47 <!-- this is the directory where the plugin jar is copied to --> 47 <property name="plugin.dist.dir" value="../../dist/"/>48 <property name="smed_ core.dist.dir" value="core/dist/"/>49 <property name="ant.build.javac.target" value="1.5" />50 <property name="plugin.jar" value="${plugin.dist.dir}${ant.project.name}.jar"/>48 <property name="plugin.dist.dir" value="../../dist/" /> 49 <property name="smed_fw_core.dist.dir" value="core/dist/" /> 50 <property name="ant.build.javac.target" value="1.5" /> 51 <property name="plugin.jar" value="${plugin.dist.dir}${ant.project.name}.jar" /> 51 52 52 53 <!-- … … 56 57 --> 57 58 <target name="init"> 58 <mkdir dir="${plugin.build.dir}" />59 <mkdir dir="${smed_ core.dist.dir}"/>60 <mkdir dir="${smed .dist.dir}"/>59 <mkdir dir="${plugin.build.dir}" /> 60 <mkdir dir="${smed_fw_core.dist.dir}" /> 61 <mkdir dir="${smed_fw.dist.dir}" /> 61 62 </target> 62 63 … … 67 68 --> 68 69 <target name="compile" depends="init"> 69 <echo message="compiling sources for ${plugin.jar} ... " />70 <javac srcdir="src" classpath="${josm} " debug="true" destdir="${plugin.build.dir}">71 <compilerarg value="-Xlint:deprecation" />72 <compilerarg value="-Xlint:unchecked" />70 <echo message="compiling sources for ${plugin.jar} ... " /> 71 <javac srcdir="src" classpath="${josm}:${felix}" debug="true" destdir="${plugin.build.dir}"> 72 <compilerarg value="-Xlint:deprecation" /> 73 <compilerarg value="-Xlint:unchecked" /> 73 74 </javac> 74 75 </target> … … 80 81 --> 81 82 <target name="dist" depends="compile, revision"> 82 <echo message="creating ${ant.project.name}.jar ... "/> 83 84 <copy todir="${plugin.build.dir}/images"> 85 <fileset dir="${plugin.src.dir}/images"/> 86 </copy> 83 <echo message="creating ${ant.project.name}.jar ... " /> 87 84 88 85 <copy todir="${plugin.build.dir}/images"> 89 <fileset dir="images"/> 90 </copy> 91 92 <copy todir="${plugin.build.dir}/smed/msg"> 93 <fileset dir="${plugin.src.dir}/smed/msg"/> 94 </copy> 95 86 <fileset dir="${plugin.src.dir}/images" /> 87 </copy> 88 89 <copy todir="${plugin.build.dir}/images"> 90 <fileset dir="images" /> 91 </copy> 92 93 <copy todir="${plugin.build.dir}/smed_fw/msg"> 94 <fileset dir="${plugin.src.dir}/smed_fw/msg" /> 95 </copy> 96 96 97 <copy todir="${plugin.build.dir}"> 97 <fileset dir="${smed .dist.dir}"/>98 </copy> 99 98 <fileset dir="${smed_fw.dist.dir}" /> 99 </copy> 100 100 101 <copy todir="${plugin.build.dir}"> 101 102 <fileset dir="."> 102 103 <include name="*.txt" /> 103 104 </fileset> 104 105 </copy> … … 113 114 --> 114 115 <manifest> 115 <attribute name="Author" value="Werner, Malcolm" />116 <attribute name="Plugin-Class" value="smed .Smed"/>117 <attribute name="Plugin-Date" value="${version.entry.commit.date}" />118 <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap" />119 <attribute name="Plugin-Icon" value="images/Smed.png" />120 <attribute name="Plugin-Link" value="http://openseamap.org/" />121 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />116 <attribute name="Author" value="Werner, Malcolm" /> 117 <attribute name="Plugin-Class" value="smed_fw.SmedFW" /> 118 <attribute name="Plugin-Date" value="${version.entry.commit.date}" /> 119 <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap" /> 120 <attribute name="Plugin-Icon" value="images/Smed.png" /> 121 <attribute name="Plugin-Link" value="http://openseamap.org/" /> 122 <attribute name="Plugin-Mainversion" value="${plugin.main.version}" /> 122 123 <!-- 123 124 <attribute name="Plugin-Version" value="23456"/> 124 125 --> 125 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />126 126 <attribute name="Plugin-Version" value="${version.entry.commit.revision}" /> 127 127 128 </manifest> 128 129 </jar> 129 130 130 131 <!-- install interface --> 131 <copy file="${plugin.jar}" todir="${smed_ core.dist.dir}"/>132 </target> 133 132 <copy file="${plugin.jar}" todir="${smed_fw_core.dist.dir}" /> 133 </target> 134 134 135 <!-- 135 136 ********************************************************** … … 142 143 143 144 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false"> 144 <env key="LANG" value="C" />145 <arg value="info" />146 <arg value="--xml" />147 <arg value="." />148 </exec> 149 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />150 <delete file="REVISION" />151 </target> 152 153 145 <env key="LANG" value="C" /> 146 <arg value="info" /> 147 <arg value="--xml" /> 148 <arg value="." /> 149 </exec> 150 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" /> 151 <delete file="REVISION" /> 152 </target> 153 154 154 155 <!-- 155 156 ********************************************************** … … 158 159 --> 159 160 <target name="clean"> 160 <delete dir="${plugin.build.dir}" />161 <delete file="${plugin.jar}" />161 <delete dir="${plugin.build.dir}" /> 162 <delete file="${plugin.jar}" /> 162 163 </target> 163 164 … … 168 169 --> 169 170 <target name="install" depends="dist"> 170 <property environment="env" />171 <property environment="env" /> 171 172 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins"> 172 173 <and> 173 <os family="windows" />174 <os family="windows" /> 174 175 </and> 175 176 </condition> 176 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />177 </target> 178 177 <copy file="${plugin.jar}" todir="${josm.plugins.dir}" /> 178 </target> 179 179 180 <!-- 180 181 ** commits the source tree for this plugin … … 183 184 <echo>Commiting the plugin source with message '${commit.message}' ...</echo> 184 185 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 185 <env key="LANG" value="C" />186 <arg value="commit" />187 <arg value="-m '${commit.message}'" />188 <arg value="." />186 <env key="LANG" value="C" /> 187 <arg value="commit" /> 188 <arg value="-m '${commit.message}'" /> 189 <arg value="." /> 189 190 </exec> 190 191 </target> … … 196 197 <echo>Updating plugin source ...</echo> 197 198 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 198 <env key="LANG" value="C" />199 <arg value="up" />200 <arg value="." />199 <env key="LANG" value="C" /> 200 <arg value="up" /> 201 <arg value="." /> 201 202 </exec> 202 203 <echo>Updating ${plugin.jar} ...</echo> 203 204 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 204 <env key="LANG" value="C" />205 <arg value="up" />206 <arg value="../dist/${plugin.jar}" />205 <env key="LANG" value="C" /> 206 <arg value="up" /> 207 <arg value="../dist/${plugin.jar}" /> 207 208 </exec> 208 209 </target> -
applications/editors/josm/plugins/smed_fw/src/smed_fw/SmedFW.java
r23882 r23895 1 1 package smed_fw; 2 2 3 import java.util.ArrayList; 4 import java.util.HashMap; 5 import java.util.List; 6 import java.util.Map; 7 8 import org.apache.felix.framework.Felix; 9 import org.apache.felix.framework.util.FelixConstants; 3 10 import org.openstreetmap.josm.plugins.Plugin; 4 11 import org.openstreetmap.josm.plugins.PluginInformation; 12 import org.osgi.framework.Bundle; 13 import org.osgi.framework.BundleActivator; 14 import org.osgi.framework.BundleContext; 15 import org.osgi.framework.BundleException; 5 16 6 public class SmedFW extends Plugin {17 public class SmedFW extends Plugin implements BundleActivator{ 7 18 19 private BundleContext context; 20 private Felix felix; 21 8 22 public SmedFW(PluginInformation info) { 9 23 super(info); 10 24 25 init(); 11 26 System.out.println("SmedFW (OSGi-Implementation) noch nicht weiter programmiert"); 12 27 } 13 28 29 private void init() { 30 Map config = new HashMap(); 31 List list = new ArrayList(); 32 33 list.add(this); 34 config.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); 35 36 // Now create an instance of the framework with 37 // our configurations properties 38 felix = new Felix(config); 39 40 // now start Felix instance 41 try { 42 felix.start(); 43 } catch (BundleException e) { 44 System.err.println("Could not generate framework: " + e); 45 e.printStackTrace(); 46 } 47 } 48 49 @Override 50 public void start(BundleContext context) throws Exception { 51 this.context = context; 52 } 53 54 @Override 55 public void stop(BundleContext context) throws Exception { 56 context = null; 57 } 58 59 public Bundle[] getBundles() { 60 if(context != null) return context.getBundles(); 61 62 return null; 63 } 64 14 65 }
Note:
See TracChangeset
for help on using the changeset viewer.