]> source.dussan.org Git - vaadin-framework.git/commitdiff
widgetset build button in plugin can now be used while developing vaadin itself
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 3 Nov 2009 12:43:46 +0000 (12:43 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Tue, 3 Nov 2009 12:43:46 +0000 (12:43 +0000)
svn changeset:9602/svn branch:6.2

src/com/vaadin/portal/gwt/PortalDefaultWidgetSet.gwt.xml
src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java

index 096376003524c232f2edc6a65e7d1604808b888b..682534e16e000bec9684235a0abac9ef0a83588b 100644 (file)
@@ -1,4 +1,6 @@
 <module>
+       <!-- WS Compiler: manually edited  -->
+
        <!-- Inherit the SamplerWidgetSet -->
        <inherits name="com.vaadin.demo.sampler.gwt.SamplerWidgetSet" />
 </module>
index 0c139aabc4cb75656efb82e58196387e62024c3f..d7cf1ca4d0965c1cd1fc61cd01f9ff626ea714f2 100644 (file)
@@ -1,18 +1,14 @@
 <module>
        <!--
+           
                This GWT module defines the Vaadin DefaultWidgetSet. This is
                the module you want to extend when creating an extended widget set, or
                when creating a specialized widget set with a subset of the
                components.
-       -->
-       <!--
-               NOTE that your WidgetSet entry-point (.java) should have the same
-               "logical" name (a.k.a SimpleName) as the specification (.gwt.xml).
-       -->
-       <!--
-               E.g: com/example/gwt/MyWidgetSet.gwt.xml should point to the
-               entry-point
-               com.example.gwt.client[.some.package].MyWidgetSet.java
+               
+               
+               WS Compiler: manually edited
+               
        -->
 
        <inherits name="com.google.gwt.user.User" />
index d849c85fc71bf2e169613ad2ee720b87c60a4fa6..ac1ef284c9e835f2876d7ce96793df0b944081c5 100644 (file)
@@ -20,6 +20,11 @@ import java.util.regex.Pattern;
 /**
  * Helper class to update widgetsets GWT module configuration file. Can be used
  * command line or via IDE tools.
+ * 
+ * <p>
+ * If module definition file contains text "WS Compiler: manually edited", tool
+ * will skip editing file.
+ * 
  */
 public class WidgetSetBuilder {
 
@@ -66,32 +71,41 @@ public class WidgetSetBuilder {
         }
 
         String content = readFile(widgetsetFile);
-        String originalContent = content;
-
-        Collection<String> oldInheritedWidgetsets = getCurrentWidgetSets(content);
-
-        // add widgetsets that do not exist
-        for (String ws : availableWidgetSets.keySet()) {
-            if (ws.equals(widgetset)) {
-                // do not inherit the module itself
-                continue;
+        if (isEditable(content)) {
+            String originalContent = content;
+
+            Collection<String> oldInheritedWidgetsets = getCurrentWidgetSets(content);
+
+            // add widgetsets that do not exist
+            for (String ws : availableWidgetSets.keySet()) {
+                if (ws.equals(widgetset)) {
+                    // do not inherit the module itself
+                    continue;
+                }
+                if (!oldInheritedWidgetsets.contains(ws)) {
+                    content = addWidgetSet(ws, content);
+                }
             }
-            if (!oldInheritedWidgetsets.contains(ws)) {
-                content = addWidgetSet(ws, content);
+
+            for (String ws : oldInheritedWidgetsets) {
+                if (!availableWidgetSets.containsKey(ws)) {
+                    // widgetset not available in classpath
+                    content = removeWidgetSet(ws, content);
+                }
             }
-        }
 
-        for (String ws : oldInheritedWidgetsets) {
-            if (!availableWidgetSets.containsKey(ws)) {
-                // widgetset not available in classpath
-                content = removeWidgetSet(ws, content);
+            changed = changed || !content.equals(originalContent);
+            if (changed) {
+                commitChanges(widgetsetfilename, content);
             }
+        } else {
+            System.out
+                    .println("Widgetset is manually edited. Skipping updates.");
         }
+    }
 
-        changed = changed || !content.equals(originalContent);
-        if (changed) {
-            commitChanges(widgetsetfilename, content);
-        }
+    private static boolean isEditable(String content) {
+        return !content.contains("WS Compiler: manually edited");
     }
 
     private static String removeWidgetSet(String ws, String content) {
@@ -135,6 +149,7 @@ public class WidgetSetBuilder {
             sb.append(line);
             sb.append("\n");
         }
+        fi.close();
         return sb.toString();
     }