private void getLabelsFromJavaFiles() throws IOException { for (String rootFolder : this.rootFolders) { List<File> javaFiles = FileUtil.findFiles("java", rootFolder + "src", null, null); for (File javaFile : javaFiles) { String inFile = FileUtil.readString("UTF-8", javaFile); int pos = inFile.indexOf(getMessage); while (pos >= 0) { int endLabel = inFile.indexOf(")", pos); if (endLabel >= 0) { String[] args = inFile.substring(pos + getMessage.length(), endLabel).split(","); for (String labelKey : this.labelSet) { String searchString = "\"" + labelKey + "\""; if (searchString.equals(args[1].trim())) { setLabelReference(labelKey, javaFile.getPath()); } } pos = endLabel; } else { pos = pos + getMessage.length(); } pos = inFile.indexOf(getMessage, pos); } } } }
private void getLabelsFromSimpleMethodFiles() throws IOException { for (String rootFolder : this.rootFolders) { List<File> simpleMethodsFiles = FileUtil.findFiles("xml", rootFolder + "script", null, null); for (File file : simpleMethodsFiles) { String inFile = FileUtil.readString("UTF-8", file); findUiLabelMapInFile(inFile, file.getPath()); findLabelKeyInElement(inFile, file.getPath(), "set"); findLabelKeyInElement(inFile, file.getPath(), "fail-property"); } } }
private void getLabelsFromFtlFiles() throws IOException { for (String rootFolder : this.rootFolders) { List<File> ftlFiles = FileUtil.findFiles("ftl", rootFolder, null, null); for (File file : ftlFiles) { String inFile = FileUtil.readString("UTF-8", file); int pos = inFile.indexOf(bracketedUiLabelMap); while (pos >= 0) { int endPos = inFile.indexOf("}", pos); if (endPos >= 0) { String labelKey = inFile.substring(pos + bracketedUiLabelMap.length(), endPos); if (this.labelSet.contains(labelKey)) { setLabelReference(labelKey, file.getPath()); } pos = endPos; } else { pos = pos + bracketedUiLabelMap.length(); } pos = inFile.indexOf(bracketedUiLabelMap, pos); } } } }