# HG changeset patch # User Omair Majid # Date 1391701026 18000 # Node ID 146a0704ba68b559a6d268386c80f7ed6662f841 # Parent 13279d78dfe1ced464fd358c6963df83d430ac25 Include a schemaLocation attribute This will make eclipse automatically validate the thermostat-plugin.xml file whenever possible. diff -r 13279d78dfe1 -r 146a0704ba68 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/PluginModelReaderWriter.java --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/PluginModelReaderWriter.java Wed Jan 22 12:55:20 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/PluginModelReaderWriter.java Thu Feb 06 10:37:06 2014 -0500 @@ -70,6 +70,7 @@ JAXBContext context = JAXBContext.newInstance(Plugin.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, SchemaConstants.getSchemaLocation()); m.marshal(plugin, out); } catch (JAXBException e) { diff -r 13279d78dfe1 -r 146a0704ba68 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/SchemaConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/SchemaConstants.java Thu Feb 06 10:37:06 2014 -0500 @@ -0,0 +1,11 @@ +package com.redhat.thermostat.tools.eclipse.plugin.model; + +public class SchemaConstants { + + public static final String SCHEMA_NAMESPACE = "http://icedtea.classpath.org/thermostat/plugins/v1.0"; //$NON-NLS-1$ + public static final String SCHEMA_URL = "http://icedtea.classpath.org/thermostat/docs/1.0/thermostat-plugin.xsd"; //$NON-NLS-1$ + + public static String getSchemaLocation() { + return SCHEMA_NAMESPACE + " " + SCHEMA_URL; // //$NON-NLS-1$ + } +} diff -r 13279d78dfe1 -r 146a0704ba68 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/package-info.java --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/package-info.java Wed Jan 22 12:55:20 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/model/package-info.java Thu Feb 06 10:37:06 2014 -0500 @@ -3,6 +3,6 @@ * {@code thermostat-plugin.xml} file. */ @javax.xml.bind.annotation.XmlSchema( - namespace="http://icedtea.classpath.org/thermostat/plugins/v1.0", + namespace=SchemaConstants.SCHEMA_NAMESPACE, elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.redhat.thermostat.tools.eclipse.plugin.model; diff -r 13279d78dfe1 -r 146a0704ba68 com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java --- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java Wed Jan 22 12:55:20 2014 -0500 +++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/wizards/PluginXmlCreationWizard.java Thu Feb 06 10:37:06 2014 -0500 @@ -22,6 +22,7 @@ import com.redhat.thermostat.tools.eclipse.plugin.Activator; import com.redhat.thermostat.tools.eclipse.plugin.Messages; +import com.redhat.thermostat.tools.eclipse.plugin.model.SchemaConstants; public class PluginXmlCreationWizard extends Wizard implements INewWizard { @@ -112,9 +113,9 @@ private InputStream getInitialContentStream() { String contents = "\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ $NON-NLS-2$ + ""; //$NON-NLS-1$ return new ByteArrayInputStream(contents.getBytes());