<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" />
/**
* 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 {
}
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) {
sb.append(line);
sb.append("\n");
}
+ fi.close();
return sb.toString();
}