aboutsummaryrefslogtreecommitdiffstats
path: root/tools/eclipse
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-06 14:57:48 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-06 14:57:48 +0000
commita072b394a2ea71c424cd80c2541492724448b6d2 (patch)
tree00ddc173a2b8ee440381b42eec56f182f7718225 /tools/eclipse
parent52dc5338772fa93dc6ad1c4bd0b8245a9db59405 (diff)
downloadChibiOS-a072b394a2ea71c424cd80c2541492724448b6d2.tar.gz
ChibiOS-a072b394a2ea71c424cd80c2541492724448b6d2.tar.bz2
ChibiOS-a072b394a2ea71c424cd80c2541492724448b6d2.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4537 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'tools/eclipse')
-rw-r--r--tools/eclipse/config_wizard/META-INF/MANIFEST.MF2
-rw-r--r--tools/eclipse/config_wizard/build.properties3
-rw-r--r--tools/eclipse/config_wizard/plugin.xml19
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd37
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd102
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd36
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml4
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml4
-rw-r--r--tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml4
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java62
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java11
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java50
-rw-r--r--tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java94
13 files changed, 175 insertions, 253 deletions
diff --git a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
index fb3d848cd..6b14e432e 100644
--- a/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
+++ b/tools/eclipse/config_wizard/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ChibiOS-RT_Configuration_Support
Bundle-SymbolicName: org.chibios.tools.eclipse.config;singleton:=true
-Bundle-Version: 1.0.4
+Bundle-Version: 1.1.0
Bundle-Activator: config_wizard.Activator
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
diff --git a/tools/eclipse/config_wizard/build.properties b/tools/eclipse/config_wizard/build.properties
index 05b402447..81715159f 100644
--- a/tools/eclipse/config_wizard/build.properties
+++ b/tools/eclipse/config_wizard/build.properties
@@ -32,4 +32,5 @@ bin.includes = plugin.xml,\
resources/gencfg/processors/boards/stm32l1xx/templates/board.h.ftl,\
resources/gencfg/processors/boards/stm32l1xx/templates/board.mk.ftl,\
resources/gencfg/schema/boards/stm32l1xx_board.xsd,\
- resources/gencfg/xml/stm32l1board.xml
+ resources/gencfg/xml/stm32l1board.xml,\
+ resources/gencfg/schema/common/config_settings.xsd
diff --git a/tools/eclipse/config_wizard/plugin.xml b/tools/eclipse/config_wizard/plugin.xml
index e2163c8fb..84ca332e5 100644
--- a/tools/eclipse/config_wizard/plugin.xml
+++ b/tools/eclipse/config_wizard/plugin.xml
@@ -17,14 +17,29 @@
</wizard>
</extension>
- <!-- Registers the file extension .chxml as an XML type. -->
+ <!-- Registers the file extension .chcfg as an XML type. -->
<extension point="org.eclipse.core.contenttype.contentTypes">
<file-association
content-type="org.eclipse.core.runtime.xml"
- file-extensions="chxml">
+ file-extensions="chcfg">
</file-association>
</extension>
+ <!-- XML catalog extensions. -->
+ <extension point="org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <uri
+ name="http://www.chibios.org/xml/schema/boards/stm32f0xx_board.xsd"
+ uri="resources/gencfg/schema/boards/stm32f0xx_board.xsd" />
+ <uri
+ name="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd"
+ uri="resources/gencfg/schema/boards/stm32f4xx_board.xsd" />
+ <uri
+ name="http://www.chibios.org/xml/schema/boards/stm32l1xx_board.xsd"
+ uri="resources/gencfg/schema/boards/stm32l1xx_board.xsd" />
+ </catalogContribution>
+ </extension>
+
<!-- Commands. -->
<extension
point="org.eclipse.ui.commands">
diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd
index c4c953240..a1c696339 100644
--- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd
+++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/abstract_board.xsd
@@ -3,10 +3,12 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="../common/doc.xsd" />
+ <xs:include schemaLocation="../common/config_settings.xsd" />
<xs:complexType name="AbstractBoardType" abstract="true">
<xs:sequence>
- <xs:element name="board_name" maxOccurs="1" minOccurs="1">
+ <xs:element name="configuration_settings" type="ConfigurationSettingsType" maxOccurs="1" minOccurs="1"></xs:element>
+ <xs:element name="board_name" maxOccurs="1" minOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="collapse"></xs:whiteSpace>
@@ -21,25 +23,36 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="board_functions" maxOccurs="1" minOccurs="1">
+ <xs:element name="board_functions" maxOccurs="1"
+ minOccurs="1">
<xs:complexType>
<xs:sequence>
- <xs:element name="__early_init" type="xs:string" maxOccurs="1" minOccurs="0"></xs:element>
- <xs:element name="boardInit" type="xs:string" maxOccurs="1" minOccurs="0">
- </xs:element>
- <xs:element name="sdc_lld_is_card_inserted" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="__early_init" type="xs:string"
+ maxOccurs="1" minOccurs="0">
</xs:element>
- <xs:element name="sdc_lld_is_write_protected" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="boardInit" type="xs:string"
+ maxOccurs="1" minOccurs="0">
</xs:element>
- <xs:element name="mmc_lld_is_card_inserted" type="xs:string" maxOccurs="1" minOccurs="0">
+
+ <xs:element name="sdc_lld_is_card_inserted"
+ type="xs:string" maxOccurs="1" minOccurs="0">
+ </xs:element>
+ <xs:element name="sdc_lld_is_write_protected"
+ type="xs:string" maxOccurs="1" minOccurs="0">
+ </xs:element>
+ <xs:element name="mmc_lld_is_card_inserted"
+ type="xs:string" maxOccurs="1" minOccurs="0">
</xs:element>
- <xs:element name="mmc_lld_is_write_protected" type="xs:string" maxOccurs="1" minOccurs="0">
+ <xs:element name="mmc_lld_is_write_protected"
+ type="xs:string" maxOccurs="1" minOccurs="0">
</xs:element>
</xs:sequence>
- </xs:complexType></xs:element>
- <xs:element name="ethernet_phy" type="EthernetPHYType"
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ethernet_phy" type="EthernetPHYType"
maxOccurs="1" minOccurs="0">
- </xs:element>
+ </xs:element>
+
</xs:sequence>
</xs:complexType>
diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd
index ace3b5acb..072880711 100644
--- a/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd
+++ b/tools/eclipse/config_wizard/resources/gencfg/schema/boards/stm32f4xx_board.xsd
@@ -1,63 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
- xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:include schemaLocation="../common/doc.xsd" />
- <xs:include schemaLocation="../common/stm32/stm32_gpiov2_port.xsd" />
- <xs:include schemaLocation="abstract_board.xsd" />
+ <xs:include schemaLocation="../common/doc.xsd" />
+ <xs:include schemaLocation="../common/stm32/stm32_gpiov2_port.xsd" />
+ <xs:include schemaLocation="abstract_board.xsd" />
- <xs:complexType name="STM32F4xxBoardType">
- <xs:complexContent>
- <xs:extension base="AbstractBoardType">
- <xs:sequence>
- <xs:element name="clocks" maxOccurs="1" minOccurs="1">
- <xs:complexType>
- <xs:attribute name="HSEBypass" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:whiteSpace value="collapse"></xs:whiteSpace>
- <xs:enumeration value="false"></xs:enumeration>
- <xs:enumeration value="true"></xs:enumeration>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="HSEFrequency"
- use="required">
- <xs:simpleType>
- <xs:restriction base="xs:int">
- <xs:whiteSpace value="collapse"></xs:whiteSpace>
- <xs:minInclusive value="0"></xs:minInclusive>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="LSEFrequency"
- use="required">
- <xs:simpleType>
- <xs:restriction base="xs:int">
- <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:complexType name="STM32F4xxBoardType">
+ <xs:complexContent>
+ <xs:extension base="AbstractBoardType">
+ <xs:sequence>
+ <xs:element name="clocks" maxOccurs="1" minOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="HSEBypass" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:enumeration value="false"></xs:enumeration>
+ <xs:enumeration value="true"></xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="HSEFrequency" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:int">
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:minInclusive value="0"></xs:minInclusive>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="LSEFrequency" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:int">
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
- <xs:minInclusive value="0"></xs:minInclusive>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="VDD" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:int">
- <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:minInclusive value="0"></xs:minInclusive>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="VDD" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:int">
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
- <xs:minInclusive value="180"></xs:minInclusive>
+ <xs:minInclusive value="180"></xs:minInclusive>
- <xs:maxInclusive value="360"></xs:maxInclusive>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType></xs:element>
- <xs:element name="ports" type="portsType" maxOccurs="1"
- minOccurs="1">
- </xs:element>
- </xs:sequence>
+ <xs:maxInclusive value="360"></xs:maxInclusive>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ports" type="portsType" maxOccurs="1" minOccurs="1">
+ </xs:element>
+ </xs:sequence>
- </xs:extension>
+ </xs:extension>
</xs:complexContent>
</xs:complexType>
diff --git a/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd b/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd
new file mode 100644
index 000000000..45d228142
--- /dev/null
+++ b/tools/eclipse/config_wizard/resources/gencfg/schema/common/config_settings.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema elementFormDefault="qualified"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:complexType name="ConfigurationSettingsType">
+ <xs:sequence>
+ <xs:element name="templates_path" minOccurs="1"
+ maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Templates resources associated to the configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"></xs:minLength>
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:pattern value="[\w\d_/.]+"></xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ <xs:element name="output_path" maxOccurs="1"
+ minOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Output directory relative to the configuration file.</xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:minLength value="1"></xs:minLength>
+ <xs:whiteSpace value="collapse"></xs:whiteSpace>
+ <xs:pattern value="[\w\d_/.]+"></xs:pattern>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml
index 7e4dd5459..843dfe925 100644
--- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml
+++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f0board.xml
@@ -3,6 +3,10 @@
<board
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f0xx_board.xsd">
+ <configuration_settings>
+ <templates_path>resources/gencfg/processors/boards/stm32f0xx/templates</templates_path>
+ <output_path>.</output_path>
+ </configuration_settings>
<board_name>-----human readable board name-----</board_name>
<board_id>BOARD_IDENTIFIER</board_id>
<board_functions></board_functions>
diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml
index 7becd89df..66a09d0d6 100644
--- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml
+++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32f4board.xml
@@ -3,6 +3,10 @@
<board
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32f4xx_board.xsd">
+ <configuration_settings>
+ <templates_path>resources/gencfg/processors/boards/stm32f4xx/templates</templates_path>
+ <output_path>.</output_path>
+ </configuration_settings>
<board_name>-----human readable board name-----</board_name>
<board_id>BOARD_IDENTIFIER</board_id>
<board_functions></board_functions>
diff --git a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml
index 1f6554026..00e5b5319 100644
--- a/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml
+++ b/tools/eclipse/config_wizard/resources/gencfg/xml/stm32l1board.xml
@@ -3,6 +3,10 @@
<board
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.chibios.org/xml/schema/boards/stm32l1xx_board.xsd">
+ <configuration_settings>
+ <templates_path>resources/gencfg/processors/boards/stm32l1xx/templates</templates_path>
+ <output_path>.</output_path>
+ </configuration_settings>
<board_name>-----human readable board name-----</board_name>
<board_id>BOARD_IDENTIFIER</board_id>
<board_functions></board_functions>
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
index e10d4c667..e6e9b3790 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/handlers/GenerateFiles.java
@@ -21,9 +21,7 @@
package org.chibios.tools.eclipse.config.handlers;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
-import java.util.Properties;
import org.chibios.tools.eclipse.config.utils.TemplateEngine;
import org.chibios.tools.eclipse.config.utils.TemplateException;
@@ -40,6 +38,10 @@ import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.JDOMException;
+import org.jdom2.input.SAXBuilder;
import org.osgi.framework.Bundle;
import config_wizard.Activator;
@@ -70,53 +72,32 @@ public class GenerateFiles extends AbstractHandler {
if (selection instanceof IStructuredSelection) {
/* Retrieves the full path of the configuration file. */
- IPath cfgfilepath = ((IFile) ((IStructuredSelection) selection)
+ IPath cfgfilepath = ((IFile)((IStructuredSelection)selection)
.getFirstElement()).getLocation();
-
- /* Determines the base path as the parent of the configuration file.*/
- IPath basepath = cfgfilepath.removeLastSegments(1);
- /* Reads the configuration file into a Properties object. */
- Properties cfgfile = new Properties();
+ /* DOM tree creation. */
+ SAXBuilder builder = new SAXBuilder();
+ Document document;
try {
- cfgfile.load(new FileReader(cfgfilepath.toFile()));
- } catch (IOException e) {
- MessageDialog.openInformation(window.getShell(), "I/O Error",
- e.getMessage());
- return null;
- }
-
- /* Retrieves source property. */
- String source = cfgfile.getProperty("source");
- if (source == null) {
- MessageDialog.openInformation(window.getShell(), "Properties Error",
- "Property \"source\" not found in configuration file.");
+ document = builder.build(cfgfilepath.toFile());
+ } catch (JDOMException e) {
return null;
- }
-
- /* Retrieves xmlfile property. */
- String xmlfile = cfgfile.getProperty("xmlfile");
- if (xmlfile == null) {
- MessageDialog.openInformation(window.getShell(), "Properties Error",
- "Property \"xmlfile\" not found in configuration file.");
+ } catch (IOException e) {
return null;
}
- /* Retrieves output property. */
- String output = cfgfile.getProperty("output");
- if (output == null) {
- MessageDialog.openInformation(window.getShell(), "Properties Error",
- "Property \"output\" not found in configuration file.");
- return null;
- }
+ /* Retrieving configuration settings info.*/
+ Element settings = document.getRootElement().getChild("configuration_settings");
+ String templates_path = settings.getChildText("templates_path");
+ String output_path = settings.getChildText("output_path");
/* Calculating derived paths. */
- IPath sourcepath = new Path(source);
+ IPath tpath = new Path(templates_path);
IPath libpath = new Path("resources/gencfg/lib");
try {
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
- sourcepath = new Path(FileLocator.toFileURL(
- FileLocator.find(bundle, sourcepath, null)).getFile());
+ tpath = new Path(FileLocator.toFileURL(
+ FileLocator.find(bundle, tpath, null)).getFile());
libpath = new Path(FileLocator.toFileURL(
FileLocator.find(bundle, libpath, null)).getFile());
} catch (IOException e) {
@@ -127,9 +108,10 @@ public class GenerateFiles extends AbstractHandler {
/* Templates execution. */
try {
- TemplateEngine.process(basepath.addTrailingSeparator().append(xmlfile)
- .toFile(), libpath.toFile(), sourcepath.toFile(),
- basepath.toFile(), new File(output));
+ TemplateEngine.process(cfgfilepath.toFile(),
+ libpath.toFile(),
+ tpath.toFile(),
+ new File(output_path));
} catch (TemplateException e) {
MessageDialog.openInformation(window.getShell(), "Processing Error",
e.getMessage());
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
index 892c9c99b..272d6a5c2 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/utils/TemplateEngine.java
@@ -80,16 +80,15 @@ public class TemplateEngine {
* absolute path to libraries directory
* @param sourcedir
* absolute path to templates directory
- * @param basedir
- * absolute path to project directory
* @param outputdir
- * output directory relative to basedir
+ * output directory relative to xmldata
*
* @throws SettingException
* @throws ProcessingException
*/
- public static void process(java.io.File xmldata, java.io.File libdir,
- java.io.File sourcedir, java.io.File basedir,
+ public static void process(java.io.File xmldata,
+ java.io.File libdir,
+ java.io.File sourcedir,
java.io.File outputdir) throws TemplateException {
/* Finds or creates a named console. */
@@ -110,7 +109,7 @@ public class TemplateEngine {
* events to be logged.
*/
try {
- settings = new Settings(basedir);
+ settings = new Settings(xmldata.getParentFile());
} catch (SettingException e) {
e.printStackTrace();
return;
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java
index e6c309b43..28ee7e6e7 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizard.java
@@ -54,9 +54,6 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard {
private String containerName;
private String projectFileName;
- private String dataFileName;
- private String templatesPath;
- private String outputDirName;
private String defaultDataFile;
/**
@@ -91,9 +88,6 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard {
containerName = page.getContainerName();
projectFileName = page.getProjectFileName();
- dataFileName = page.getDataFileName();
- templatesPath = page.getTemplatesPath();
- outputDirName = page.getOutputDirName();
defaultDataFile = page.getDefaultDataFile();
IRunnableWithProgress op = new IRunnableWithProgress() {
@@ -133,36 +127,20 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard {
throwCoreException("Container \"" + containerName + "\" does not exist.");
}
IContainer container = (IContainer)resource;
- monitor.beginTask("Creating " + projectFileName, 4);
+ monitor.beginTask("Creating " + projectFileName, 3);
/* Step #1, creates the project file.*/
final IFile projectFile = container.getFile(new Path(projectFileName));
- try {
- InputStream stream = openProjectContentStream(templatesPath,
- dataFileName,
- outputDirName);
- if (projectFile.exists()) {
- projectFile.setContents(stream, true, true, monitor);
- } else {
- projectFile.create(stream, true, monitor);
- }
- stream.close();
- } catch (IOException e) {
- }
- monitor.worked(1);
-
- /* Step #2, creates the XML data file.*/
- final IFile dataFile = container.getFile(new Path(dataFileName));
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
IPath path = new Path(defaultDataFile);
String s;
try {
s = FileLocator.toFileURL(FileLocator.find(bundle, path, null)).getFile();
InputStream stream = new FileInputStream(s);
- if (dataFile.exists()) {
- dataFile.setContents(stream, true, true, monitor);
+ if (projectFile.exists()) {
+ projectFile.setContents(stream, true, true, monitor);
} else {
- dataFile.create(stream, true, monitor);
+ projectFile.create(stream, true, monitor);
}
stream.close();
} catch (IOException e) {
@@ -183,29 +161,11 @@ public class ConfigurationNewWizard extends Wizard implements INewWizard {
});
monitor.worked(1);
- /* Step #4, refreshing local resources.*/
+ /* Step #3, refreshing local resources.*/
container.refreshLocal(IResource.DEPTH_INFINITE, monitor);
monitor.worked(1);
}
- /**
- * We will initialize file contents with a sample text.
- */
- private InputStream openProjectContentStream(String templatesPath,
- String dataFileName,
- String outputDirName) {
-
- String contents = "# Automatically generated configuration project file.\n\n" +
- "# Templates path in the configuration plugin resources, do not modify.\n" +
- "source=" + templatesPath + "\n\n" +
- "# XML configuration data file path relative to this configuration file.\n" +
- "xmlfile=" + dataFileName + "\n\n" +
- "# Output directory path relative to directory containing this configuration\n" +
- "# file.\n" +
- "output=" + outputDirName + "\n";
- return new ByteArrayInputStream(contents.getBytes());
- }
-
private void throwCoreException(String message) throws CoreException {
IStatus status = new Status(IStatus.ERROR,
"org.chibios.tools.eclipse.config", IStatus.OK,
diff --git a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java
index 599c17af0..dde12645b 100644
--- a/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java
+++ b/tools/eclipse/config_wizard/src/org/chibios/tools/eclipse/config/wizards/ConfigurationNewWizardPage.java
@@ -24,8 +24,6 @@ import java.io.IOException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -65,14 +63,11 @@ public class ConfigurationNewWizardPage extends WizardPage {
private IContainer resourceContainer;
private Document processorsDocument;
- private String currentTemplatesPath;
private String currentDefaultDataFile;
private Composite container;
private Combo configurationTemplatesCombo;
private Text confProjectFilenameText;
- private Text confDataFilenameText;
- private Text confOutputDirectoryText;
/**
* Constructor for SampleNewWizardPage.
@@ -118,43 +113,15 @@ public class ConfigurationNewWizardPage extends WizardPage {
}
});
- Label lbl3 = new Label(container, SWT.NONE);
- lbl3.setText("Configuration data filename:");
-
- confDataFilenameText = new Text(container, SWT.BORDER);
- confDataFilenameText.setText("config.chxml");
- confDataFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false, 1, 1));
- confDataFilenameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- confDataFilenameUpdated();
- }
- });
-
- Label lbl4 = new Label(container, SWT.NONE);
- lbl4.setText("Configuration output directory:");
-
- confOutputDirectoryText = new Text(container, SWT.BORDER);
- confOutputDirectoryText.setText(".");
- confOutputDirectoryText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
- true, false, 1, 1));
-
/* Note, it must stay after the creation of the text fields. */
configurationTemplatesCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Element processor = getSelectedTemplate();
String basefilename = processor.getChildText("basefilename");
confProjectFilenameText.setText(basefilename.concat(".chcfg"));
- confDataFilenameText.setText(basefilename.concat(".chxml"));
- currentTemplatesPath = processor.getChildText("path");
currentDefaultDataFile = processor.getChildText("default");
}
});
- confOutputDirectoryText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- confOutputDirectoryUpdated();
- }
- });
populateWizardPanel();
initialize();
@@ -171,21 +138,6 @@ public class ConfigurationNewWizardPage extends WizardPage {
return confProjectFilenameText.getText();
}
- public String getDataFileName() {
-
- return confDataFilenameText.getText();
- }
-
- public String getOutputDirName() {
-
- return confOutputDirectoryText.getText();
- }
-
- public String getTemplatesPath() {
-
- return currentTemplatesPath;
- }
-
public String getDefaultDataFile() {
return currentDefaultDataFile;
@@ -292,52 +244,6 @@ public class ConfigurationNewWizardPage extends WizardPage {
}
/**
- * Checks the content of the confProjectFilenameText field.
- */
- private void confDataFilenameUpdated() {
- String fileName = getDataFileName();
-
- if (fileName.length() == 0) {
- updateStatus("File name must be specified");
- return;
- }
- if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
- updateStatus("File name must be valid");
- return;
- }
- int dotLoc = fileName.lastIndexOf('.');
- if (dotLoc != -1) {
- String ext = fileName.substring(dotLoc + 1);
- if (ext.equalsIgnoreCase("chxml") == false) {
- updateStatus("Configuration project filename extension must be \"chxml\"");
- return;
- }
- }
- updateStatus(null);
- }
-
- /**
- * Checks the content of the confOutputDirectoryText field.
- */
- private void confOutputDirectoryUpdated() {
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath outputPath = resourceContainer.getFullPath().addTrailingSeparator()
- .append(getOutputDirName());
- IResource outputContainer = root.findMember(outputPath);
-
- if (outputContainer == null) {
- updateStatus("The directory must exists");
- return;
- }
- if (!(outputContainer instanceof IContainer)) {
- updateStatus("A directory must be specified");
- return;
- }
- updateStatus(null);
- }
-
- /**
* Returns the XML Element associated to the current selection in the combo
* box.
*