Changeset 35012 in osm for applications/editors/josm/plugins/dataimport
- Timestamp:
- 2019-05-28T01:20:32+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/dataimport
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/dataimport/.classpath
r34575 r35012 5 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 6 6 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 7 <classpathentry combineaccessrules="false" kind="src" path="/JOSM-jaxb"/> 7 8 <classpathentry kind="output" path="bin"/> 8 9 </classpath> -
applications/editors/josm/plugins/dataimport/src/org/openstreetmap/josm/plugins/dataimport/DataImportPlugin.java
r34475 r35012 3 3 4 4 import java.io.IOException; 5 6 import javax.xml.bind.JAXBException; 5 7 6 8 import org.openstreetmap.josm.actions.ExtensionFileFilter; … … 19 21 * @param info plugin information 20 22 * @throws IOException in case of I/O error 23 * @throws JAXBException if JAXB cannot be initialized 21 24 */ 22 public DataImportPlugin(PluginInformation info) throws IOException { 25 public DataImportPlugin(PluginInformation info) throws IOException, JAXBException { 23 26 super(info); 24 27 -
applications/editors/josm/plugins/dataimport/src/org/openstreetmap/josm/plugins/dataimport/io/Tcx.java
r34749 r35012 13 13 import javax.xml.bind.JAXBElement; 14 14 import javax.xml.bind.JAXBException; 15 import javax.xml.bind.Unmarshaller;16 15 import javax.xml.datatype.XMLGregorianCalendar; 17 16 … … 35 34 import org.openstreetmap.josm.spi.preferences.Config; 36 35 37 38 36 /** 39 * TCX Reader. This class is based on code gen arated by the Java Architecture37 * TCX Reader. This class is based on code generated by the Java Architecture 40 38 * for XML Binding (JAXB). For this class to work you will need the API und IMPL 41 39 * Jars from the RI. JAXB can be downloaded at <a … … 51 49 * {@code xjc.bat -p org.openstreetmap.josm.io.tcx TrainingCenterDatabasev2.xsd -d <path to the src folder of JOSM>} 52 50 * <p> 53 * Note: if you get an exception that JAXB 2.1 is not supported on your system, you will have to add the jaxb-api.jar54 * to the endorsed directory (create it if necessary) of your JRE. Usually it is something like this:55 * {@code \<program files>\Java\jre<java version>\lib\endorsed}56 51 * 57 52 * @author adrian <as@nitegate.de> … … 63 58 64 59 private GpxData gpxData; 60 private final JAXBContext jc; 65 61 66 public Tcx() { 62 public Tcx() throws JAXBException { 67 63 super(new ExtensionFileFilter("tcx", "tcx", tr("TCX Files (*.tcx)"))); 64 // JAXB must be initialized at plugin construction to get access to JAXB plugin from JOSM plugin classloader 65 jc = JAXBContext.newInstance(TrainingCenterDatabaseT.class); 68 66 } 69 67 … … 84 82 } 85 83 86 /** 87 * 88 */ 89 @SuppressWarnings("unchecked") private void parseFile(File tcxFile) { 84 @SuppressWarnings("unchecked") 85 private void parseFile(File tcxFile) { 90 86 try { 91 JAXBContext jc = JAXBContext 92 .newInstance(TrainingCenterDatabaseT.class); 93 Unmarshaller unmarshaller = jc.createUnmarshaller(); 94 JAXBElement<TrainingCenterDatabaseT> element = (JAXBElement<TrainingCenterDatabaseT>) unmarshaller 95 .unmarshal(tcxFile); 96 97 TrainingCenterDatabaseT tcd = element.getValue(); 87 TrainingCenterDatabaseT tcd = ((JAXBElement<TrainingCenterDatabaseT>) 88 jc.createUnmarshaller().unmarshal(tcxFile)).getValue(); 98 89 99 90 gpxData = new GpxData();
Note:
See TracChangeset
for help on using the changeset viewer.