changeset 21:540c47958d9c

Generate empty thermostat-plugin.xml file by default
author Omair Majid <omajid@redhat.com>
date Tue, 03 Dec 2013 18:10:22 -0500
parents 48d068992070
children 7c6ffc3fb478
files src/com/redhat/thermostat/plugin/eclipse/wizards/PluginXmlCreationWizard.java
diffstat 1 files changed, 6 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/redhat/thermostat/plugin/eclipse/wizards/PluginXmlCreationWizard.java	Tue Dec 03 17:07:28 2013 -0500
+++ b/src/com/redhat/thermostat/plugin/eclipse/wizards/PluginXmlCreationWizard.java	Tue Dec 03 18:10:22 2013 -0500
@@ -78,8 +78,9 @@
         IContainer container = (IContainer) resource;
         final IFile file = container.getFile(new Path(fileName));
         try {
-            InputStream stream = openContentStream();
+            InputStream stream = getInitialContentStream();
             if (file.exists()) {
+                // TODO dont replace file without confirming
                 file.setContents(stream, true, true, monitor);
             } else {
                 file.create(stream, true, monitor);
@@ -102,34 +103,12 @@
         monitor.worked(1);
     }
 
-    private InputStream openContentStream() {
+    private InputStream getInitialContentStream() {
         String contents = "<?xml version=\"1.0\"?>\n"
                 + "<plugin xmlns=\"http://icedtea.classpath.org/thermostat/plugins/v1.0\"\n"
-                + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-                + "xsi:schemaLocation=\"http://icedtea.classpath.org/thermostat/plugins/v1.0 thermostat-plugin.xsd\">\n"
-                + "<commands>\n"
-                + "<command>\n"
-                + "<name>test</name>\n"
-                + "<description>print the kernel cmdline for a host</description>\n"
-                + "<options>\n"
-                + "<option>\n"
-                + "<long>aaaa</long>\n"
-                + "<short>a</short>\n"
-                + "</option>\n"
-                + "</options>\n"
-                + "<bundles>\n"
-                + "</bundles>\n"
-                + "<dependencies>\n"
-                + "</dependencies>\n"
-                + "</command>\n"
-                + "</commands>\n"
-                + "<extensions>\n"
-                + "<extension>\n"
-                + "<name>agent</name>\n"
-                + "<bundles>\n"
-                + "<bundle>thermostat-plug-in-agent-0.0.2-SNAPSHOT.jar</bundle>\n"
-                + "<bundle>thermostat-plug-in-storage-common-0.0.2-SNAPSHOT.jar</bundle>\n"
-                + "</bundles>\n" + "</extension>\n" + "</extensions>\n" + "</plugin>";
+                + "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+                + "\txsi:schemaLocation=\"http://icedtea.classpath.org/thermostat/plugins/v1.0 thermostat-plugin.xsd\">\n"
+                + "</plugin>";
 
         return new ByteArrayInputStream(contents.getBytes());
     }