diff options
author | Konrad Kolosowski | 2004-05-10 18:36:53 +0000 |
---|---|---|
committer | Konrad Kolosowski | 2004-05-10 18:36:53 +0000 |
commit | 1f8f6e98b3783d31aa14867ff73f27c60e31e8b6 (patch) | |
tree | 2a18415fcf3310693c3be5a5bc1a940321ebc708 /org.eclipse.help.base | |
parent | 7f7bb95d74e9fa5bc556d2ba9ba075787daee70f (diff) | |
download | eclipse.platform.ua-1f8f6e98b3783d31aa14867ff73f27c60e31e8b6.tar.gz eclipse.platform.ua-1f8f6e98b3783d31aa14867ff73f27c60e31e8b6.tar.xz eclipse.platform.ua-1f8f6e98b3783d31aa14867ff73f27c60e31e8b6.zip |
NLS
Diffstat (limited to 'org.eclipse.help.base')
32 files changed, 339 insertions, 339 deletions
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java index b02bf566e..20b91dfa2 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java @@ -19,18 +19,18 @@ import org.eclipse.osgi.service.environment.*; * Creates browser by delegating to appropriate browser adapter */ public class BrowserManager { - public static final String ALWAYS_EXTERNAL_BROWSER_KEY = "always_external_browser"; - public static final String DEFAULT_BROWSER_ID_KEY = "default_browser"; + public static final String ALWAYS_EXTERNAL_BROWSER_KEY = "always_external_browser"; //$NON-NLS-1$ + public static final String DEFAULT_BROWSER_ID_KEY = "default_browser"; //$NON-NLS-1$ public static final String BROWSER_ID_CUSTOM = HelpBasePlugin.PLUGIN_ID - + ".custombrowser"; + + ".custombrowser"; //$NON-NLS-1$ public static final String BROWSER_ID_MOZILLA = HelpBasePlugin.PLUGIN_ID - + ".mozilla"; + + ".mozilla"; //$NON-NLS-1$ public static final String BROWSER_ID_NETSCAPE = HelpBasePlugin.PLUGIN_ID - + ".netscape"; + + ".netscape"; //$NON-NLS-1$ public static final String BROWSER_ID_MAC_SYSTEM = HelpBasePlugin.PLUGIN_ID - + ".defaultBrowserMacOSX"; - public static final String BROWSER_ID_EMBEDDED = "org.eclipse.help.ui.embeddedbrowser"; - public static final String BROWSER_ID_SYSTEM = "org.eclipse.help.ui.systembrowser"; + + ".defaultBrowserMacOSX"; //$NON-NLS-1$ + public static final String BROWSER_ID_EMBEDDED = "org.eclipse.help.ui.embeddedbrowser"; //$NON-NLS-1$ + public static final String BROWSER_ID_SYSTEM = "org.eclipse.help.ui.systembrowser"; //$NON-NLS-1$ private static BrowserManager instance; private boolean initialized = false; private BrowserDescriptor currentBrowserDesc; @@ -55,7 +55,7 @@ public class BrowserManager { String defBrowserID = HelpBasePlugin.getDefault() .getPluginPreferences() .getDefaultString(DEFAULT_BROWSER_ID_KEY); - if (defBrowserID != null && (!"".equals(defBrowserID))) { + if (defBrowserID != null && (!"".equals(defBrowserID))) { //$NON-NLS-1$ setDefaultBrowserID(defBrowserID); } // 2. set default browser to embedded @@ -95,7 +95,7 @@ public class BrowserManager { // 6. use null browser if (defaultBrowserDesc == null) { // If no browsers at all, use the Null Browser Adapter - defaultBrowserDesc = new BrowserDescriptor("", "Null Browser", + defaultBrowserDesc = new BrowserDescriptor("", "Null Browser", //$NON-NLS-1$ //$NON-NLS-2$ new IBrowserFactory() { public boolean isAvailable() { return true; @@ -106,7 +106,7 @@ public class BrowserManager { } public void displayURL(String url) { String msg = HelpBaseResources.getString( - "no_browsers", url); + "no_browsers", url); //$NON-NLS-1$ HelpBasePlugin.logError(msg, null); BaseHelpSystem.getDefaultErrorUtil() .displayError(msg); @@ -131,7 +131,7 @@ public class BrowserManager { // initialize current browser String curBrowserID = HelpBasePlugin.getDefault() .getPluginPreferences().getString(DEFAULT_BROWSER_ID_KEY); - if (curBrowserID != null && (!"".equals(curBrowserID))) { + if (curBrowserID != null && (!"".equals(curBrowserID))) { //$NON-NLS-1$ setCurrentBrowserID(curBrowserID); // may fail if such browser does not exist } @@ -158,19 +158,19 @@ public class BrowserManager { Collection bDescriptors = new ArrayList(); IConfigurationElement configElements[] = Platform.getExtensionRegistry() .getConfigurationElementsFor(HelpBasePlugin.PLUGIN_ID, - "browser"); + "browser"); //$NON-NLS-1$ for (int i = 0; i < configElements.length; i++) { - if (!configElements[i].getName().equals("browser")) + if (!configElements[i].getName().equals("browser")) //$NON-NLS-1$ continue; - String id = configElements[i].getAttribute("id"); + String id = configElements[i].getAttribute("id"); //$NON-NLS-1$ if (id == null) continue; - String label = configElements[i].getAttribute("name"); + String label = configElements[i].getAttribute("name"); //$NON-NLS-1$ if (label == null) continue; try { Object adapter = configElements[i] - .createExecutableExtension("factoryclass"); + .createExecutableExtension("factoryclass"); //$NON-NLS-1$ if (!(adapter instanceof IBrowserFactory)) continue; if (((IBrowserFactory) adapter).isAvailable()) { diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java index 1c7221ad4..4396f6ab3 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java @@ -21,7 +21,7 @@ import org.eclipse.osgi.service.environment.*; * */ public class CustomBrowser implements IBrowser { - public static final String CUSTOM_BROWSER_PATH_KEY = "custom_browser_path"; + public static final String CUSTOM_BROWSER_PATH_KEY = "custom_browser_path"; //$NON-NLS-1$ /** * @see org.eclipse.help.ui.browser.IBrowser#close() @@ -49,17 +49,17 @@ public class CustomBrowser implements IBrowser { try { Process pr = Runtime.getRuntime().exec(command); Thread outConsumer = new StreamConsumer(pr.getInputStream()); - outConsumer.setName("Custom browser adapter output reader"); + outConsumer.setName("Custom browser adapter output reader"); //$NON-NLS-1$ outConsumer.start(); Thread errConsumer = new StreamConsumer(pr.getErrorStream()); - errConsumer.setName("Custom browser adapter error reader"); + errConsumer.setName("Custom browser adapter error reader"); //$NON-NLS-1$ errConsumer.start(); } catch (Exception e) { HelpBasePlugin.logError( - HelpBaseResources.getString("CustomBrowser.errorLaunching", url, path), + HelpBaseResources.getString("CustomBrowser.errorLaunching", url, path), //$NON-NLS-1$ e); throw new Exception( - HelpBaseResources.getString("CustomBrowser.errorLaunching", url, path)); + HelpBaseResources.getString("CustomBrowser.errorLaunching", url, path)); //$NON-NLS-1$ } } @@ -99,24 +99,24 @@ public class CustomBrowser implements IBrowser { ArrayList tokenList = new ArrayList(); //Divide along quotation marks StringTokenizer qTokenizer = - new StringTokenizer(path.trim(), "\"", true); + new StringTokenizer(path.trim(), "\"", true); //$NON-NLS-1$ boolean withinQuotation = false; - String quotedString = ""; + String quotedString = ""; //$NON-NLS-1$ while (qTokenizer.hasMoreTokens()) { String curToken = qTokenizer.nextToken(); - if (curToken.equals("\"")) { + if (curToken.equals("\"")) { //$NON-NLS-1$ if (withinQuotation) { if (Constants .OS_WIN32 .equalsIgnoreCase(Platform.getOS())) { // need to quote URLs on Windows - tokenList.add("\"" + quotedString + "\""); + tokenList.add("\"" + quotedString + "\""); //$NON-NLS-1$ //$NON-NLS-2$ } else { // qotes prevent launching on Unix 35673 tokenList.add(quotedString); } } else { - quotedString = ""; + quotedString = ""; //$NON-NLS-1$ } withinQuotation = !withinQuotation; continue; @@ -135,11 +135,11 @@ public class CustomBrowser implements IBrowser { boolean substituted = false; for (int i = 0; i < tokenList.size(); i++) { String token = (String) tokenList.get(i); - if ("%1".equals(token)) { + if ("%1".equals(token)) { //$NON-NLS-1$ tokenList.set(i, url); substituted = true; - } else if ("\"%1\"".equals(token)) { - tokenList.set(i, "\"" + url + "\""); + } else if ("\"%1\"".equals(token)) { //$NON-NLS-1$ + tokenList.set(i, "\"" + url + "\""); //$NON-NLS-1$ //$NON-NLS-2$ substituted = true; } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java index 1473afcbe..ed8c380db 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java @@ -100,8 +100,8 @@ public class MozillaBrowserAdapter implements IBrowser { IPath pluginPath = HelpBasePlugin.getDefault().getStateLocation(); File outFile = pluginPath - .append("mozillaPositon") - .append("position.html") + .append("mozillaPositon") //$NON-NLS-1$ + .append("position.html") //$NON-NLS-1$ .toFile(); try { outFile.getParentFile().mkdirs(); @@ -110,24 +110,24 @@ public class MozillaBrowserAdapter implements IBrowser { new BufferedWriter( new OutputStreamWriter( new FileOutputStream(outFile), - "UTF8")), + "UTF8")), //$NON-NLS-1$ false); writer.println( - "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); - writer.println("<html><head>"); + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); //$NON-NLS-1$ + writer.println("<html><head>"); //$NON-NLS-1$ writer.println( - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"); - writer.print("<title></title><script language=\"JavaScript\">"); + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"); //$NON-NLS-1$ + writer.print("<title></title><script language=\"JavaScript\">"); //$NON-NLS-1$ if (setSizePending) - writer.print("window.resizeTo(" + width + "," + height + ");"); + writer.print("window.resizeTo(" + width + "," + height + ");"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (setLocationPending) - writer.print("window.moveTo(" + x + "," + y + ");"); - writer.print("location.replace(\"" + url + "\");"); - writer.print("</script></head><body>"); - writer.print("<a href=\"" + url + "\">--></a>"); - writer.print("</body></html>"); + writer.print("window.moveTo(" + x + "," + y + ");"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writer.print("location.replace(\"" + url + "\");"); //$NON-NLS-1$ //$NON-NLS-2$ + writer.print("</script></head><body>"); //$NON-NLS-1$ + writer.print("<a href=\"" + url + "\">--></a>"); //$NON-NLS-1$ //$NON-NLS-2$ + writer.print("</body></html>"); //$NON-NLS-1$ writer.close(); - return "file://" + outFile.getAbsolutePath(); + return "file://" + outFile.getAbsolutePath(); //$NON-NLS-1$ } catch (IOException ioe) { // return the original url return url; @@ -162,7 +162,7 @@ public class MozillaBrowserAdapter implements IBrowser { } catch (IOException e) { String msg = HelpBaseResources.getString( - "MozillaBrowserAdapter.executeFailed", + "MozillaBrowserAdapter.executeFailed", //$NON-NLS-1$ executableName); HelpBasePlugin.logError(msg, e); BaseHelpSystem.getDefaultErrorUtil().displayError(msg, uiThread); @@ -185,17 +185,17 @@ public class MozillaBrowserAdapter implements IBrowser { try { outputs.join(1000); if (outputs.getLastLine() != null - && (outputs.getLastLine().indexOf("No running window found") + && (outputs.getLastLine().indexOf("No running window found") //$NON-NLS-1$ >= 0 - || outputs.getLastLine().indexOf("not running on display") + || outputs.getLastLine().indexOf("not running on display") //$NON-NLS-1$ >= 0)) { return true; } errors.join(1000); if (errors.getLastLine() != null - && (errors.getLastLine().indexOf("No running window found") + && (errors.getLastLine().indexOf("No running window found") //$NON-NLS-1$ >= 0 - || errors.getLastLine().indexOf("not running on display") + || errors.getLastLine().indexOf("not running on display") //$NON-NLS-1$ >= 0)) { return true; } @@ -209,14 +209,14 @@ public class MozillaBrowserAdapter implements IBrowser { waitForBrowser(); if (exitRequested) return; - if (openBrowser(executable + " -remote openURL(" + url + ")") + if (openBrowser(executable + " -remote openURL(" + url + ")") //$NON-NLS-1$ //$NON-NLS-2$ == 0) { return; } if (exitRequested) return; browserFullyOpenedAt = System.currentTimeMillis() + DELAY; - openBrowser(executable + " " + url); + openBrowser(executable + " " + url); //$NON-NLS-1$ } private void waitForBrowser() { while (System.currentTimeMillis() < browserFullyOpenedAt) diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java index b9e57c3f4..b4ad58df4 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java @@ -30,11 +30,11 @@ public class MozillaFactory implements IBrowserFactory, IExecutableExtension { * @see IBrowserFactory#isAvailable() */ public boolean isAvailable() { - if (!isSupportedOS(System.getProperty("os.name"))) { + if (!isSupportedOS(System.getProperty("os.name"))) { //$NON-NLS-1$ return false; } try { - Process pr = Runtime.getRuntime().exec("which " + executable); + Process pr = Runtime.getRuntime().exec("which " + executable); //$NON-NLS-1$ StreamConsumer outputs = new StreamConsumer(pr.getInputStream()); (outputs).start(); StreamConsumer errors = new StreamConsumer(pr.getErrorStream()); @@ -67,13 +67,13 @@ public class MozillaFactory implements IBrowserFactory, IExecutableExtension { try { outputs.join(1000); if (outputs.getLastLine() != null - && outputs.getLastLine().indexOf("no " + executable + " in") + && outputs.getLastLine().indexOf("no " + executable + " in") //$NON-NLS-1$ //$NON-NLS-2$ >= 0) { return true; } errors.join(1000); if (errors.getLastLine() != null - && errors.getLastLine().indexOf("no " + executable + " in") + && errors.getLastLine().indexOf("no " + executable + " in") //$NON-NLS-1$ //$NON-NLS-2$ >= 0) { return true; } @@ -103,16 +103,16 @@ public class MozillaFactory implements IBrowserFactory, IExecutableExtension { throws CoreException { try { Hashtable params = (Hashtable) data; - executable = (String) params.get("executable"); - executableName = (String) params.get("executableName"); - osList = (String) params.get("os"); + executable = (String) params.get("executable"); //$NON-NLS-1$ + executableName = (String) params.get("executableName"); //$NON-NLS-1$ + osList = (String) params.get("os"); //$NON-NLS-1$ } catch (Exception e) { throw new CoreException( new Status( IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, IStatus.OK, - HelpBaseResources.getString("MozillaFactory.dataMissing"), + HelpBaseResources.getString("MozillaFactory.dataMissing"), //$NON-NLS-1$ e)); } } @@ -121,7 +121,7 @@ public class MozillaFactory implements IBrowserFactory, IExecutableExtension { // parameter missing return false; } - String[] OSes = osList.split(",\\s*"); + String[] OSes = osList.split(",\\s*"); //$NON-NLS-1$ for (int i = 0; i < OSes.length; i++) { if (os.toLowerCase().startsWith(OSes[i].toLowerCase())) { return true; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java index c5c6165f8..db142d46f 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java @@ -41,13 +41,13 @@ public class DefaultBrowserAdapter implements IBrowser { try { Runtime.getRuntime().exec( new String[] { - "/usr/bin/osascript", - "-e", - "open location \"" + url + "\"" }); + "/usr/bin/osascript", //$NON-NLS-1$ + "-e", //$NON-NLS-1$ + "open location \"" + url + "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ } catch (IOException ioe) { HelpBasePlugin.logError( HelpBaseResources.getString( - "DefaultBrowserAdapter.executeFailed"), + "DefaultBrowserAdapter.executeFailed"), //$NON-NLS-1$ ioe); } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java index bc28d1a2d..20b612ed5 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java @@ -44,7 +44,7 @@ public class AnalyzerDescriptor { if (this.luceneAnalyzer == null) { this.id = HelpBasePlugin.PLUGIN_ID - + "#" + + "#" //$NON-NLS-1$ + HelpBasePlugin .getDefault() .getBundle() @@ -91,16 +91,16 @@ public class AnalyzerDescriptor { IConfigurationElement configElements[] = Platform.getExtensionRegistry().getConfigurationElementsFor( HelpBasePlugin.PLUGIN_ID, - "luceneAnalyzer"); + "luceneAnalyzer"); //$NON-NLS-1$ for (int i = 0; i < configElements.length; i++) { - if (!configElements[i].getName().equals("analyzer")) + if (!configElements[i].getName().equals("analyzer")) //$NON-NLS-1$ continue; - String analyzerLocale = configElements[i].getAttribute("locale"); + String analyzerLocale = configElements[i].getAttribute("locale"); //$NON-NLS-1$ if (analyzerLocale == null || !analyzerLocale.equals(locale)) continue; try { Object analyzer = - configElements[i].createExecutableExtension("class"); + configElements[i].createExecutableExtension("class"); //$NON-NLS-1$ if (!(analyzer instanceof Analyzer)) continue; else { @@ -112,7 +112,7 @@ public class AnalyzerDescriptor { Platform.getBundle(pluginId) .getHeaders().get(Constants.BUNDLE_VERSION); this.luceneAnalyzer = (Analyzer) analyzer; - this.id = pluginId + "#" + pluginVersion; + this.id = pluginId + "#" + pluginVersion; //$NON-NLS-1$ this.lang = locale; if (HelpBasePlugin.PLUGIN_ID.equals(pluginId)) { // The analyzer is contributed by help plugin. @@ -126,8 +126,8 @@ public class AnalyzerDescriptor { } catch (CoreException ce) { HelpBasePlugin.logError( HelpBaseResources.getString( - "ES23", - configElements[i].getAttribute("class"), + "ES23", //$NON-NLS-1$ + configElements[i].getAttribute("class"), //$NON-NLS-1$ locale), ce); } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java index b15681516..361049265 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java @@ -39,36 +39,36 @@ public class Analyzer_en extends Analyzer { */ private final static String[] STOP_WORDS = { - "a", - "and", - "are", - "as", - "at", - "be", - "but", - "by", - "in", - "into", - "is", - "it", - "no", - "not", - "of", - "on", - "or", - "s", - "such", - "t", - "that", - "the", - "their", - "then", - "there", - "these", - "they", - "to", - "was", - "will", - "with" }; + "a", //$NON-NLS-1$ + "and", //$NON-NLS-1$ + "are", //$NON-NLS-1$ + "as", //$NON-NLS-1$ + "at", //$NON-NLS-1$ + "be", //$NON-NLS-1$ + "but", //$NON-NLS-1$ + "by", //$NON-NLS-1$ + "in", //$NON-NLS-1$ + "into", //$NON-NLS-1$ + "is", //$NON-NLS-1$ + "it", //$NON-NLS-1$ + "no", //$NON-NLS-1$ + "not", //$NON-NLS-1$ + "of", //$NON-NLS-1$ + "on", //$NON-NLS-1$ + "or", //$NON-NLS-1$ + "s", //$NON-NLS-1$ + "such", //$NON-NLS-1$ + "t", //$NON-NLS-1$ + "that", //$NON-NLS-1$ + "the", //$NON-NLS-1$ + "their", //$NON-NLS-1$ + "then", //$NON-NLS-1$ + "there", //$NON-NLS-1$ + "these", //$NON-NLS-1$ + "they", //$NON-NLS-1$ + "to", //$NON-NLS-1$ + "was", //$NON-NLS-1$ + "will", //$NON-NLS-1$ + "with" }; //$NON-NLS-1$ } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java index e2c0dee90..f4f43d5a8 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java @@ -52,7 +52,7 @@ public class DefaultAnalyzer extends Analyzer { } if (locale == null && userLocale.getCountry().length() > 0) { // Check if at least the language is supported by BreakIterator - Locale language = new Locale(userLocale.getLanguage(), ""); + Locale language = new Locale(userLocale.getLanguage(), ""); //$NON-NLS-1$ for (int i = 0; i < availableLocales.length; i++) { if (language.equals(availableLocales[i])) { locale = language; @@ -64,9 +64,9 @@ public class DefaultAnalyzer extends Analyzer { if (locale == null) { // Locale is not supported, will use en_US HelpBasePlugin.logError( - HelpBaseResources.getString("ES24", localeString), + HelpBaseResources.getString("ES24", localeString), //$NON-NLS-1$ null); - locale = new Locale("en", "US"); + locale = new Locale("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$ } } /** @@ -88,9 +88,9 @@ public class DefaultAnalyzer extends Analyzer { clientLocale = Locale.getDefault().toString(); // break the string into tokens to get the Locale object - StringTokenizer locales = new StringTokenizer(clientLocale, "_"); + StringTokenizer locales = new StringTokenizer(clientLocale, "_"); //$NON-NLS-1$ if (locales.countTokens() == 1) - return new Locale(locales.nextToken(), ""); + return new Locale(locales.nextToken(), ""); //$NON-NLS-1$ else if (locales.countTokens() == 2) return new Locale(locales.nextToken(), locales.nextToken()); else if (locales.countTokens() == 3) diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java index 751065cdc..8a9c75d32 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java @@ -30,12 +30,12 @@ public class HTMLDocParser { private static final int MAX_OFFSET = 2048; // elements, atributes and values contstants - final String ELEMENT_META = "META"; - final String ELEMENT_BODY = "body"; - final String ELEMENT_HEAD = "head"; - final String ATTRIBUTE_HTTP = "http-equiv"; - final String ATTRIBUTE_HTTP_VALUE = "content-type"; - final String ATTRIBUTE_CONTENT = "content"; + final String ELEMENT_META = "META"; //$NON-NLS-1$ + final String ELEMENT_BODY = "body"; //$NON-NLS-1$ + final String ELEMENT_HEAD = "head"; //$NON-NLS-1$ + final String ATTRIBUTE_HTTP = "http-equiv"; //$NON-NLS-1$ + final String ATTRIBUTE_HTTP_VALUE = "content-type"; //$NON-NLS-1$ + final String ATTRIBUTE_CONTENT = "content"; //$NON-NLS-1$ // states for parsing elements final int STATE_ELEMENT_START = 0; @@ -78,11 +78,11 @@ public class HTMLDocParser { if (HelpBasePlugin.DEBUG_SEARCH) { System.out.println( this.getClass().getName() - + " JVM does not support encoding " + + " JVM does not support encoding " //$NON-NLS-1$ + encoding - + " specified in document " + + " specified in document " //$NON-NLS-1$ + url.getPath() - + ". Default encoding will be used during indexing."); + + ". Default encoding will be used during indexing."); //$NON-NLS-1$ } htmlParser = new HTMLParser(new InputStreamReader(inputStream)); } @@ -90,9 +90,9 @@ public class HTMLDocParser { if (HelpBasePlugin.DEBUG_SEARCH) { System.out.println( this.getClass().getName() - + " Encoding not found in document " + + " Encoding not found in document " //$NON-NLS-1$ + url.getPath() - + ". Default encoding will be used during indexing."); + + ". Default encoding will be used during indexing."); //$NON-NLS-1$ } htmlParser = new HTMLParser(new InputStreamReader(inputStream)); } @@ -115,7 +115,7 @@ public class HTMLDocParser { try { return htmlParser.getTitle(); } catch (InterruptedException ie) { - return ""; + return ""; //$NON-NLS-1$ } } public String getSummary() throws IOException { @@ -125,7 +125,7 @@ public class HTMLDocParser { try { return htmlParser.getSummary(); } catch (InterruptedException ie) { - return ""; + return ""; //$NON-NLS-1$ } } public Reader getContentReader() throws IOException { @@ -365,12 +365,12 @@ public class HTMLDocParser { * or null if parameter does not exist */ public String getCharsetFromHTTP(String contentValue) { - StringTokenizer t = new StringTokenizer(contentValue, ";"); + StringTokenizer t = new StringTokenizer(contentValue, ";"); //$NON-NLS-1$ while (t.hasMoreTokens()) { String parameter = t.nextToken().trim(); - if (parameter.toLowerCase().startsWith("charset=")) { + if (parameter.toLowerCase().startsWith("charset=")) { //$NON-NLS-1$ String charset = - parameter.substring("charset=".length()).trim(); + parameter.substring("charset=".length()).trim(); //$NON-NLS-1$ if (charset.length() > 0) { return charset; } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java index 825b3cae7..fe3cc54d3 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java @@ -84,7 +84,7 @@ class IndexingOperation { } LazyProgressMonitor monitor = new LazyProgressMonitor(pm); - monitor.beginTask("", workTotal); + monitor.beginTask("", workTotal); //$NON-NLS-1$ removeDocuments(monitor, removedDocs); addDocuments(monitor, addedDocs); monitor.done(); @@ -102,7 +102,7 @@ class IndexingOperation { try { checkCancelled(pm); pm.worked((numRemoved + numAdded) * WORK_PREPARE); - pm.subTask(HelpBaseResources.getString("UpdatingIndex")); + pm.subTask(HelpBaseResources.getString("UpdatingIndex")); //$NON-NLS-1$ for (Iterator it = addedDocs.iterator(); it.hasNext();) { URL doc = (URL) it.next(); index.addDocument(getName(doc), doc); @@ -111,12 +111,12 @@ class IndexingOperation { } } catch (OperationCanceledException oce) { // Need to perform rollback on the index - pm.subTask(HelpBaseResources.getString("Undoing_document_adds")); + pm.subTask(HelpBaseResources.getString("Undoing_document_adds")); //$NON-NLS-1$ // if (!index.abortUpdate()) // throw new Exception(); throw oce; } - pm.subTask(HelpBaseResources.getString("Writing_index")); + pm.subTask(HelpBaseResources.getString("Writing_index")); //$NON-NLS-1$ if (!index.endAddBatch()) throw new IndexingException(); } @@ -124,7 +124,7 @@ class IndexingOperation { private void removeDocuments(IProgressMonitor pm, Collection removedDocs) throws IndexingException { - pm.subTask(HelpBaseResources.getString("Preparing_for_indexing")); + pm.subTask(HelpBaseResources.getString("Preparing_for_indexing")); //$NON-NLS-1$ checkCancelled(pm); if (numRemoved > 0) { @@ -133,7 +133,7 @@ class IndexingOperation { try { checkCancelled(pm); pm.worked((numRemoved + numAdded) * WORK_PREPARE); - pm.subTask(HelpBaseResources.getString("UpdatingIndex")); + pm.subTask(HelpBaseResources.getString("UpdatingIndex")); //$NON-NLS-1$ for (Iterator it = removedDocs.iterator(); it.hasNext();) { URL doc = (URL) it.next(); index.removeDocument(getName(doc)); @@ -142,7 +142,7 @@ class IndexingOperation { } } catch (OperationCanceledException oce) { // Need to perform rollback on the index - pm.subTask(HelpBaseResources.getString("Undoing_document_deletions")); + pm.subTask(HelpBaseResources.getString("Undoing_document_deletions")); //$NON-NLS-1$ // if (!index.abortUpdate()) // throw new Exception(); throw oce; @@ -183,7 +183,7 @@ class IndexingOperation { String doc = (String) docs.next(); // Assume the url is /pluginID/path_to_topic.html int i = doc.indexOf('/', 1); - String plugin = i == -1 ? "" : doc.substring(1, i); + String plugin = i == -1 ? "" : doc.substring(1, i); //$NON-NLS-1$ if (!addedPlugins.contains(plugin)) { continue; } @@ -214,7 +214,7 @@ class IndexingOperation { String doc = (String) docs.next(); // Assume the url is /pluginID/path_to_topic.html int i = doc.indexOf('/', 1); - String plugin = i == -1 ? "" : doc.substring(1, i); + String plugin = i == -1 ? "" : doc.substring(1, i); //$NON-NLS-1$ if (!removedPlugins.contains(plugin)) { continue; } @@ -231,7 +231,7 @@ class IndexingOperation { */ private void add(ITopic topic, Set hrefs) { String href = topic.getHref(); - if (href != null && !href.equals("") && !href.startsWith("http://")) + if (href != null && !href.equals("") && !href.startsWith("http://")) //$NON-NLS-1$ //$NON-NLS-2$ hrefs.add(href); ITopic[] subtopics = topic.getSubtopics(); for (int i = 0; i < subtopics.length; i++) @@ -268,15 +268,15 @@ class IndexingOperation { */ private URL getIndexableURL(String url) { String fileName = url.toLowerCase(); - if (fileName.endsWith(".htm") - || fileName.endsWith(".html") - || fileName.endsWith(".txt") - || fileName.endsWith(".xml")) { + if (fileName.endsWith(".htm") //$NON-NLS-1$ + || fileName.endsWith(".html") //$NON-NLS-1$ + || fileName.endsWith(".txt") //$NON-NLS-1$ + || fileName.endsWith(".xml")) { //$NON-NLS-1$ // indexable } else if ( - fileName.indexOf(".htm#") >= 0 - || fileName.indexOf(".html#") >= 0 - || fileName.indexOf(".xml#") >= 0) { + fileName.indexOf(".htm#") >= 0 //$NON-NLS-1$ + || fileName.indexOf(".html#") >= 0 //$NON-NLS-1$ + || fileName.indexOf(".xml#") >= 0) { //$NON-NLS-1$ url = url.substring(0, url.lastIndexOf('#')); // its a fragment, index whole document } else { @@ -287,10 +287,10 @@ class IndexingOperation { try { //return new URL("help:" + url + "?lang=" + index.getLocale()); return new URL( - "help", + "help", //$NON-NLS-1$ null, -1, - url + "?lang=" + index.getLocale(), + url + "?lang=" + index.getLocale(), //$NON-NLS-1$ HelpURLStreamHandler.getDefault()); } catch (MalformedURLException mue) { diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java index 13bbb21c2..ec088f247 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java @@ -22,7 +22,7 @@ import org.osgi.framework.*; */ public class PluginVersionInfo extends HelpProperties { // Separates plugins and versions in value strings - static final String SEPARATOR = "\n"; + static final String SEPARATOR = "\n"; //$NON-NLS-1$ File dir; boolean doComparison = true; boolean hasChanged = false; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java index f22c1e538..f032832b3 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java @@ -47,7 +47,7 @@ public class QueryBuilder { this.locale = new Locale(language.substring(0, 2), language .substring(3, 5)); } else { - this.locale = new Locale(language.substring(0, 2), ""); + this.locale = new Locale(language.substring(0, 2), ""); //$NON-NLS-1$ } this.analyzerDesc = analyzerDesc; this.analyzer = analyzerDesc.getAnalyzer(); @@ -59,15 +59,15 @@ public class QueryBuilder { List tokenList = new ArrayList(); //Divide along quotation marks StringTokenizer qTokenizer = new StringTokenizer(searchWords.trim(), - "\"", true); + "\"", true); //$NON-NLS-1$ boolean withinQuotation = false; - String quotedString = ""; + String quotedString = ""; //$NON-NLS-1$ int termCount = 0; // keep track of number of terms to disallow too many int orCount = 0; // keep track of number of ORs to disallow too many while (qTokenizer.hasMoreTokens()) { String curToken = qTokenizer.nextToken(); - if (curToken.equals("\"")) { + if (curToken.equals("\"")) { //$NON-NLS-1$ if (withinQuotation) { // check for too many terms if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER @@ -76,7 +76,7 @@ public class QueryBuilder { } tokenList.add(QueryWordsToken.exactPhrase(quotedString)); } else { - quotedString = ""; + quotedString = ""; //$NON-NLS-1$ } withinQuotation = !withinQuotation; continue; @@ -142,7 +142,7 @@ public class QueryBuilder { // wild card not allowed as the first character } } else { - List wordList = analyzeText(analyzer, "contents", + List wordList = analyzeText(analyzer, "contents", //$NON-NLS-1$ token.value); if (wordList.size() > 0) { if (!highlightWords.contains(token.value)) { @@ -176,7 +176,7 @@ public class QueryBuilder { // which would result in common characters // highlighted all over (bug 30263) if (!analyzerDesc.getId().startsWith( - HelpBasePlugin.PLUGIN_ID + "#")) { + HelpBasePlugin.PLUGIN_ID + "#")) { //$NON-NLS-1$ if (!highlightWords.contains(word)) { highlightWords.add(word); } @@ -194,7 +194,7 @@ public class QueryBuilder { || token.type == QueryWordsToken.NOT) newTokens.add(token); else if (token.type == QueryWordsToken.EXACT_PHRASE) { - List wordList = analyzeText(analyzer, "exact_contents", + List wordList = analyzeText(analyzer, "exact_contents", //$NON-NLS-1$ token.value); if (wordList.size() > 0) { if (!highlightWords.contains(token.value)) { @@ -384,7 +384,7 @@ public class QueryBuilder { fields[i] = (String) fieldNamesIt.next(); boosts[i] = 5.0f; } - fields[fieldNames.size()] = "contents"; + fields[fieldNames.size()] = "contents"; //$NON-NLS-1$ boosts[fieldNames.size()] = 1.0f; } Query query = getLuceneQuery(fields, boosts); @@ -430,7 +430,7 @@ public class QueryBuilder { for (Iterator it = highlightWords.iterator(); it.hasNext();) { buf.append('"'); buf.append(it.next()); - buf.append("\" "); + buf.append("\" "); //$NON-NLS-1$ } return buf.toString(); } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java index a9ac202f1..9ffdf6f4f 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java @@ -19,7 +19,7 @@ import org.apache.lucene.search.*; public class QueryWordsExactPhrase extends QueryWordsToken { private List words; public QueryWordsExactPhrase() { - super(QueryWordsToken.EXACT_PHRASE, ""); + super(QueryWordsToken.EXACT_PHRASE, ""); //$NON-NLS-1$ words = new ArrayList(); } public void addWord(String word) { @@ -27,7 +27,7 @@ public class QueryWordsExactPhrase extends QueryWordsToken { if (words.size() <= 1) value = word; else - value += " " + word; + value += " " + word; //$NON-NLS-1$ } public List getWords() { return words; @@ -41,7 +41,7 @@ public class QueryWordsExactPhrase extends QueryWordsToken { for (Iterator it = getWords().iterator(); it.hasNext();) { String word = (String) it.next(); - Term t = new Term("exact_"+field, word); + Term t = new Term("exact_"+field, word); //$NON-NLS-1$ q.add(t); q.setBoost(boost); } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java index 476ca5eb1..3ef9ab284 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java @@ -20,7 +20,7 @@ import org.apache.lucene.search.*; public class QueryWordsPhrase extends QueryWordsToken { private List words; public QueryWordsPhrase() { - super(QueryWordsToken.PHRASE, ""); + super(QueryWordsToken.PHRASE, ""); //$NON-NLS-1$ words = new ArrayList(); } public void addWord(String word) { @@ -28,7 +28,7 @@ public class QueryWordsPhrase extends QueryWordsToken { if (words.size() <= 1) value = word; else - value += " " + word; + value += " " + word; //$NON-NLS-1$ } public List getWords() { return words; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java index 0ef082f76..64a5a3d03 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java @@ -21,9 +21,9 @@ public class QueryWordsToken { public static final int EXACT_PHRASE = 3; public static final int PHRASE = 4; public static final int WORD = 5; - private static final QueryWordsToken fAND = new QueryWordsToken(AND, "AND"); - private static final QueryWordsToken fOR = new QueryWordsToken(OR, "OR"); - private static final QueryWordsToken fNOT = new QueryWordsToken(NOT, "NOT"); + private static final QueryWordsToken fAND = new QueryWordsToken(AND, "AND"); //$NON-NLS-1$ + private static final QueryWordsToken fOR = new QueryWordsToken(OR, "OR"); //$NON-NLS-1$ + private static final QueryWordsToken fNOT = new QueryWordsToken(NOT, "NOT"); //$NON-NLS-1$ public int type; public String value; protected QueryWordsToken(int type, String value) { @@ -39,11 +39,11 @@ public class QueryWordsToken { int starPos = value.indexOf('*'); if (questionPos >= 0 || starPos >= 0) { if (questionPos == -1 && starPos == value.length() - 1) { - Term t = new Term("exact_" + field, value.substring(0, starPos)); + Term t = new Term("exact_" + field, value.substring(0, starPos)); //$NON-NLS-1$ q = new PrefixQuery(t); ((PrefixQuery) q).setBoost(boost); } else { - Term t = new Term("exact_" + field, value); + Term t = new Term("exact_" + field, value); //$NON-NLS-1$ q = new WildcardQuery(t); ((WildcardQuery) q).setBoost(boost); } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java index 8b43a960d..1d0c6f993 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java @@ -37,10 +37,10 @@ public class SearchIndex { private PluginVersionInfo docPlugins; // table of all document names, used during indexing batches private HelpProperties indexedDocs; - private static final String INDEXED_CONTRIBUTION_INFO_FILE = "indexed_contributions"; - public static final String INDEXED_DOCS_FILE = "indexed_docs"; - private static final String DEPENDENCIES_VERSION_FILENAME = "indexed_dependencies"; - private static final String LUCENE_PLUGIN_ID = "org.apache.lucene"; + private static final String INDEXED_CONTRIBUTION_INFO_FILE = "indexed_contributions"; //$NON-NLS-1$ + public static final String INDEXED_DOCS_FILE = "indexed_docs"; //$NON-NLS-1$ + private static final String DEPENDENCIES_VERSION_FILENAME = "indexed_dependencies"; //$NON-NLS-1$ + private static final String LUCENE_PLUGIN_ID = "org.apache.lucene"; //$NON-NLS-1$ private File inconsistencyFile; private HTMLDocParser parser; private IndexSearcher searcher; @@ -64,9 +64,9 @@ public class SearchIndex { this.analyzerDescriptor = analyzerDesc; this.tocManager = tocManager; indexDir = new File(HelpBasePlugin.getConfigurationDirectory(), - "index/" + locale); + "index/" + locale); //$NON-NLS-1$ inconsistencyFile = new File(indexDir.getParentFile(), locale - + ".inconsistent"); + + ".inconsistent"); //$NON-NLS-1$ parser = new HTMLDocParser(); if (!exists()) { if (tryLock()) { @@ -91,39 +91,39 @@ public class SearchIndex { */ public boolean addDocument(String name, URL url) { if (HelpBasePlugin.DEBUG_SEARCH) { - System.out.println("SearchIndex.addDocument(" + name + ", " + url - + ")"); + System.out.println("SearchIndex.addDocument(" + name + ", " + url //$NON-NLS-1$ //$NON-NLS-2$ + + ")"); //$NON-NLS-1$ } try { Document doc = new Document(); - doc.add(Field.Keyword("name", name)); + doc.add(Field.Keyword("name", name)); //$NON-NLS-1$ try { try { parser.openDocument(url); } catch (IOException ioe) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES25", + HelpBasePlugin.logError(HelpBaseResources.getString("ES25", //$NON-NLS-1$ name), null); return false; } ParsedDocument parsed = new ParsedDocument(parser .getContentReader()); - doc.add(Field.Text("contents", parsed.newContentReader())); + doc.add(Field.Text("contents", parsed.newContentReader())); //$NON-NLS-1$ doc - .add(Field.Text("exact_contents", parsed + .add(Field.Text("exact_contents", parsed //$NON-NLS-1$ .newContentReader())); String title = parser.getTitle(); - doc.add(Field.UnStored("title", title)); - doc.add(Field.UnStored("exact_title", title)); - doc.add(Field.UnIndexed("raw_title", title)); + doc.add(Field.UnStored("title", title)); //$NON-NLS-1$ + doc.add(Field.UnStored("exact_title", title)); //$NON-NLS-1$ + doc.add(Field.UnIndexed("raw_title", title)); //$NON-NLS-1$ // doc.add(Field.UnIndexed("summary", parser.getSummary())); iw.addDocument(doc); } finally { parser.closeDocument(); } - indexedDocs.put(name, "0"); + indexedDocs.put(name, "0"); //$NON-NLS-1$ return true; } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES16", name, + HelpBasePlugin.logError(HelpBaseResources.getString("ES16", name, //$NON-NLS-1$ indexDir.getAbsolutePath()), e); return false; } @@ -152,7 +152,7 @@ public class SearchIndex { iw.maxFieldLength = 1000000; return true; } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES17"), e); + HelpBasePlugin.logError(HelpBaseResources.getString("ES17"), e); //$NON-NLS-1$ return false; } } @@ -170,7 +170,7 @@ public class SearchIndex { ir = IndexReader.open(indexDir); return true; } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES18"), e); + HelpBasePlugin.logError(HelpBaseResources.getString("ES18"), e); //$NON-NLS-1$ return false; } } @@ -183,14 +183,14 @@ public class SearchIndex { */ public boolean removeDocument(String name) { if (HelpBasePlugin.DEBUG_SEARCH) { - System.out.println("SearchIndex.removeDocument(" + name + ")"); + System.out.println("SearchIndex.removeDocument(" + name + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } - Term term = new Term("name", name); + Term term = new Term("name", name); //$NON-NLS-1$ try { ir.delete(term); indexedDocs.remove(name); } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES22", name, + HelpBasePlugin.logError(HelpBaseResources.getString("ES22", name, //$NON-NLS-1$ indexDir.getAbsolutePath()), e); return false; } @@ -215,7 +215,7 @@ public class SearchIndex { setInconsistent(false); return true; } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES19"), e); + HelpBasePlugin.logError(HelpBaseResources.getString("ES19"), e); //$NON-NLS-1$ return false; } } @@ -237,7 +237,7 @@ public class SearchIndex { setInconsistent(false); return true; } catch (IOException e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES20"), e); + HelpBasePlugin.logError(HelpBaseResources.getString("ES20"), e); //$NON-NLS-1$ return false; } } @@ -288,7 +288,7 @@ public class SearchIndex { } catch (QueryTooComplexException qe) { throw qe; } catch (Exception e) { - HelpBasePlugin.logError(HelpBaseResources.getString("ES21", + HelpBasePlugin.logError(HelpBaseResources.getString("ES21", //$NON-NLS-1$ searchQuery.getSearchWord()), e); } finally { unregisterSearch(Thread.currentThread()); @@ -338,9 +338,9 @@ public class SearchIndex { * Gets analyzer identifier from a file. */ private String readAnalyzerId() { - String analyzerVersion = getDependencies().getProperty("analyzer"); + String analyzerVersion = getDependencies().getProperty("analyzer"); //$NON-NLS-1$ if (analyzerVersion == null) { - return ""; + return ""; //$NON-NLS-1$ } return analyzerVersion; } @@ -348,8 +348,8 @@ public class SearchIndex { * Gets Lucene plugin version from a file. */ private boolean isLuceneCompatible() { - String usedLuceneVersion = getDependencies().getProperty("lucene"); - String currentLuceneVersion = ""; + String usedLuceneVersion = getDependencies().getProperty("lucene"); //$NON-NLS-1$ + String currentLuceneVersion = ""; //$NON-NLS-1$ Bundle lucenePluginDescriptor = Platform.getBundle(LUCENE_PLUGIN_ID); if (lucenePluginDescriptor != null) { currentLuceneVersion += (String) lucenePluginDescriptor @@ -363,14 +363,14 @@ public class SearchIndex { * Saves Lucene version and analyzer identifier to a file. */ private void saveDependencies() { - getDependencies().put("analyzer", analyzerDescriptor.getId()); + getDependencies().put("analyzer", analyzerDescriptor.getId()); //$NON-NLS-1$ Bundle luceneBundle = Platform.getBundle(LUCENE_PLUGIN_ID); if (luceneBundle != null) { - String luceneBundleVersion = "" + String luceneBundleVersion = "" //$NON-NLS-1$ + luceneBundle.getHeaders().get(Constants.BUNDLE_VERSION); - getDependencies().put("lucene", luceneBundleVersion); + getDependencies().put("lucene", luceneBundleVersion); //$NON-NLS-1$ } else { - getDependencies().put("lucene", ""); + getDependencies().put("lucene", ""); //$NON-NLS-1$ //$NON-NLS-2$ } getDependencies().save(); } @@ -437,12 +437,12 @@ public class SearchIndex { */ private void unzipProductIndex() { String indexPluginId = HelpBasePlugin.getDefault() - .getPluginPreferences().getString("productIndex"); + .getPluginPreferences().getString("productIndex"); //$NON-NLS-1$ if (indexPluginId == null || indexPluginId.length() <= 0) { return; } InputStream zipIn = ResourceLocator.openFromPlugin(indexPluginId, - "doc_index.zip", getLocale()); + "doc_index.zip", getLocale()); //$NON-NLS-1$ if (zipIn == null) { return; } @@ -460,8 +460,8 @@ public class SearchIndex { } // if it is a file, extract it String filePath = zEntry.getName(); - int lastSeparator = filePath.lastIndexOf("/"); - String fileDir = ""; + int lastSeparator = filePath.lastIndexOf("/"); //$NON-NLS-1$ + String fileDir = ""; //$NON-NLS-1$ if (lastSeparator >= 0) { fileDir = filePath.substring(0, lastSeparator); } @@ -477,8 +477,8 @@ public class SearchIndex { fos.close(); } if (HelpBasePlugin.DEBUG_SEARCH) { - System.out.println("SearchIndex: Prebuilt index restored to " - + destDir + "."); + System.out.println("SearchIndex: Prebuilt index restored to " //$NON-NLS-1$ + + destDir + "."); //$NON-NLS-1$ } } catch (IOException ioe) { if (fos != null) { @@ -529,10 +529,10 @@ public class SearchIndex { } public boolean tryLock() { File lockFile = new File(indexDir.getParentFile(), locale - + ".lock"); + + ".lock"); //$NON-NLS-1$ lockFile.getParentFile().mkdirs(); try { - RandomAccessFile raf = new RandomAccessFile(lockFile, "rw"); + RandomAccessFile raf = new RandomAccessFile(lockFile, "rw"); //$NON-NLS-1$ FileLock l = raf.getChannel().tryLock(); if(l!=null){ lock = l; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java index 555d4a217..3f41269bb 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java @@ -89,7 +89,7 @@ public class SearchManager implements ITocsChangedListener{ if (HelpBasePlugin.DEBUG_SEARCH) { System.out.println( this.getClass().getName() - + " IndexUpdateException occurred."); + + " IndexUpdateException occurred."); //$NON-NLS-1$ } } index.search(searchQuery, collector); @@ -113,7 +113,7 @@ public class SearchManager implements ITocsChangedListener{ } try { if (useLock && !configurationLocked) { - pm.beginTask("", 1); + pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); return; @@ -124,7 +124,7 @@ public class SearchManager implements ITocsChangedListener{ // to prevent showing progress on first search after launch // if no indexing is needed if (index.isClosed() || !index.needsUpdating()) { - pm.beginTask("", 1); + pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); return; @@ -150,19 +150,19 @@ public class SearchManager implements ITocsChangedListener{ */ private synchronized void updateIndex(IProgressMonitor pm, SearchIndex index, ProgressDistributor progressDistrib) throws IndexingException { if (index.isClosed() || !index.needsUpdating()) { - pm.beginTask("", 1); + pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); return; } if (HelpBasePlugin.DEBUG_SEARCH) { - System.out.println("SearchManager indexing " + index.getLocale()); + System.out.println("SearchManager indexing " + index.getLocale()); //$NON-NLS-1$ } // Perform indexing try { PluginVersionInfo versions = index.getDocPlugins(); if (versions == null) { - pm.beginTask("", 1); + pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); return; @@ -173,7 +173,7 @@ public class SearchManager implements ITocsChangedListener{ } catch (OperationCanceledException oce) { progressDistrib.operationCanceled(); HelpBasePlugin.logWarning(HelpBaseResources - .getString("Search_cancelled")); + .getString("Search_cancelled")); //$NON-NLS-1$ throw oce; } } @@ -198,7 +198,7 @@ public class SearchManager implements ITocsChangedListener{ synchronized(indexes){ indexes.remove(ix.getLocale()); ProgressDistributor pm = ix.getProgressDistributor(); - pm.beginTask("", 1); + pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); SearchProgressMonitor.reinit(ix.getLocale()); diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java index 87f22e1c2..6096b4a33 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java @@ -159,14 +159,14 @@ public class SearchProgressMonitor implements IProgressMonitor { progressMonitors.remove(locale); if (HelpBasePlugin.getDefault() != null) { HelpBasePlugin.logError(HelpBaseResources - .getString("search_index_update_error"), e); + .getString("search_index_update_error"), e); //$NON-NLS-1$ } else { // Plugin has been shut down } } } }); - indexer.setName("HelpSearchIndexer"); + indexer.setName("HelpSearchIndexer"); //$NON-NLS-1$ indexer.start(); // give pm chance to start // this will avoid seing progress if there is no work to do @@ -197,7 +197,7 @@ public class SearchProgressMonitor implements IProgressMonitor { * Obtains search word (user query) */ public String getSearchWord() { - return "dummy"; + return "dummy"; //$NON-NLS-1$ } /** * @return true if search only in specified fields, not the default field diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java index 9263edc9e..7fdfefedf 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java @@ -23,7 +23,7 @@ public class SearchQuery implements ISearchQuery { String locale; String searchWord; public SearchQuery() { - this("", false, new ArrayList(), Platform.getNL()); + this("", false, new ArrayList(), Platform.getNL()); //$NON-NLS-1$ } public SearchQuery( String searchWord, diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java index 25eb20b44..c9eb559d6 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java @@ -56,7 +56,7 @@ public class SearchResults implements ISearchHitCollector { } catch (IOException ioe) { continue; } - String href = doc.get("name"); + String href = doc.get("name"); //$NON-NLS-1$ IToc toc = null; // the TOC containing the topic AdaptableHelpResource scope = null; @@ -87,8 +87,8 @@ public class SearchResults implements ISearchHitCollector { } // Set the document label - String label = doc.get("raw_title"); - if ("".equals(label) && toc != null) { + String label = doc.get("raw_title"); //$NON-NLS-1$ + if ("".equals(label) && toc != null) { //$NON-NLS-1$ ITopic t; if (scope != null) { t = scope.getTopic(href); @@ -99,12 +99,12 @@ public class SearchResults implements ISearchHitCollector { label=t.getLabel(); } } - if (label == null || "".equals(label)){ + if (label == null || "".equals(label)){ //$NON-NLS-1$ label = href; } // Set document href - href = href + "?resultof=" + urlEncodedWords; + href = href + "?resultof=" + urlEncodedWords; //$NON-NLS-1$ searchHitList.add(new SearchHit(href, label, score, toc)); } searchHits = diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java index be8b555b7..e34fd9944 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java @@ -37,7 +37,7 @@ public class SmartAnalyzer extends Analyzer { * and to plugged-in analyzer for other fields. */ public final TokenStream tokenStream(String fieldName, Reader reader) { - if (fieldName != null && fieldName.startsWith("exact_")) { + if (fieldName != null && fieldName.startsWith("exact_")) { //$NON-NLS-1$ return exactAnalyzer.tokenStream(fieldName, reader); } return pluggedInAnalyzer.tokenStream(fieldName, reader); diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java index bf0da8795..90615d353 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java @@ -37,7 +37,7 @@ public class Eclipse extends Thread { public Eclipse(EclipseLifeCycleListener listener) { super(); this.lifeCycleListener = listener; - this.setName("Eclipse"); + this.setName("Eclipse"); //$NON-NLS-1$ this.dir = Options.getEclipseHome(); } private void prepareCommand() throws Exception { @@ -55,13 +55,13 @@ public class Eclipse extends Thread { List eclipseArgs = Options.getEclipseArgs(); cmdarray = new String[3 + vmArgs.size() + 1 + eclipseArgs.size()]; cmdarray[0] = - new File(Options.getEclipseHome(), "eclipse").getAbsolutePath(); - cmdarray[1] = "-vm"; + new File(Options.getEclipseHome(), "eclipse").getAbsolutePath(); //$NON-NLS-1$ + cmdarray[1] = "-vm"; //$NON-NLS-1$ cmdarray[2] = Options.getVm(); for (int i = 0; i < eclipseArgs.size(); i++) { cmdarray[3 + i] = (String) eclipseArgs.get(i); } - cmdarray[3 + eclipseArgs.size()] = "-vmargs"; + cmdarray[3 + eclipseArgs.size()] = "-vmargs"; //$NON-NLS-1$ for (int i = 0; i < vmArgs.size(); i++) { cmdarray[4 + eclipseArgs.size() + i] = (String) vmArgs.get(i); } @@ -74,9 +74,9 @@ public class Eclipse extends Thread { for (int i = 0; i < vmArgs.size(); i++) { cmdarray[1 + i] = (String) vmArgs.get(i); } - cmdarray[1 + vmArgs.size()] = "-cp"; - cmdarray[2 + vmArgs.size()] = "startup.jar"; - cmdarray[3 + vmArgs.size()] = "org.eclipse.core.launcher.Main"; + cmdarray[1 + vmArgs.size()] = "-cp"; //$NON-NLS-1$ + cmdarray[2 + vmArgs.size()] = "startup.jar"; //$NON-NLS-1$ + cmdarray[3 + vmArgs.size()] = "org.eclipse.core.launcher.Main"; //$NON-NLS-1$ for (int i = 0; i < eclipseArgs.size(); i++) { cmdarray[4 + vmArgs.size() + i] = (String) eclipseArgs.get(i); } @@ -104,10 +104,10 @@ public class Eclipse extends Thread { } if (Options.isDebug()) { System.out.println( - "Eclipse exited with status code " + pr.exitValue()); + "Eclipse exited with status code " + pr.exitValue()); //$NON-NLS-1$ if (pr.exitValue() == NEEDS_RESTART) { System.out.println( - "Updates are installed, Eclipse will be restarted."); + "Updates are installed, Eclipse will be restarted."); //$NON-NLS-1$ } } } while (pr.exitValue() == NEEDS_RESTART); @@ -131,7 +131,7 @@ public class Eclipse extends Thread { BufferedReader bReader; public StreamConsumer(InputStream inputStream) { super(); - this.setName("Eclipse out/err consumer"); + this.setName("Eclipse out/err consumer"); //$NON-NLS-1$ this.setDaemon(true); bReader = new BufferedReader(new InputStreamReader(inputStream)); } @@ -152,7 +152,7 @@ public class Eclipse extends Thread { if (vmExe.exists() && !vmExe.isDirectory()) { return; } - vmExe = new File(Options.getVm() + ".exe"); + vmExe = new File(Options.getVm() + ".exe"); //$NON-NLS-1$ if (vmExe.exists() && !vmExe.isDirectory()) { return; } @@ -165,10 +165,10 @@ public class Eclipse extends Thread { File eclipseExe = new File( Options.getEclipseHome(), - "eclipse" - + (System.getProperty("os.name").startsWith("Win") - ? ".exe" - : "")); + "eclipse" //$NON-NLS-1$ + + (System.getProperty("os.name").startsWith("Win") //$NON-NLS-1$ //$NON-NLS-2$ + ? ".exe" //$NON-NLS-1$ + : "")); //$NON-NLS-1$ if (eclipseExe.exists() && !eclipseExe.isDirectory()) { return; } @@ -178,7 +178,7 @@ public class Eclipse extends Thread { + " does not exists. Pass a correct -eclipsehome option"); } private void ensureStartupJarExists() throws Exception { - File startupJar = new File(Options.getEclipseHome(), "startup.jar"); + File startupJar = new File(Options.getEclipseHome(), "startup.jar"); //$NON-NLS-1$ if (startupJar.exists() && !startupJar.isDirectory()) { return; } @@ -203,7 +203,7 @@ public class Eclipse extends Thread { private void printCommand() { System.out.println("Launch command is:"); for (int i = 0; i < cmdarray.length; i++) { - System.out.println(" " + cmdarray[i]); + System.out.println(" " + cmdarray[i]); //$NON-NLS-1$ } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java index 5427660a3..361426b56 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java @@ -50,16 +50,16 @@ public class EclipseConnection { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); if (Options.isDebug()) { - System.out.println("Connection to control servlet created."); + System.out.println("Connection to control servlet created."); //$NON-NLS-1$ } connection.connect(); if (Options.isDebug()) { - System.out.println("Connection to control servlet connected."); + System.out.println("Connection to control servlet connected."); //$NON-NLS-1$ } int code = connection.getResponseCode(); if (Options.isDebug()) { System.out.println( - "Response code from control servlet=" + code); + "Response code from control servlet=" + code); //$NON-NLS-1$ } connection.disconnect(); return; @@ -93,13 +93,13 @@ public class EclipseConnection { } } } - host = (String) p.get("host"); - port = (String) p.get("port"); + host = (String) p.get("host"); //$NON-NLS-1$ + port = (String) p.get("port"); //$NON-NLS-1$ if (Options.isDebug()) { - System.out.println("Help server host=" + host); + System.out.println("Help server host=" + host); //$NON-NLS-1$ } if (Options.isDebug()) { - System.out.println("Help server port=" + port); + System.out.println("Help server port=" + port); //$NON-NLS-1$ } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java index 0c74921f1..2bfbbd89d 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java @@ -23,7 +23,7 @@ public class EclipseController implements EclipseLifeCycleListener { // control servlet path private static final String CONTROL_SERVLET_PATH = - "/helpControl/control.html"; + "/helpControl/control.html"; //$NON-NLS-1$ // application to launch protected String applicationId; @@ -58,7 +58,7 @@ public class EclipseController implements EclipseLifeCycleListener { public final synchronized void shutdown() throws Exception { try { obtainLock(); - sendHelpCommandInternal("shutdown", new String[0]); + sendHelpCommandInternal("shutdown", new String[0]); //$NON-NLS-1$ } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (InterruptedException ie) { @@ -109,7 +109,7 @@ public class EclipseController implements EclipseLifeCycleListener { } if (Options.isDebug()) { System.out.println( - "Using workspace " + Options.getWorkspace().getAbsolutePath()); + "Using workspace " + Options.getWorkspace().getAbsolutePath()); //$NON-NLS-1$ } // delete old connection file Options.getConnectionFile().delete(); @@ -117,7 +117,7 @@ public class EclipseController implements EclipseLifeCycleListener { if (Options.isDebug()) { System.out.println( - "Ensured old .connection file is deleted. Launching Eclipse."); + "Ensured old .connection file is deleted. Launching Eclipse."); //$NON-NLS-1$ } eclipseEnded = false; eclipse = new Eclipse(this); @@ -137,14 +137,14 @@ public class EclipseController implements EclipseLifeCycleListener { return; } if (Options.isDebug()) { - System.out.println("Eclipse launched"); + System.out.println("Eclipse launched"); //$NON-NLS-1$ } // in case controller is killed Runtime.getRuntime().addShutdownHook(new EclipseCleaner()); } private void sendHelpCommandInternal(String command, String[] parameters) throws Exception { - if (!"shutdown".equalsIgnoreCase(command)) { + if (!"shutdown".equalsIgnoreCase(command)) { //$NON-NLS-1$ startEclipse(); } if (!isApplicationRunning()) { @@ -155,7 +155,7 @@ public class EclipseController implements EclipseLifeCycleListener { } try { URL url = createCommandURL(command, parameters); - if ("shutdown".equalsIgnoreCase(command) + if ("shutdown".equalsIgnoreCase(command) //$NON-NLS-1$ && Options.getConnectionFile().exists()) { connection.connect(url); long timeLimit = System.currentTimeMillis() + 60 * 1000; @@ -186,19 +186,19 @@ public class EclipseController implements EclipseLifeCycleListener { private URL createCommandURL(String command, String[] parameters) throws MalformedURLException { StringBuffer urlStr = new StringBuffer(); - urlStr.append("http://"); + urlStr.append("http://"); //$NON-NLS-1$ urlStr.append(connection.getHost()); - urlStr.append(":"); + urlStr.append(":"); //$NON-NLS-1$ urlStr.append(connection.getPort()); urlStr.append(CONTROL_SERVLET_PATH); - urlStr.append("?command="); + urlStr.append("?command="); //$NON-NLS-1$ urlStr.append(command); for (int i = 0; i < parameters.length; i++) { - urlStr.append("&"); + urlStr.append("&"); //$NON-NLS-1$ urlStr.append(parameters[i]); } if (Options.isDebug()) { - System.out.println("Control servlet URL=" + urlStr.toString()); + System.out.println("Control servlet URL=" + urlStr.toString()); //$NON-NLS-1$ } return new URL(urlStr.toString()); } @@ -216,10 +216,10 @@ public class EclipseController implements EclipseLifeCycleListener { Options.getLockFile().getParentFile().mkdirs(); } RandomAccessFile raf = - new RandomAccessFile(Options.getLockFile(), "rw"); + new RandomAccessFile(Options.getLockFile(), "rw"); //$NON-NLS-1$ lock = raf.getChannel().lock(); if (Options.isDebug()) { - System.out.println("Lock obtained."); + System.out.println("Lock obtained."); //$NON-NLS-1$ } } private void releaseLock() { @@ -227,7 +227,7 @@ public class EclipseController implements EclipseLifeCycleListener { try { lock.channel().close(); if (Options.isDebug()) { - System.out.println("Lock released."); + System.out.println("Lock released."); //$NON-NLS-1$ } lock = null; } catch (IOException ioe) { @@ -239,11 +239,11 @@ public class EclipseController implements EclipseLifeCycleListener { */ private boolean isApplicationRunning() { File applicationLockFile = - new File(Options.getLockFile().getParentFile(), ".applicationlock"); + new File(Options.getLockFile().getParentFile(), ".applicationlock"); //$NON-NLS-1$ RandomAccessFile randomAccessFile = null; FileLock applicationLock = null; try { - randomAccessFile = new RandomAccessFile(applicationLockFile, "rw"); + randomAccessFile = new RandomAccessFile(applicationLockFile, "rw"); //$NON-NLS-1$ applicationLock = randomAccessFile.getChannel().tryLock(); } catch (IOException ioe) { } finally { @@ -261,7 +261,7 @@ public class EclipseController implements EclipseLifeCycleListener { } if (Options.isDebug()) { System.out.println( - "isApplicationRunning? " + (applicationLock == null)); + "isApplicationRunning? " + (applicationLock == null)); //$NON-NLS-1$ } } return applicationLock == null; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java index 6cd9cf234..f6dc31848 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java @@ -79,56 +79,56 @@ public class Options { eclipseArgs.addAll(options); // consume -command option - helpCommand = extractOption(eclipseArgs, "-command"); + helpCommand = extractOption(eclipseArgs, "-command"); //$NON-NLS-1$ if (helpCommand == null) { helpCommand = new ArrayList(0); } // read -debug option - if (getOption(eclipseArgs, "-debug") != null) { + if (getOption(eclipseArgs, "-debug") != null) { //$NON-NLS-1$ debug = true; - System.out.println("Debugging is on."); + System.out.println("Debugging is on."); //$NON-NLS-1$ } // consume -noexec option - if (extractOption(eclipseArgs, "-noexec") != null) { + if (extractOption(eclipseArgs, "-noexec") != null) { //$NON-NLS-1$ useExe = false; } // consume -eclipsehome (accept eclipse_home too) option - List homes = extractOption(eclipseArgs, "-eclipseHome"); + List homes = extractOption(eclipseArgs, "-eclipseHome"); //$NON-NLS-1$ if (homes == null || homes.isEmpty()) { - homes = extractOption(eclipseArgs, "-eclipse_Home"); + homes = extractOption(eclipseArgs, "-eclipse_Home"); //$NON-NLS-1$ } if (homes != null && !homes.isEmpty()) { eclipseHome = new File((String) homes.get(0)); } else { - eclipseHome = new File(System.getProperty("user.dir")); + eclipseHome = new File(System.getProperty("user.dir")); //$NON-NLS-1$ } // read -data option - List workspaces = getOption(eclipseArgs, "-data"); + List workspaces = getOption(eclipseArgs, "-data"); //$NON-NLS-1$ if (workspaces != null && !workspaces.isEmpty()) { workspace = new File((String) workspaces.get(0)); } else { - workspace = new File(eclipseHome, "workspace"); + workspace = new File(eclipseHome, "workspace"); //$NON-NLS-1$ } - lockFile = new File(workspace, "/.metadata/.helplock"); - hostPortFile = new File(workspace, "/.metadata/.connection"); + lockFile = new File(workspace, "/.metadata/.helplock"); //$NON-NLS-1$ + hostPortFile = new File(workspace, "/.metadata/.connection"); //$NON-NLS-1$ // consume -host option - List hosts = extractOption(eclipseArgs, "-host"); + List hosts = extractOption(eclipseArgs, "-host"); //$NON-NLS-1$ if (hosts != null && hosts.size() > 0) { host = (String) hosts.get(0); } // consume -port option - List ports = extractOption(eclipseArgs, "-port"); + List ports = extractOption(eclipseArgs, "-port"); //$NON-NLS-1$ if (ports != null && ports.size() > 0) { port = (String) ports.get(0); } // consume -servertimout option serverTimeout = 0; - List timeouts = extractOption(eclipseArgs, "-servertimeout"); + List timeouts = extractOption(eclipseArgs, "-servertimeout"); //$NON-NLS-1$ if (timeouts != null && timeouts.size() > 0) { try { int timeout = Integer.parseInt((String) timeouts.get(0)); @@ -140,49 +140,49 @@ public class Options { } // consume -vm option - List vms = extractOption(eclipseArgs, "-vm"); + List vms = extractOption(eclipseArgs, "-vm"); //$NON-NLS-1$ if (vms != null && !vms.isEmpty()) { vm = (String) vms.get(0); } else { - String vmName = System.getProperty("java.vm.name"); - String executable = "J9".equals(vmName) ? "j9" : "java"; - if (System.getProperty("os.name").startsWith("Win")) { - executable += "w.exe"; + String vmName = System.getProperty("java.vm.name"); //$NON-NLS-1$ + String executable = "J9".equals(vmName) ? "j9" : "java"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (System.getProperty("os.name").startsWith("Win")) { //$NON-NLS-1$ //$NON-NLS-2$ + executable += "w.exe"; //$NON-NLS-1$ } vm = - System.getProperty("java.home") + System.getProperty("java.home") //$NON-NLS-1$ + File.separator - + "bin" + + "bin" //$NON-NLS-1$ + File.separator + executable; } // consume -vmargs option vmArgs = new ArrayList(0); - List passedVmArgs = extractOption(eclipseArgs, "-vmargs"); + List passedVmArgs = extractOption(eclipseArgs, "-vmargs"); //$NON-NLS-1$ if (passedVmArgs != null && passedVmArgs.size() > 0) { vmArgs = passedVmArgs; } // modify the options for passing them to eclipse // add -application option - extractOption(eclipseArgs, "-application"); - eclipseArgs.add(0, "-application"); + extractOption(eclipseArgs, "-application"); //$NON-NLS-1$ + eclipseArgs.add(0, "-application"); //$NON-NLS-1$ eclipseArgs.add(1, appId); // add -nosplash option (prevent splash) - extractOption(eclipseArgs, "-showsplash"); - extractOption(eclipseArgs, "-endsplash"); - extractOption(eclipseArgs, "-nosplash"); - eclipseArgs.add(0, "-nosplash"); + extractOption(eclipseArgs, "-showsplash"); //$NON-NLS-1$ + extractOption(eclipseArgs, "-endsplash"); //$NON-NLS-1$ + extractOption(eclipseArgs, "-nosplash"); //$NON-NLS-1$ + eclipseArgs.add(0, "-nosplash"); //$NON-NLS-1$ // add server_host and/or port to -vmargs option if (host != null || port != null) { if (host != null) { - vmArgs.add("-Dserver_host=" + host); + vmArgs.add("-Dserver_host=" + host); //$NON-NLS-1$ } if (port != null) { - vmArgs.add("-Dserver_port=" + port); + vmArgs.add("-Dserver_port=" + port); //$NON-NLS-1$ } } } @@ -245,8 +245,8 @@ public class Options { options.remove(i); // remove option parameters while (i < options.size()) { - if (((String) options.get(i)).startsWith("-") - && !optionName.equals("-vmargs")) { + if (((String) options.get(i)).startsWith("-") //$NON-NLS-1$ + && !optionName.equals("-vmargs")) { //$NON-NLS-1$ // start of next option break; } @@ -278,8 +278,8 @@ public class Options { } // read option parameters for (int j = i + 1; j < options.size(); j++) { - if (((String) options.get(j)).startsWith("-") - && !optionName.equals("-vmargs")) { + if (((String) options.get(j)).startsWith("-") //$NON-NLS-1$ + && !optionName.equals("-vmargs")) { //$NON-NLS-1$ // start of next option i = j; break; diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java index e574666f7..ac11ac661 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java @@ -33,7 +33,7 @@ import org.eclipse.help.internal.base.*; public class StandaloneHelp extends EclipseController { // ID of the application to run private static final String HELP_APPLICATION_ID = - HelpBasePlugin.PLUGIN_ID + ".helpApplication"; + HelpBasePlugin.PLUGIN_ID + ".helpApplication"; //$NON-NLS-1$ /** * Constructs help system @@ -83,14 +83,14 @@ public class StandaloneHelp extends EclipseController { * @see org.eclipse.help.standalone.Help#displayHelp() */ public void displayHelp() throws Exception { - sendHelpCommand("displayHelp", new String[0]); + sendHelpCommand("displayHelp", new String[0]); //$NON-NLS-1$ } /** * @see org.eclipse.help.standalone.Help#displayHelp(java.lang.String) */ public void displayHelp(String href) throws Exception { - sendHelpCommand("displayHelp", new String[] { "href=" + href }); + sendHelpCommand("displayHelp", new String[] { "href=" + href }); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -104,20 +104,20 @@ public class StandaloneHelp extends EclipseController { } String command = (String) helpCommands.get(0); - if ("start".equalsIgnoreCase(command)) { + if ("start".equalsIgnoreCase(command)) { //$NON-NLS-1$ start(); return true; - } else if ("shutdown".equalsIgnoreCase(command)) { + } else if ("shutdown".equalsIgnoreCase(command)) { //$NON-NLS-1$ shutdown(); return true; - } else if ("displayHelp".equalsIgnoreCase(command)) { + } else if ("displayHelp".equalsIgnoreCase(command)) { //$NON-NLS-1$ if (helpCommands.size() >= 2) { displayHelp((String) helpCommands.get(1)); } else { displayHelp(); } return true; - } else if ("displayContext".equalsIgnoreCase(command)) { + } else if ("displayContext".equalsIgnoreCase(command)) { //$NON-NLS-1$ if (helpCommands.size() >= 4) { displayContext( (String) helpCommands.get(1), @@ -126,7 +126,7 @@ public class StandaloneHelp extends EclipseController { return true; } - } else if ("displayContextInfopop".equalsIgnoreCase(command)) { + } else if ("displayContextInfopop".equalsIgnoreCase(command)) { //$NON-NLS-1$ if (helpCommands.size() >= 4) { displayContextInfopop( (String) helpCommands.get(1), @@ -145,7 +145,7 @@ public class StandaloneHelp extends EclipseController { System.out.println("Parameters syntax:"); System.out.println(); System.out.println( - "-command start | shutdown | (displayHelp [href]) [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [platform options] [-vmargs [Java VM arguments]]"); + "-command start | shutdown | (displayHelp [href]) [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [platform options] [-vmargs [Java VM arguments]]"); //$NON-NLS-1$ System.out.println(); System.out.println("where:"); System.out.println(" href is the URL of the help resource to display,"); diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java index e430abde5..5b6d788c0 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java @@ -21,7 +21,7 @@ import org.eclipse.help.internal.base.*; public class StandaloneInfocenter extends EclipseController { // ID of the application to run private static final String INFOCENTER_APPLICATION_ID = - HelpBasePlugin.PLUGIN_ID + ".infocenterApplication"; + HelpBasePlugin.PLUGIN_ID + ".infocenterApplication"; //$NON-NLS-1$ /** * Constructs help system @@ -65,10 +65,10 @@ public class StandaloneInfocenter extends EclipseController { return false; } String command = (String) helpCommand.get(0); - if ("start".equalsIgnoreCase(command)) { + if ("start".equalsIgnoreCase(command)) { //$NON-NLS-1$ start(); return true; - } else if ("shutdown".equalsIgnoreCase(command)) { + } else if ("shutdown".equalsIgnoreCase(command)) { //$NON-NLS-1$ shutdown(); return true; } @@ -82,7 +82,7 @@ public class StandaloneInfocenter extends EclipseController { System.out.println("Parameters syntax:"); System.out.println(); System.out.println( - "-command start | shutdown [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [-noexec] [platform options] [-vmargs [Java VM arguments]]"); + "-command start | shutdown [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [-noexec] [platform options] [-vmargs [Java VM arguments]]"); //$NON-NLS-1$ System.out.println(); System.out.println("where:"); System.out.println( diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java index fb1627714..0554b54b2 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java @@ -65,6 +65,6 @@ public class AdaptableToc extends AdaptableHelpResource { } public void saveState(Element element) { - element.setAttribute("toc", getHref()); + element.setAttribute("toc", getHref()); //$NON-NLS-1$ } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java index a3c9ba4d5..435bff3c1 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java @@ -96,6 +96,6 @@ public class AdaptableTopic extends AdaptableHelpResource { AdaptableHelpResource[] topics = toc.getChildren(); for (int i=0; i<topics.length; i++) if (topics[i] == this) - element.setAttribute("topic", String.valueOf(i)); + element.setAttribute("topic", String.valueOf(i)); //$NON-NLS-1$ } } diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java index 57fe978b3..c7850c0d8 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java @@ -70,12 +70,12 @@ public class WorkingSet { public void saveState(Element parent) { Document doc = parent.getOwnerDocument(); - Element ws = doc.createElement("workingSet"); - ws.setAttribute("name", name); + Element ws = doc.createElement("workingSet"); //$NON-NLS-1$ + ws.setAttribute("name", name); //$NON-NLS-1$ parent.appendChild(ws); for (Iterator it=elements.iterator(); it.hasNext(); ) { - Element child = doc.createElement("item"); + Element child = doc.createElement("item"); //$NON-NLS-1$ AdaptableHelpResource helpResource = (AdaptableHelpResource)it.next(); helpResource.saveState(child); ws.appendChild(child); diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java index a4433478a..aed7bf75b 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java +++ b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java @@ -41,7 +41,7 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi * * @see IPropertyChangeListener */ - public static final String CHANGE_WORKING_SET_ADD = "workingSetAdd"; + public static final String CHANGE_WORKING_SET_ADD = "workingSetAdd"; //$NON-NLS-1$ /** * Change event id when a working set is removed * newValue of the PropertyChangeEvent will be null. @@ -49,7 +49,7 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi * * @see IPropertyChangeListener */ - public static final String CHANGE_WORKING_SET_REMOVE = "workingSetRemove"; + public static final String CHANGE_WORKING_SET_REMOVE = "workingSetRemove"; //$NON-NLS-1$ /** * Change event id when the working set contents changed * newValue of the PropertyChangeEvent will be the changed working set. @@ -58,7 +58,7 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi * @see IPropertyChangeListener */ public static final String CHANGE_WORKING_SET_CONTENT_CHANGE = - "workingSetContentChange"; + "workingSetContentChange"; //$NON-NLS-1$ /** * Change event id when the working set name changed. * newValue of the PropertyChangeEvent will be the changed working set. @@ -74,10 +74,10 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi * * @see IPropertyChangeListener */ - public static final String CHANGE_WORKING_SETS_SYNCH = "workingSetsSynch"; + public static final String CHANGE_WORKING_SETS_SYNCH = "workingSetsSynch"; //$NON-NLS-1$ // Working set persistence - private static final String WORKING_SET_STATE_FILENAME = "workingsets.xml"; + private static final String WORKING_SET_STATE_FILENAME = "workingsets.xml"; //$NON-NLS-1$ private SortedSet workingSets = new TreeSet(new WorkingSetComparator()); private PropertyChange.ListenerList propertyChangeListeners = new PropertyChange.ListenerList(); @@ -261,19 +261,19 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi return true; } catch (ParserConfigurationException pce) { - String msg = HelpBaseResources.getString("WorkingSetManager.PCE"); + String msg = HelpBaseResources.getString("WorkingSetManager.PCE"); //$NON-NLS-1$ HelpPlugin.logError(msg, pce); - HelpPlugin.logError(HelpBaseResources.getString("E041"), pce); + HelpPlugin.logError(HelpBaseResources.getString("E041"), pce); //$NON-NLS-1$ return false; } catch (SAXException se) { - String msg = HelpBaseResources.getString("E018", stateFile.toString()); + String msg = HelpBaseResources.getString("E018", stateFile.toString()); //$NON-NLS-1$ HelpBasePlugin.logError(msg, se); - HelpBasePlugin.logError(HelpBaseResources.getString("E041"), se); + HelpBasePlugin.logError(HelpBaseResources.getString("E041"), se); //$NON-NLS-1$ return false; } catch (IOException ioe) { - String msg = HelpBaseResources.getString("E018", stateFile.toString()); + String msg = HelpBaseResources.getString("E018", stateFile.toString()); //$NON-NLS-1$ HelpBasePlugin.logError(msg, ioe); - HelpBasePlugin.logError(HelpBaseResources.getString("E041"), ioe); + HelpBasePlugin.logError(HelpBaseResources.getString("E041"), ioe); //$NON-NLS-1$ return false; } } @@ -310,16 +310,16 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi */ private WorkingSet restoreWorkingSet(Element workingSetNode) { - String name = workingSetNode.getAttribute("name"); - NodeList items = workingSetNode.getElementsByTagName("item"); + String name = workingSetNode.getAttribute("name"); //$NON-NLS-1$ + NodeList items = workingSetNode.getElementsByTagName("item"); //$NON-NLS-1$ List helpResources = new ArrayList(items.getLength()); for (int i = 0; i < items.getLength(); i++) { Element item = (Element) items.item(i); - String href = item.getAttribute("toc"); + String href = item.getAttribute("toc"); //$NON-NLS-1$ if (href == null || href.length() == 0) continue; - String child_pos = item.getAttribute("topic"); + String child_pos = item.getAttribute("topic"); //$NON-NLS-1$ int pos = -1; if (child_pos != null) { try { @@ -368,7 +368,7 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi try { DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); - Element rootElement = doc.createElement("workingSets"); + Element rootElement = doc.createElement("workingSets"); //$NON-NLS-1$ doc.appendChild(rootElement); saveWorkingSetState(rootElement); @@ -378,8 +378,8 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi FileOutputStream stream = new FileOutputStream(stateFile); Transformer transformer=transformerFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(stream); @@ -387,16 +387,16 @@ public class WorkingSetManager implements IHelpWorkingSetManager, ITocsChangedLi stream.close(); return true; }catch (ParserConfigurationException pce){ - String msg = HelpBaseResources.getString("WorkingSetManager.PCE"); + String msg = HelpBaseResources.getString("WorkingSetManager.PCE"); //$NON-NLS-1$ HelpPlugin.logError(msg, pce); return false; }catch (TransformerException e){ - String message = HelpBaseResources.getString("WorkingSetManager.transformer"); + String message = HelpBaseResources.getString("WorkingSetManager.transformer"); //$NON-NLS-1$ HelpPlugin.logError(message, null); return false; } catch (IOException e) { stateFile.delete(); - String message = HelpBaseResources.getString("E40"); + String message = HelpBaseResources.getString("E40"); //$NON-NLS-1$ HelpBasePlugin.logError(message, null); return false; } diff --git a/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java b/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java index 04043958b..dfc9e1fb8 100644 --- a/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java +++ b/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java @@ -73,7 +73,7 @@ public class Help { ArrayList options = new ArrayList(2); if (install != null) { options = new ArrayList(2); - options.add("-eclipseHome"); + options.add("-eclipseHome"); //$NON-NLS-1$ options.add(install); } String[] args = new String[options.size()]; |