Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Kolosowski2004-08-20 03:54:12 +0000
committerKonrad Kolosowski2004-08-20 03:54:12 +0000
commita87d8603698ae22b879ee84933ec9f89a85455bb (patch)
tree8e1d10fdcfba27a356ebb942e8d53ad290251e52 /org.eclipse.help.base/src/org
parent9b706e6f1eec7d21c118f01e5468eee5c4ed3257 (diff)
downloadeclipse.platform.ua-a87d8603698ae22b879ee84933ec9f89a85455bb.tar.gz
eclipse.platform.ua-a87d8603698ae22b879ee84933ec9f89a85455bb.tar.xz
eclipse.platform.ua-a87d8603698ae22b879ee84933ec9f89a85455bb.zip
67872 TVT3.0: Translated error messages appear in log filev20040823
Diffstat (limited to 'org.eclipse.help.base/src/org')
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java37
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties53
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java20
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java13
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java15
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java5
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java300
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java50
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java13
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java32
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java10
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java24
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java13
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java15
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java94
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java12
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java19
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java22
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java20
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java56
20 files changed, 351 insertions, 472 deletions
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
index e0e1d51b5..f3fa3aaff 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
@@ -26,23 +26,37 @@ public final class BaseHelpSystem {
private final static String WEBAPP_EXTENSION_ID = HelpBasePlugin.PLUGIN_ID
+ ".webapp"; //$NON-NLS-1$
+
private static final String WEBAPP_DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
public final static String BOOKMARKS = "bookmarks"; //$NON-NLS-1$
+
public final static String WORKING_SETS = "workingSets"; //$NON-NLS-1$
+
public final static String WORKING_SET = "workingSet"; //$NON-NLS-1$
+
public final static int MODE_WORKBENCH = 0;
+
public final static int MODE_INFOCENTER = 1;
+
public final static int MODE_STANDALONE = 2;
protected SearchManager searchManager;
+
protected WorkingSetManager workingSetManager;
+
private int mode = MODE_WORKBENCH;
+
private boolean webappStarted = false;
+
private IErrorUtil defaultErrorMessenger;
+
private IBrowser browser;
+
private IBrowser internalBrowser;
+
private HelpDisplay helpDisplay = null;
+
private boolean webappRunning = false;
/**
@@ -51,9 +65,11 @@ public final class BaseHelpSystem {
private BaseHelpSystem() {
super();
}
+
public static BaseHelpSystem getInstance() {
return instance;
}
+
/**
* Used to obtain Search Manager
*
@@ -69,6 +85,7 @@ public final class BaseHelpSystem {
}
return getInstance().searchManager;
}
+
/**
* Used to obtain Working Set Manager
*
@@ -100,6 +117,7 @@ public final class BaseHelpSystem {
getInstance().helpDisplay = new HelpDisplay();
return getInstance().helpDisplay;
}
+
/**
*/
public BaseHelpSystem newInstance() {
@@ -133,6 +151,7 @@ public final class BaseHelpSystem {
System.out.println("Help System is shut down."); //$NON-NLS-1$
}
}
+
/**
* Called by Platform after loading the plugin
*/
@@ -152,13 +171,14 @@ public final class BaseHelpSystem {
} catch (Exception e) {
HelpBasePlugin.getDefault().getLog().log(
new Status(IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, 0,
- HelpBaseResources.getString("E005"), //$NON-NLS-1$
+ "Error in launching help.", //$NON-NLS-1$
e));
}
if (HelpBasePlugin.DEBUG) {
System.out.println("Base Help System started."); //$NON-NLS-1$
}
}
+
public static boolean ensureWebappRunning() {
if (!getInstance().webappStarted) {
getInstance().webappStarted = true;
@@ -171,9 +191,10 @@ public final class BaseHelpSystem {
WebappManager.start("helpControl", //$NON-NLS-1$
webappPlugin, Path.EMPTY);
} catch (CoreException e) {
- HelpBasePlugin.logError(
- HelpBaseResources.getString("E042"), //$NON-NLS-1$
- e);
+ HelpBasePlugin
+ .logError(
+ "Stand-alone help control web application failed to run.", //$NON-NLS-1$
+ e);
return false;
}
}
@@ -181,9 +202,11 @@ public final class BaseHelpSystem {
try {
WebappManager.start("help", webappPlugin, Path.EMPTY); //$NON-NLS-1$
} catch (CoreException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("E043"), e); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "The embedded application server could not run help web application.", e); //$NON-NLS-1$
BaseHelpSystem.getDefaultErrorUtil().displayError(
- HelpBaseResources.getString("E043")); //$NON-NLS-1$
+ HelpBaseResources.getString("HelpWebappNotStarted")); //$NON-NLS-1$
return false;
}
getInstance().webappRunning = true;
@@ -276,4 +299,4 @@ public final class BaseHelpSystem {
return name == null ? "" : name; //$NON-NLS-1$
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties
index a575b8ef2..818fc86ea 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties
@@ -8,70 +8,25 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-# ====================================
-# Eclipse Help System Properties File
-# ====================================
-Error = Error
-File4 = File {0} cannot be read.
-File = File
-Exception_occurred = Exception occurred while saving table {0} to file {1}.
-Plugin = Plug-in
-# search
-Search_cancelled = Search cancelled
+# Search progress
+# ---------------
UpdatingIndex = Updating documentation index ...
Preparing_for_indexing = Preparing for indexing ...
Writing_index = Writing index ...
Undoing_document_adds = Undoing canceled operation.
Undoing_document_deletions = Undoing canceled operation.
-WorkingSetManager.PCE = DocumentBuilder implementation could not be loaded.
-WorkingSetManager.transformer = Problems occurred while saving working sets.
# Error Messages
# --------------
-E005 = Error in launching help.
-E011 = No context information found for {0} plugin
-E014 = Error accessing file: {0}
-E015 = Errors occurred generating file: {0}
-E017 = IO Error occurred reading file {0}.
-E018 = Error occurred parsing file {0}.
-E019 = Expected: {0} but got: {1}
-E040 = Problems occurred while saving working set file.
-E041 = Problems occurred while restoring working set state.
-E042 = Help web application failed to run.
-E042 = Stand-alone help control web application failed to run.
-E043 = Help cannot be displayed. The embedded application server could not run help web application. Check the log for details.
+HelpWebappNotStarted = Help cannot be displayed. The embedded application server could not run help web application. Check the log for details.
HelpDisplay.exceptionMessage = An exception occurred while launching help. Refer to the log for more details.
-HelpDisplay.exception = An exception occurred while launching help.
-
-
-# Search
-ES16 = IO exception occurred while adding document {0} to index {1}.
-ES17 = Exception occurred in search indexing at beginAddBatch .
-ES18 = Exception occurred in search indexing at beginDeleteBatch .
-ES19 = Exception occurred in search indexing at endAddBatch.
-ES20 = Exception occurred in search indexing at endDeleteBatch.
-ES21 = Exception occurred performing search for: {0}.
-ES22 = IO exception occurred while removing document {0} from index {1}.
-ES23 = Exception occurred creating text analyzer {0} for {1} locale.
-ES24 = Text Analyzer could not be created for locale {0}. An analyzer that extends org.eclipse.help.luceneAnalyzer extension point needs to be plugged in for locale {0}, or Java Virtual Machine needs to be upgraded to version with proper support for locale {0}.
-ES25 = Help document {0} cannot be opened. The document will not be indexed.
-search_index_update_error=Problem occurred during indexing of documentation.
-
-# Browser
-WE001 = Exception occurred reading from web browser.
-
no_browsers = There is no browser adapter configured to display {0}. Ensure that you have a required browser and adapter installed, and that the browser program is available on the system path.
CustomBrowser.errorLaunching = Launching URL "{0}" using browser program "{1}" has failed. Specify another browser in help preferences.
MozillaFactory.dataMissing = Initialization data required by Mozilla adapter is missing.
MozillaBrowserAdapter.executeFailed = Launching {0} has failed. Ensure that the executable program is available on your system path.
-DefaultBrowserAdapter.executeFailed = Launching "osascript" has failed.
-
-# Warning Messages
-# ----------------
-WW001 = Documentation is not installed.
+HelpDisplay.docsNotInstalled = Documentation is not installed.
HelpApplication.couldNotStart=Help web application could not start. Check the log file at {0} for details.
IndexToolApplication.propertyNotSet={0} property is not set.
-IndexToolApplication.failed=Preindexing failed.
IndexToolApplication.cannotDelete=Cannot delete file {0}.
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
index cf47029dc..99db93f80 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.base;
+
import java.io.*;
import java.net.*;
@@ -38,9 +39,14 @@ public class HelpDisplay {
// Do not start help view if documentaton is not available, display
// error
if (HelpSystem.getTocs().length == 0) {
+ HelpBasePlugin.logError(
+ "Failed launching help. Documentation is not installed.", //$NON-NLS-1$
+ null);
// There is no documentation
- BaseHelpSystem.getDefaultErrorUtil().displayError(
- HelpBaseResources.getString("WW001")); //$NON-NLS-1$
+ BaseHelpSystem.getDefaultErrorUtil()
+ .displayError(
+ HelpBaseResources
+ .getString("HelpDisplay.docsNotInstalled")); //$NON-NLS-1$
//Documentation is not installed.
return;
}
@@ -123,6 +129,7 @@ public class HelpDisplay {
displayHelpURL(getNoframesURL(topicURL), true);
}
}
+
/**
* Display help to search view for given query and selected topic.
*
@@ -148,6 +155,7 @@ public class HelpDisplay {
displayHelpURL(getNoframesURL(topic), true);
}
}
+
/**
* Displays the specified url. The url can contain query parameters to
* identify how help displays the document
@@ -176,15 +184,15 @@ public class HelpDisplay {
.displayURL(helpURL);
}
} catch (Exception e) {
+ HelpBasePlugin.logError(
+ "An exception occurred while launching help.", e); //$NON-NLS-1$
BaseHelpSystem.getDefaultErrorUtil()
.displayError(
HelpBaseResources
.getString("HelpDisplay.exceptionMessage")); //$NON-NLS-1$
- HelpBasePlugin.logError(HelpBaseResources.getString(
- "HelpDisplay.exception", //$NON-NLS-1$
- e.getMessage()), e);
}
}
+
private String getContextID(IContext context) {
if (context instanceof Context)
return ((Context) context).getID();
@@ -242,4 +250,4 @@ public class HelpDisplay {
return null;
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java
index fe5d99a2c..b5b3db4c3 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java
@@ -19,10 +19,8 @@ import org.eclipse.core.runtime.*;
/**
* application org.eclipse.help.indexTool
*/
-public class IndexToolApplication
- implements
- IPlatformRunnable,
- IExecutableExtension {
+public class IndexToolApplication implements IPlatformRunnable,
+ IExecutableExtension {
/**
* Constructor for IndexToolApplication.
@@ -65,8 +63,7 @@ public class IndexToolApplication
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
- HelpBasePlugin.logError(HelpBaseResources
- .getString("IndexToolApplication.failed"), e); //$NON-NLS-1$
+ HelpBasePlugin.logError("Preindexing failed.", e); //$NON-NLS-1$
}
return EXIT_OK;
}
@@ -99,6 +96,7 @@ public class IndexToolApplication
zout.close();
}
}
+
/**
* Recursively deletes directory and files.
*
@@ -119,6 +117,7 @@ public class IndexToolApplication
"IndexToolApplication.cannotDelete", file.getAbsolutePath())); //$NON-NLS-1$
}
}
+
/**
* Adds files in a directory to a zip stream
*
@@ -159,4 +158,4 @@ public class IndexToolApplication
}
}
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
index 37cd8bffc..7544e3564 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
@@ -15,14 +15,15 @@ import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.base.*;
/**
* Properties stored in file.
*/
public class HelpProperties extends Properties {
private File file = null;
+
protected String name = null;
+
/**
* Creates empty Properties for the specified plugin
*
@@ -34,6 +35,7 @@ public class HelpProperties extends Properties {
public HelpProperties(String name, Plugin plugin) {
this(name, plugin.getStateLocation().toFile());
}
+
/**
* Creates empty Properties persisted in the specified directory
*
@@ -67,8 +69,7 @@ public class HelpProperties extends Properties {
super.load(in);
loaded = true;
} catch (IOException ioe00) {
- HelpPlugin.logError(HelpBaseResources.getString(
- "File4", file.getName()), //$NON-NLS-1$
+ HelpPlugin.logError("File " + file.getName() + " cannot be read.", //$NON-NLS-1$ //$NON-NLS-2$
null);
} finally {
if (in != null)
@@ -79,6 +80,7 @@ public class HelpProperties extends Properties {
}
return loaded;
}
+
/**
* Saves contents of the table to a file.
*
@@ -92,9 +94,8 @@ public class HelpProperties extends Properties {
super.store(out, "This is a generated file; do not edit."); //$NON-NLS-1$
ret = true;
} catch (IOException ioe00) {
- HelpPlugin.logError(HelpBaseResources.getString(
- "Exception_occurred", //$NON-NLS-1$
- name, file.getAbsolutePath()), ioe00);
+ HelpPlugin.logError("Exception occurred while saving table " + name //$NON-NLS-1$
+ + " to file " + file.getAbsolutePath() + ".", ioe00); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
try {
if (out != null) {
@@ -105,4 +106,4 @@ public class HelpProperties extends Properties {
}
return ret;
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java
index 2791bbf2d..436e6206c 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java
@@ -12,9 +12,10 @@ package org.eclipse.help.internal.base.util;
/**
* Utility interface for displaying an error message. Implementation may output
- * messages in different ways (log, console, pop up window).
+ * messages in different ways (console, pop up window).
*/
public interface IErrorUtil {
public void displayError(String msg);
+
public void displayError(String msg, Thread uiThread);
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java
index a77f07e73..672f0a20c 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java
@@ -9,19 +9,16 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.base.util;
-import java.util.*;
-import org.eclipse.help.internal.base.*;
/**
- * This class provides static methods for some of the very used IString
+ * This class provides static methods for some of the very used String
* operations
*/
public class TString {
- private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
- private static final String ALPHANUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //$NON-NLS-1$
- private static final String NUMERIC = "0123456789"; //$NON-NLS-1$
// change all occurrences of oldPat to newPat
public static String change(String in, String oldPat, String newPat) {
+ if (true)
+ return in;
if (oldPat.length() == 0)
return in;
if (oldPat.length() == 1 && newPat.length() == 1)
@@ -43,293 +40,4 @@ public class TString {
}
return newString.toString();
}
- // change the occurrences of oldPat to newPat starting at startPosition
- // for number of numChanges
- // Note: the 1st char in the string has position of 0
- public static String change(String in, String oldPat, String newPat,
- int startPos, int numChanges) {
- if (oldPat.length() == 0)
- return in;
- if (oldPat.length() == 1 && newPat.length() == 1)
- return in.replace(oldPat.charAt(0), newPat.charAt(0));
- int inLen = in.length();
- if (startPos >= inLen)
- return in;
- int lastIndex = startPos;
- int newIndex = 0;
- int countChanges = 0;
- StringBuffer newString = new StringBuffer();
- for (;;) {
- newIndex = in.indexOf(oldPat, lastIndex);
- if (newIndex != -1) {
- newString.append(in.substring(lastIndex, newIndex) + newPat);
- lastIndex = newIndex + oldPat.length();
- countChanges++;
- } else {
- newString.append(in.substring(lastIndex));
- break;
- }
- if (countChanges == numChanges) {
- newString.append(in.substring(lastIndex));
- break;
- }
- }
- return newString.toString();
- }
- // return true if the " " appears within srcString
- // example:
- // srcString = "a m"
- // return = true
- public static boolean containsDoubleBlanks(String srcString) {
- String bb = " "; //$NON-NLS-1$
- char b = bb.charAt(0);
- if (srcString.length() > 0) {
- for (int i = 0; i < (srcString.length() - 1); i++) {
- if ((b == srcString.charAt(i)) & (b == srcString.charAt(i + 1)))
- return true;
- }
- }
- return false;
- }
- // return a string that contains number of copies of srcString
- // example:
- // srcString = "abc"
- // numberOfCopies = 2
- // return string = "abcabc"
- public static String copy(String srcString, int numberOfCopies) {
- StringBuffer result = new StringBuffer();
- if (numberOfCopies > 0) {
- for (int i = 1; i <= numberOfCopies; i++)
- result.append(srcString);
- } else
- result = new StringBuffer(srcString);
- return result.toString();
- }
- public static long getLong(String str) {
- try {
- return Long.parseLong(str);
- } catch (Exception m) {
- return 0;
- }
- }
- // return the first index within srcString that is not in the validString
- // example:
- // srcString = "abcdefg"
- // validString = "bcfg"
- // return = 0 (i.e. char a is not in "bcfg") - 1st index = 0
- public static int indexOfAnyBut(String srcString, String validString) {
- int result = -1;
- int srcLen = srcString.length();
- // walk backward to find if a char within srcString is in validString
- for (int i = 0; i < srcLen; i++) {
- // not found, stop it
- if (validString.indexOf(srcString.charAt(i)) == -1) {
- result = i;
- break;
- }
- }
- return result;
- }
- //
- // return true if all chars in srcString are in {a...z} or {A...Z}
- public static boolean isAlphabetic(String srcString) {
- return (lastIndexOfAnyBut(srcString, ALPHABET) == -1);
- }
- //
- // return true if all chars in srcString are in {a...z,} or {A...Z} {0...9}
- public static boolean isAlphanumeric(String srcString) {
- return (lastIndexOfAnyBut(srcString, ALPHANUMERIC) == -1);
- }
- //
- // return true if all chars are in '0' - '9'
- public static boolean isDigits(String srcString) {
- return (lastIndexOfAnyBut(srcString, NUMERIC) == -1);
- }
- // return the last index within srcString that is not in the validString
- // example:
- // srcString = "abcdefg"
- // validString = "bcfg"
- // return = 4 (i.e. char e is not in "bcfg") - 1st index = 0
- public static int lastIndexOfAnyBut(String srcString, String validString) {
- int result = -1;
- int srcLen = srcString.length();
- // walk backward to find if a char within srcString is in validString
- for (int i = srcLen - 1; i >= 0; i--) {
- // not found, stop it
- if (validString.indexOf(srcString.charAt(i)) == -1) {
- result = i;
- break;
- }
- }
- return result;
- }
- //
- // return the string after the matching token is removed
- public static String match(String in, String token) throws Exception {
- if (in == null)
- return null;
- in = in.trim();
- if (in.startsWith(token))
- return in.substring(token.length(), in.length());
- else
- throw new Exception(HelpBaseResources.getString(
- "E019", token, word(in, 1))); //$NON-NLS-1$
- //Expected: %1 but got: %2
- }
- public static int numWords(String in) {
- StringTokenizer st = new StringTokenizer(in);
- return st.countTokens();
- }
- // return number of occurrences of searchChar within srcString
- // example:
- // srcString = "::f::f::g"
- // seachrChar = ':'
- // return = 6
- public static int occurrenceOf(String srcString, char searchChar) {
- int result = 0;
- // walk backward to find if a char within srcString is in validString
- if (srcString.length() > 0) {
- for (int i = 0; i < srcString.length(); i++) {
- // found, increment the count
- if (searchChar == srcString.charAt(i))
- result++;
- }
- }
- return result;
- }
- // strip the leading pString in the srcString
- // example:
- // srcString = "::f::f::g"
- // pString "::"
- // return = "f::f::g"
- public static String stripLeading(String srcString, String pString) {
- String result;
- if (srcString.startsWith(pString)) // leading patString found
- result = srcString.substring(pString.length(), srcString.length());
- else
- // not found
- result = srcString;
- return result;
- }
- public static String stripSpace(String srcString) {
- String b1 = " "; //$NON-NLS-1$
- int lastIndex = 0;
- int newIndex = 0;
- StringBuffer newString = new StringBuffer();
- for (;;) {
- newIndex = srcString.indexOf(b1, lastIndex);
- if (newIndex != -1) {
- newString.append(srcString.substring(lastIndex, newIndex));
- lastIndex = newIndex + 1;
- } else {
- newString.append(srcString.substring(lastIndex));
- break;
- }
- }
- return newString.toString();
- }
- // strip the trailing pString in the srcString
- // example:
- // srcString = "f::f::g::"
- // pString "::"
- // return = "f::f::g"
- public static String stripTrailing(String srcString, String pString) {
- String result;
- if (srcString.endsWith(pString)) // leading patString found
- result = srcString.substring(0, srcString.lastIndexOf(pString));
- else
- // not found
- result = srcString;
- return result;
- }
- /**
- * strip the trailing blanks in the src
- */
- public static String stripTrailingBlanks(String src) {
- if (src != null) {
- while (src.length() > 0) {
- if (src.endsWith(" ")) //$NON-NLS-1$
- src = src.substring(0, src.length() - 1);
- else
- break;
- }
- }
- return src;
- }
- public static String word(String in, int i) {
- StringTokenizer st = new StringTokenizer(in);
- if (i <= 0 || i > st.countTokens())
- return ""; //$NON-NLS-1$
- else {
- String ret = new String();
- while (st.hasMoreTokens()) {
- ret = st.nextToken();
- if (--i == 0)
- return ret;
- }
- }
- return ""; //$NON-NLS-1$
- }
- public static String words(String in, int i) {
- StringTokenizer st = new StringTokenizer(in);
- if (i <= 0 || i > st.countTokens())
- return ""; //$NON-NLS-1$
- else {
- while (st.hasMoreTokens()) {
- if (--i == 0)
- break;
- st.nextToken();
- }
- if (st.hasMoreTokens())
- return st.nextToken(""); //$NON-NLS-1$
- else
- return ""; //$NON-NLS-1$
- }
- }
- /**
- * Returns the unicode encoding of word...
- */
- public static String getUnicodeEncoding(String word) {
- int len = word.length();
- if (len == 0)
- return word;
- char[] chars = new char[len];
- word.getChars(0, len, chars, 0);
- StringBuffer encodedChars = new StringBuffer();
- for (int j = 0; j < chars.length; j++) {
- String charInHex = Integer.toString(chars[j], 16).toUpperCase();
- switch (charInHex.length()) {
- case 1 :
- encodedChars.append("\\u000").append(charInHex); //$NON-NLS-1$
- break;
- case 2 :
- encodedChars.append("\\u00").append(charInHex); //$NON-NLS-1$
- break;
- case 3 :
- encodedChars.append("\\u0").append(charInHex); //$NON-NLS-1$
- break;
- default :
- encodedChars.append("\\u").append(charInHex); //$NON-NLS-1$
- break;
- }
- }
- return encodedChars.toString();
- }
- /**
- * Returns the unicode encoding of word as u1,u2,u3... where u_i is the
- * unicode code (decimal) of the i'th char of word.
- */
- public static String getUnicodeNumbers(String word) {
- int len = word.length();
- if (len == 0)
- return word;
- StringBuffer buf = new StringBuffer(len);
- for (int i = 0; i < len; i++) {
- if (i != 0)
- buf.append(',');
- int unicode = word.charAt(i);
- buf.append(String.valueOf(unicode));
- }
- return buf.toString();
- }
-}
+} \ No newline at end of file
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 26aaaff87..a077a4384 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
@@ -9,41 +9,60 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.browser;
+
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.browser.*;
import org.eclipse.help.internal.base.*;
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"; //$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"; //$NON-NLS-1$
+
public static final String BROWSER_ID_MOZILLA = HelpBasePlugin.PLUGIN_ID
+ ".mozilla"; //$NON-NLS-1$
+
public static final String BROWSER_ID_NETSCAPE = HelpBasePlugin.PLUGIN_ID
+ ".netscape"; //$NON-NLS-1$
+
public static final String BROWSER_ID_MAC_SYSTEM = HelpBasePlugin.PLUGIN_ID
+ ".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;
+
private BrowserDescriptor defaultBrowserDesc;
+
private BrowserDescriptor[] browsersDescriptors;
+
private BrowserDescriptor internalBrowserDesc;
+
private Collection browsers = new ArrayList();
+
private boolean alwaysUseExternal = false;
+
/**
* Private Constructor
*/
private BrowserManager() {
}
+
/**
* Initialize
*/
@@ -100,28 +119,40 @@ public class BrowserManager {
public boolean isAvailable() {
return true;
}
+
public IBrowser createBrowser() {
return new IBrowser() {
public void close() {
}
+
public void displayURL(String url) {
+ HelpBasePlugin
+ .logError(
+ "There is no browser adapter configured to display " //$NON-NLS-1$
+ + url
+ + ". Ensure that you have a required browser and adapter installed, and that the browser program is available on the system path.", //$NON-NLS-1$
+ null);
String msg = HelpBaseResources.getString(
"no_browsers", url); //$NON-NLS-1$
- HelpBasePlugin.logError(msg, null);
BaseHelpSystem.getDefaultErrorUtil()
.displayError(msg);
}
+
public boolean isCloseSupported() {
return false;
}
+
public boolean isSetLocationSupported() {
return false;
}
+
public boolean isSetSizeSupported() {
return false;
}
+
public void setLocation(int width, int height) {
}
+
public void setSize(int x, int y) {
}
};
@@ -141,6 +172,7 @@ public class BrowserManager {
setAlwaysUseExternal(HelpBasePlugin.getDefault().getPluginPreferences()
.getBoolean(ALWAYS_EXTERNAL_BROWSER_KEY));
}
+
/**
* Obtains singleton instance.
*/
@@ -149,6 +181,7 @@ public class BrowserManager {
instance = new BrowserManager();
return instance;
}
+
/**
* Creates all adapters, and returns available ones.
*/
@@ -189,6 +222,7 @@ public class BrowserManager {
.toArray(new BrowserDescriptor[bDescriptors.size()]);
return this.browsersDescriptors;
}
+
/**
* Obtains browsers descriptors.
*/
@@ -198,6 +232,7 @@ public class BrowserManager {
}
return this.browsersDescriptors;
}
+
/**
* Gets the currentBrowserID.
*
@@ -211,6 +246,7 @@ public class BrowserManager {
return null;
return currentBrowserDesc.getID();
}
+
/**
* Gets the currentBrowserID.
*
@@ -226,6 +262,7 @@ public class BrowserManager {
return getCurrentBrowserID();
}
}
+
/**
* Gets the currentBrowserID.
*
@@ -239,6 +276,7 @@ public class BrowserManager {
return null;
return defaultBrowserDesc.getID();
}
+
/**
* Sets the currentBrowserID. If browser of given ID does not exists, the
* method does nothing
@@ -257,6 +295,7 @@ public class BrowserManager {
}
}
}
+
/**
* Sets the defaultBrowserID. If browser of given ID does not exists, the
* method does nothing
@@ -275,6 +314,7 @@ public class BrowserManager {
}
}
}
+
/**
* Creates web browser If preferences specify to always use external, the
* parameter will not be honored
@@ -294,12 +334,14 @@ public class BrowserManager {
}
}
+
/**
* Creates web browser
*/
public IBrowser createBrowser() {
return createBrowser(true);
}
+
/**
* Creates web browser for external == false, if no internal browsers are
* present it will create external one
@@ -317,6 +359,7 @@ public class BrowserManager {
browsers.add(browser);
return browser;
}
+
/**
* Closes all browsers created
*/
@@ -330,22 +373,25 @@ public class BrowserManager {
browser.close();
}
}
+
public boolean isEmbeddedBrowserPresent() {
if (!initialized) {
init();
}
return internalBrowserDesc != null;
}
+
public void setAlwaysUseExternal(boolean alwaysExternal) {
if (!initialized) {
init();
}
alwaysUseExternal = alwaysExternal || !isEmbeddedBrowserPresent();
}
+
private boolean isAlwaysUseExternal() {
if (!isEmbeddedBrowserPresent()) {
return true;
}
return alwaysUseExternal;
}
-}
+} \ No newline at end of file
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 bdc076130..df7b2f02a 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
@@ -54,9 +54,14 @@ public class CustomBrowser implements IBrowser {
errConsumer.setName("Custom browser adapter error reader"); //$NON-NLS-1$
errConsumer.start();
} catch (Exception e) {
- HelpBasePlugin.logError(HelpBaseResources.getString(
- "CustomBrowser.errorLaunching", url, path), //$NON-NLS-1$
- e);
+ HelpBasePlugin
+ .logError(
+ "Launching URL \"" //$NON-NLS-1$
+ + url
+ + "\" using browser program \"" //$NON-NLS-1$
+ + path
+ + "\" has failed. Specify another browser in help preferences.", //$NON-NLS-1$
+ e);
throw new Exception(HelpBaseResources.getString(
"CustomBrowser.errorLaunching", url, path)); //$NON-NLS-1$
}
@@ -149,4 +154,4 @@ public class CustomBrowser implements IBrowser {
tokenList.toArray(command);
return command;
}
-}
+} \ No newline at end of file
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 a7445a4d7..a09034678 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.browser;
+
import java.io.*;
import org.eclipse.core.runtime.*;
@@ -23,17 +24,28 @@ public class MozillaBrowserAdapter implements IBrowser {
// delay that it takes mozilla to start responding
// to remote command after mozilla has been called
protected static final int DELAY = 5000;
+
protected long browserFullyOpenedAt = 0;
+
private BrowserThread lastBrowserThread = null;
+
private int x, y;
+
private int width, height;
+
private boolean setLocationPending = false;
+
private boolean setSizePending = false;
+
protected String executable;
+
protected String executableName;
+
protected Thread uiThread;
+
/**
* Constructor
+ *
* @executable executable filename to launch
* @executableName name of the program to display when error occurs
*/
@@ -42,11 +54,13 @@ public class MozillaBrowserAdapter implements IBrowser {
this.executable = executable;
this.executableName = executableName;
}
+
/*
* @see IBrowser#close()
*/
public void close() {
}
+
/*
* @see IBrowser#displayURL(String)
*/
@@ -61,24 +75,28 @@ public class MozillaBrowserAdapter implements IBrowser {
setLocationPending = false;
setSizePending = false;
}
+
/*
* @see IBrowser#isCloseSupported()
*/
public boolean isCloseSupported() {
return false;
}
+
/*
* @see IBrowser#isSetLocationSupported()
*/
public boolean isSetLocationSupported() {
return true;
}
+
/*
* @see IBrowser#isSetSizeSupported()
*/
public boolean isSetSizeSupported() {
return true;
}
+
/*
* @see IBrowser#setLocation(int, int)
*/
@@ -87,6 +105,7 @@ public class MozillaBrowserAdapter implements IBrowser {
this.y = y;
setLocationPending = true;
}
+
/*
* @see IBrowser#setSize(int, int)
*/
@@ -95,6 +114,7 @@ public class MozillaBrowserAdapter implements IBrowser {
this.height = height;
setSizePending = true;
}
+
private synchronized String createPositioningURL(String url) {
IPath pluginPath = HelpBasePlugin.getDefault().getStateLocation();
File outFile = pluginPath.append("mozillaPositon") //$NON-NLS-1$
@@ -127,12 +147,16 @@ public class MozillaBrowserAdapter implements IBrowser {
return url;
}
}
+
private class BrowserThread extends Thread {
public boolean exitRequested = false;
+
private String url;
+
public BrowserThread(String urlName) {
this.url = urlName;
}
+
/**
* @param browserCmd
* @return int 0 if success
@@ -153,10 +177,11 @@ public class MozillaBrowserAdapter implements IBrowser {
return ret;
} catch (InterruptedException e) {
} catch (IOException e) {
+ HelpBasePlugin.logError("Launching " + executableName //$NON-NLS-1$
+ + " has failed.", e); //$NON-NLS-1$
String msg = HelpBaseResources.getString(
"MozillaBrowserAdapter.executeFailed", //$NON-NLS-1$
executableName);
- HelpBasePlugin.logError(msg, e);
BaseHelpSystem.getDefaultErrorUtil()
.displayError(msg, uiThread);
// return success, so second command does not execute
@@ -164,6 +189,7 @@ public class MozillaBrowserAdapter implements IBrowser {
}
return -1;
}
+
/**
* On some OSes 0 is always returned by netscape -remote. It is
* necessary to examine ouput to find out failure
@@ -199,6 +225,7 @@ public class MozillaBrowserAdapter implements IBrowser {
}
return false;
}
+
public void run() {
// If browser is opening, wait until it fully opens,
waitForBrowser();
@@ -213,6 +240,7 @@ public class MozillaBrowserAdapter implements IBrowser {
browserFullyOpenedAt = System.currentTimeMillis() + DELAY;
openBrowser(executable + " " + url); //$NON-NLS-1$
}
+
private void waitForBrowser() {
while (System.currentTimeMillis() < browserFullyOpenedAt)
try {
@@ -223,4 +251,4 @@ public class MozillaBrowserAdapter implements IBrowser {
}
}
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java
index af8e1d46e..a62419042 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.browser;
+
import java.io.*;
import org.eclipse.help.internal.base.*;
@@ -18,12 +19,15 @@ import org.eclipse.help.internal.base.*;
*/
public class StreamConsumer extends Thread {
BufferedReader bReader;
+
private String lastLine;
+
public StreamConsumer(InputStream inputStream) {
super();
setDaemon(true);
bReader = new BufferedReader(new InputStreamReader(inputStream));
}
+
public void run() {
try {
String line;
@@ -33,9 +37,11 @@ public class StreamConsumer extends Thread {
}
bReader.close();
} catch (IOException ioe) {
- HelpBasePlugin.logError(HelpBaseResources.getString("WE001"), ioe); //$NON-NLS-1$
+ HelpBasePlugin.logError(
+ "Exception occurred reading from web browser.", ioe); //$NON-NLS-1$
}
}
+
/**
* @return last line obtained or null
*/
@@ -43,4 +49,4 @@ public class StreamConsumer extends Thread {
return lastLine;
}
-}
+} \ No newline at end of file
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 03473527d..056d3cfcd 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
@@ -1,13 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
+ * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Common Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
package org.eclipse.help.internal.browser.macosx;
import java.io.*;
@@ -39,13 +37,11 @@ public class DefaultBrowserAdapter implements IBrowser {
* Code from Marc-Antoine Parent
*/
try {
- Runtime.getRuntime().exec(new String[]{"/usr/bin/osascript", //$NON-NLS-1$
+ Runtime.getRuntime().exec(new String[] { "/usr/bin/osascript", //$NON-NLS-1$
"-e", //$NON-NLS-1$
- "open location \"" + url + "\""}); //$NON-NLS-1$ //$NON-NLS-2$
+ "open location \"" + url + "\"" }); //$NON-NLS-1$ //$NON-NLS-2$
} catch (IOException ioe) {
- HelpBasePlugin.logError(HelpBaseResources
- .getString("DefaultBrowserAdapter.executeFailed"), //$NON-NLS-1$
- ioe);
+ HelpBasePlugin.logError("Launching \"osascript\" has failed.", ioe); //$NON-NLS-1$
}
}
@@ -81,4 +77,4 @@ public class DefaultBrowserAdapter implements IBrowser {
*/
public void setSize(int width, int height) {
}
-}
+} \ No newline at end of file
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 b346607cc..4fc0ef487 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
@@ -20,7 +20,9 @@ import org.osgi.framework.*;
*/
public class AnalyzerDescriptor {
private Analyzer luceneAnalyzer;
+
private String id;
+
private String lang;
/**
@@ -52,6 +54,7 @@ public class AnalyzerDescriptor {
}
}
+
/**
* Gets the analyzer.
*
@@ -123,14 +126,16 @@ public class AnalyzerDescriptor {
}
}
} catch (CoreException ce) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES23", //$NON-NLS-1$
- configElements[i].getAttribute("class"), //$NON-NLS-1$
- locale), ce);
+ HelpBasePlugin.logError(
+ "Exception occurred creating text analyzer " //$NON-NLS-1$
+ + configElements[i].getAttribute("class") //$NON-NLS-1$
+ + " for " + locale + " locale.", ce); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return this.luceneAnalyzer;
}
+
/**
* Checks whether analyzer is compatible with a given analyzer
*
@@ -157,4 +162,4 @@ public class AnalyzerDescriptor {
return false;
}
-}
+} \ No newline at end of file
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 203d288f1..72b3e438e 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.search;
+
import java.io.*;
import java.text.*;
import java.util.*;
@@ -16,6 +17,7 @@ import java.util.*;
import org.apache.lucene.analysis.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.base.*;
+
/**
* Lucene Analyzer. LowerCaseTokenizer->WordTokenStream (uses word breaking in
* java.text)
@@ -25,6 +27,7 @@ public class DefaultAnalyzer extends Analyzer {
* Constructor for Analyzer.
*/
private Locale locale;
+
public DefaultAnalyzer(String localeString) {
super();
// Create a locale object for a given locale string
@@ -63,12 +66,16 @@ public class DefaultAnalyzer extends Analyzer {
if (locale == null) {
// Locale is not supported, will use en_US
- HelpBasePlugin.logError(HelpBaseResources.getString(
- "ES24", localeString), //$NON-NLS-1$
- null);
+ HelpBasePlugin
+ .logError(
+ "Text Analyzer could not be created for locale {0}. An analyzer that extends org.eclipse.help.luceneAnalyzer extension point needs to be plugged in for locale " //$NON-NLS-1$
+ + localeString
+ + ", or Java Virtual Machine needs to be upgraded to version with proper support for locale {0}.", //$NON-NLS-1$
+ null);
locale = new Locale("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
+
/**
* Creates a TokenStream which tokenizes all the text in the provided
* Reader.
@@ -99,4 +106,4 @@ public class DefaultAnalyzer extends Analyzer {
else
return Locale.getDefault();
}
-}
+} \ No newline at end of file
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 b1d1aab36..bd3809562 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
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.help.internal.search;
+
import java.io.*;
import java.net.*;
import java.nio.channels.*;
@@ -24,33 +25,54 @@ import org.eclipse.help.internal.base.util.*;
import org.eclipse.help.internal.toc.*;
import org.eclipse.help.internal.util.*;
import org.osgi.framework.*;
+
/**
* Text search index. Documents added to this index can than be searched against
* a search query.
*/
public class SearchIndex {
private IndexReader ir;
+
private IndexWriter iw;
+
private File indexDir;
+
private String locale;
+
private TocManager tocManager;
+
private AnalyzerDescriptor analyzerDescriptor;
+
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"; //$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;
+
private Object searcherCreateLock = new Object();
+
private HelpProperties dependencies;
+
private boolean closed = false;
+
// Collection of searches occuring now
private Collection searches = new ArrayList();
+
private FileLock lock;
+
/**
* Constructor.
*
@@ -81,10 +103,12 @@ public class SearchIndex {
}
} catch (OverlappingFileLockException ofle) {
// another thread in this process is unzipping
- // should never be here - one index instance per locale exists in vm
+ // should never be here - one index instance per locale exists
+ // in vm
}
}
}
+
/**
* Indexes one document from a stream. Index has to be open and close
* outside of this method
@@ -107,8 +131,12 @@ public class SearchIndex {
try {
parser.openDocument(url);
} catch (IOException ioe) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES25", //$NON-NLS-1$
- name), null);
+ HelpBasePlugin
+ .logError(
+ "Help document " //$NON-NLS-1$
+ + name
+ + " cannot be opened. The document will not be indexed.", //$NON-NLS-1$
+ null);
return false;
}
ParsedDocument parsed = new ParsedDocument(parser
@@ -128,11 +156,14 @@ public class SearchIndex {
indexedDocs.put(name, "0"); //$NON-NLS-1$
return true;
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES16", name, //$NON-NLS-1$
- indexDir.getAbsolutePath()), e);
+ HelpBasePlugin.logError(
+ "IO exception occurred while adding document " + name //$NON-NLS-1$
+ + " to index " + indexDir.getAbsolutePath() + ".", //$NON-NLS-1$ //$NON-NLS-2$
+ e);
return false;
}
}
+
/**
* Starts additions. To be called before adding documents.
*/
@@ -157,10 +188,13 @@ public class SearchIndex {
iw.maxFieldLength = 1000000;
return true;
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES17"), e); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "Exception occurred in search indexing at beginAddBatch.", e); //$NON-NLS-1$
return false;
}
}
+
/**
* Starts deletions. To be called before deleting documents.
*/
@@ -175,10 +209,13 @@ public class SearchIndex {
ir = IndexReader.open(indexDir);
return true;
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES18"), e); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "Exception occurred in search indexing at beginDeleteBatch.", e); //$NON-NLS-1$
return false;
}
}
+
/**
* Deletes a single document from the index.
*
@@ -195,12 +232,15 @@ public class SearchIndex {
ir.delete(term);
indexedDocs.remove(name);
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES22", name, //$NON-NLS-1$
- indexDir.getAbsolutePath()), e);
+ HelpBasePlugin
+ .logError("IO exception occurred while removing document " //$NON-NLS-1$
+ + name + " from index " //$NON-NLS-1$
+ + indexDir.getAbsolutePath() + ".", e); //$NON-NLS-1$
return false;
}
return true;
}
+
/**
* Finish additions. To be called after adding documents.
*/
@@ -220,10 +260,12 @@ public class SearchIndex {
setInconsistent(false);
return true;
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES19"), e); //$NON-NLS-1$
+ HelpBasePlugin.logError(
+ "Exception occurred in search indexing at endAddBatch.", e); //$NON-NLS-1$
return false;
}
}
+
/**
* Finish deletions. To be called after deleting documents.
*/
@@ -242,10 +284,13 @@ public class SearchIndex {
setInconsistent(false);
return true;
} catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES20"), e); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "Exception occurred in search indexing at endDeleteBatch.", e); //$NON-NLS-1$
return false;
}
}
+
/**
* Checks if index exists and is usable.
*
@@ -255,6 +300,7 @@ public class SearchIndex {
return indexDir.exists() && !isInconsistent();
// assume index exists if directory does
}
+
/**
* Performs a query search on this index
*/
@@ -281,15 +327,18 @@ public class SearchIndex {
} catch (QueryTooComplexException qe) {
throw qe;
} catch (Exception e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES21", //$NON-NLS-1$
- searchQuery.getSearchWord()), e);
+ HelpBasePlugin.logError(
+ "Exception occurred performing search for: " //$NON-NLS-1$
+ + searchQuery.getSearchWord() + ".", e); //$NON-NLS-1$
} finally {
unregisterSearch(Thread.currentThread());
}
}
+
public String getLocale() {
return locale;
}
+
/**
* Returns the list of all the plugins in this session that have declared a
* help contribution.
@@ -302,6 +351,7 @@ public class SearchIndex {
}
return docPlugins;
}
+
/**
* We use HelpProperties, but a list would suffice. We only need the key
* values.
@@ -315,6 +365,7 @@ public class SearchIndex {
indexedDocs.restore();
return indexedDocs;
}
+
/**
* Gets properties with versions of Lucene plugin and Analyzer used for
* indexing
@@ -327,6 +378,7 @@ public class SearchIndex {
}
return dependencies;
}
+
/**
* Gets analyzer identifier from a file.
*/
@@ -337,6 +389,7 @@ public class SearchIndex {
}
return analyzerVersion;
}
+
/**
* Gets Lucene plugin version from a file.
*/
@@ -352,6 +405,7 @@ public class SearchIndex {
// of compatibility between post 1.2.1 versions.
return currentLuceneVersion.equals(usedLuceneVersion);
}
+
/**
* Saves Lucene version and analyzer identifier to a file.
*/
@@ -367,6 +421,7 @@ public class SearchIndex {
}
getDependencies().save();
}
+
/**
* @return Returns true if index has been left in inconsistent state If
* analyzer has changed to incompatible one, index is treated as
@@ -379,6 +434,7 @@ public class SearchIndex {
return !isLuceneCompatible()
|| !analyzerDescriptor.isCompatible(readAnalyzerId());
}
+
/**
* Writes or deletes inconsistency flag file
*/
@@ -394,6 +450,7 @@ public class SearchIndex {
} else
inconsistencyFile.delete();
}
+
public void openSearcher() throws IOException {
synchronized (searcherCreateLock) {
if (searcher == null) {
@@ -401,6 +458,7 @@ public class SearchIndex {
}
}
}
+
/**
* Closes IndexReader used by Searcher. Should be called on platform
* shutdown, or when TOCs have changed when no more reading from this index
@@ -425,6 +483,7 @@ public class SearchIndex {
}
}
}
+
/**
* Finds and unzips prebuild index specified in preferences
*/
@@ -489,6 +548,7 @@ public class SearchIndex {
}
}
}
+
/**
* Returns true when the index must be updated.
*/
@@ -498,28 +558,33 @@ public class SearchIndex {
}
return getDocPlugins().detectChange();
}
+
/**
* @return Returns the tocManager.
*/
public TocManager getTocManager() {
return tocManager;
}
+
private void registerSearch(Thread t) {
synchronized (searches) {
searches.add(t);
}
}
+
private void unregisterSearch(Thread t) {
synchronized (searches) {
searches.remove(t);
}
}
+
/**
* @return Returns the closed.
*/
public boolean isClosed() {
return closed;
}
+
/**
* @return true if lock obtained for this Eclipse instance
* @throws OverlappingFileLockException
@@ -543,6 +608,7 @@ public class SearchIndex {
}
return false;
}
+
public synchronized void releaseLock() {
if (lock != null) {
try {
@@ -552,4 +618,4 @@ public class SearchIndex {
lock = null;
}
}
-}
+} \ No newline at end of file
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 ed82f5ea2..4beed2a96 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
@@ -24,8 +24,10 @@ import org.eclipse.help.internal.search.IndexingOperation.*;
public class SearchManager implements ITocsChangedListener {
/** Search indexes, by locale */
private Map indexes = new HashMap();
+
/** Caches analyzer descriptors for each locale */
private Map analyzerDescriptors = new HashMap();
+
/**
* Constructs a Search manager.
*/
@@ -33,6 +35,7 @@ public class SearchManager implements ITocsChangedListener {
super();
HelpPlugin.getDefault().addTocsChangedListener(this);
}
+
/**
* Public for use by indexing tool
*/
@@ -47,6 +50,7 @@ public class SearchManager implements ITocsChangedListener {
return (SearchIndexWithIndexingProgress) index;
}
}
+
/**
* Obtains AnalyzerDescriptor that indexing and search should use for a
* given locale.
@@ -158,6 +162,7 @@ public class SearchManager implements ITocsChangedListener {
}
}
}
+
/**
* @param pm
* @param index
@@ -190,11 +195,11 @@ public class SearchManager implements ITocsChangedListener {
return;
} catch (OperationCanceledException oce) {
progressDistrib.operationCanceled();
- HelpBasePlugin.logWarning(HelpBaseResources
- .getString("Search_cancelled")); //$NON-NLS-1$
+ HelpBasePlugin.logWarning("Search cancelled."); //$NON-NLS-1$
throw oce;
}
}
+
/**
* Closes all indexes.
*/
@@ -205,6 +210,7 @@ public class SearchManager implements ITocsChangedListener {
}
}
}
+
public synchronized void tocsChanged() {
Collection activeIndexes = new ArrayList();
synchronized (indexes) {
@@ -225,4 +231,4 @@ public class SearchManager implements ITocsChangedListener {
}
}
-}
+} \ No newline at end of file
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 33cbb07d8..9c0aadd8e 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
@@ -30,7 +30,9 @@ public class SearchProgressMonitor implements IProgressMonitor {
protected static ISearchHitCollector dummy_collector;
private boolean started, done, canceled;
+
private int totalWork = IProgressMonitor.UNKNOWN;
+
private int currWork;
static {
@@ -46,6 +48,7 @@ public class SearchProgressMonitor implements IProgressMonitor {
public SearchProgressMonitor() {
started = done = canceled = false;
}
+
public void beginTask(String name, int totalWork) {
this.totalWork = totalWork;
this.started = true;
@@ -84,6 +87,7 @@ public class SearchProgressMonitor implements IProgressMonitor {
return 100;
return (100 * currWork / totalWork);
}
+
/**
* Gets the isCancelled.
*
@@ -164,8 +168,10 @@ public class SearchProgressMonitor implements IProgressMonitor {
} catch (Exception e) {
progressMonitors.remove(locale);
if (HelpBasePlugin.getDefault() != null) {
- HelpBasePlugin.logError(HelpBaseResources
- .getString("search_index_update_error"), e); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "Problem occurred during indexing of documentation.", //$NON-NLS-1$
+ e);
} else {
// Plugin has been shut down
}
@@ -188,23 +194,28 @@ public class SearchProgressMonitor implements IProgressMonitor {
return pm;
}
+
static class DummySearchQuery implements ISearchQuery {
private String l;
+
DummySearchQuery(String loc) {
l = loc;
}
+
/**
* Obtains names of fields in addition to default field
*/
public Collection getFieldNames() {
return new ArrayList();
}
+
/**
* Obtains search word (user query)
*/
public String getSearchWord() {
return "dummy"; //$NON-NLS-1$
}
+
/**
* @return true if search only in specified fields, not the default
* field
@@ -212,6 +223,7 @@ public class SearchProgressMonitor implements IProgressMonitor {
public boolean isFieldSearch() {
return false;
}
+
/**
* Obtains locale
*/
@@ -219,8 +231,9 @@ public class SearchProgressMonitor implements IProgressMonitor {
return l;
}
}
+
public synchronized static void reinit(String locale) {
progressMonitors.remove(locale);
}
-}
+} \ No newline at end of file
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 2dbf21a0c..5ca75602f 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
@@ -19,25 +19,25 @@ import java.nio.channels.*;
* should be launched from command line.
*/
public class EclipseController implements EclipseLifeCycleListener {
- public static final String CMD_INSTALL = "install";
+ public static final String CMD_INSTALL = "install"; //$NON-NLS-1$
- public static final String CMD_UPDATE = "update";
+ public static final String CMD_UPDATE = "update"; //$NON-NLS-1$
- public static final String CMD_ENABLE = "enable";
+ public static final String CMD_ENABLE = "enable"; //$NON-NLS-1$
- public static final String CMD_DISABLE = "disable";
+ public static final String CMD_DISABLE = "disable"; //$NON-NLS-1$
- public static final String CMD_UNINSTALL = "uninstall";
+ public static final String CMD_UNINSTALL = "uninstall"; //$NON-NLS-1$
- public static final String CMD_SEARCH = "search";
+ public static final String CMD_SEARCH = "search"; //$NON-NLS-1$
- public static final String CMD_LIST = "listFeatures";
+ public static final String CMD_LIST = "listFeatures"; //$NON-NLS-1$
- public static final String CMD_ADDSITE = "addSite";
+ public static final String CMD_ADDSITE = "addSite"; //$NON-NLS-1$
- public static final String CMD_REMOVESITE = "removeSite";
+ public static final String CMD_REMOVESITE = "removeSite"; //$NON-NLS-1$
- public static final String CMD_APPLY = "apply";
+ public static final String CMD_APPLY = "apply"; //$NON-NLS-1$
// control servlet path
private static final String CONTROL_SERVLET_PATH = "/helpControl/control.html"; //$NON-NLS-1$
@@ -183,7 +183,7 @@ public class EclipseController implements EclipseLifeCycleListener {
Thread.sleep(200);
if (System.currentTimeMillis() > timeLimit) {
System.out
- .println("Shutting down is taking too long. Will not wait.");
+ .println("Shutting down is taking too long. Will not wait."); //$NON-NLS-1$
break;
}
}
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 ffc789d83..67794ac82 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
@@ -18,15 +18,15 @@ import java.util.*;
*/
public class Options {
// Update command parameters' keys
- public static final String PARAM_FEATUREID = "featureId";
+ public static final String PARAM_FEATUREID = "featureId"; //$NON-NLS-1$
- public static final String PARAM_VERSION = "version";
+ public static final String PARAM_VERSION = "version"; //$NON-NLS-1$
- public static final String PARAM_FROM = "from";
+ public static final String PARAM_FROM = "from"; //$NON-NLS-1$
- public static final String PARAM_TO = "to";
+ public static final String PARAM_TO = "to"; //$NON-NLS-1$
- public static final String PARAM_VERIFYONLY = "verifyOnly";
+ public static final String PARAM_VERIFYONLY = "verifyOnly"; //$NON-NLS-1$
// debugging
private static boolean debug = false;
@@ -116,23 +116,23 @@ public class Options {
List parameters = new ArrayList();
List param = extractOption(eclipseArgs, "-" + PARAM_FEATUREID); //$NON-NLS-1$
if (param != null) {
- parameters.add(PARAM_FEATUREID + "=" + (String) param.get(0));
+ parameters.add(PARAM_FEATUREID + "=" + (String) param.get(0)); //$NON-NLS-1$
}
param = extractOption(eclipseArgs, "-" + PARAM_VERSION); //$NON-NLS-1$
if (param != null) {
- parameters.add(PARAM_VERSION + "=" + (String) param.get(0));
+ parameters.add(PARAM_VERSION + "=" + (String) param.get(0)); //$NON-NLS-1$
}
param = extractOption(eclipseArgs, "-" + PARAM_FROM); //$NON-NLS-1$
if (param != null) {
- parameters.add(PARAM_FROM + "=" + (String) param.get(0));
+ parameters.add(PARAM_FROM + "=" + (String) param.get(0)); //$NON-NLS-1$
}
param = extractOption(eclipseArgs, "-" + PARAM_TO); //$NON-NLS-1$
if (param != null) {
- parameters.add(PARAM_TO + "=" + (String) param.get(0));
+ parameters.add(PARAM_TO + "=" + (String) param.get(0)); //$NON-NLS-1$
}
param = extractOption(eclipseArgs, "-" + PARAM_VERIFYONLY); //$NON-NLS-1$
if (param != null) {
- parameters.add(PARAM_VERIFYONLY + "=" + (String) param.get(0));
+ parameters.add(PARAM_VERIFYONLY + "=" + (String) param.get(0)); //$NON-NLS-1$
}
updateParameters = (String[]) parameters.toArray(new String[parameters
.size()]);
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 0cf54971e..06b43fbc7 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
@@ -31,10 +31,8 @@ import org.xml.sax.*;
*
* @since 2.1
*/
-public class WorkingSetManager
- implements
- IHelpWorkingSetManager,
- ITocsChangedListener {
+public class WorkingSetManager implements IHelpWorkingSetManager,
+ ITocsChangedListener {
// Note: keep the following constants in sych with the values defined in
// IWorkingSetManager.
@@ -48,6 +46,7 @@ public class WorkingSetManager
* @see IPropertyChangeListener
*/
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. oldValue will be the removed working
@@ -56,6 +55,7 @@ public class WorkingSetManager
* @see IPropertyChangeListener
*/
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. oldValue will be
@@ -64,6 +64,7 @@ public class WorkingSetManager
* @see IPropertyChangeListener
*/
public static final String CHANGE_WORKING_SET_CONTENT_CHANGE = "workingSetContentChange"; //$NON-NLS-1$
+
/**
* Change event id when the working set name changed. newValue of the
* PropertyChangeEvent will be the changed working set. oldValue will be
@@ -83,12 +84,16 @@ public class WorkingSetManager
// Working set persistence
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();
+
private AdaptableTocsArray root;
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
+
private static final TransformerFactory transformerFactory = TransformerFactory
.newInstance();
@@ -178,6 +183,7 @@ public class WorkingSetManager
.propertyChange(event);
}
}
+
/**
* Returns a working set by name
*
@@ -194,6 +200,7 @@ public class WorkingSetManager
}
return null;
}
+
/**
* Returns the hash code.
*
@@ -202,6 +209,7 @@ public class WorkingSetManager
public int hashCode() {
return workingSets.hashCode();
}
+
/**
* Implements IWorkingSetManager.
*
@@ -211,6 +219,7 @@ public class WorkingSetManager
return (WorkingSet[]) workingSets.toArray(new WorkingSet[workingSets
.size()]);
}
+
/**
* Returns the file used as the persistence store
*
@@ -255,24 +264,19 @@ public class WorkingSetManager
return true;
} catch (ParserConfigurationException pce) {
- String msg = HelpBaseResources
- .getString("WorkingSetManager.PCE"); //$NON-NLS-1$
- HelpPlugin.logError(msg, pce);
- HelpPlugin.logError(HelpBaseResources.getString("E041"), pce); //$NON-NLS-1$
+ HelpPlugin
+ .logError(
+ "DocumentBuilder implementation could not be loaded, to restore working set state.", pce); //$NON-NLS-1$
return false;
} catch (SAXException se) {
- String msg = HelpBaseResources.getString(
- "E018", stateFile.toString()); //$NON-NLS-1$
- HelpBasePlugin.logError(msg, se);
HelpBasePlugin
- .logError(HelpBaseResources.getString("E041"), se); //$NON-NLS-1$
+ .logError(
+ "Error occurred parsing file " + stateFile.toString() + ", while restoring working set state.", se); //$NON-NLS-1$ //$NON-NLS-2$
return false;
} catch (IOException ioe) {
- String msg = HelpBaseResources.getString(
- "E018", stateFile.toString()); //$NON-NLS-1$
- HelpBasePlugin.logError(msg, ioe);
- HelpBasePlugin.logError(
- HelpBaseResources.getString("E041"), ioe); //$NON-NLS-1$
+ HelpBasePlugin
+ .logError(
+ "Error occurred parsing file " + stateFile.toString() + ", while restoring working set state.", ioe); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
}
@@ -387,18 +391,17 @@ public class WorkingSetManager
stream.close();
return true;
} catch (ParserConfigurationException pce) {
- String msg = HelpBaseResources.getString("WorkingSetManager.PCE"); //$NON-NLS-1$
- HelpPlugin.logError(msg, pce);
+ HelpPlugin.logError(
+ "DocumentBuilder implementation could not be loaded.", pce); //$NON-NLS-1$
return false;
} catch (TransformerException e) {
- String message = HelpBaseResources
- .getString("WorkingSetManager.transformer"); //$NON-NLS-1$
- HelpPlugin.logError(message, null);
+ HelpPlugin.logError("Problems occurred while saving working sets.", //$NON-NLS-1$
+ null);
return false;
} catch (IOException e) {
stateFile.delete();
- String message = HelpBaseResources.getString("E40"); //$NON-NLS-1$
- HelpBasePlugin.logError(message, null);
+ HelpBasePlugin.logError(
+ "Problems occurred while saving working set file.", null); //$NON-NLS-1$
return false;
}
}
@@ -417,6 +420,7 @@ public class WorkingSetManager
workingSet.saveState(parent);
}
}
+
/**
* Persists all working sets. Should only be called by the webapp working
* set dialog.
@@ -476,6 +480,7 @@ public class WorkingSetManager
return null;
}
+
public String getCurrentWorkingSet() {
return HelpBasePlugin.getDefault().getPluginPreferences().getString(
BaseHelpSystem.WORKING_SET);
@@ -486,6 +491,7 @@ public class WorkingSetManager
BaseHelpSystem.WORKING_SET, workingSet);
HelpBasePlugin.getDefault().savePluginPreferences();
}
+
public void tocsChanged() {
saveState();
List oldWorkingSets = new ArrayList(workingSets);
@@ -503,4 +509,4 @@ public class WorkingSetManager
}
}
-}
+} \ No newline at end of file

Back to the top