From: Matti Tahvonen Date: Tue, 3 Nov 2009 12:43:46 +0000 (+0000) Subject: widgetset build button in plugin can now be used while developing vaadin itself X-Git-Tag: 6.7.0.beta1~2339 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7165b1d6601b32a6b258f6309f5aa4293bf5f4d5;p=vaadin-framework.git widgetset build button in plugin can now be used while developing vaadin itself svn changeset:9602/svn branch:6.2 --- 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 @@ + + 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 @@ - - 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. + * + *

+ * 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 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 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(); }