diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-03 12:43:46 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-11-03 12:43:46 +0000 |
commit | 7165b1d6601b32a6b258f6309f5aa4293bf5f4d5 (patch) | |
tree | c265903dc70b02ee5594709ab79bd582963d5a1d /src | |
parent | 6f0ac065787bcde54260cb0b0fdb3533a84f2b0c (diff) | |
download | vaadin-framework-7165b1d6601b32a6b258f6309f5aa4293bf5f4d5.tar.gz vaadin-framework-7165b1d6601b32a6b258f6309f5aa4293bf5f4d5.zip |
widgetset build button in plugin can now be used while developing vaadin itself
svn changeset:9602/svn branch:6.2
Diffstat (limited to 'src')
3 files changed, 42 insertions, 29 deletions
diff --git a/src/com/vaadin/portal/gwt/PortalDefaultWidgetSet.gwt.xml b/src/com/vaadin/portal/gwt/PortalDefaultWidgetSet.gwt.xml index 0963760035..682534e16e 100644 --- a/src/com/vaadin/portal/gwt/PortalDefaultWidgetSet.gwt.xml +++ b/src/com/vaadin/portal/gwt/PortalDefaultWidgetSet.gwt.xml @@ -1,4 +1,6 @@ <module> + <!-- WS Compiler: manually edited --> + <!-- Inherit the SamplerWidgetSet --> <inherits name="com.vaadin.demo.sampler.gwt.SamplerWidgetSet" /> </module> diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml index 0c139aabc4..d7cf1ca4d0 100644 --- a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml +++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml @@ -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" /> diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java index d849c85fc7..ac1ef284c9 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetSetBuilder.java @@ -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(); } |