Modified the ShowcaseGenerator to generate file names using only the simple class name of the examples, instead of the fully qualified name. The fully qualified names exceeded the filename length allows by Windows, so the distribution package could not be extracted using a zip utility without seeing error messages.
Patch by: jlabanca
Review by: knorton (desk review)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2935 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
index dd39a95..62e53e7 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ContentWidget.java
@@ -261,8 +261,10 @@
String tabHTML = getTabBar().getTabHTML(tabIndex);
if (!sourceLoaded && tabHTML.equals(constants.contentWidgetSource())) {
sourceLoaded = true;
- requestSourceContents(ShowcaseConstants.DST_SOURCE_EXAMPLE
- + this.getClass().getName() + ".html", sourceWidget, null);
+ String className = this.getClass().getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
+ requestSourceContents(ShowcaseConstants.DST_SOURCE_EXAMPLE + className
+ + ".html", sourceWidget, null);
}
// Load the style definitions
@@ -286,8 +288,10 @@
if (LocaleInfo.getCurrentLocale().isRTL()) {
srcPath += "_rtl";
}
- requestSourceContents(srcPath + "/" + this.getClass().getName()
- + ".html", styleWidget, callback);
+ String className = this.getClass().getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
+ requestSourceContents(srcPath + "/" + className + ".html", styleWidget,
+ callback);
}
}
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsExample.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsExample.java
index 1eec347..13602aa 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsExample.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsExample.java
@@ -176,12 +176,14 @@
// Load ErrorMessages.java
javaLoaded = true;
String className = ExampleConstants.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".java.html", javaWidget, null);
} else if (!propertiesLoaded && tabIndex == 3) {
// Load ErrorMessages.properties
propertiesLoaded = true;
String className = ExampleConstants.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".properties.html", propertiesWidget, null);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsWithLookupExample.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsWithLookupExample.java
index 610447d..82d69ce 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsWithLookupExample.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwConstantsWithLookupExample.java
@@ -198,12 +198,14 @@
// Load ErrorMessages.java
javaLoaded = true;
String className = ColorConstants.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".java.html", javaWidget, null);
} else if (!propertiesLoaded && tabIndex == 3) {
// Load ErrorMessages.properties
propertiesLoaded = true;
String className = ColorConstants.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".properties.html", propertiesWidget, null);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwMessagesExample.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwMessagesExample.java
index d741a55..ff5183c 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwMessagesExample.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/i18n/CwMessagesExample.java
@@ -230,12 +230,14 @@
// Load ErrorMessages.java
javaLoaded = true;
String className = ErrorMessages.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".java.html", javaWidget, null);
} else if (!propertiesLoaded && tabIndex == 3) {
// Load ErrorMessages.properties
propertiesLoaded = true;
String className = ErrorMessages.class.getName();
+ className = className.substring(className.lastIndexOf(".") + 1);
requestSourceContents(ShowcaseConstants.DST_SOURCE_RAW + className
+ ".properties.html", propertiesWidget, null);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java b/samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java
index c594d95..3d6bb38 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/generator/ShowcaseGenerator.java
@@ -156,8 +156,7 @@
fileContents = "<pre>" + fileContents + "</pre>";
// Save the raw source in the public directory
- String dstPath = ShowcaseConstants.DST_SOURCE_RAW + pkgName + "."
- + filename + ".html";
+ String dstPath = ShowcaseConstants.DST_SOURCE_RAW + filename + ".html";
createPublicResource(dstPath, fileContents);
}
}
@@ -219,7 +218,7 @@
// Save the source code to a file
String dstPath = ShowcaseConstants.DST_SOURCE_EXAMPLE
- + type.getQualifiedSourceName() + ".html";
+ + type.getSimpleSourceName() + ".html";
createPublicResource(dstPath, formattedSource);
}
@@ -272,7 +271,7 @@
}
// Save the raw source in the public directory
- String dstPath = outDir + type.getQualifiedSourceName() + ".html";
+ String dstPath = outDir + type.getSimpleSourceName() + ".html";
createPublicResource(dstPath, formattedStyle);
}