Author: jleroux
Date: Fri Sep 9 05:06:51 2016
New Revision: 1759941
URL:
http://svn.apache.org/viewvc?rev=1759941&view=revLog:
Fix for "LabelManager doesn't search .groovy files"
OFBIZ-8153
There are over 60 labels used in groovy files. These don't get reflected in the counts of the label manager and in the search for labels not used.
Thanks to Pierre Smits for report
Modified:
ofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java
Modified: ofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java?rev=1759941&r1=1759940&r2=1759941&view=diff==============================================================================
--- ofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java (original)
+++ ofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java Fri Sep 9 05:06:51 2016
@@ -109,8 +109,10 @@ public class LabelReferences {
}
// get labels from FTL files
getLabelsFromFtlFiles();
- // get labels from java files
+ // get labels from Java files
getLabelsFromJavaFiles();
+ // get labels from Groovy files
+ getLabelsFromGroovyFiles();
// get labels from simple method files
getLabelsFromSimpleMethodFiles();
// get labels from widgets files
@@ -209,6 +211,17 @@ public class LabelReferences {
}
}
+ private void getLabelsFromGroovyFiles() throws IOException {
+ for (String rootFolder : this.rootFolders) {
+ List<File> groovyFiles = FileUtil.findFiles("groovy", rootFolder + "groovyScripts", null, null);
+ for (File file : groovyFiles) {
+ String inFile = FileUtil.readString("UTF-8", file);
+ findUiLabelMapInFile(inFile, file.getPath());
+ }
+ }
+ }
+
+
protected void findUiLabelMapInFile(String inFile, String filePath) {
int pos = inFile.indexOf(uiLabelMap);
while (pos >= 0) {