From 4f47e316c73d2414d4f1a1f8232d39025e042c5b Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Thu, 9 Nov 2006 10:54:59 +0000 Subject: [PATCH] [cleanup] fix NON-NLS-1 tags --- .../clientserver/FileTypeMatcher.java | 16 ++-- .../clientserver/IClassifierConstants.java | 16 ++-- .../clientserver/IClientServerConstants.java | 38 +++++----- .../clientserver/NamePatternMatcher.java | 29 ++++---- .../services/clientserver/PathUtility.java | 4 +- .../clientserver/SystemEncodingUtil.java | 24 +++--- .../clientserver/SystemFileClassifier.java | 73 ++++++++++--------- .../clientserver/SystemSearchString.java | 8 +- 8 files changed, 105 insertions(+), 103 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/FileTypeMatcher.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/FileTypeMatcher.java index dd3356707f2..8028f390ffa 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/FileTypeMatcher.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/FileTypeMatcher.java @@ -187,8 +187,8 @@ public class FileTypeMatcher implements IMatcher { if (name.equals(names[idx])) matches = true; - else if (names[idx].endsWith(".null") && - name.equals(names[idx].substring(0,names[idx].indexOf(".null"))) ) + else if (names[idx].endsWith(".null") && //$NON-NLS-1$ + name.equals(names[idx].substring(0,names[idx].indexOf(".null"))) ) //$NON-NLS-1$ matches = true; } if (matches) @@ -212,7 +212,7 @@ public class FileTypeMatcher implements IMatcher else if (dotIdx == -1) { for (int idx=0; !matches && (idx\, then replace \\->\ StringBuffer buf = new StringBuffer(path.length()); @@ -72,7 +72,7 @@ public class PathUtility if (path == null || path.length() < 2) { return path; } - boolean endsWithSlash = (path.endsWith("\\") || path.endsWith("/")); + boolean endsWithSlash = (path.endsWith("\\") || path.endsWith("/")); //$NON-NLS-1$ //$NON-NLS-2$ if (badSlashPatternUnix.matcher(path).find()) { //Replace \->/, then replace //->/ StringBuffer buf = new StringBuffer(path.length()); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java index 9914257757f..5a7b8f47e6e 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java @@ -28,7 +28,7 @@ import java.io.InputStreamReader; public class SystemEncodingUtil { private static SystemEncodingUtil instance; - public static String ENCODING_UTF_8 = "UTF-8"; + public static String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$ /** * Constructor to create the utility class. @@ -56,7 +56,7 @@ public class SystemEncodingUtil { * @return the evironment encoding. */ public String getEnvironmentEncoding() { - return System.getProperty("file.encoding"); + return System.getProperty("file.encoding"); //$NON-NLS-1$ } /** @@ -66,7 +66,7 @@ public class SystemEncodingUtil { */ public boolean isXML(String filePath) { - int index = filePath.lastIndexOf("."); + int index = filePath.lastIndexOf("."); //$NON-NLS-1$ // check if there is a "." if (index == -1) { @@ -81,7 +81,7 @@ public class SystemEncodingUtil { else { String extension = filePath.substring(index+1); - if (extension.equalsIgnoreCase("xml") || extension.equalsIgnoreCase("xmi")) { + if (extension.equalsIgnoreCase("xml") || extension.equalsIgnoreCase("xmi")) { //$NON-NLS-1$ //$NON-NLS-2$ return true; } else { @@ -158,7 +158,7 @@ public class SystemEncodingUtil { // in big-endian order and ASCII characters encoded as ASCII values (the encoding // declaration must be read to determine which) else if (temp[0] == 0x00 && temp[1] == 0x3C && temp[2] == 0x00 && temp[3] == 0x3F) { - encodingGuess = "UnicodeBigUnmarked"; + encodingGuess = "UnicodeBigUnmarked"; //$NON-NLS-1$ } @@ -166,14 +166,14 @@ public class SystemEncodingUtil { // in little-endian order and ASCII characters encoded as ASCII values (the encoding // declaration must be read to determine which) else if (temp[0] == 0x3C && temp[1] == 0x00 && temp[2] == 0x3F && temp[3] == 0x00) { - encodingGuess = "UnicodeLittleUnmarked"; + encodingGuess = "UnicodeLittleUnmarked"; //$NON-NLS-1$ } // EBCDIC (in some flavor; the full encoding declaration must be read to tell which // code page is in use) else if (temp[0] == 0x4C && temp[1] == 0x6F && temp[2] == 0xA7 && temp[3] == 0x94) { - encodingGuess = "Cp037"; + encodingGuess = "Cp037"; //$NON-NLS-1$ } @@ -218,7 +218,7 @@ public class SystemEncodingUtil { while (line != null) { - int encodingIndex = line.indexOf("encoding"); + int encodingIndex = line.indexOf("encoding"); //$NON-NLS-1$ // look for the encoding attribute if (encodingIndex != -1) { @@ -320,8 +320,8 @@ public class SystemEncodingUtil { // check if our initial guess was UTF-8 or UTF-16 // those do not have to have an encoding declaration - if (encodingGuess.equals(SystemEncodingUtil.ENCODING_UTF_8) || encodingGuess.startsWith("UnicodeBig") || - encodingGuess.equals("UnicodeLittle")) { + if (encodingGuess.equals(SystemEncodingUtil.ENCODING_UTF_8) || encodingGuess.startsWith("UnicodeBig") || //$NON-NLS-1$ + encodingGuess.equals("UnicodeLittle")) { //$NON-NLS-1$ encoding = encodingGuess; } } @@ -385,11 +385,11 @@ public class SystemEncodingUtil { } // UTF-16, big-endian order else if (bomBytes[0] == 0xFE && bomBytes[1] == 0xFF && !(bomBytes[2] == 0x00 && bomBytes[3] == 0x00)) { - return "UnicodeBig"; + return "UnicodeBig"; //$NON-NLS-1$ } // UTF-16, little-endian order else if (bomBytes[0] == 0xFF && bomBytes[1] == 0xFE && !(bomBytes[2] == 0x00 && bomBytes[3] == 0x00)) { - return "UnicodeLittle"; + return "UnicodeLittle"; //$NON-NLS-1$ } // not a BOM else { diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java index 50470a3efec..351d9f63118 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemFileClassifier.java @@ -107,7 +107,7 @@ public class SystemFileClassifier { protected String classifyNonVirtual(String absolutePath) { // default type - String type = "file"; + String type = "file"; //$NON-NLS-1$ File file = new File(absolutePath); @@ -117,41 +117,41 @@ public class SystemFileClassifier { } // find out if we are on Windows - boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); + boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); //$NON-NLS-1$ //$NON-NLS-2$ // for Windows, we only detect *.exe and *.dll files if (isWindows) { absolutePath = absolutePath.toLowerCase(); // classify *.class file - if (absolutePath.endsWith(".class")) { + if (absolutePath.endsWith(".class")) { //$NON-NLS-1$ type = classifyClassFile(absolutePath); } // *.exe files are binary executables - else if (absolutePath.endsWith(".exe")) { - type = "executable(binary)"; + else if (absolutePath.endsWith(".exe")) { //$NON-NLS-1$ + type = "executable(binary)"; //$NON-NLS-1$ } // *.dll files are of type "module" - else if (absolutePath.endsWith(".dll")) { - type = "module"; + else if (absolutePath.endsWith(".dll")) { //$NON-NLS-1$ + type = "module"; //$NON-NLS-1$ } return type; } // get specified encoding if any - String encoding = System.getProperty("dstore.stdin.encoding"); + String encoding = System.getProperty("dstore.stdin.encoding"); //$NON-NLS-1$ // otherwise, default to system encoding - if (encoding == null || encoding.equals("")) { - encoding = System.getProperty("file.encoding"); + if (encoding == null || encoding.equals("")) { //$NON-NLS-1$ + encoding = System.getProperty("file.encoding"); //$NON-NLS-1$ } // create command "sh -c file " String args[] = new String[3]; - args[0] = "sh"; - args[1] = "-c"; - args[2] = "file \"" + absolutePath + "\""; + args[0] = "sh"; //$NON-NLS-1$ + args[1] = "-c"; //$NON-NLS-1$ + args[2] = "file \"" + absolutePath + "\""; //$NON-NLS-1$ //$NON-NLS-2$ BufferedReader poutReader = null; @@ -173,9 +173,9 @@ public class SystemFileClassifier { poutReader.close(); // if it a symbolic link, then get the canonical path and classify it as well - if (type.equals("link")) { + if (type.equals("link")) { //$NON-NLS-1$ String canonicalPath = file.getCanonicalPath(); - return type + "(" + classifyNonVirtual(canonicalPath) + ")" + ":" + canonicalPath; + return type + "(" + classifyNonVirtual(canonicalPath) + ")" + ":" + canonicalPath; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else { return type; @@ -203,10 +203,10 @@ public class SystemFileClassifier { protected String getClassification(String absolutePath, String line) { // default type - String type = "file"; + String type = "file"; //$NON-NLS-1$ String name = line; - String fulltype = ""; + String fulltype = ""; //$NON-NLS-1$ // Look for colon. Name appears before colon. Full type appears after the colon int colon = line.indexOf(':'); @@ -217,27 +217,27 @@ public class SystemFileClassifier { // if it is a *.class file, then we look for main method and qulaified class name // as part of the classification - if (name.endsWith(".class")) { + if (name.endsWith(".class")) { //$NON-NLS-1$ type = classifyClassFile(absolutePath); } // check if it is a shared library - boolean matchesLib = (fulltype.indexOf("shared object") > -1) || - (fulltype.indexOf("object module") > -1) || - (fulltype.indexOf("archive") > -1); + boolean matchesLib = (fulltype.indexOf("shared object") > -1) || //$NON-NLS-1$ + (fulltype.indexOf("object module") > -1) || //$NON-NLS-1$ + (fulltype.indexOf("archive") > -1); //$NON-NLS-1$ // check if it is an executable - boolean matchesExe = (fulltype.indexOf("executable") > -1); + boolean matchesExe = (fulltype.indexOf("executable") > -1); //$NON-NLS-1$ // check if it is a script - boolean matchesScript = (fulltype.indexOf("script") > -1); + boolean matchesScript = (fulltype.indexOf("script") > -1); //$NON-NLS-1$ // shared library if (matchesLib) { // all *.a, *.so and *.so.* files are of type "module" - if (name.endsWith(".a") || name.endsWith(".so") || (name.indexOf(".so.") > 0)) { - type = "module"; + if (name.endsWith(".a") || name.endsWith(".so") || (name.indexOf(".so.") > 0)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + type = "module"; //$NON-NLS-1$ } } @@ -246,27 +246,27 @@ public class SystemFileClassifier { // an executable script file if (matchesExe) { - type = "executable(script)"; + type = "executable(script)"; //$NON-NLS-1$ } // non-executable script file else { - type = "script"; + type = "script"; //$NON-NLS-1$ } } // binary executable else if (matchesExe) { - type = "executable(binary)"; + type = "executable(binary)"; //$NON-NLS-1$ } // on iSeries we look for "OS/400 object" as a type - else if (fulltype.indexOf("OS/400 object") > -1) { - type = "OS/400 object"; + else if (fulltype.indexOf("OS/400 object") > -1) { //$NON-NLS-1$ + type = "OS/400 object"; //$NON-NLS-1$ } // finally, if the full type contains the symbolic link string, then type is simply "link" - else if (fulltype.startsWith("symbolic link to")) { - type = "link"; + else if (fulltype.startsWith("symbolic link to")) { //$NON-NLS-1$ + type = "link"; //$NON-NLS-1$ } return type; @@ -280,7 +280,7 @@ public class SystemFileClassifier { protected String classifyClassFile(String absolutePath) { // default type - String type = "file"; + String type = "file"; //$NON-NLS-1$ // input stream to file FileInputStream stream = null; @@ -305,19 +305,20 @@ public class SystemFileClassifier { // we assume not executable isExecutable = false; + return type; } // if it is executable, then also get qualified class name if (isExecutable) { - type = "executable(java"; + type = "executable(java"; //$NON-NLS-1$ String qualifiedClassName = parser.getQualifiedClassName(); if (qualifiedClassName != null) { - type = type + ":" + qualifiedClassName; + type = type + ":" + qualifiedClassName; //$NON-NLS-1$ } - type = type + ")"; + type = type + ")"; //$NON-NLS-1$ } return type; diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemSearchString.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemSearchString.java index b01bd482812..b60cd152ec5 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemSearchString.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemSearchString.java @@ -50,7 +50,7 @@ public class SystemSearchString { String fileNamesString, boolean isFileNamesRegex, boolean includeArchives, boolean includeSubfolders) { this(textString, isCaseSensitive, isTextStringRegex, fileNamesString, isFileNamesRegex, includeArchives, - includeSubfolders, ""); + includeSubfolders, ""); //$NON-NLS-1$ } /** @@ -146,8 +146,8 @@ public class SystemSearchString { * @see java.lang.Object#toString() */ public String toString() { - return textString + " - " + isCaseSensitive + " - " + isTextStringRegex + " - " + - fileNamesString + " - " + isFileNamesRegex + " - " + includeArchives + " - " + - includeSubfolders + " - " + classificationString; + return textString + " - " + isCaseSensitive + " - " + isTextStringRegex + " - " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + fileNamesString + " - " + isFileNamesRegex + " - " + includeArchives + " - " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + includeSubfolders + " - " + classificationString; //$NON-NLS-1$ } } \ No newline at end of file