Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.ui/.cvsignore4
-rw-r--r--org.eclipse.help.ui/.project4
-rw-r--r--org.eclipse.help.ui/build.properties4
-rw-r--r--org.eclipse.help.ui/contexts.xml27
-rw-r--r--org.eclipse.help.ui/contexts_search.xml8
-rw-r--r--org.eclipse.help.ui/icons/search_menu.gifbin245 -> 0 bytes
-rw-r--r--org.eclipse.help.ui/icons/search_sortmatch.gifbin160 -> 0 bytes
-rw-r--r--org.eclipse.help.ui/plugin.properties12
-rw-r--r--org.eclipse.help.ui/plugin.xml97
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/AppserverPreferencePage.java14
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java33
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java (renamed from org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelp.java)42
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpContentsAction.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java (renamed from org.eclipse.help.ui/src/org/eclipse/help/ui/internal/WorkbenchHelpPlugin.java)71
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java (renamed from org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/WorkbenchResources.java)12
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties (renamed from org.eclipse.help.ui/src/helpworkbench.properties)72
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java17
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/OpenHelpSearchPageAction.java63
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java23
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/SystemBrowserAdapter.java5
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchPage.java297
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchSorter.java41
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchOperation.java226
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchQueryData.java185
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/ErrorUtil.java18
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/HelpWorkbenchException.java21
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/SWTUtil.java89
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSet.java135
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetElementLabelProvider.java47
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetPage.java342
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetSynchronizer.java234
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetTreeContentProvider.java76
-rw-r--r--org.eclipse.help.webapp/.classpath2
-rw-r--r--org.eclipse.help.webapp/.cvsignore1
-rw-r--r--org.eclipse.help.webapp/.project2
-rw-r--r--org.eclipse.help.webapp/WEB-INF/lib/.cvsignore1
-rw-r--r--org.eclipse.help.webapp/WEB-INF/web.xml5
-rw-r--r--org.eclipse.help.webapp/basic/advanced.inc2
-rw-r--r--org.eclipse.help.webapp/build.xml116
-rw-r--r--org.eclipse.help.webapp/plugin.properties6
-rw-r--r--org.eclipse.help.webapp/plugin.xml7
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java71
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties (renamed from org.eclipse.help.webapp/src/webapp.properties)2
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/BookmarksData.java32
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LayoutData.java6
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LinksData.java4
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/RequestData.java10
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/SearchData.java8
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/TocData.java13
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/UrlUtil.java10
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/WebappPreferences.java8
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ContextServlet.java8
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ControlServlet.java19
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java14
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java4
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java2
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java6
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/SearchServlet.java5
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/TocServlet.java10
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java8
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/XMLGenerator.java7
-rw-r--r--org.eclipse.help/.options1
-rw-r--r--org.eclipse.help/.project2
-rw-r--r--org.eclipse.help/build.properties2
-rw-r--r--org.eclipse.help/doc/banner_prod.jpgbin11300 -> 0 bytes
-rw-r--r--org.eclipse.help/doc/book.css1
-rw-r--r--org.eclipse.help/doc/contents_view.gifbin169 -> 0 bytes
-rw-r--r--org.eclipse.help/doc/help_home.html51
-rw-r--r--org.eclipse.help/doc/hglegal2003.htm14
-rw-r--r--org.eclipse.help/doc/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.help/doc/org_eclipse_help.html81
-rw-r--r--org.eclipse.help/doc/search_results_view.gifbin162 -> 0 bytes
-rw-r--r--org.eclipse.help/doc/synch_toc_nav.gifbin361 -> 0 bytes
-rw-r--r--org.eclipse.help/plugin.properties14
-rw-r--r--org.eclipse.help/plugin.xml193
-rw-r--r--org.eclipse.help/preferences.ini53
-rw-r--r--org.eclipse.help/schema/browser.exsd166
-rw-r--r--org.eclipse.help/schema/luceneAnalyzer.exsd133
-rw-r--r--org.eclipse.help/schema/support.exsd111
-rw-r--r--org.eclipse.help/schema/webapp.exsd110
-rw-r--r--org.eclipse.help/src/help.properties90
-rw-r--r--org.eclipse.help/src/org/eclipse/help/HelpSystem.java78
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IHelp.java46
-rw-r--r--org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/browser/IBrowser.java69
-rw-r--r--org.eclipse.help/src/org/eclipse/help/browser/IBrowserFactory.java31
-rw-r--r--org.eclipse.help/src/org/eclipse/help/browser/package.html40
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/DefaultHelpSupport.java344
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpApplication.java140
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java150
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java80
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties37
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpSystem.java369
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/IHelpRoleManager.java5
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/IndexToolApplication.java160
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java (renamed from org.eclipse.help/src/org/eclipse/help/internal/util/RuntimeHelpStatus.java)14
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserDescriptor.java38
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserLog.java88
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserManager.java288
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/CurrentBrowser.java135
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowser.java154
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java34
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java232
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaFactory.java123
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/StreamConsumer.java47
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java85
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java39
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextProxy.java61
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java23
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java15
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/ASCIIReader.java50
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java164
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/Analyzer_en.java74
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/DefaultAnalyzer.java105
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/HTMLDocParser.java381
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/ISearchHitCollector.java24
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/ISearchQuery.java32
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/IndexingOperation.java292
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/LazyProgressMonitor.java57
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/ParsedDocument.java73
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/ProgressDistributor.java132
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/QueryBuilder.java458
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/QueryTooComplexException.java18
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java50
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsPhrase.java51
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsToken.java73
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchHit.java79
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchIndex.java526
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchManager.java168
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchProgressMonitor.java211
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchQuery.java102
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SearchResults.java169
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/SmartAnalyzer.java45
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/search/WordTokenStream.java101
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/Eclipse.java218
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseConnection.java106
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseController.java280
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java17
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/Options.java307
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneHelp.java161
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java100
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java11
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java3
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java20
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java11
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/HelpProperties.java102
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/IErrorUtil.java22
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/PluginVersionInfo.java189
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/Resources.java197
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/TString.java336
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java103
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableToc.java70
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java104
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTopic.java101
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java69
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/PropertyChange.java306
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSet.java84
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java43
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetManager.java497
-rw-r--r--org.eclipse.help/src/org/eclipse/help/package.html30
-rw-r--r--org.eclipse.help/src/org/eclipse/help/standalone/Help.java159
-rw-r--r--org.eclipse.help/src/org/eclipse/help/standalone/Infocenter.java101
-rw-r--r--org.eclipse.help/src/org/eclipse/help/standalone/package.html27
165 files changed, 708 insertions, 13064 deletions
diff --git a/org.eclipse.help.ui/.cvsignore b/org.eclipse.help.ui/.cvsignore
index 66b913441..e219ad3ed 100644
--- a/org.eclipse.help.ui/.cvsignore
+++ b/org.eclipse.help.ui/.cvsignore
@@ -1,5 +1,5 @@
bin
build.xml
-helpworkbench.jar
-helpworkbench.jar.bin.log
+helpui.jar
+helpui.jar.bin.log
org.eclipse.help.ui_* \ No newline at end of file
diff --git a/org.eclipse.help.ui/.project b/org.eclipse.help.ui/.project
index 741b5f694..f8bfa2479 100644
--- a/org.eclipse.help.ui/.project
+++ b/org.eclipse.help.ui/.project
@@ -4,11 +4,9 @@
<comment></comment>
<projects>
<project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
- <project>org.eclipse.help</project>
<project>org.eclipse.help.appserver</project>
- <project>org.eclipse.search</project>
+ <project>org.eclipse.help.base</project>
<project>org.eclipse.ui</project>
</projects>
<buildSpec>
diff --git a/org.eclipse.help.ui/build.properties b/org.eclipse.help.ui/build.properties
index e43ae7a27..7f841c2fa 100644
--- a/org.eclipse.help.ui/build.properties
+++ b/org.eclipse.help.ui/build.properties
@@ -8,7 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-source.helpworkbench.jar=src/
+source.helpui.jar=src/
src.includes=schema/,about.html
-bin.includes=icons/,doc/,contexts*.xml,plugin.xml,*.jar,plugin.properties,about.html,.options
+bin.includes=icons/,contexts*.xml,plugin.xml,*.jar,plugin.properties,about.html,.options
diff --git a/org.eclipse.help.ui/contexts.xml b/org.eclipse.help.ui/contexts.xml
index 3e9989849..ba1965b0e 100644
--- a/org.eclipse.help.ui/contexts.xml
+++ b/org.eclipse.help.ui/contexts.xml
@@ -18,18 +18,14 @@ This infopop opened because you pressed F1 while an infopop was already open.</d
<topic label="Online Help System" href="/org.eclipse.platform.doc.user/concepts/chelpsys.htm"/>
<topic label="Help Menu - Help Contents" href="/org.eclipse.platform.doc.user/reference/ref-61.htm"/>
</context>
-
-<!-- Search Menu: Help -->
- <context id="helpSearchMenu" >
- <description>This action will open the Search dialog that allows documentation searching.</description>
- <topic label="Searching online help" href="/org.eclipse.platform.doc.user/tasks/tsearch.htm" />
- </context>
+<!-- Preference page for help browsers -->
<context id="prefPageBrowsers" >
<description>Allows selecting a web browser. The selected web browser will be the default browser used to display help contents.</description>
<topic label="Preferences Dialog" href="/org.eclipse.platform.doc.user/reference/ref-72.htm"/>
</context>
+<!-- Path to custom browser on preference page for help browsers -->
<context id="prefPageCustomBrowserPath" >
<description>When custom web browser is selected from the list, specify path to the browser program that launches the browser. If the program is available on your system path, you may specify only the program name.
@@ -37,6 +33,7 @@ If the program does not accept URL as its last parameter, you may use %1 string
<topic label="Preferences Dialog" href="/org.eclipse.platform.doc.user/reference/ref-72.htm"/>
</context>
+<!-- Application server preference page -->
<context id="prefPageAppServer" >
<description>These settings allow you to override the network interface address and port number that the internal <b>application server</b> will use. Change the settings when the port it is trying to use is taken, or when your IP address has changed.
@@ -48,22 +45,4 @@ Under normal circumstances, use the <b>Default</b> settings.</description>
<topic label="Preferences Dialog" href="/org.eclipse.platform.doc.user/reference/ref-72.htm"/>
</context>
-<!-- Search dialog Search Help -->
- <context id="searchPage" >
- <description>Type a search term or terms in the search expression field, and then click <b>Search</b>. This will open Search view that contains all the search results.
-
-You can use OR and NOT qualifiers between terms. Also, if you put double-quotation marks around a query, search will return only results that contain specified phrase.
-
-Click <b>Choose</b> to see the working set selection dialog, allowing for additional filtering to be specified.</description>
- <topic label="Searching online help" href="/org.eclipse.platform.doc.user/tasks/tsearch.htm" />
- </context>
-
-<!-- Search result view -->
- <context id="searchResultView" >
- <description>This view lists the results of recent searches. Currently displayed are results or last documentation search. Double click one of the documents to open it.</description>
- <topic label="Help search" href="/org.eclipse.platform.doc.user/tasks/tsearch.htm"/>
- <topic label="Search view" href="reference/ref-26.htm"/>
- <topic label="File search" href="reference/ref-45.htm"/>
- </context>
-
</contexts>
diff --git a/org.eclipse.help.ui/contexts_search.xml b/org.eclipse.help.ui/contexts_search.xml
deleted file mode 100644
index e8ee35687..000000000
--- a/org.eclipse.help.ui/contexts_search.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.contexts"?>
-
-<contexts>
- <context id="search_view_context" >
- <topic label="Help search" href="/org.eclipse.platform.doc.user/tasks/tsearch.htm"/>
- </context>
-</contexts>
diff --git a/org.eclipse.help.ui/icons/search_menu.gif b/org.eclipse.help.ui/icons/search_menu.gif
deleted file mode 100644
index f3ac243b5..000000000
--- a/org.eclipse.help.ui/icons/search_menu.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.ui/icons/search_sortmatch.gif b/org.eclipse.help.ui/icons/search_sortmatch.gif
deleted file mode 100644
index 9ed470d02..000000000
--- a/org.eclipse.help.ui/icons/search_sortmatch.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.ui/plugin.properties b/org.eclipse.help.ui/plugin.properties
index 4a3c663f7..5223923ca 100644
--- a/org.eclipse.help.ui/plugin.properties
+++ b/org.eclipse.help.ui/plugin.properties
@@ -14,17 +14,7 @@ providerName=Eclipse.org
help_preferences_page_name = Help
helpcontents = &Help Contents
help = Help
-help_view = Help
-help_perspective = Help
openhelpcontents = Open Help Contents
-related_view = Related Contexts
-browsers_preferences_page_name = Web Browsers
-help_search_page = Help Search
-helpsearchhitname = Help Search Hit
-helpsearchhitsorter.label = &Relevance
-helpsearchhitsorter.tooltip = Sort by Relevance
-openHelpSearchPageAction.label = &Help...
-searchMenu.label = Se&arch
# Browser adapters
internet_explorer = Embedded Internet Explorer Adapter
@@ -32,5 +22,3 @@ system_browser = Default System Browser
# Application Server
appserver_preferences_page_name= Help Server
-
-HelpWorkingSet=Help \ No newline at end of file
diff --git a/org.eclipse.help.ui/plugin.xml b/org.eclipse.help.ui/plugin.xml
index f63dd13e3..1d8984ddc 100644
--- a/org.eclipse.help.ui/plugin.xml
+++ b/org.eclipse.help.ui/plugin.xml
@@ -1,31 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
<plugin
id="org.eclipse.help.ui"
name="%help_system_plugin_name"
version="3.0.0"
provider-name="%providerName"
- class="org.eclipse.help.ui.internal.WorkbenchHelpPlugin">
+ class="org.eclipse.help.ui.internal.HelpUIPlugin">
<runtime>
- <library name="helpworkbench.jar">
+ <library name="helpui.jar">
<export name="*"/>
<packages prefixes="org.eclipse.help.ui"/>
</library>
</runtime>
<requires>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.help"/>
+ <import plugin="org.eclipse.help.base"/>
<import plugin="org.eclipse.help.appserver"/>
- <import plugin="org.eclipse.search"/>
<import plugin="org.eclipse.ui"/>
</requires>
<!-- Default Help UI -->
<extension
- point="org.eclipse.help.support">
+ point="org.eclipse.ui.helpSupport">
<config
- class="org.eclipse.help.ui.internal.DefaultHelp">
+ class="org.eclipse.help.ui.internal.DefaultHelpUI">
</config>
</extension>
<!-- Preference pages -->
@@ -49,10 +48,6 @@
<contexts
file="contexts.xml">
</contexts>
- <contexts
- file="contexts_search.xml"
- plugin="org.eclipse.search">
- </contexts>
</extension>
<!-- Action Sets -->
<extension
@@ -70,94 +65,16 @@
menubarPath="help/helpEnd"
id="org.eclipse.help.internal.ui.HelpAction">
</action>
- <menu
- label="%searchMenu.label"
- path="navigate"
- id="org.eclipse.search.menu">
- <groupMarker
- name="internalDialogGroup">
- </groupMarker>
-<!-- not to be used by clients -->
- <groupMarker
- name="dialogGroup">
- </groupMarker>
-<!-- to be used by clients -->
- <separator
- name="contextMenuActionsGroup">
- </separator>
- </menu>
- <action
- label="%openHelpSearchPageAction.label"
- icon="icons/search_menu.gif"
- helpContextId="org.eclipse.help.ui.helpSearchMenu"
- class="org.eclipse.help.ui.internal.OpenHelpSearchPageAction"
- menubarPath="org.eclipse.search.menu/dialogGroup"
- id="org.eclipse.help.ui.OpenHelpSearchPage">
- </action>
</actionSet>
</extension>
<!-- Web Browsers -->
<extension
- point="org.eclipse.help.browser">
+ point="org.eclipse.help.base.browser">
<browser
factoryclass="org.eclipse.help.ui.internal.browser.SystemBrowserFactory"
name="%system_browser"
id="org.eclipse.help.ui.systembrowser">
</browser>
</extension>
-<!-- Search Page -->
- <extension
- point="org.eclipse.search.searchPages">
- <page
- searchViewHelpContextId="org.eclipse.help.ui.searchResultView"
- label="%help_search_page"
- icon="icons/search_menu.gif"
- class="org.eclipse.help.ui.internal.search.HelpSearchPage"
- id="org.eclipse.help.ui.searchPage">
- </page>
- </extension>
-<!-- Markers -->
- <extension
- id="helpsearchhit"
- name="%helpsearchhitname"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.search.searchmarker">
- </super>
- <attribute
- name="href">
- </attribute>
- <attribute
- name="label">
- </attribute>
- <attribute
- name="resultfof">
- </attribute>
- <attribute
- name="order">
- </attribute>
- </extension>
-<!-- Search Results Sorter -->
- <extension
- point="org.eclipse.search.searchResultSorters">
- <sorter
- pageId="org.eclipse.help.ui.searchPage"
- label="%helpsearchhitsorter.label"
- icon="icons/search_sortmatch.gif"
- tooltip="%helpsearchhitsorter.tooltip"
- class="org.eclipse.help.ui.internal.search.HelpSearchSorter"
- id="org.eclipse.help.ui.helpsearchhitsorter">
- </sorter>
- </extension>
-<!-- Help Working Set Page -->
- <extension
- point="org.eclipse.ui.workingSets">
- <workingSet
- name="%HelpWorkingSet"
- pageClass="org.eclipse.help.ui.internal.workingset.HelpWorkingSetPage"
- icon="icons/workingset.gif"
- id="org.eclipse.help.ui.HelpWorkingSetPage">
- </workingSet>
- </extension>
</plugin>
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/AppserverPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/AppserverPreferencePage.java
index b85e130c8..bccdbc5b5 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/AppserverPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/AppserverPreferencePage.java
@@ -11,7 +11,6 @@
package org.eclipse.help.ui.internal;
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.ui.internal.util.*;
import org.eclipse.jface.preference.*;
import org.eclipse.jface.resource.*;
import org.eclipse.swt.*;
@@ -50,8 +49,7 @@ public class AppserverPreferencePage
Label label = new Label(mainComposite, SWT.NONE);
label.setText(
- WorkbenchResources.getString(
- "AppserverPreferencePage.description"));
+ HelpUIResources.getString("AppserverPreferencePage.description"));
GridData data = new GridData();
data.horizontalSpan = 2;
label.setLayoutData(data);
@@ -67,7 +65,7 @@ public class AppserverPreferencePage
label = new Label(mainComposite, SWT.NONE);
label.setFont(font);
label.setText(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"AppserverPreferencePage.hostDescription"));
data = new GridData();
data.horizontalSpan = 2;
@@ -99,7 +97,7 @@ public class AppserverPreferencePage
label = new Label(mainComposite, SWT.NONE);
label.setFont(font);
label.setText(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"AppserverPreferencePage.portDescription"));
data = new GridData();
data.horizontalSpan = 2;
@@ -141,7 +139,7 @@ public class AppserverPreferencePage
}
AppserverPreferencePage.this.setValid(false);
setErrorMessage(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"AppserverPreferencePage.invalidPort"));
}
});
@@ -155,7 +153,7 @@ public class AppserverPreferencePage
label = new Label(mainComposite, SWT.NONE);
label.setText(
- WorkbenchResources.getString("AppserverPreferencePage.Note"));
+ HelpUIResources.getString("AppserverPreferencePage.Note"));
label.setFont(JFaceResources.getBannerFont());
data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
//data.horizontalSpan = 2;
@@ -163,7 +161,7 @@ public class AppserverPreferencePage
label = new Label(mainComposite, SWT.NONE);
label.setText(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"AppserverPreferencePage.requireRestart"));
data = new GridData();
//data.horizontalSpan = 2;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
index 6c4d07863..95e4ba9a2 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
@@ -12,7 +12,7 @@
package org.eclipse.help.ui.internal;
import org.eclipse.help.*;
-import org.eclipse.help.ui.internal.util.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.jface.resource.*;
import org.eclipse.swt.*;
import org.eclipse.swt.accessibility.*;
@@ -63,7 +63,7 @@ public class ContextHelpDialog {
foregroundColour = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
linkColour = display.getSystemColor(SWT.COLOR_BLUE);
shell = new Shell(display.getActiveShell(), SWT.NONE);
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog.ContextHelpDialog(): Shell is:"
+ shell.toString());
@@ -72,7 +72,7 @@ public class ContextHelpDialog {
shell.addListener(SWT.Deactivate, new Listener() {
public void handleEvent(Event e) {
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog shell deactivate listener: SWT.Deactivate called. ");
}
@@ -83,7 +83,7 @@ public class ContextHelpDialog {
shell.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog: shell traverse listener: SWT.TRAVERSE_ESCAPE called. ");
}
@@ -94,7 +94,7 @@ public class ContextHelpDialog {
shell.addControlListener(new ControlAdapter() {
public void controlMoved(ControlEvent e) {
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog: shell control adapter called.");
}
@@ -108,7 +108,7 @@ public class ContextHelpDialog {
shell.update();
}
});
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog.ContextHelpDialog(): Focus owner is: "
+ Display.getCurrent().getFocusControl().toString());
@@ -133,7 +133,7 @@ public class ContextHelpDialog {
}
public synchronized void close() {
try {
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println("ContextHelpDialog.close()");
}
if (shell != null) {
@@ -166,12 +166,12 @@ public class ContextHelpDialog {
// Create the text field.
String styledText = context.getText();
if (styledText == null) // no description found in context objects.
- styledText = WorkbenchResources.getString("WW002");
+ styledText = HelpUIResources.getString("WW002");
Description text = new Description(parent, SWT.MULTI | SWT.READ_ONLY);
text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog text TraverseListener.handleEvent(): SWT.TRAVERSE_ESCAPE.");
}
@@ -256,33 +256,32 @@ public class ContextHelpDialog {
*/
private void launchLinks(IHelpResource selectedTopic) {
close();
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println("ContextHelpDialog.launchLinks(): closed shell");
}
- // launch help view
- DefaultHelp.getInstance().displayHelp(context, selectedTopic);
+ BaseHelpSystem.getHelpDisplay().displayHelp(context, selectedTopic);
}
public synchronized void open() {
try {
shell.open();
- if (WorkbenchHelpPlugin.DEBUG_INFOPOP) {
+ if (HelpUIPlugin.DEBUG_INFOPOP) {
System.out.println(
"ContextHelpDialog.open(): Focus owner after open is: "
+ Display.getCurrent().getFocusControl().toString());
}
} catch (Throwable e) {
- WorkbenchHelpPlugin.logError(
- WorkbenchResources.getString("ContextHelpDialog.open"),
+ HelpUIPlugin.logError(
+ HelpUIResources.getString("ContextHelpDialog.open"),
e);
}
}
private Image getImage() {
if (imgRegistry == null) {
- imgRegistry = WorkbenchHelpPlugin.getDefault().getImageRegistry();
+ imgRegistry = HelpUIPlugin.getDefault().getImageRegistry();
imgRegistry.put(
IHelpUIConstants.IMAGE_KEY_F1TOPIC,
ImageDescriptor.createFromURL(
- WorkbenchResources.getImagePath(
+ HelpUIResources.getImagePath(
IHelpUIConstants.IMAGE_FILE_F1TOPIC)));
}
return imgRegistry.get(IHelpUIConstants.IMAGE_KEY_F1TOPIC);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelp.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
index 94bfb7fec..62d5f00af 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelp.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
@@ -10,37 +10,49 @@
*******************************************************************************/
package org.eclipse.help.ui.internal;
import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.ui.internal.util.*;
+import org.eclipse.ui.help.*;
/**
- * This class is an implementation of the pluggable help support.
- * In is registered into the support extension point, and all
- * requests to display help are delegated to this class.
+ * This class is an implementation of the Help UI.
+ * In is registered into the helpSupport extension point,
+ * and is responsible for handling requests to display help.
* The methods on this class interact with the actual
* UI component handling the display.
- * <p>Most methods are inherited from the default hep support class; only
- * the UI specific ones are overriden.</p>
+ * <p>Most methods delegate most work to HelpDisplay class; only
+ * the UI specific ones implemented in place.</p>
*/
-public class DefaultHelp extends DefaultHelpSupport {
- private static DefaultHelp instance;
+public class DefaultHelpUI extends AbstractHelpUI {
private ContextHelpDialog f1Dialog = null;
/**
- * BaseHelpViewer constructor.
+ * Constructor.
*/
- public DefaultHelp() {
+ public DefaultHelpUI() {
super();
- instance = this;
}
/**
- * Singleton method
+ * Displays help.
*/
- public static DefaultHelp getInstance() {
- return instance;
+ public void displayHelp() {
+ BaseHelpSystem.getHelpDisplay().displayHelp();
+ }
+ /**
+ * Displays a help resource specified as a url.
+ * <ul>
+ * <li>a URL in a format that can be returned by
+ * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
+ * <li>a URL query in the format format <em>key=value&amp;key=value ...</em>
+ * The valid keys are: "tab", "toc", "topic", "contextId".
+ * For example, <em>toc="/myplugin/mytoc.xml"&amp;topic="/myplugin/references/myclass.html"</em>
+ * is valid.
+ * </ul>
+ */
+ public void displayHelpResource(String href) {
+ BaseHelpSystem.getHelpDisplay().displayHelpResource(href);
}
-
/**
* Displays context-sensitive help for specified context
* @param contexts the context to display
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpContentsAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpContentsAction.java
index 924d181ee..f9bcc7973 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpContentsAction.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpContentsAction.java
@@ -44,7 +44,7 @@ implements IWorkbenchWindowActionDelegate, IExecutableExtension {
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
try {
- WorkbenchHelp.getHelpSupport().displayHelp();
+ WorkbenchHelp.displayHelp();
} catch (Exception e) {
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/WorkbenchHelpPlugin.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java
index 3c0d017a7..419933537 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/WorkbenchHelpPlugin.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIPlugin.java
@@ -12,17 +12,16 @@ package org.eclipse.help.ui.internal;
import org.eclipse.core.runtime.*;
import org.eclipse.help.browser.*;
import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.ui.internal.util.*;
-import org.eclipse.help.ui.internal.workingset.*;
import org.eclipse.ui.*;
import org.eclipse.ui.internal.*;
import org.eclipse.ui.plugin.*;
/**
- * This class is a UI plugin. This may need to change to regular plugin if the
- * plugin class is moved into the base help.
+ * This class is Help UI plugin.
*/
-public class WorkbenchHelpPlugin extends AbstractUIPlugin {
+public class HelpUIPlugin extends AbstractUIPlugin {
public final static String PLUGIN_ID = "org.eclipse.help.ui";
// debug options
public static boolean DEBUG = false;
@@ -30,13 +29,11 @@ public class WorkbenchHelpPlugin extends AbstractUIPlugin {
public static boolean DEBUG_IE_ADAPTER_IN_PROCESS = false;
public static boolean DEBUG_INFOPOP = false;
- private static WorkbenchHelpPlugin plugin;
- private HelpWorkingSetSynchronizer workingSetListener;
-
+ private static HelpUIPlugin plugin;
/**
* Logs an Error message with an exception. Note that the message should
- * already be localized to proper locale. ie:
- * WorkbenchResources.getString() should already have been called
+ * already be localized to proper locale. ie: Resources.getString() should
+ * already have been called
*/
public static synchronized void logError(String message, Throwable ex) {
if (message == null)
@@ -47,8 +44,8 @@ public class WorkbenchHelpPlugin extends AbstractUIPlugin {
}
/**
* Logs a Warning message with an exception. Note that the message should
- * already be localized to proper local. ie: WorkbenchResources.getString()
- * should already have been called
+ * already be localized to proper local. ie: Resources.getString() should
+ * already have been called
*/
public static synchronized void logWarning(String message) {
if (HelpPlugin.DEBUG) {
@@ -66,17 +63,18 @@ public class WorkbenchHelpPlugin extends AbstractUIPlugin {
}
/**
- * WorkbenchHelpPlugin constructor. It is called as part of plugin
- * activation.
+ * Plugin constructor. It is called as part of plugin activation.
*/
- public WorkbenchHelpPlugin(IPluginDescriptor descriptor) {
+ public HelpUIPlugin(IPluginDescriptor descriptor) {
super(descriptor);
plugin = this;
}
/**
- * @return HelpViewerPlugin
+ * Provides access to singleton
+ *
+ * @return HelpUIPlugin
*/
- public static WorkbenchHelpPlugin getDefault() {
+ public static HelpUIPlugin getDefault() {
return plugin;
}
/**
@@ -86,16 +84,6 @@ public class WorkbenchHelpPlugin extends AbstractUIPlugin {
* if this method fails to shut down this plug-in
*/
public void shutdown() throws CoreException {
-
- if (HelpSystem.getMode() == HelpSystem.MODE_WORKBENCH) {
- PlatformUI
- .getWorkbench()
- .getWorkingSetManager()
- .removePropertyChangeListener(
- workingSetListener);
- HelpSystem.getWorkingSetManager().removePropertyChangeListener(
- workingSetListener);
- }
super.shutdown();
}
/**
@@ -105,34 +93,19 @@ public class WorkbenchHelpPlugin extends AbstractUIPlugin {
// Setup debugging options
DEBUG = isDebugging();
if (DEBUG) {
- DEBUG_IE_ADAPTER = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help.ui/debug/ieadapter")); //$NON-NLS-1$
- DEBUG_IE_ADAPTER_IN_PROCESS = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help.ui/debug/ieadapter/inprocess")); //$NON-NLS-1$
- DEBUG_INFOPOP = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help.ui/debug/infopop")); //$NON-NLS-1$
+ DEBUG_IE_ADAPTER = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/ieadapter")); //$NON-NLS-1$
+ DEBUG_IE_ADAPTER_IN_PROCESS = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/ieadapter/inprocess")); //$NON-NLS-1$
+ DEBUG_INFOPOP = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/infopop")); //$NON-NLS-1$
}
- HelpSystem.setDefaultErrorUtil(new ErrorUtil());
- if (HelpSystem.getMode() == HelpSystem.MODE_WORKBENCH) {
- // register the working set listener to keep the ui and the help
- // working sets in sych
- workingSetListener = new HelpWorkingSetSynchronizer();
- PlatformUI
- .getWorkbench()
- .getWorkingSetManager()
- .addPropertyChangeListener(
- workingSetListener);
- HelpSystem.getWorkingSetManager().addPropertyChangeListener(
- workingSetListener);
+ BaseHelpSystem.setDefaultErrorUtil(new ErrorUtil());
- HelpSystem.setRoleManager(new
- HelpRoleManager(((Workbench)PlatformUI.getWorkbench()).getActivityManager()));
- }
+ HelpPlugin.setRoleManager(
+ new HelpRoleManager(
+ ((Workbench) PlatformUI.getWorkbench()).getActivityManager()));
}
public IBrowser getHelpBrowser() {
- return HelpSystem.getHelpBrowser();
- }
-
- public HelpWorkingSetSynchronizer getWorkingSetSynchronizer() {
- return workingSetListener;
+ return BaseHelpSystem.getHelpBrowser();
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/WorkbenchResources.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java
index a81e3b3e8..3e26ced71 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/WorkbenchResources.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java
@@ -8,28 +8,26 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.help.ui.internal.util;
+package org.eclipse.help.ui.internal;
import java.net.*;
import java.text.*;
import java.util.*;
-
-import org.eclipse.help.ui.internal.*;
/**
* Uses a resource bundle to load images and strings from
* a property file.
* This class needs to properly use the desired locale.
*/
-public class WorkbenchResources {
+public class HelpUIResources {
//*** NOTE: change this to properly load a resource bundle help.properties
//*** for a desired locale....
private static ResourceBundle resBundle;
private static URL imageURL;
static {
- resBundle = ResourceBundle.getBundle("helpworkbench", Locale.getDefault());
+ resBundle = ResourceBundle.getBundle(HelpUIResources.class.getName());
try {
imageURL =
new URL(
- WorkbenchHelpPlugin.getDefault().getDescriptor().getInstallURL(),
+ HelpUIPlugin.getDefault().getDescriptor().getInstallURL(),
"icons/");
} catch (MalformedURLException e) {
}
@@ -37,7 +35,7 @@ public class WorkbenchResources {
/**
* WorkbenchResources constructor comment.
*/
- public WorkbenchResources() {
+ public HelpUIResources() {
super();
}
/**
diff --git a/org.eclipse.help.ui/src/helpworkbench.properties b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties
index 9bdd9bd54..992eb9145 100644
--- a/org.eclipse.help.ui/src/helpworkbench.properties
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.properties
@@ -8,43 +8,33 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-# =============================================
-# Eclipse Help System Workbench Properties File
-# =============================================
-
-back = Back
-back_tip = Go Back
-forward = Forward
-forward_tip = Go Forward
+
+# ErrorUtil
Help_Error = Help Error
Help_Question = Help Question
Help_Info = Help Information
+
+# IEBrowserAdapter
browserTitle = Help - {0}
+
+# BrowserManager
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.
+# BrowsersPreferencePage
select_browser = The selected web browser adapter determines the web browser used to display\n\
help documents. If only one browser adapter has been configured, the selection\n\
cannot be changed.
current_browser = Current &web browser adapter:
-# search
-Search_headers_only = Search headings only
-expression = S&earch expression:
-expression_label = * = any string, ? = any character, "" = phrase,\nAND, OR, NOT = boolean operators
-limit_to = Scope
-singleSearchResult = "{0}" - 1 Help Document
-multipleSearchResult = "{0}" - {1} Help Documents
-HelpSearchPage.allBooks = &All
-HelpSearchPage.allBooksText = All
-HelpSearchPage.selectedBooks = &Working Set
-HelpSearchPage.choose = C&hoose...
-HelpSearchPage.bookLabelSeparator = ;\
-SearchFilteringOptions.description = &Select a set of books to be searched:
-SearchFilteringOptions.title = Book Selection
-StreamConsumer.linePrefix = Help browser message: {0}
+
+# SystemBrowserAdapter
SystemBrowser.noProgramForURL = Your system has no program registered for file {0}. Change the file association or choose a different help web browser in the preferences.
SystemBrowser.noProgramForHTML= A program associated with ".html" extension could not be launched. Change the file association or choose a different help web browser in the preferences.
+
+# BrowsersPreferencePage
CustomBrowserPreferencePage.Program = Custom Browser &command:
CustomBrowserPreferencePage.Browse = &Browse...
CustomBrowserPreferencePage.Details = Select a browser program
+
+# AppserverPreferencePage
AppserverPreferencePage.description = Internal Application Server configuration. The server is used internally\n\
by help system.
AppserverPreferencePage.hostDescription = &Host name or IP address of local machine. Leave blank, to be automatically\n\
@@ -56,42 +46,24 @@ AppserverPreferencePage.Note = Note:
AppserverPreferencePage.requireRestart = If the server is already running, these preferences will only take effect\n\
after restarting.
AppserverPreferencePage.invalidPort = Port must be a number in the range 0-65535
-WorkingSetPageTitle = Help Working Set
-WorkingSetPageDescription = Enter a working set name and select working set elements
-WorkingSetName = &Working set name:
-WorkingSetContent = Working set &content:
+
+# ContextHelpDialog
ContextHelpDialog.open = An error occurred when opening context-sensitive help pop-up.
+WW002 = No description.
-# Error Messages
-# --------------
-WE001 = The Help System viewer could not be initialized.\n\
- To display online documentation, the Help System requires \
- Internet Explorer, version 5.5 or later.\n\
- Please install or upgrade your current version of IE.
+# ErrorUtil
WE005 = Errors encountered while displaying help.
-WE019 = Expected: {0} but got: {1}
-WE021 = Exception occurred executing help search
+
+# IEBrowseAdapter
WE022 = Exception occurred trying to obtain install location of Internet Explorer adapter.
WE023 = Internet Explorer adapter interrupted before Internet Explorer process has finished.
WE024 = Exception occurred launching Internet Explorer help browser. Executed command: {0}
+WE029 = Exception occurred when obtaining product icon.
+WW003 = Could not send command to Internet Explorer. Possible that browser is not running.
+# IEHost
WE026 = The following exception occurred when reading commands: {0}
-WE027 = Exception occurred while creating browser control: {0}
WE028 = Unrecognized command: {0}
-WE029 = Exception occurred when obtaining product icon.
-WE030 = The name must not have leading or trailing whitespace
-WE031 = The name must not be empty
-WE032 = The working set already exists
-WE033 = Need to select something
-WE034 = Cannot initialize Internet Explorer. Try selecting another browser adapter from Window->Preferences->Help
-
-
-# Warning Messages
-# ----------------
-WW001 = Documentation is not installed.
-WW002 = No description.
-WW003 = Could not send command to Internet Explorer. Possible that browser is not running.
-WW004 = You have cancelled documentation indexing. Indexing process happens only once after installation of new documentation. You need to allow it to complete, before you can obtain any search results. Subsequent searching of help will be fast.\n\nDo you want to restart indexing now?
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java
index e503631ad..6f876af4c 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.help.ui.internal;
/**
- * Interface for holding UI constants
+ * Interface for holding Help UI plug-in constants
*/
public interface IHelpUIConstants {
// Help UI pluging id with a "." for convenience.
public static final String HELP_UI_PLUGIN_ID =
- WorkbenchHelpPlugin.PLUGIN_ID + ".";
+ HelpUIPlugin.PLUGIN_ID + ".";
// F1 ids
public static final String F1_SHELL = HELP_UI_PLUGIN_ID + "f1Shell";
public static final String PREF_PAGE_BROWSERS =
@@ -24,19 +24,6 @@ public interface IHelpUIConstants {
HELP_UI_PLUGIN_ID + "prefPageAppServer";
public static final String PREF_PAGE_CUSTOM_BROWSER_PATH =
HELP_UI_PLUGIN_ID + "prefPageCustomBrowserPath";
- public static final String SEARCH_PAGE = HELP_UI_PLUGIN_ID + "searchPage";
- public static final String HIT_MARKER_ID =
- HELP_UI_PLUGIN_ID + "helpsearchhit";
- public static final String HIT_MARKER_ATTR_HREF = "href";
- public static final String HIT_MARKER_ATTR_LABEL = "label";
- public static final String HIT_MARKER_ATTR_ORDER = "order";
- public static final String HIT_MARKER_ATTR_RESULTOF = "resultfof";
- public static final String RESULTS_PAGE_ID =
- HELP_UI_PLUGIN_ID + "searchPage";
- public static final String IMAGE_KEY_SEARCH = "search_icon";
- public static final String IMAGE_KEY_TOPIC = "s_topic_icon";
public static final String IMAGE_KEY_F1TOPIC = "f1_topic_icon";
- public static final String IMAGE_FILE_SEARCH = "search_menu.gif";
- public static final String IMAGE_FILE_TOPIC = "topic.gif";
public static final String IMAGE_FILE_F1TOPIC = "topic.gif";
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/OpenHelpSearchPageAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/OpenHelpSearchPageAction.java
deleted file mode 100644
index a5aa50264..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/OpenHelpSearchPageAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.search.ui.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-
-/**
- * Opens the Search Dialog and brings the Help search page to front
- */
-public class OpenHelpSearchPageAction
- implements IWorkbenchWindowActionDelegate {
-
- private static final String HELP_SEARCH_PAGE_ID = WorkbenchHelpPlugin.PLUGIN_ID+".searchPage"; //$NON-NLS-1$
-
- private IWorkbenchWindow fWindow;
-
- public OpenHelpSearchPageAction() {
- }
-
- public void init(IWorkbenchWindow window) {
- fWindow = window;
- }
-
- public void run(IAction action) {
- if (fWindow == null || fWindow.getActivePage() == null) {
- beep();
- WorkbenchHelpPlugin.logError("Could not open the search dialog - for some reason the window handle was null", null); //$NON-NLS-1$
- return;
- }
- SearchUI.openSearchDialog(fWindow, HELP_SEARCH_PAGE_ID);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing since the action isn't selection dependent.
- }
-
- public void dispose() {
- fWindow = null;
- }
-
- protected void beep() {
- Shell shell = null;
- IWorkbenchWindow window =
- PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- shell = window.getShell();
- }
- if (shell != null && shell.getDisplay() != null)
- shell.getDisplay().beep();
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java
index 72fec4a76..54c90656e 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/StyledLineWrapper.java
@@ -12,8 +12,8 @@ package org.eclipse.help.ui.internal;
import java.text.*;
import java.util.*;
+import org.eclipse.help.internal.base.util.*;
import org.eclipse.help.internal.context.*;
-import org.eclipse.help.internal.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.custom.*;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
index c957ec589..18dfcceb5 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/BrowsersPreferencePage.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.help.ui.internal.browser;
import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.browser.*;
import org.eclipse.help.ui.internal.*;
-import org.eclipse.help.ui.internal.util.*;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.preference.*;
import org.eclipse.swt.*;
@@ -58,13 +57,13 @@ public class BrowsersPreferencePage
Label description = new Label(mainComposite, SWT.NULL);
description.setFont(font);
- description.setText(WorkbenchResources.getString("select_browser"));
+ description.setText(HelpUIResources.getString("select_browser"));
createSpacer(mainComposite);
Label tableDescription = new Label(mainComposite, SWT.NULL);
tableDescription.setFont(font);
tableDescription.setText(
- WorkbenchResources.getString("current_browser"));
+ HelpUIResources.getString("current_browser"));
//data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
//description.setLayoutData(data);
browsersTable = new Table(mainComposite, SWT.CHECK | SWT.BORDER);
@@ -133,18 +132,18 @@ public class BrowsersPreferencePage
bPathComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
customBrowserPathLabel = new Label(bPathComposite, SWT.LEFT);
customBrowserPathLabel.setFont(font);
- customBrowserPathLabel.setText(WorkbenchResources.getString("CustomBrowserPreferencePage.Program")); //$NON-NLS-1$
+ customBrowserPathLabel.setText(HelpUIResources.getString("CustomBrowserPreferencePage.Program")); //$NON-NLS-1$
customBrowserPath = new Text(bPathComposite, SWT.BORDER);
customBrowserPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
customBrowserPath.setFont(font);
customBrowserPath.setText(
- HelpPlugin.getDefault().getPluginPreferences().getString(
+ HelpBasePlugin.getDefault().getPluginPreferences().getString(
CustomBrowser.CUSTOM_BROWSER_PATH_KEY));
customBrowserBrowse = new Button(bPathComposite, SWT.NONE);
customBrowserBrowse.setFont(font);
- customBrowserBrowse.setText(WorkbenchResources.getString("CustomBrowserPreferencePage.Browse")); //$NON-NLS-1$
+ customBrowserBrowse.setText(HelpUIResources.getString("CustomBrowserPreferencePage.Browse")); //$NON-NLS-1$
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.heightHint =
@@ -164,7 +163,7 @@ public class BrowsersPreferencePage
}
public void widgetSelected(SelectionEvent event) {
FileDialog d = new FileDialog(getShell());
- d.setText(WorkbenchResources.getString("CustomBrowserPreferencePage.Details")); //$NON-NLS-1$
+ d.setText(HelpUIResources.getString("CustomBrowserPreferencePage.Details")); //$NON-NLS-1$
String file = d.open();
if (file != null) {
customBrowserPath.setText("\"" + file + "\" %1");
@@ -196,7 +195,7 @@ public class BrowsersPreferencePage
items[i].setChecked(browserID == defaultBrowserID);
}
customBrowserPath.setText(
- HelpPlugin.getDefault().getPluginPreferences().getDefaultString(
+ HelpBasePlugin.getDefault().getPluginPreferences().getDefaultString(
CustomBrowser.CUSTOM_BROWSER_PATH_KEY));
setEnabledCustomBrowserPath();
super.performDefaults();
@@ -205,7 +204,7 @@ public class BrowsersPreferencePage
* @see IPreferencePage
*/
public boolean performOk() {
- Preferences pref = HelpPlugin.getDefault().getPluginPreferences();
+ Preferences pref = HelpBasePlugin.getDefault().getPluginPreferences();
TableItem[] items = browsersTable.getItems();
for (int i = 0; i < items.length; i++) {
if (items[i].getChecked()) {
@@ -224,7 +223,7 @@ public class BrowsersPreferencePage
pref.setValue(
CustomBrowser.CUSTOM_BROWSER_PATH_KEY,
customBrowserPath.getText());
- HelpPlugin.getDefault().savePluginPreferences();
+ HelpBasePlugin.getDefault().savePluginPreferences();
return true;
}
/**
@@ -244,7 +243,7 @@ public class BrowsersPreferencePage
for (int i = 0; i < items.length; i++) {
if (items[i].getChecked()) {
boolean enabled =
- (HelpPlugin.PLUGIN_ID + ".custombrowser").equals(
+ (HelpBasePlugin.PLUGIN_ID + ".custombrowser").equals(
BrowserManager
.getInstance()
.getBrowserDescriptors()[i]
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/SystemBrowserAdapter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/SystemBrowserAdapter.java
index 96b3e90bb..ea8b85b63 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/SystemBrowserAdapter.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/SystemBrowserAdapter.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.help.ui.internal.browser;
import org.eclipse.help.browser.*;
+import org.eclipse.help.ui.internal.*;
import org.eclipse.help.ui.internal.util.*;
import org.eclipse.swt.program.*;
/**
@@ -34,7 +35,7 @@ public class SystemBrowserAdapter implements IBrowser {
if (System.getProperty("os.name").startsWith("Win")) {
if (!Program.launch(url)) {
ErrorUtil.displayErrorDialog(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"SystemBrowser.noProgramForURL",
url));
}
@@ -42,7 +43,7 @@ public class SystemBrowserAdapter implements IBrowser {
Program b = Program.findProgram("html");
if (b == null || !b.execute(url)) {
ErrorUtil.displayErrorDialog(
- WorkbenchResources.getString(
+ HelpUIResources.getString(
"SystemBrowser.noProgramForHTML",
url));
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchPage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchPage.java
deleted file mode 100644
index 42ed865f8..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchPage.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.search;
-
-import java.lang.reflect.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.ui.internal.*;
-import org.eclipse.help.ui.internal.util.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.window.*;
-import org.eclipse.search.ui.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.help.*;
-
-/**
- * HelpSearchPage
- */
-public class HelpSearchPage extends DialogPage implements ISearchPage {
- private Combo searchWordCombo = null;
- private static java.util.List previousSearchQueryData =
- new java.util.ArrayList(20);
- private Button all;
- private Button selected;
- private Text selectedWorkingSetsText;
- //private Button headingsButton = null;
- private ISearchPageContainer scontainer = null;
- private boolean firstTime = true;
- // Search query based on the data entered in the UI
- private SearchQueryData searchQueryData;
- /**
- * Search Page
- */
- public HelpSearchPage() {
- super();
- searchQueryData = new SearchQueryData();
- }
- public void createControl(Composite parent) {
- Font font = parent.getFont();
- Composite control = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- control.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- control.setLayoutData(gd);
- // Search Expression
- Label expressionLabel = new Label(control, SWT.LEFT);
- expressionLabel.setFont(font);
- expressionLabel.setText(WorkbenchResources.getString("expression"));
- // Pattern combo
- searchWordCombo = new Combo(control, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = convertWidthInCharsToPixels(30);
- searchWordCombo.setLayoutData(gd);
- searchWordCombo.setFont(font);
- // Not done here to prevent page from resizing
- // fPattern.setItems(getPreviousSearchPatterns());
- searchWordCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (searchWordCombo.getSelectionIndex() < 0)
- return;
- int index =
- previousSearchQueryData.size()
- - 1
- - searchWordCombo.getSelectionIndex();
- searchQueryData =
- (SearchQueryData) previousSearchQueryData.get(index);
- searchWordCombo.setText(searchQueryData.getSearchWord());
- all.setSelection(!searchQueryData.isBookFiltering());
- selected.setSelection(searchQueryData.isBookFiltering());
- displaySelectedBooks();
- //headingsButton.setSelection(searchOperation.getQueryData().isFieldsSearch());
- }
- });
- searchWordCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateSearchButtonState();
- }
- });
- // Space
- new Label(control, SWT.NONE);
- // Syntax description
- Label label = new Label(control, SWT.LEFT);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- label.setLayoutData(gd);
- label.setFont(font);
- label.setText(WorkbenchResources.getString("expression_label"));
- // Headings only button
- // headingsButton = new Button(control, SWT.CHECK);
- // gd = new GridData();
- // gd.horizontalAlignment = gd.BEGINNING;
- // gd = new GridData();
- // gd.verticalAlignment = gd.VERTICAL_ALIGN_BEGINNING;
- // headingsButton.setLayoutData(gd);
- // headingsButton.setFont(font);
- // headingsButton.setText(WorkbenchResources.getString("Search_headers_only"));
- // Filtering group
- Group filteringGroup = new Group(control, SWT.NONE);
- filteringGroup.setLayout(layout);
- gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- filteringGroup.setLayoutData(gd);
- filteringGroup.setFont(font);
- filteringGroup.setText(WorkbenchResources.getString("limit_to"));
- layout = new GridLayout();
- layout.numColumns = 3;
- filteringGroup.setLayout(layout);
- //
- all = new Button(filteringGroup, SWT.RADIO);
- all.setSelection(!searchQueryData.isBookFiltering());
- all.setFont(font);
- all.setText(WorkbenchResources.getString("HelpSearchPage.allBooks"));
- gd = new GridData();
- gd.horizontalSpan = 3;
- all.setLayoutData(gd);
- all.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchQueryData.setBookFiltering(false);
- }
- });
- //
- selected = new Button(filteringGroup, SWT.RADIO);
- selected.setSelection(searchQueryData.isBookFiltering());
- selected.setFont(font);
- selected.setText(
- WorkbenchResources.getString("HelpSearchPage.selectedBooks"));
- selected.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- searchQueryData.setBookFiltering(true);
- updateSearchButtonState();
- }
- });
- //
- selectedWorkingSetsText =
- new Text(filteringGroup, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- displaySelectedBooks();
- //
- Button chooseWorkingSet = new Button(filteringGroup, SWT.PUSH);
- chooseWorkingSet.setLayoutData(new GridData());
- chooseWorkingSet.setFont(font);
- chooseWorkingSet.setText(
- WorkbenchResources.getString("HelpSearchPage.choose"));
- SWTUtil.setButtonDimensionHint(chooseWorkingSet);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent = 8;
- gd.widthHint =
- SWTUtil.convertWidthInCharsToPixels(30, selectedWorkingSetsText);
- selectedWorkingSetsText.setLayoutData(gd);
- chooseWorkingSet.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IWorkingSetSelectionDialog dialog =
- PlatformUI
- .getWorkbench()
- .getWorkingSetManager()
- .createWorkingSetSelectionDialog(
- selected.getShell(),
- false);
- // no multiple selection
-
- if (dialog.open() == Window.OK) {
- all.setSelection(false);
- selected.setSelection(true);
- searchQueryData.setBookFiltering(true);
- searchQueryData.setSelectedWorkingSets(
- dialog.getSelection());
- displaySelectedBooks();
- }
- }
- });
- setControl(control);
- WorkbenchHelp.setHelp(control, IHelpUIConstants.SEARCH_PAGE);
- }
- /**
- * @see ISearchPage#performAction()
- */
- public boolean performAction() {
- searchQueryData.setSearchWord(searchWordCombo.getText());
- searchQueryData.setFieldsSearch(false);
-
- // Save working set
- Preferences prefs = HelpPlugin.getDefault().getPluginPreferences();
- String lastWS = prefs.getString(HelpSystem.WORKING_SET);
- IWorkingSet[] iws = searchQueryData.getSelectedWorkingSets();
- if (searchQueryData.isBookFiltering()
- && iws != null
- && iws.length > 0
- && !iws[0].getName().equals(lastWS)) {
- prefs.setValue(HelpSystem.WORKING_SET, iws[0].getName());
- HelpPlugin.getDefault().savePluginPreferences();
- } else if (
- !searchQueryData.isBookFiltering()
- && (lastWS != null || lastWS.length() > 0)) {
- prefs.setValue(HelpSystem.WORKING_SET, "");
- HelpPlugin.getDefault().savePluginPreferences();
- }
- if (!previousSearchQueryData.contains(searchQueryData))
- previousSearchQueryData.add(searchQueryData);
- boolean dontCancel = false;
- do {
- try {
- SearchUI.activateSearchResultView();
- scontainer.getRunnableContext().run(
- true,
- true,
- new SearchOperation(searchQueryData));
- dontCancel=false;
- } catch (InvocationTargetException ex) {
- return false;
- } catch (InterruptedException e) {
- dontCancel =
- ErrorUtil.displayQuestionDialog(
- WorkbenchResources.getString("WW004"));
- }
- } while (dontCancel);
- return true;
- }
- public void setContainer(ISearchPageContainer container) {
- scontainer = container;
- }
- /*
- * Implements method from IDialogPage
- */
- public void setVisible(boolean visible) {
- if (visible && searchWordCombo != null) {
- if (firstTime) {
- firstTime = false;
- // Set item and text here to prevent page from resizing
- String[] patterns = new String[previousSearchQueryData.size()];
- for (int i = 0; i < previousSearchQueryData.size(); i++) {
- patterns[previousSearchQueryData.size() - 1 - i] =
- ((SearchQueryData) previousSearchQueryData.get(i))
- .getSearchWord();
- }
- searchWordCombo.setItems(patterns);
- }
- searchWordCombo.setFocus();
- updateSearchButtonState();
- }
- super.setVisible(visible);
- }
- /**
- * Lists selected books in the selection field.
- * If filtering dissabled or all books are selected,
- * it will display "All"
- */
- private void displaySelectedBooks() {
- String workingSetNames = "";
- if (searchQueryData.isBookFiltering()) {
- IWorkingSet[] workingSets =
- searchQueryData.getSelectedWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- String workingSet = workingSets[i].getName();
- if (workingSetNames.length() <= 0)
- workingSetNames = workingSet;
- else
- workingSetNames
- += WorkbenchResources.getString(
- "HelpSearchPage.bookLabelSeparator")
- + workingSet;
- }
- } else {
- workingSetNames = "";
- }
- selectedWorkingSetsText.setText(workingSetNames);
- updateSearchButtonState();
- }
-
- private void updateSearchButtonState() {
- boolean searchWordValid =
- searchWordCombo.getText() != null
- && searchWordCombo.getText().trim().length() > 0;
- boolean workingSetValid =
- selectedWorkingSetsText.getText() != null
- && selectedWorkingSetsText.getText().length() > 0;
-
- scontainer.setPerformActionEnabled(
- searchWordValid && (all.getSelection() || workingSetValid));
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchSorter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchSorter.java
deleted file mode 100644
index 435659bee..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpSearchSorter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.search;
-import org.eclipse.help.ui.internal.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.search.ui.*;
-/**
- * Sorts results of help sarch in search view.
- */
-public class HelpSearchSorter extends ViewerSorter {
- /**
- * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.ViewerSorter,java.lang.Object,java.lang.Object)
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- try {
- ISearchResultViewEntry entry1 = (ISearchResultViewEntry) e1;
- int order1 =
- Integer.parseInt(
- entry1.getSelectedMarker().getAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_ORDER,
- "0"));
- ISearchResultViewEntry entry2 = (ISearchResultViewEntry) e2;
- int order2 =
- Integer.parseInt(
- entry2.getSelectedMarker().getAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_ORDER,
- "0"));
- return order1 - order2;
- } catch (Exception e) {
- }
- return super.compare(viewer, e1, e2);
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchOperation.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchOperation.java
deleted file mode 100644
index 08ea2fffc..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchOperation.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.search;
-
-import java.lang.reflect.*;
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.search.*;
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.help.ui.internal.*;
-import org.eclipse.help.ui.internal.util.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.search.ui.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.help.*;
-
-/**
- * Help Search Operation.
- */
-public class SearchOperation extends WorkspaceModifyOperation {
- // Images
- private static final ImageDescriptor IMAGE_DSCR_SEARCH =
- ImageDescriptor.createFromURL(
- WorkbenchResources.getImagePath(
- IHelpUIConstants.IMAGE_FILE_SEARCH));
- private static final ImageDescriptor IMAGE_DSCR_TOPIC =
- ImageDescriptor.createFromURL(
- WorkbenchResources.getImagePath(IHelpUIConstants.IMAGE_FILE_TOPIC));
- // Resource we will be using
- private static final IResource resource =
- ResourcesPlugin.getWorkspace().getRoot();
- private static ImageRegistry imgRegistry = null;
- private SearchQueryData queryData = null;
- /**
- * SearchOperation constructor.
- * @param data SearchQueryData
- */
- public SearchOperation(SearchQueryData data) {
- if (imgRegistry == null) {
- imgRegistry = WorkbenchHelpPlugin.getDefault().getImageRegistry();
- imgRegistry.put(
- IHelpUIConstants.IMAGE_KEY_SEARCH,
- IMAGE_DSCR_SEARCH);
- imgRegistry.put(IHelpUIConstants.IMAGE_KEY_TOPIC, IMAGE_DSCR_TOPIC);
- }
- queryData = data;
- }
- /**
- * @see WorkspaceModifyOperation#execute(IProgressMonitor)
- */
- protected void execute(IProgressMonitor monitor)
- throws CoreException, InvocationTargetException, InterruptedException {
- try {
- WorkingSet[] workingSets = null; // no filtering
- if (queryData.isBookFiltering()) {
- IWorkingSet[] allWorkingSets =
- queryData.getSelectedWorkingSets();
- ArrayList helpWorkingSets = new ArrayList();
- WorkingSetManager wsmgr =
- HelpSystem.getWorkingSetManager(queryData.getLocale());
- for (int i = 0; i < allWorkingSets.length; i++) {
- WorkingSet ws = wsmgr.getWorkingSet(allWorkingSets[i].getName());
- if (ws != null) {
- helpWorkingSets.add(ws);
- }
- }
- workingSets =
- (WorkingSet[]) helpWorkingSets.toArray(
- new WorkingSet[helpWorkingSets.size()]);
- }
- SearchResults results =
- new SearchResults(
- workingSets,
- queryData.getMaxHits(),
- queryData.getLocale());
- HelpSystem.getSearchManager().search(
- queryData.getSearchQuery(),
- results,
- monitor);
- displayResults(results.getSearchHits());
- } catch(QueryTooComplexException qe){
- displayResults(new SearchHit[0]);
- } catch (OperationCanceledException oce) {
- // allowed, no logging
- monitor.done();
- throw oce;
- } catch (Exception e) {
- WorkbenchHelpPlugin.logError(
- WorkbenchResources.getString("WE021"),
- e);
- }
- monitor.done();
- }
- private void displayResults(SearchHit[] searchHits) {
- ISearchResultView sView = SearchUI.getSearchResultView();
- if (sView != null)
- sView
- .searchStarted(
- (IActionGroupFactory) null,
- WorkbenchResources.getString(
- "singleSearchResult",
- queryData.getSearchWord()),
- WorkbenchResources.getString(
- "multipleSearchResult",
- queryData.getSearchWord(),
- "{0}"),
- IMAGE_DSCR_SEARCH,
- IHelpUIConstants.RESULTS_PAGE_ID,
- new LabelProvider() {
- public String getText(Object element) {
- if (element instanceof ISearchResultViewEntry)
- try {
- ISearchResultViewEntry entry =
- (ISearchResultViewEntry) element;
- return (String) entry.getSelectedMarker().getAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_LABEL);
- } catch (CoreException ce) {
- }
- return "";
- }
- public Image getImage(Object element) {
- if (element instanceof ISearchResultViewEntry)
- return imgRegistry.get(IHelpUIConstants.IMAGE_KEY_TOPIC);
- return null;
- }
- }, new org.eclipse.jface.action.Action() {
- public void run() {
- ISearchResultView view = SearchUI.getSearchResultView();
- view.getSelection();
- ISelection selection = view.getSelection();
- Object element = null;
- if (selection instanceof IStructuredSelection)
- element =
- ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof ISearchResultViewEntry) {
- ISearchResultViewEntry entry =
- (ISearchResultViewEntry) element;
- try {
- IHelp ihelp = WorkbenchHelp.getHelpSupport();
- if (ihelp instanceof DefaultHelp)
- ((DefaultHelp) ihelp).displaySearch(
- queryData.toURLQuery(),
- (String) entry
- .getSelectedMarker()
- .getAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_HREF));
- } catch (Exception e) {
- System.out.println(e);
- }
- }
- }
- }, new IGroupByKeyComputer() {
- public Object computeGroupByKey(IMarker marker) {
- try {
- if (marker
- .getAttribute(IHelpUIConstants.HIT_MARKER_ATTR_HREF)
- != null)
- return marker.getAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_HREF);
- } catch (CoreException ce) {
- }
- return "UNKNOWN";
- }
- }, this);
- // Delete all previous results
- try {
- resource.deleteMarkers(
- IHelpUIConstants.HIT_MARKER_ID,
- true,
- IResource.DEPTH_INFINITE);
- } catch (CoreException ex) {
- }
- createResultsMarkers(searchHits, sView);
- sView.searchFinished();
- }
- private void createResultsMarkers(
- SearchHit[] searchHits,
- ISearchResultView sView) {
- for (int i = 0; i < searchHits.length; i++) {
- try {
- IMarker marker = null;
- marker = resource.createMarker(IHelpUIConstants.HIT_MARKER_ID);
- marker.setAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_HREF,
- searchHits[i].getHref());
- marker.setAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_RESULTOF,
- queryData.toURLQuery());
-
- // Use Score percentage and label as topic label
- float score = searchHits[i].getScore();
- NumberFormat percentFormat = NumberFormat.getPercentInstance();
- String scoreString = percentFormat.format(score);
- String label = scoreString + " " + searchHits[i].getLabel();
- marker.setAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_LABEL,
- label);
- marker.setAttribute(
- IHelpUIConstants.HIT_MARKER_ATTR_ORDER,
- new Integer(i).toString());
- sView.addMatch(
- searchHits[i].getLabel(),
- marker.getAttribute(IHelpUIConstants.HIT_MARKER_ATTR_HREF),
- resource,
- marker);
- } catch (CoreException ce) {
- }
- }
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchQueryData.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchQueryData.java
deleted file mode 100644
index 217a5db42..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/SearchQueryData.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.search;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.search.*;
-import org.eclipse.help.internal.util.*;
-import org.eclipse.ui.*;
-
-/**
- * Help Search Query Data.
- */
-public class SearchQueryData {
- private SearchQuery searchQuery;
- /**
- * Default maximum number of hits that a search engine
- * will search stop
- */
- private static int MAX_HITS = 500;
- /**
- * maximum number of hits that a search engine
- * will search
- */
- private int maxHits;
- private boolean bookFiltering;
- private IWorkingSet[] workingSets;
-
- /**
- * HelpSearchQuery constructor.
- * @param key java.lang.String
- * @param maxH int
- */
- public SearchQueryData() {
- searchQuery = new SearchQuery();
- maxHits = MAX_HITS;
-
- String workingSetName =
- HelpPlugin.getDefault().getPluginPreferences().getString(
- HelpSystem.WORKING_SET);
- if (workingSetName == null || workingSetName.length() == 0) {
- bookFiltering = false;
- workingSets = new IWorkingSet[0];
- } else {
- // Assumption: we only remember one working set (no multi selection)
- IWorkingSet iws =
- PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(
- workingSetName);
- if (iws == null) {
- bookFiltering = false;
- workingSets = new IWorkingSet[0];
- } else {
- bookFiltering = true;
- workingSets = new IWorkingSet[] { iws };
- }
- }
- }
- public ISearchQuery getSearchQuery() {
- return searchQuery;
- }
- /**
- * Returns the list of books to be included in search,
- * or null (if bookFiltering is off).
- */
- public IWorkingSet[] getSelectedWorkingSets() {
- if (bookFiltering) {
- return workingSets;
- }
- return null;
- }
- /**
- * Returns the locale in which the search will be performed.
- */
- public String getLocale() {
- return searchQuery.getLocale();
- }
- /**
- * Returns true if books filtering is enabled.
- */
- public boolean isBookFiltering() {
- return bookFiltering;
- }
- /**
- * Enables book filtering.
- * @param enable true if book filtering is turned on
- */
- public void setBookFiltering(boolean enable) {
- this.bookFiltering = enable;
- if (enable && workingSets.length > 0) {
- /*
- selectedBooks = new ArrayList();
- IToc tocs[] =
- HelpSystem.getTocManager().getTocs(searchQuery.getLocale());
- for (int i = 0; i < tocs.length; i++)
- selectedBooks.add(tocs[i]);
- */
- }
- }
-
- /**
- * Sets the working sets to be included in search.
- * @param workingSets
- */
- public void setSelectedWorkingSets(IWorkingSet[] workingSets) {
- this.workingSets = workingSets;
- }
-
- /**
- * Sets search to be performed on the fields only.
- * @param fieldSearch true if field only search
- */
- public void setFieldsSearch(boolean fieldSearch) {
- searchQuery.setFieldSearch(fieldSearch);
- }
- /**
- * Sets the maxHits.
- * @param maxHits The maxHits to set
- */
- public void setMaxHits(int maxHits) {
- this.maxHits = maxHits;
- }
-
- public String toURLQuery() {
- String q =
- "searchWord="
- + URLCoder.encode(searchQuery.getSearchWord())
- + "&maxHits="
- + maxHits
- + "&lang="
- + (searchQuery.getLocale());
- if (!searchQuery.getFieldNames().isEmpty())
- for (Iterator iterator = searchQuery.getFieldNames().iterator();
- iterator.hasNext();
- ) {
- String field = (String) iterator.next();
- try {
- q += "&field=" + URLEncoder.encode(field, "UTF-8");
- } catch (UnsupportedEncodingException uee) {
- }
- }
- if (searchQuery.isFieldSearch())
- q += "&fieldSearch=true";
- else
- q += "&fieldSearch=false";
- if (bookFiltering) {
- for (int i = 0; i < workingSets.length; i++) {
- q += "&scope=" + URLCoder.encode(workingSets[i].getName());
- }
- }
- return q;
- }
- /**
- * Gets the searchWord
- * @return Returns a String
- */
- public String getSearchWord() {
- return searchQuery.getSearchWord();
- }
- /**
- * Sets the searchWord
- * @param searchWord The search word to set
- */
- public void setSearchWord(String searchWord) {
- searchQuery.setSearchWord(searchWord);
- }
- /**
- * Gets the maxHits.
- * @return Returns a int
- */
- public int getMaxHits() {
- return maxHits;
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/ErrorUtil.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/ErrorUtil.java
index 102c3a1da..d38ca2ebd 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/ErrorUtil.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/ErrorUtil.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.help.ui.internal.util;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
+import org.eclipse.help.internal.base.util.*;
import org.eclipse.help.ui.internal.*;
import org.eclipse.jface.dialogs.*;
import org.eclipse.swt.widgets.*;
@@ -39,7 +39,7 @@ public class ErrorUtil implements IErrorUtil {
* msg error message to display and log.
*/
public static void displayErrorDialog(String msg) {
- String title = WorkbenchResources.getString("Help_Error");
+ String title = HelpUIResources.getString("Help_Error");
IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow();
Shell shell;
if (workbenchWindow != null) {
@@ -48,7 +48,7 @@ public class ErrorUtil implements IErrorUtil {
shell = new Shell();
}
MessageDialog.openError(shell, title, msg);
- WorkbenchHelpPlugin.logError(msg, null);
+ HelpUIPlugin.logError(msg, null);
}
/**
* Immidiately displays error dialog with a given string,
@@ -57,7 +57,7 @@ public class ErrorUtil implements IErrorUtil {
* ex the exception to be passed to Logger.logError()
*/
public static void displayErrorDialog(String msg, Throwable ex) {
- String title = WorkbenchResources.getString("Help_Error");
+ String title = HelpUIResources.getString("Help_Error");
IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow();
Shell shell;
if (workbenchWindow != null) {
@@ -66,7 +66,7 @@ public class ErrorUtil implements IErrorUtil {
shell = new Shell();
}
MessageDialog.openError(shell, title, msg);
- WorkbenchHelpPlugin.logError(msg, ex);
+ HelpUIPlugin.logError(msg, ex);
}
/**
* Immidiately displays an Information dialog with a given string,
@@ -74,7 +74,7 @@ public class ErrorUtil implements IErrorUtil {
* msg error message to display and log.
*/
public static void displayInfoDialog(String msg) {
- String title = WorkbenchResources.getString("Help_Info");
+ String title = HelpUIResources.getString("Help_Info");
IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow();
Shell shell;
if (workbenchWindow != null) {
@@ -93,7 +93,7 @@ public class ErrorUtil implements IErrorUtil {
* returns which button(Yes/No) was pressed by user
*/
public static boolean displayQuestionDialog(String msg) {
- String title = WorkbenchResources.getString("Help_Question");
+ String title = HelpUIResources.getString("Help_Question");
IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow();
Shell shell;
if (workbenchWindow != null) {
@@ -110,8 +110,8 @@ public class ErrorUtil implements IErrorUtil {
public static void displayStatus() {
// show error dialog box if errors have occurred
if (RuntimeHelpStatus.getInstance().errorsExist()) {
- String title = WorkbenchResources.getString("Help_Error");
- String msg = WorkbenchResources.getString("WE005");
+ String title = HelpUIResources.getString("Help_Error");
+ String msg = HelpUIResources.getString("WE005");
//Errors encountered while displaying help.
String errorMessage = RuntimeHelpStatus.getInstance().toString();
Shell parent = getActiveWorkbenchWindow().getShell();
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/HelpWorkbenchException.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/HelpWorkbenchException.java
deleted file mode 100644
index e23db5957..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/HelpWorkbenchException.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.util;
-// possibly use platform CoreException later. For now, this is
-// handled by the Logger class in base.
-public class HelpWorkbenchException extends Exception {
- public HelpWorkbenchException() {
- super();
- }
- public HelpWorkbenchException(String message) {
- super(message);
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/SWTUtil.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/SWTUtil.java
deleted file mode 100644
index 99aced38b..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/SWTUtil.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.util;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-/**
- * Utility class to simplify access to some SWT resources.
- */
-public class SWTUtil {
- private static double fgHorizontalDialogUnitSize = 0.0;
- private static double fgVerticalDialogUnitSize = 0.0;
- private static void initializeDialogUnits(Control control) {
- GC gc = new GC(control);
- gc.setFont(control.getFont());
- int averageWidth = gc.getFontMetrics().getAverageCharWidth();
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- fgHorizontalDialogUnitSize = averageWidth * 0.25;
- fgVerticalDialogUnitSize = height * 0.125;
- }
- /**
- * @see DialogPage#convertHorizontalDLUsToPixels
- */
- private static int convertHorizontalDLUsToPixels(int dlus) {
- return (int) Math.round(dlus * fgHorizontalDialogUnitSize);
- }
- /**
- * @see DialogPage#convertVerticalDLUsToPixels
- */
- private static int convertVerticalDLUsToPixels(int dlus) {
- return (int) Math.round(dlus * fgVerticalDialogUnitSize);
- }
- /**
- * @see DialogPage#convertWidthInCharsToPixels
- */
- public static int convertWidthInCharsToPixels(int chars, Text text) {
- if (fgHorizontalDialogUnitSize == 0.0)
- initializeDialogUnits(text);
- return convertHorizontalDLUsToPixels(chars * 4);
- }
- /**
- * Returns a width hint for a button control.
- */
- public static int getButtonWidthHint(Button button) {
- if (fgHorizontalDialogUnitSize == 0.0) {
- initializeDialogUnits(button);
- }
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- return Math.max(
- widthHint,
- button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
- /**
- * Returns a height hint for a button control.
- */
- public static int getButtonHeigthHint(Button button) {
- if (fgHorizontalDialogUnitSize == 0.0) {
- initializeDialogUnits(button);
- }
- return convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- }
- /**
- * Sets width and height hint for the button control.
- * <b>Note:</b> This is a NOP if the button's layout data is not
- * an instance of <code>GridData</code>.
- *
- * @param the button for which to set the dimension hint
- */
- public static void setButtonDimensionHint(Button button) {
- Assert.isNotNull(button);
- Object gd = button.getLayoutData();
- if (gd instanceof GridData) {
- ((GridData) gd).heightHint = SWTUtil.getButtonHeigthHint(button);
- ((GridData) gd).widthHint = SWTUtil.getButtonWidthHint(button);
- }
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSet.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSet.java
deleted file mode 100644
index 72e62339a..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSet.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.workingset;
-
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.ui.*;
-
-/**
- * A working set for help elements.
- * NOTE: The only reason we inherit from ui's working set is because there is a
- * cast in the wizard, when getting the page id...
- */
-public class HelpWorkingSet {
-
- private WorkingSet workingSet;
- private IWorkingSet iworkingSet;
-
- /**
- * Constructor for HelpWorkingSet.
- * @param name
- * @param elements
- */
- public HelpWorkingSet(String name, IAdaptable[] elements) {
- this(
- HelpSystem.getWorkingSetManager().createWorkingSet(
- name,
- (AdaptableHelpResource[]) elements));
- }
-
- public HelpWorkingSet(WorkingSet ws) {
- this.workingSet = ws;
- this.iworkingSet =
- PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet(
- ws.getName(),
- ws.getElements());
-
- iworkingSet.setId(HelpWorkingSetPage.PAGE_ID);
-
- //HelpSystem.getWorkingSetManager().addWorkingSet(workingSet);
- //PlatformUI.getWorkbench().getWorkingSetManager().addWorkingSet(iworkingSet);
- }
-
- public HelpWorkingSet(IWorkingSet iws) {
- this.iworkingSet = iws;
- AdaptableHelpResource[] elements =
- new AdaptableHelpResource[iws.getElements().length];
- System.arraycopy(iws.getElements(), 0, elements, 0, elements.length);
- this.workingSet =
- HelpSystem.getWorkingSetManager().createWorkingSet(
- iws.getName(),
- elements);
-
- //HelpSystem.getWorkingSetManager().addWorkingSet(workingSet);
- //PlatformUI.getWorkbench().getWorkingSetManager().addWorkingSet(iworkingSet);
- }
-
- public HelpWorkingSet(WorkingSet ws, IWorkingSet iws) {
- this.workingSet = ws;
- this.iworkingSet = iws;
- }
-
- public IWorkingSet getIWorkingSet() {
- return iworkingSet;
- }
-
- public WorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, the name is the same.
- * false otherwise
- */
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof HelpWorkingSet) {
- HelpWorkingSet ws = (HelpWorkingSet) object;
- return this.workingSet == ws.workingSet;
- } else
- return false;
- }
-
- /**
- * @see org.eclipse.ui.IPersistableElement#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- HelpSystem.getWorkingSetManager().saveState();
-
- memento.putString("workingSet", workingSet.getName());
- //memento.putString(IWorkbenchConstants.TAG_EDIT_PAGE_ID, editPageId);
-
- for (int i = 0; i < workingSet.getElements().length; i++) {
- saveState(
- (AdaptableHelpResource) workingSet.getElements()[i],
- memento);
- }
- }
-
- private void saveState(AdaptableHelpResource element, IMemento memento) {
- IToc toc = (IToc) element.getAdapter(IToc.class);
- ITopic topic = (ITopic) element.getAdapter(ITopic.class);
- if (toc != null)
- memento.putString("toc", toc.getHref());
- else if (topic != null) {
- AdaptableHelpResource parent =
- (AdaptableHelpResource) element.getParent();
- memento.putString("toc", parent.getHref());
- // get the index of this topic
- IAdaptable[] topics = parent.getChildren();
- for (int i = 0; i < topics.length; i++)
- if (topics[i] == this) {
- memento.putString("topic", String.valueOf(i));
- return;
- }
- }
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetElementLabelProvider.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetElementLabelProvider.java
deleted file mode 100644
index 6a204020f..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetElementLabelProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.workingset;
-
-
-
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.*;
-
-public class HelpWorkingSetElementLabelProvider extends LabelProvider {
-
- /**
- * Constructor for HelpWorkingSetElementLabelProvider.
- */
- public HelpWorkingSetElementLabelProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (element instanceof AdaptableToc )
- return ((AdaptableToc)element).getLabel();
- else if (element instanceof AdaptableTopic)
- return ((AdaptableTopic)element).getLabel();
- else
- return null;
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetPage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetPage.java
deleted file mode 100644
index 01b095311..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetPage.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.workingset;
-
-
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.help.ui.internal.*;
-import org.eclipse.help.ui.internal.util.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-
-/**
- * Page for help working sets.
- */
-public class HelpWorkingSetPage extends WizardPage implements IWorkingSetPage {
-
- public final static String PAGE_ID =
- WorkbenchHelpPlugin.PLUGIN_ID + ".HelpWorkingSetPage";
- public final static String PAGE_TITLE =
- WorkbenchResources.getString("WorkingSetPageTitle");
- public final static String PAGE_DESCRIPTION =
- WorkbenchResources.getString("WorkingSetPageDescription");
-
- private Text workingSetName;
- private CheckboxTreeViewer tree;
- private ITreeContentProvider treeContentProvider;
- private ILabelProvider elementLabelProvider;
-
- private boolean firstCheck;
- private IWorkingSet workingSet;
-
- /**
- * Default constructor.
- */
- public HelpWorkingSetPage() {
- super(PAGE_ID, PAGE_TITLE, null);
- setDescription(PAGE_DESCRIPTION);
- firstCheck = true;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Font font = parent.getFont();
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setFont(font);
- label.setText(WorkbenchResources.getString("WorkingSetName"));
- GridData gd =
- new GridData(
- GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(gd);
-
- workingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
- workingSetName.setLayoutData(
- new GridData(
- GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- workingSetName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
- workingSetName.setFocus();
- workingSetName.setFont(font);
-
- label = new Label(composite, SWT.WRAP);
- label.setFont(font);
- label.setText(WorkbenchResources.getString("WorkingSetContent"));
- gd =
- new GridData(
- GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(gd);
-
- tree =
- new CheckboxTreeViewer(
- composite,
- SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- gd.heightHint = convertHeightInCharsToPixels(15);
- tree.getControl().setLayoutData(gd);
- tree.getControl().setFont(font);
-
- treeContentProvider = new HelpWorkingSetTreeContentProvider();
- tree.setContentProvider(treeContentProvider);
-
- elementLabelProvider = new HelpWorkingSetElementLabelProvider();
- tree.setLabelProvider(elementLabelProvider);
-
- tree.setUseHashlookup(true);
-
- tree.setInput(HelpSystem.getWorkingSetManager().getRoot());
-
- tree.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChange(event);
- }
- });
-
- tree.addTreeListener(new ITreeViewerListener() {
- public void treeCollapsed(TreeExpansionEvent event) {
- }
- public void treeExpanded(TreeExpansionEvent event) {
- final Object element = event.getElement();
- if (tree.getGrayed(element) == false)
- BusyIndicator
- .showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- setSubtreeChecked(
- element,
- tree.getChecked(element),
- false);
- }
- });
- }
- });
-
- if (workingSet != null) {
- workingSetName.setText(workingSet.getName());
- // May need to reconcile working sets
- WorkbenchHelpPlugin
- .getDefault()
- .getWorkingSetSynchronizer()
- .addWorkingSet(
- workingSet);
- }
- initializeCheckedState();
- validateInput();
-
- // Set help for the page
- //WorkbenchHelp.setHelp(tree, "help_workingset_page");
- }
-
- /**
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#finish()
- */
- public void finish() {
- String workingSetName = this.workingSetName.getText();
- ArrayList elements = new ArrayList(10);
- findCheckedElements(elements, tree.getInput());
- if (workingSet == null) {
- HelpWorkingSet ws =
- new HelpWorkingSet(
- workingSetName,
- (AdaptableHelpResource[]) elements.toArray(
- new AdaptableHelpResource[elements.size()]));
- workingSet = ws.getIWorkingSet();
- } else {
- workingSet.setName(workingSetName);
- workingSet.setElements(
- (IAdaptable[]) elements.toArray(
- new IAdaptable[elements.size()]));
- }
- }
-
- /**
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#getSelection()
- */
- public IWorkingSet getSelection() {
- return workingSet;
- }
-
- /**
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#setSelection(org.eclipse.ui.IWorkingSet)
- */
- public void setSelection(IWorkingSet workingSet) {
- Assert.isNotNull(workingSet, "Working set must not be null");
- this.workingSet = workingSet;
- if (getContainer() != null
- && getShell() != null
- && workingSetName != null) {
- firstCheck = false;
- workingSetName.setText(workingSet.getName());
- initializeCheckedState();
- validateInput();
- }
- }
-
- private void validateInput() {
- String errorMessage = null;
- String newText = workingSetName.getText();
-
- if (newText.equals(newText.trim()) == false)
- errorMessage = WorkbenchResources.getString("WE030");
- if (newText.equals("")) {
- if (firstCheck) {
- setPageComplete(false);
- firstCheck = false;
- return;
- } else
- errorMessage = WorkbenchResources.getString("WE031");
- }
-
- firstCheck = false;
-
- if (errorMessage == null
- && (workingSet == null
- || newText.equals(workingSet.getName()) == false)) {
- IWorkingSet[] workingSets =
- PlatformUI
- .getWorkbench()
- .getWorkingSetManager()
- .getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- if (newText.equals(workingSets[i].getName())) {
- errorMessage = WorkbenchResources.getString("WE032");
- }
- }
- }
- if (errorMessage == null && tree.getCheckedElements().length == 0)
- errorMessage = WorkbenchResources.getString("WE033");
-
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- }
-
- private void initializeCheckedState() {
- if (workingSet == null)
- return;
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- Object[] elements = workingSet.getElements();
- tree.setCheckedElements(elements);
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
- if (isExpandable(element))
- setSubtreeChecked(element, true, true);
- updateParentState(element, true);
- }
- }
- });
- }
-
- private boolean isExpandable(Object element) {
- return treeContentProvider.hasChildren(element);
- }
-
- private void updateParentState(Object child, boolean baseChildState) {
- if (child == null)
- return;
-
- Object parent = treeContentProvider.getParent(child);
- if (parent == null)
- return;
-
- boolean allSameState = true;
- Object[] children = null;
- children = treeContentProvider.getChildren(parent);
-
- for (int i = children.length - 1; i >= 0; i--) {
- if (tree.getChecked(children[i]) != baseChildState
- || tree.getGrayed(children[i])) {
- allSameState = false;
- break;
- }
- }
-
- tree.setGrayed(parent, !allSameState);
- tree.setChecked(parent, !allSameState || baseChildState);
-
- updateParentState(parent, baseChildState);
- }
-
- private void setSubtreeChecked(
- Object parent,
- boolean state,
- boolean checkExpandedState) {
-
- Object[] children = treeContentProvider.getChildren(parent);
- for (int i = children.length - 1; i >= 0; i--) {
- Object element = children[i];
- if (state) {
- tree.setChecked(element, true);
- tree.setGrayed(element, false);
- } else
- tree.setGrayChecked(element, false);
- if (isExpandable(element))
- setSubtreeChecked(element, state, checkExpandedState);
- }
- }
-
- private void findCheckedElements(
- java.util.List checkedResources,
- Object parent) {
- Object[] children = treeContentProvider.getChildren(parent);
- for (int i = 0; i < children.length; i++) {
- if (tree.getGrayed(children[i]))
- findCheckedElements(checkedResources, children[i]);
- else if (tree.getChecked(children[i]))
- checkedResources.add(children[i]);
- }
- }
-
- void handleCheckStateChange(final CheckStateChangedEvent event) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- Object element = event.getElement();
- boolean state = event.getChecked();
- tree.setGrayed(element, false);
- if (isExpandable(element))
- setSubtreeChecked(element, state, state);
- // only check subtree if state is set to true
-
- updateParentState(element, state);
- validateInput();
- }
- });
- }
-
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetSynchronizer.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetSynchronizer.java
deleted file mode 100644
index d31f80ce8..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetSynchronizer.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.workingset;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.ui.*;
-
-
-/**
- * Listener for changes in the help and ui working set managers to keep them in
- * synch.
- */
-public class HelpWorkingSetSynchronizer
- implements IPropertyChangeListener, PropertyChange.IPropertyChangeListener {
-
- private ArrayList workingSets;
-
- /**
- * Constructor
- */
- public HelpWorkingSetSynchronizer() {
- workingSets = new ArrayList();
- }
- /**
- * @see org.eclipse.help.internal.workingset.PropertyChange.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event
- .getProperty()
- .equals(IWorkingSetManager.CHANGE_WORKING_SET_ADD)) {
-
- // add the help working set
- IWorkingSet iws = (IWorkingSet) event.getNewValue();
- addWorkingSet(iws);
- } else if (
- event.getProperty().equals(
- IWorkingSetManager.CHANGE_WORKING_SET_REMOVE)) {
-
- // remove the help working set
- IWorkingSet iws = (IWorkingSet) event.getOldValue();
- removeWorkingSet(iws);
- } else if (
- event.getProperty().equals(
- IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE)) {
-
- // rename the help working set
- IWorkingSet iws = (IWorkingSet) event.getNewValue();
- renameWorkingSet(iws);
- } else if (
- event.getProperty().equals(
- IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
-
- // change the content of the help working set
- IWorkingSet iws = (IWorkingSet) event.getNewValue();
- changeWorkingSet(iws);
- }
- }
-
- /**
- * @see org.eclipse.help.internal.workingset.PropertyChange.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChange.PropertyChangeEvent event) {
- if (event
- .getProperty()
- .equals(WorkingSetManager.CHANGE_WORKING_SET_ADD)) {
-
- // add an eclipse working set
- WorkingSet ws = (WorkingSet) event.getNewValue();
- addWorkingSet(ws);
- } else if (
- event.getProperty().equals(
- WorkingSetManager.CHANGE_WORKING_SET_REMOVE)) {
-
- // remove the eclipse working set
- WorkingSet ws = (WorkingSet) event.getOldValue();
- removeWorkingSet(ws);
- } else if (
- event.getProperty().equals(
- WorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE)) {
-
- // change the name of the eclipse working set
- WorkingSet ws = (WorkingSet) event.getNewValue();
- renameWorkingSet(ws);
- } else if (
- event.getProperty().equals(
- WorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
-
- // change the content of the eclipse working set
- WorkingSet ws = (WorkingSet) event.getNewValue();
- changeWorkingSet(ws);
- } else if (
- event.getProperty().equals(
- WorkingSetManager.CHANGE_WORKING_SETS_SYNCH)) {
-
- // remove working sets not present in the UI
- WorkingSet[] baseWorkingSets =
- getHelpWorkingSetManager().getWorkingSets();
- for (int i = 0; i < baseWorkingSets.length; i++) {
- IWorkingSet iws =
- getEclipseWorkingSetManager().getWorkingSet(
- baseWorkingSets[i].getName());
- if (iws == null)
- getHelpWorkingSetManager().removeWorkingSet(
- baseWorkingSets[i]);
- }
- }
- }
-
- public void renameWorkingSet(IWorkingSet iws) {
- HelpWorkingSet hws = findWorkingSet(iws);
- if (hws != null) {
- hws.getWorkingSet().setName(iws.getName());
- }
- }
- public void changeWorkingSet(IWorkingSet iws) {
- HelpWorkingSet hws = findWorkingSet(iws);
- if (hws != null) {
- AdaptableHelpResource[] elements =
- new AdaptableHelpResource[iws.getElements().length];
- System.arraycopy(
- iws.getElements(),
- 0,
- elements,
- 0,
- elements.length);
- hws.getWorkingSet().setElements(elements);
- }
- }
-
- public void addWorkingSet(IWorkingSet iws) {
- WorkingSet ws = getHelpWorkingSetManager().getWorkingSet(iws.getName());
- if (ws == null && isHelpWorkingSet(iws)) {
- HelpWorkingSet hws = new HelpWorkingSet(iws);
- workingSets.add(hws);
- getHelpWorkingSetManager().addWorkingSet(hws.getWorkingSet());
- }
- // see if this is happening upon workbench startup
- if (ws != null && findWorkingSet(iws) == null) {
- HelpWorkingSet hws = new HelpWorkingSet(ws, iws);
- workingSets.add(hws);
- iws.setElements(ws.getElements());
- }
- }
- public void removeWorkingSet(IWorkingSet iws) {
- WorkingSet ws = getHelpWorkingSetManager().getWorkingSet(iws.getName());
- if (ws != null) {
- HelpWorkingSet hws = findWorkingSet(iws);
- if (hws != null)
- workingSets.remove(hws);
- getHelpWorkingSetManager().removeWorkingSet(ws);
- }
- }
-
- public void renameWorkingSet(WorkingSet ws) {
- HelpWorkingSet hws = findWorkingSet(ws);
- if (hws != null) {
- hws.getIWorkingSet().setName(ws.getName());
- }
- }
- public void changeWorkingSet(WorkingSet ws) {
- HelpWorkingSet hws = findWorkingSet(ws);
- if (hws != null) {
- hws.getIWorkingSet().setElements(ws.getElements());
- }
- }
- public void removeWorkingSet(WorkingSet ws) {
- IWorkingSet iws =
- getEclipseWorkingSetManager().getWorkingSet(ws.getName());
- if (iws != null) {
- HelpWorkingSet hws = findWorkingSet(ws);
- if (hws != null)
- workingSets.remove(hws);
- getEclipseWorkingSetManager().removeWorkingSet(iws);
- }
- }
- public void addWorkingSet(WorkingSet ws) {
- IWorkingSet iws =
- getEclipseWorkingSetManager().getWorkingSet(ws.getName());
- if (iws == null) {
- HelpWorkingSet hws = new HelpWorkingSet(ws);
- workingSets.add(hws);
- getEclipseWorkingSetManager().addWorkingSet(hws.getIWorkingSet());
- } else if (findWorkingSet(ws) == null) {
- HelpWorkingSet hws = new HelpWorkingSet(ws, iws);
- workingSets.add(hws);
- }
- }
-
- private boolean isHelpWorkingSet(IWorkingSet ws) {
- IAdaptable[] elements = ws.getElements();
- return (
- elements.length > 0
- && elements[0] instanceof AdaptableHelpResource);
- }
-
- private HelpWorkingSet findWorkingSet(WorkingSet ws) {
- for (Iterator it = workingSets.iterator(); it.hasNext();) {
- HelpWorkingSet hws = (HelpWorkingSet) it.next();
- if (hws.getWorkingSet() == ws)
- return hws;
- }
- return null;
- }
-
- private HelpWorkingSet findWorkingSet(IWorkingSet iws) {
- for (Iterator it = workingSets.iterator(); it.hasNext();) {
- HelpWorkingSet hws = (HelpWorkingSet) it.next();
- if (hws.getIWorkingSet() == iws)
- return hws;
- }
- return null;
- }
-
- private IWorkingSetManager getEclipseWorkingSetManager() {
- return PlatformUI.getWorkbench().getWorkingSetManager();
- }
-
- private WorkingSetManager getHelpWorkingSetManager() {
- return HelpSystem.getWorkingSetManager();
- }
-}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetTreeContentProvider.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetTreeContentProvider.java
deleted file mode 100644
index a6861b626..000000000
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/workingset/HelpWorkingSetTreeContentProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.ui.internal.workingset;
-
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.workingset.*;
-import org.eclipse.jface.viewers.*;
-
-public class HelpWorkingSetTreeContentProvider
- implements ITreeContentProvider {
-
- /**
- * Constructor for HelpWorkingSetTreeContentProvider.
- */
- public HelpWorkingSetTreeContentProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof AdaptableTocsArray)
- return ((AdaptableTocsArray)parentElement).getChildren();
- else if (parentElement instanceof AdaptableToc)
- return ((AdaptableToc) parentElement).getChildren();
- else
- return new IAdaptable[0];
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
- if (element instanceof AdaptableHelpResource)
- return ((AdaptableHelpResource) element).getParent();
- else
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
- return (element instanceof AdaptableToc || element instanceof AdaptableTocsArray);
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-}
diff --git a/org.eclipse.help.webapp/.classpath b/org.eclipse.help.webapp/.classpath
index bda2965b3..465feb235 100644
--- a/org.eclipse.help.webapp/.classpath
+++ b/org.eclipse.help.webapp/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src_servlets"/>
+ <classpathentry kind="src" output="WEB-INF/classes" path="src_servlets"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.help.webapp/.cvsignore b/org.eclipse.help.webapp/.cvsignore
index d9d8f3fbd..592c6ece7 100644
--- a/org.eclipse.help.webapp/.cvsignore
+++ b/org.eclipse.help.webapp/.cvsignore
@@ -4,3 +4,4 @@ webapp.jar.bin.log
temp.folder
jsp.jar
webapp.jar
+webappsrc.zip
diff --git a/org.eclipse.help.webapp/.project b/org.eclipse.help.webapp/.project
index b1c49af50..ee3a4c204 100644
--- a/org.eclipse.help.webapp/.project
+++ b/org.eclipse.help.webapp/.project
@@ -5,7 +5,7 @@
<projects>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.runtime</project>
- <project>org.eclipse.help</project>
+ <project>org.eclipse.help.base</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/org.eclipse.help.webapp/WEB-INF/lib/.cvsignore b/org.eclipse.help.webapp/WEB-INF/lib/.cvsignore
index 740c9a106..3adad4940 100644
--- a/org.eclipse.help.webapp/WEB-INF/lib/.cvsignore
+++ b/org.eclipse.help.webapp/WEB-INF/lib/.cvsignore
@@ -1,2 +1,3 @@
jsp.jar
servlets.jar
+servletssrc.zip
diff --git a/org.eclipse.help.webapp/WEB-INF/web.xml b/org.eclipse.help.webapp/WEB-INF/web.xml
index 631f15d8d..2e6a8b443 100644
--- a/org.eclipse.help.webapp/WEB-INF/web.xml
+++ b/org.eclipse.help.webapp/WEB-INF/web.xml
@@ -53,6 +53,11 @@
<servlet-name>content</servlet-name>
<url-pattern>/topic/*</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>content</servlet-name>
+ <url-pattern>/nftopic/*</url-pattern>
+ </servlet-mapping>
<servlet-mapping>
<servlet-name>livehelp</servlet-name>
diff --git a/org.eclipse.help.webapp/basic/advanced.inc b/org.eclipse.help.webapp/basic/advanced.inc
index 53412b589..e7bb61f3d 100644
--- a/org.eclipse.help.webapp/basic/advanced.inc
+++ b/org.eclipse.help.webapp/basic/advanced.inc
@@ -18,7 +18,7 @@
</tr>
<tr>
<td nowrap>
- <input type="text" name="searchWord" id="searchWord" value='<%=data.getSearchWord()%>' maxlength=256 alt='<%=ServletResources.getString("SearchExpression", request)%>' title='<%=ServletResources.getString("SearchExpression", request)%>>
+ <input type="text" name="searchWord" id="searchWord" value='<%=data.getSearchWord()%>' maxlength=256 alt='<%=ServletResources.getString("SearchExpression", request)%>' title='<%=ServletResources.getString("SearchExpression", request)%>'>
<input type="hidden" name="maxHits" value="500" >
<input type="hidden" name="scopedSearch" value="true" >
<input type="submit" value='<%=ServletResources.getString("GO", request)%>' alt='<%=ServletResources.getString("GO", request)%>' title='<%=ServletResources.getString("GO", request)%>'>
diff --git a/org.eclipse.help.webapp/build.xml b/org.eclipse.help.webapp/build.xml
index d62808012..8e37c88b0 100644
--- a/org.eclipse.help.webapp/build.xml
+++ b/org.eclipse.help.webapp/build.xml
@@ -2,14 +2,17 @@
<project name="org.eclipse.help.webapp" default="build.jars" basedir=".">
<property name="bootclasspath" value=""/>
- <property name="ws" value="win32"/>
- <property name="os" value="win32"/>
- <property name="arch" value="x86"/>
+ <property name="basews" value="${ws}"/>
+ <property name="baseos" value="${os}"/>
+ <property name="basearch" value="${arch}"/>
+ <property name="basenl" value="${nl}"/>
+ <property name="javacFailOnError" value="false"/>
+ <property name="javacDebugInfo" value="on"/>
+ <property name="javacVerbose" value="true"/>
+ <property name="javacSource" value="1.3"/>
+ <property name="javacTarget" value="1.1"/>
<target name="init" depends="properties">
- <property name="plugin" value="org.eclipse.help.webapp"/>
- <property name="version.suffix" value="_3.0.0"/>
- <property name="full.name" value="${plugin}${version.suffix}"/>
<property name="temp.folder" value="${basedir}/temp.folder"/>
<property name="plugin.destination" value="${basedir}"/>
<property name="build.result.folder" value="${basedir}"/>
@@ -19,52 +22,50 @@
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
- <target name="build.update.jar" depends="init">
+ <target name="build.update.jar" depends="init" description="Build the plug-in: org.eclipse.help.webapp for an update site.">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
- <zip zipfile="${plugin.destination}/${full.name}.jar" basedir="${temp.folder}/${full.name}" filesonly="false"/>
+ <zip zipfile="${plugin.destination}/org.eclipse.help.webapp_3.0.0.jar" basedir="${temp.folder}/org.eclipse.help.webapp_3.0.0" filesonly="false"/>
<delete dir="${temp.folder}"/>
</target>
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/${full.name}"/>
- <mkdir dir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${build.result.folder}/WEB-INF/lib/servlets.jar" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${build.result.folder}/WEB-INF/lib/jsp.jar" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${build.result.folder}/webapp.jar" todir="${destination.temp.folder}/${full.name}"/>
- <copy todir="${destination.temp.folder}/${full.name}">
- <fileset dir="${basedir}" includes="advanced/,basic/,WEB-INF/,*.html,*.jsp,plugin.properties,plugin.xml,.options" excludes="WEB-INF/classes/"/>
+ <mkdir dir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0"/>
+ <copy todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0">
+ <fileset dir="${build.result.folder}" includes="advanced/,basic/,WEB-INF/,*.html,*.jar,*.jsp,plugin.properties,plugin.xml,.options" excludes="WEB-INF/classes/" />
+ </copy>
+ <copy todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0">
+ <fileset dir="${basedir}" includes="advanced/,basic/,WEB-INF/,*.html,*.jar,*.jsp,plugin.properties,plugin.xml,.options" excludes="WEB-INF/classes/" />
</copy>
<!-- custom begin -->
<loadfile
property="web.xml.fragment"
srcFile="${temp.folder}/jsp.jar.src/web.xml.fragment"/>
<replace
- file="${destination.temp.folder}/${full.name}/WEB-INF/web.xml"
+ file="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/web.xml"
token="&lt;!-- placeholder for JSPs web.xml --&gt;"
value="${web.xml.fragment}"
encoding="ISO-8859-1" />
<!-- custom end -->
</target>
- <target name="webapp.jar" depends="init" unless="webapp.jar">
- <property name="destdir" value="${temp.folder}/webapp.jar.bin"/>
+ <target name="webapp.jar" depends="init" unless="webapp.jar" description="Create jar: webapp.jar.">
<delete dir="${temp.folder}/webapp.jar.bin"/>
<mkdir dir="${temp.folder}/webapp.jar.bin"/>
<!-- compile the source code -->
- <javac destdir="${temp.folder}/webapp.jar.bin" failonerror="false" verbose="true" debug="on" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.runtime/runtime.jar;../org.eclipse.help/help.jar;../org.eclipse.help/bin;../org.eclipse.core.runtime/bin;../org.eclipse.core.boot/boot.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.boot/bin">
- <src path="src/"/>
+ <javac destdir="${temp.folder}/webapp.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.boot/bin;../org.eclipse.core.boot/boot.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.runtime/bin;../org.eclipse.core.runtime/runtime.jar;../org.apache.xerces/bin;../org.apache.xerces/xmlParserAPIs.jar;../org.apache.xerces/xercesImpl.jar;../org.eclipse.help.base/bin;../org.eclipse.help.base/helpbase.jar;../org.apache.lucene/bin;../org.apache.lucene/parser.jar;../org.apache.lucene/lucene-1.2.jar;../org.eclipse.help/bin;../org.eclipse.help/help.jar;../org.eclipse.help.appserver/bin;../org.eclipse.help.appserver/appserver.jar" source="${javacSource}" target="${javacTarget}" >
+ <src path="src/" />
</javac>
<!-- copy necessary resources -->
<copy todir="${temp.folder}/webapp.jar.bin">
- <fileset dir="src/" excludes="**/*.java"/>
+ <fileset dir="src/" excludes="**/*.java" />
</copy>
<!-- custom begin -->
- <copy file="${temp.folder}/webapp.jar.bin/webapp.properties" tofile="${temp.folder}/webapp.jar.bin/webapp_en.properties" />
+ <copy file="${temp.folder}/webapp.jar.bin/org/eclipse/help/internal/webapp/WebappResources.properties" tofile="${temp.folder}/webapp.jar.bin/org/eclipse/help/internal/webapp/WebappResources_en.properties" />
<!-- custom end -->
<mkdir dir="${build.result.folder}"/>
<jar jarfile="${build.result.folder}/webapp.jar" basedir="${temp.folder}/webapp.jar.bin"/>
@@ -74,21 +75,20 @@
<target name="webappsrc.zip" depends="init" unless="webappsrc.zip">
<mkdir dir="${build.result.folder}"/>
<zip zipfile="${build.result.folder}/webappsrc.zip" filesonly="false">
- <fileset dir="src/" includes="**/*.java"/>
+ <fileset dir="src/" includes="**/*.java" />
</zip>
</target>
- <target name="WEB-INF/lib/servlets.jar" depends="init" unless="WEB-INF/lib/servlets.jar">
- <property name="destdir" value="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
+ <target name="WEB-INF/lib/servlets.jar" depends="init" unless="WEB-INF/lib/servlets.jar" description="Create jar: WEB-INF/lib/servlets.jar.">
<delete dir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
<mkdir dir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
<!-- compile the source code -->
- <javac destdir="${temp.folder}/WEB-INF/lib/servlets.jar.bin" failonerror="false" verbose="true" debug="on" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.runtime/runtime.jar;../org.eclipse.help/help.jar;webapp.jar;../org.eclipse.help/bin;../org.eclipse.core.runtime/bin;../org.eclipse.core.boot/boot.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.boot/bin">
- <src path="src_servlets/"/>
+ <javac destdir="${temp.folder}/WEB-INF/lib/servlets.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.boot/bin;../org.eclipse.core.boot/boot.jar;bin;webapp.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.runtime/bin;../org.eclipse.core.runtime/runtime.jar;../org.apache.xerces/bin;../org.apache.xerces/xmlParserAPIs.jar;../org.apache.xerces/xercesImpl.jar;../org.eclipse.help.base/bin;../org.eclipse.help.base/helpbase.jar;../org.apache.lucene/bin;../org.apache.lucene/parser.jar;../org.apache.lucene/lucene-1.2.jar;../org.eclipse.help/bin;../org.eclipse.help/help.jar;../org.eclipse.help.appserver/bin;../org.eclipse.help.appserver/appserver.jar" source="${javacSource}" target="${javacTarget}" >
+ <src path="src_servlets/" />
</javac>
<!-- copy necessary resources -->
<copy todir="${temp.folder}/WEB-INF/lib/servlets.jar.bin">
- <fileset dir="src_servlets/" excludes="**/*.java"/>
+ <fileset dir="src_servlets/" excludes="**/*.java" />
</copy>
<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
<jar jarfile="${build.result.folder}/WEB-INF/lib/servlets.jar" basedir="${temp.folder}/WEB-INF/lib/servlets.jar.bin"/>
@@ -98,12 +98,11 @@
<target name="WEB-INF/lib/servletssrc.zip" depends="init" unless="WEB-INF/lib/servletssrc.zip">
<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
<zip zipfile="${build.result.folder}/WEB-INF/lib/servletssrc.zip" filesonly="false">
- <fileset dir="src_servlets/" includes="**/*.java"/>
+ <fileset dir="src_servlets/" includes="**/*.java" />
</zip>
</target>
- <target name="WEB-INF/lib/jsp.jar" depends="init" unless="WEB-INF/lib/jsp.jar">
- <property name="destdir" value="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
+ <target name="WEB-INF/lib/jsp.jar" depends="init" unless="WEB-INF/lib/jsp.jar" description="Create jar: WEB-INF/lib/jsp.jar.">
<delete dir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
<mkdir dir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
<!-- custom begin -->
@@ -133,12 +132,12 @@
</java>
<!-- custom end -->
<!-- compile the source code -->
- <javac destdir="${temp.folder}/WEB-INF/lib/jsp.jar.bin" failonerror="false" verbose="true" debug="on" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.runtime/runtime.jar;../org.eclipse.help/help.jar;webapp.jar;../org.eclipse.help/bin;../org.eclipse.core.runtime/bin;../org.eclipse.core.boot/boot.jar;WEB-INF/lib/servlets.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.boot/bin">
- <src path="${temp.folder}/jsp.jar.src/"/>
+ <javac destdir="${temp.folder}/WEB-INF/lib/jsp.jar.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bootclasspath}" classpath="../org.eclipse.core.boot/bin;../org.eclipse.core.boot/boot.jar;bin;webapp.jar;WEB-INF/lib/servlets.jar;../org.eclipse.tomcat/servlet.jar;../org.eclipse.tomcat/jasper-runtime.jar;../org.eclipse.core.runtime/bin;../org.eclipse.core.runtime/runtime.jar;../org.apache.xerces/bin;../org.apache.xerces/xmlParserAPIs.jar;../org.apache.xerces/xercesImpl.jar;../org.eclipse.help.base/bin;../org.eclipse.help.base/helpbase.jar;../org.apache.lucene/bin;../org.apache.lucene/parser.jar;../org.apache.lucene/lucene-1.2.jar;../org.eclipse.help/bin;../org.eclipse.help/help.jar;../org.eclipse.help.appserver/bin;../org.eclipse.help.appserver/appserver.jar" source="${javacSource}" target="${javacTarget}" >
+ <src path="${temp.folder}/jsp.jar.src/" />
</javac>
<!-- copy necessary resources -->
<copy todir="${temp.folder}/WEB-INF/lib/jsp.jar.bin">
- <fileset dir="${temp.folder}/jsp.jar.src/" excludes="**/*.java"/>
+ <fileset dir="${temp.folder}/jsp.jar.src/" excludes="**/*.java" />
</copy>
<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
<jar jarfile="${build.result.folder}/WEB-INF/lib/jsp.jar" basedir="${temp.folder}/WEB-INF/lib/jsp.jar.bin"/>
@@ -148,11 +147,11 @@
<target name="WEB-INF/lib/jspsrc.zip" depends="init" unless="WEB-INF/lib/jspsrc.zip">
<mkdir dir="${build.result.folder}/WEB-INF/lib"/>
<zip zipfile="${build.result.folder}/WEB-INF/lib/jspsrc.zip" filesonly="false">
- <fileset dir="${temp.folder}/jsp.jar.src/" includes="**/*.java"/>
+ <fileset dir="${temp.folder}/jsp.jar.src/" includes="**/*.java" />
</zip>
</target>
- <target name="build.jars" depends="init">
+ <target name="build.jars" depends="init" description="Build all the jars for the plug-in: org.eclipse.help.webapp.">
<available property="webapp.jar" file="${build.result.folder}/webapp.jar"/>
<antcall target="webapp.jar"/>
<available property="WEB-INF/lib/servlets.jar" file="${build.result.folder}/WEB-INF/lib/servlets.jar"/>
@@ -174,49 +173,50 @@
<!-- custom end -->
</target>
- <target name="build.zips" depends="init">
- </target>
+ <target name="build.zips" depends="init">
+ </target>
<target name="gather.sources" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${build.result.folder}/WEB-INF/lib/servletssrc.zip" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
+ <mkdir dir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
+ <copy file="${build.result.folder}/WEB-INF/lib/servletssrc.zip" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
<!-- custom begin -->
<!--
- <copy file="${build.result.folder}/WEB-INF/lib/jspsrc.zip" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
+ <copy file="${build.result.folder}/WEB-INF/lib/jspsrc.zip" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
-->
<!-- custom end -->
- <mkdir dir="${destination.temp.folder}/${full.name}"/>
- <copy file="${build.result.folder}/webappsrc.zip" todir="${destination.temp.folder}/${full.name}"/>
- <copy todir="${destination.temp.folder}/${full.name}">
- <fileset dir="${basedir}" includes="about.html"/>
+ <mkdir dir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0"/>
+ <copy file="${build.result.folder}/webappsrc.zip" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0"/>
+ <copy todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0">
+ <fileset dir="${basedir}" includes="about.html" />
</copy>
</target>
<target name="gather.logs" depends="init" if="destination.temp.folder">
- <mkdir dir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${temp.folder}/WEB-INF/lib/servlets.jar.bin.log" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <copy file="${temp.folder}/WEB-INF/lib/jsp.jar.bin.log" todir="${destination.temp.folder}/${full.name}/WEB-INF/lib"/>
- <mkdir dir="${destination.temp.folder}/${full.name}"/>
- <copy file="${temp.folder}/webapp.jar.bin.log" todir="${destination.temp.folder}/${full.name}"/>
+ <mkdir dir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
+ <copy file="${temp.folder}/WEB-INF/lib/servlets.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
+ <copy file="${temp.folder}/WEB-INF/lib/jsp.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0/WEB-INF/lib"/>
+ <mkdir dir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0"/>
+ <copy file="${temp.folder}/webapp.jar.bin.log" todir="${destination.temp.folder}/org.eclipse.help.webapp_3.0.0"/>
</target>
- <target name="clean" depends="init">
+ <target name="clean" depends="init" description="Clean the plug-in: org.eclipse.help.webapp of all the zips, jars and logs created.">
<delete file="${build.result.folder}/WEB-INF/lib/servlets.jar"/>
<delete file="${build.result.folder}/WEB-INF/lib/servletssrc.zip"/>
<delete file="${build.result.folder}/WEB-INF/lib/jsp.jar"/>
<delete file="${build.result.folder}/WEB-INF/lib/jspsrc.zip"/>
<delete file="${build.result.folder}/webapp.jar"/>
<delete file="${build.result.folder}/webappsrc.zip"/>
- <delete file="${plugin.destination}/${full.name}.jar"/>
- <delete file="${plugin.destination}/${full.name}.zip"/>
+ <delete file="${plugin.destination}/org.eclipse.help.webapp_3.0.0.jar"/>
+ <delete file="${plugin.destination}/org.eclipse.help.webapp_3.0.0.zip"/>
<delete dir="${temp.folder}"/>
</target>
- <target name="refresh" depends="init" if="eclipse.running">
- <eclipse.refreshLocal resource="${plugin}" depth="infinite"/>
+ <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
+ <eclipse.convertPath fileSystemPath="d:/workspaceUpdate/plugins/org.eclipse.help.webapp/" property="resourcePath"/>
+ <eclipse.refreshLocal resource="org.eclipse.help.webapp" depth="infinite"/>
</target>
- <target name="zip.plugin" depends="init">
+ <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.eclipse.help.webapp.">
<delete dir="${temp.folder}"/>
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
@@ -228,9 +228,9 @@
<param name="destination.temp.folder" value="${temp.folder}/"/>
</antcall>
<delete>
- <fileset dir="${temp.folder}" includes="**/*.bin.log"/>
+ <fileset dir="${temp.folder}" includes="**/*.bin.log" />
</delete>
- <zip zipfile="${plugin.destination}/${full.name}.zip" basedir="${temp.folder}" filesonly="true"/>
+ <zip zipfile="${plugin.destination}/org.eclipse.help.webapp_3.0.0.zip" basedir="${temp.folder}" filesonly="true"/>
<delete dir="${temp.folder}"/>
</target>
diff --git a/org.eclipse.help.webapp/plugin.properties b/org.eclipse.help.webapp/plugin.properties
index 9e8761d8d..f8be5ef8e 100644
--- a/org.eclipse.help.webapp/plugin.properties
+++ b/org.eclipse.help.webapp/plugin.properties
@@ -8,11 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-help_plugin_name = Help System Webapp
+help_webapp_plugin_name = Help System Webapp
providerName=Eclipse.org
-helpcontents = Browse &Help Contents
-help = Help
-help_view = Help
-openhelpcontents = Open Help Contents
diff --git a/org.eclipse.help.webapp/plugin.xml b/org.eclipse.help.webapp/plugin.xml
index a0d2cdb75..4e7ad58ec 100644
--- a/org.eclipse.help.webapp/plugin.xml
+++ b/org.eclipse.help.webapp/plugin.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
<plugin
id="org.eclipse.help.webapp"
- name="%help_plugin_name"
+ name="%help_webapp_plugin_name"
version="3.0.0"
provider-name="%providerName"
class="org.eclipse.help.internal.webapp.HelpWebappPlugin">
@@ -12,12 +13,12 @@
</library>
</runtime>
<requires>
- <import plugin="org.eclipse.help"/>
+ <import plugin="org.eclipse.help.base"/>
</requires>
<extension
- point="org.eclipse.help.webapp">
+ point="org.eclipse.help.base.webapp">
<webapp
default="true">
</webapp>
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
index 80e62304a..3e3d2a68e 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
@@ -23,12 +23,6 @@ public class WebappResources {
// resource bundles indexed by locale
private static HashMap resourceBundleTable = new HashMap();
- /**
- * Resources constructor.
- */
- protected WebappResources() {
- super();
- }
/**
* Returns a string from a property file.
@@ -36,22 +30,13 @@ public class WebappResources {
* @param request HttpServletRequest or null; default locale will be used if null passed
*/
public static String getString(String name, Locale locale) {
- if (locale == null)
- locale = getDefaultLocale();
- // check cache
- ResourceBundle bundle =
- (ResourceBundle) resourceBundleTable.get(locale);
-
- // load bundle
+ // get bundle
+ ResourceBundle bundle = getBundle(locale);
if (bundle == null) {
- bundle = ResourceBundle.getBundle("webapp", locale);
- if (bundle != null) {
- resourceBundleTable.put(locale, bundle);
- } else {
- return name;
- }
+ return name;
}
+
// get value
try {
return bundle.getString(name);
@@ -63,23 +48,17 @@ public class WebappResources {
/**
* Returns a string from a property file
*/
- public static String getString(String name, Locale locale, String replace0) {
- if (locale == null)
- locale = getDefaultLocale();
+ public static String getString(
+ String name,
+ Locale locale,
+ String replace0) {
- // check cache
- ResourceBundle bundle =
- (ResourceBundle) resourceBundleTable.get(locale);
-
- // load bundle
+ // get bundle
+ ResourceBundle bundle = getBundle(locale);
if (bundle == null) {
- bundle = ResourceBundle.getBundle("webapp", locale);
- if (bundle != null) {
- resourceBundleTable.put(locale, bundle);
- } else {
- return name;
- }
+ return name;
}
+
// get value
try {
String stringFromPropertiesFile = bundle.getString(name);
@@ -93,6 +72,32 @@ public class WebappResources {
}
}
+ /**
+ * Obtains resource bundle for specified locale.
+ * Loads bundle if necessary
+ * @param locale Locale or null to use default locale
+ * @return ResourceBundle or null if not found
+ */
+ private static ResourceBundle getBundle(Locale locale) {
+ if (locale == null)
+ locale = getDefaultLocale();
+
+ // check cache
+ ResourceBundle bundle =
+ (ResourceBundle) resourceBundleTable.get(locale);
+
+ // load bundle
+ if (bundle == null) {
+ bundle =
+ ResourceBundle.getBundle(
+ WebappResources.class.getName(),
+ locale);
+ if (bundle != null) {
+ resourceBundleTable.put(locale, bundle);
+ }
+ }
+ return bundle;
+ }
private static Locale getDefaultLocale() {
String nl = BootLoader.getNL();
// sanity test
diff --git a/org.eclipse.help.webapp/src/webapp.properties b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties
index 71a86af86..189378d92 100644
--- a/org.eclipse.help.webapp/src/webapp.properties
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.properties
@@ -56,6 +56,7 @@ search=Search Results
toc=Contents
links=Links
bookmarks=Bookmarks
+searchTooComplex=Search request too complex.
Views=Navigation Views
noLiveHelpInInfocenter=You must run help locally to perform "active help" actions.
@@ -82,4 +83,3 @@ TabsFrame=Selection of Navigation Views
aView={0} View
aViewToolbar={0} View Toolbar
topic=Topic
-searchTooComplex=Search request too complex. \ No newline at end of file
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/BookmarksData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/BookmarksData.java
index b0964e1fa..b073e75f7 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/BookmarksData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/BookmarksData.java
@@ -16,8 +16,8 @@ import javax.servlet.*;
import javax.servlet.http.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
+import org.eclipse.help.internal.base.*;
+import org.eclipse.help.internal.base.util.*;
/**
* This class manages bookmarks.
@@ -55,8 +55,8 @@ public class BookmarksData extends RequestData {
if(title==null){
return;
}
- Preferences prefs = HelpPlugin.getDefault().getPluginPreferences();
- String bookmarks = prefs.getString(HelpSystem.BOOKMARKS);
+ Preferences prefs = HelpBasePlugin.getDefault().getPluginPreferences();
+ String bookmarks = prefs.getString(BaseHelpSystem.BOOKMARKS);
// separate the url and title by vertical bar
@@ -65,8 +65,8 @@ public class BookmarksData extends RequestData {
return;
bookmarks =
bookmarks + "," + encode(bookmarkURL) + "|" + encode(title);
- prefs.setValue(HelpSystem.BOOKMARKS, bookmarks);
- HelpPlugin.getDefault().savePluginPreferences();
+ prefs.setValue(BaseHelpSystem.BOOKMARKS, bookmarks);
+ HelpBasePlugin.getDefault().savePluginPreferences();
}
}
@@ -79,8 +79,8 @@ public class BookmarksData extends RequestData {
if(title==null){
return;
}
- Preferences prefs = HelpPlugin.getDefault().getPluginPreferences();
- String bookmarks = prefs.getString(HelpSystem.BOOKMARKS);
+ Preferences prefs = HelpBasePlugin.getDefault().getPluginPreferences();
+ String bookmarks = prefs.getString(BaseHelpSystem.BOOKMARKS);
String removeString =
"," + encode(bookmarkURL) + "|" + encode(title);
int i = bookmarks.indexOf(removeString);
@@ -89,23 +89,23 @@ public class BookmarksData extends RequestData {
bookmarks =
bookmarks.substring(0, i)
+ bookmarks.substring(i + removeString.length());
- prefs.setValue(HelpSystem.BOOKMARKS, bookmarks);
- HelpPlugin.getDefault().savePluginPreferences();
+ prefs.setValue(BaseHelpSystem.BOOKMARKS, bookmarks);
+ HelpBasePlugin.getDefault().savePluginPreferences();
}
}
public void removeAllBookmarks() {
- Preferences prefs = HelpPlugin.getDefault().getPluginPreferences();
- prefs.setValue(HelpSystem.BOOKMARKS, "");
- HelpPlugin.getDefault().savePluginPreferences();
+ Preferences prefs = HelpBasePlugin.getDefault().getPluginPreferences();
+ prefs.setValue(BaseHelpSystem.BOOKMARKS, "");
+ HelpBasePlugin.getDefault().savePluginPreferences();
}
public Topic[] getBookmarks() {
// sanity test for infocenter, but this could not work anyway...
- if (HelpSystem.getMode() != HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER) {
// this is workbench
- Preferences prefs = HelpPlugin.getDefault().getPluginPreferences();
- String bookmarks = prefs.getString(HelpSystem.BOOKMARKS);
+ Preferences prefs = HelpBasePlugin.getDefault().getPluginPreferences();
+ String bookmarks = prefs.getString(BaseHelpSystem.BOOKMARKS);
StringTokenizer tokenizer = new StringTokenizer(bookmarks, ",");
Topic[] topics = new Topic[tokenizer.countTokens()];
for (int i = 0; tokenizer.hasMoreTokens(); i++) {
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LayoutData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LayoutData.java
index 9af68b91d..7ea49119a 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LayoutData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LayoutData.java
@@ -13,7 +13,7 @@ package org.eclipse.help.internal.webapp.data;
import javax.servlet.*;
import javax.servlet.http.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
public class LayoutData extends RequestData {
@@ -135,10 +135,10 @@ public class LayoutData extends RequestData {
if (preferences.isWindowTitlePrefix()) {
return ServletResources.getString(
"browserTitle",
- HelpSystem.getProductName(),
+ BaseHelpSystem.getProductName(),
request);
} else {
- return HelpSystem.getProductName();
+ return BaseHelpSystem.getProductName();
}
}
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LinksData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LinksData.java
index 89104cae4..1354f9b81 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LinksData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/LinksData.java
@@ -83,7 +83,7 @@ public class LinksData extends RequestData {
* or within a scope if specified
*/
private IToc findTocForTopic(String href) {
- IToc[] tocs = HelpSystem.getTocManager().getTocs(getLocale());
+ IToc[] tocs = HelpPlugin.getTocManager().getTocs(getLocale());
for (int i = 0; i < tocs.length; i++) {
ITopic topic = tocs[i].getTopic(href);
if (topic != null)
@@ -95,7 +95,7 @@ public class LinksData extends RequestData {
private void loadLinks() {
String contextId = request.getParameter("contextId");
- IContext context = HelpSystem.getContextManager().getContext(contextId);
+ IContext context = HelpSystem.getContext(contextId);
if (context == null) {
links = new IHelpResource[0];
return;
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/RequestData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/RequestData.java
index 3f0ba732b..5e2647d52 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/RequestData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/RequestData.java
@@ -13,15 +13,15 @@ package org.eclipse.help.internal.webapp.data;
import javax.servlet.*;
import javax.servlet.http.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
/**
* Helper class for contents.jsp initialization
*/
public class RequestData {
- public final static int MODE_WORKBENCH = HelpSystem.MODE_WORKBENCH;
- public final static int MODE_INFOCENTER = HelpSystem.MODE_INFOCENTER;
- public final static int MODE_STANDALONE = HelpSystem.MODE_STANDALONE;
+ public final static int MODE_WORKBENCH = BaseHelpSystem.MODE_WORKBENCH;
+ public final static int MODE_INFOCENTER = BaseHelpSystem.MODE_INFOCENTER;
+ public final static int MODE_STANDALONE = BaseHelpSystem.MODE_STANDALONE;
protected ServletContext context;
protected HttpServletRequest request;
@@ -82,7 +82,7 @@ public class RequestData {
}
public int getMode() {
- return HelpSystem.getMode();
+ return BaseHelpSystem.getMode();
}
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/SearchData.java
index 0c9ce9f9e..b6a62a3b2 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/SearchData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/SearchData.java
@@ -16,8 +16,8 @@ import javax.servlet.*;
import javax.servlet.http.*;
import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.search.*;
-import org.eclipse.help.internal.util.*;
import org.eclipse.help.internal.webapp.*;
import org.eclipse.help.internal.webapp.servlet.*;
import org.eclipse.help.internal.workingset.*;
@@ -245,14 +245,14 @@ public class SearchData extends RequestData {
if (pm.isDone()) {
this.indexCompletion = 100;
SearchResults results = createHitCollector();
- HelpSystem.getSearchManager().search(
+ BaseHelpSystem.getSearchManager().search(
createSearchQuery(),
results,
pm);
hits = results.getSearchHits();
if (hits == null) {
HelpWebappPlugin.logError(
- Resources.getString("index_is_busy"),
+ HelpBaseResources.getString("index_is_busy"),
null);
}
return;
@@ -340,7 +340,7 @@ public class SearchData extends RequestData {
return new WorkingSet[0];
}
if (scopes.length
- == HelpSystem.getTocManager().getTocs(getLocale()).length) {
+ == HelpPlugin.getTocManager().getTocs(getLocale()).length) {
// do not filter if all books are selected
return null;
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/TocData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/TocData.java
index 87ffec211..7defebdbd 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/TocData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/TocData.java
@@ -107,7 +107,6 @@ public class TocData extends RequestData {
// and allow help classes in JSP's.
public int getTocCount() {
- // get filtered tocs
return tocs.length;
}
@@ -171,11 +170,11 @@ public class TocData extends RequestData {
* @return true if TOC should be visible
*/
public boolean isInRole(int toc) {
- return HelpSystem.getTocManager().isTocInRole(toc, getLocale());
+ return HelpPlugin.getTocManager().isTocInRole(toc, getLocale());
}
private void loadTocs() {
- tocs = HelpSystem.getTocManager().getTocs(getLocale());
+ tocs = HelpPlugin.getTocManager().getTocs(getLocale());
// Find the requested TOC
selectedToc = -1;
if (tocHref != null && tocHref.length() > 0) {
@@ -203,7 +202,7 @@ public class TocData extends RequestData {
* Finds a TOC that contains specified topic
*
* @param topic
- * the topic href
+ * the topic href
*/
private int findTocContainingTopic(String topic) {
if (topic == null || topic.equals(""))
@@ -311,10 +310,10 @@ public class TocData extends RequestData {
* @param topic
* @param out
* @param maxLevels
- * relative number of topic levels to generate (pass
- * <0 for inifinite), 1 generates this topic as last level topic
+ * relative number of topic levels to generate (pass
+ * <0 for inifinite), 1 generates this topic as last level topic
* @param currentLevel
- * current level of topic, 0 is first Level under TOC
+ * current level of topic, 0 is first Level under TOC
* @throws IOException
*/
private void generateTopic(
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/UrlUtil.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/UrlUtil.java
index 38c49d104..66e436cc2 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/UrlUtil.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/UrlUtil.java
@@ -16,8 +16,8 @@ import java.util.*;
import javax.servlet.http.*;
import org.eclipse.core.boot.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
+import org.eclipse.help.internal.base.*;
+import org.eclipse.help.internal.base.util.*;
public class UrlUtil {
// XML escaped characters mapping
@@ -208,7 +208,7 @@ public class UrlUtil {
if (defaultLocale == null) {
initializeLocales();
}
- if ((HelpSystem.getMode() != HelpSystem.MODE_INFOCENTER)
+ if ((BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER)
|| request == null) {
return defaultLocale;
}
@@ -317,7 +317,7 @@ public class UrlUtil {
if (defaultLocale == null) {
defaultLocale = Locale.getDefault().toString();
}
- if (HelpSystem.getMode() != HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER) {
return;
}
@@ -344,7 +344,7 @@ public class UrlUtil {
if (infocenterLocales == null) {
StringTokenizer tokenizer =
new StringTokenizer(
- HelpPlugin.getDefault().getPluginPreferences().getString(
+ HelpBasePlugin.getDefault().getPluginPreferences().getString(
"locales"),
" ,\t");
while (tokenizer.hasMoreTokens()) {
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/WebappPreferences.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/WebappPreferences.java
index ec5ab3883..8d0369f4e 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/WebappPreferences.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/WebappPreferences.java
@@ -11,7 +11,7 @@
package org.eclipse.help.internal.webapp.data;
import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
/**
* Preferences for availiable to webapp
@@ -22,7 +22,7 @@ public class WebappPreferences {
* Constructor.
*/
public WebappPreferences() {
- prefs = HelpPlugin.getDefault().getPluginPreferences();
+ prefs = HelpBasePlugin.getDefault().getPluginPreferences();
}
/**
* @return String - URL of banner page or null
@@ -40,12 +40,12 @@ public class WebappPreferences {
}
public boolean isBookmarksView() {
- return HelpSystem.getMode() != HelpSystem.MODE_INFOCENTER
+ return BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER
&& "true".equals(prefs.getString("bookmarksView"));
}
public boolean isLinksView() {
- return HelpSystem.getMode() != HelpSystem.MODE_INFOCENTER
+ return BaseHelpSystem.getMode() != BaseHelpSystem.MODE_INFOCENTER
&& "true".equals(prefs.getString("linksView"));
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ContextServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
index e9d5d790d..f9bd60ad5 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
@@ -12,11 +12,11 @@ package org.eclipse.help.internal.webapp.servlet;
import java.io.*;
-import javax.servlet.ServletException;
+import javax.servlet.*;
import javax.servlet.http.*;
import org.eclipse.help.*;
-import org.eclipse.help.internal.HelpSystem;
+import org.eclipse.help.internal.*;
import org.eclipse.help.internal.webapp.data.*;
/**
@@ -43,7 +43,7 @@ public class ContextServlet extends HttpServlet {
if (contextId == null || contextId.length() < 2)
throw new ServletException();
contextId = contextId.substring(1);
- IContext context = HelpSystem.getContextManager().getContext(contextId);
+ IContext context = HelpSystem.getContext(contextId);
if (context == null)
throw new ServletException();
@@ -122,7 +122,7 @@ public class ContextServlet extends HttpServlet {
* or within a scope if specified
*/
IToc findTocForTopic(String href) {
- IToc[] tocs = HelpSystem.getTocManager().getTocs(locale);
+ IToc[] tocs = HelpPlugin.getTocManager().getTocs(locale);
for (int i = 0; i < tocs.length; i++) {
ITopic topic = tocs[i].getTopic(href);
if (topic != null)
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ControlServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
index f065ff33a..b08529154 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
@@ -10,13 +10,12 @@
*******************************************************************************/
package org.eclipse.help.internal.webapp.servlet;
-import java.io.IOException;
+import java.io.*;
-import javax.servlet.ServletException;
+import javax.servlet.*;
import javax.servlet.http.*;
-import org.eclipse.help.IHelp;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.webapp.data.*;
/**
* Servlet to control Eclipse helpApplication from standalone application.
@@ -26,7 +25,7 @@ import org.eclipse.help.internal.webapp.data.*;
*/
public class ControlServlet extends HttpServlet {
- private IHelp helpSupport = null;
+ private HelpDisplay helpDisplay = null;
private boolean shuttingDown = false;
/**
@@ -35,8 +34,8 @@ public class ControlServlet extends HttpServlet {
*/
public void init() throws ServletException {
super.init();
- if (HelpSystem.getMode() == HelpSystem.MODE_STANDALONE) {
- helpSupport = HelpSystem.getHelpSupport();
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) {
+ helpDisplay = BaseHelpSystem.getHelpDisplay();
}
}
@@ -92,7 +91,7 @@ public class ControlServlet extends HttpServlet {
if ("shutdown".equalsIgnoreCase(command)) {
shutdown();
} else if ("displayHelp".equalsIgnoreCase(command)) {
- if (HelpSystem.getMode() == HelpSystem.MODE_STANDALONE) {
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) {
displayHelp(req);
}
} else {
@@ -115,9 +114,9 @@ public class ControlServlet extends HttpServlet {
private void displayHelp(HttpServletRequest req) {
String href = req.getParameter("href");
if (href != null) {
- helpSupport.displayHelpResource(href);
+ helpDisplay.displayHelpResource(href);
} else {
- helpSupport.displayHelp();
+ helpDisplay.displayHelp();
}
}
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
index 15fb6bab7..21767fd90 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
@@ -18,6 +18,7 @@ import javax.servlet.*;
import javax.servlet.http.*;
import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.webapp.data.*;
/**
@@ -56,16 +57,16 @@ public class EclipseConnector {
if (i != -1)
url = url.substring(0, i);
// ensure the file is only accessed from a local installation
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER
|| !UrlUtil.isLocalRequest(req)) {
return;
}
} else {
// enable the role
- IHelpRoleManager roleManager = HelpSystem.getRoleManager();
+ IHelpRoleManager roleManager = HelpPlugin.getRoleManager();
if (roleManager != null)
roleManager.enabledActivities(url);
-
+
url = "help:" + url;
}
@@ -74,10 +75,11 @@ public class EclipseConnector {
long maxAge = 0;
try {
- // getExpiration() throws NullPointerException when URL is jar:file:...
+ // getExpiration() throws NullPointerException when URL is
+ // jar:file:...
long expiration = con.getExpiration();
maxAge = (expiration - System.currentTimeMillis()) / 1000;
- if (maxAge < 0 )
+ if (maxAge < 0)
maxAge = 0;
} catch (Exception e) {
}
@@ -149,7 +151,7 @@ public class EclipseConnector {
//System.out.println("help content for: " + url);
URLConnection con = null;
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
// it is an infocentre, add client locale to url
String locale = UrlUtil.getLocale(request, response);
if (url.indexOf('?') >= 0) {
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
index 91f1b32bf..5d9541511 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
@@ -33,6 +33,10 @@ public class FramesetFilter implements IFilter {
return out;
}
+ if("/nftopic".equals(req.getServletPath())){
+ return out;
+ }
+
String noframes = req.getParameter("noframes");
if ("true".equals(noframes)){
return out;
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
index e5d408c4e..ad7f588f6 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
@@ -56,7 +56,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
if (root == null)
root =
new AdaptableTocsArray(
- HelpSystem.getTocManager().getTocs(locale));
+ HelpPlugin.getTocManager().getTocs(locale));
return root;
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
index ae69df7eb..4dd581e7b 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
@@ -17,7 +17,7 @@ import javax.servlet.http.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.ILiveHelpAction;
-import org.eclipse.help.internal.HelpSystem;
+import org.eclipse.help.internal.base.BaseHelpSystem;
/**
* Servlet to handle live help action requests
@@ -26,7 +26,7 @@ public class LiveHelpServlet extends HttpServlet {
/**
*/
public void init() throws ServletException {
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
throw new ServletException();
}
}
@@ -37,7 +37,7 @@ public class LiveHelpServlet extends HttpServlet {
*/
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
return;
}
req.setCharacterEncoding("UTF-8");
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/SearchServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
index ea00d780f..d83cdb244 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
@@ -18,6 +18,7 @@ import javax.servlet.http.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.search.*;
import org.eclipse.help.internal.webapp.*;
import org.eclipse.help.internal.webapp.data.*;
@@ -75,7 +76,7 @@ public class SearchServlet extends HttpServlet {
NullProgressMonitor pm = new NullProgressMonitor();
SearchResults results = createHitCollector(request, response);
- HelpSystem.getSearchManager().search(
+ BaseHelpSystem.getSearchManager().search(
createSearchQuery(request),
results,
pm);
@@ -170,7 +171,7 @@ public class SearchServlet extends HttpServlet {
return new WorkingSet[0];
}
if (scopes.length
- == HelpSystem.getTocManager().getTocs(locale).length) {
+ == HelpPlugin.getTocManager().getTocs(locale).length) {
// do not filter if all books are selected
return null;
}
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/TocServlet.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/TocServlet.java
index d978b94ff..9aa7000eb 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/TocServlet.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/TocServlet.java
@@ -12,11 +12,11 @@ package org.eclipse.help.internal.webapp.servlet;
import java.io.*;
-import javax.servlet.ServletException;
+import javax.servlet.*;
import javax.servlet.http.*;
import org.eclipse.help.*;
-import org.eclipse.help.internal.HelpSystem;
+import org.eclipse.help.internal.*;
import org.eclipse.help.internal.toc.*;
import org.eclipse.help.internal.webapp.data.*;
/**
@@ -72,7 +72,7 @@ public class TocServlet extends HttpServlet {
*/
private void serializeToc(String tocID, HttpServletResponse resp)
throws ServletException, IOException {
- IToc toc = (IToc) HelpSystem.getTocManager().getToc(tocID, locale);
+ IToc toc = (IToc) HelpPlugin.getTocManager().getToc(tocID, locale);
serializeToc(toc, resp);
}
/**
@@ -93,7 +93,7 @@ public class TocServlet extends HttpServlet {
*/
private void serializeTocs(HttpServletResponse resp)
throws ServletException, IOException {
- TocManager tocManager = HelpSystem.getTocManager();
+ TocManager tocManager = HelpPlugin.getTocManager();
IToc[] tocs = tocManager.getTocs(locale);
TocWriter gen = new TocWriter(resp.getWriter());
@@ -144,7 +144,7 @@ public class TocServlet extends HttpServlet {
if (topic == null || topic.equals(""))
return null;
- IToc[] tocs = HelpSystem.getTocManager().getTocs(locale);
+ IToc[] tocs = HelpPlugin.getTocManager().getTocs(locale);
for (int i = 0; i < tocs.length; i++)
if (tocs[i].getTopic(topic) != null)
return tocs[i];
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
index 47c952f9b..cfa0113a7 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
@@ -14,7 +14,7 @@ import java.io.*;
import javax.servlet.http.*;
-import org.eclipse.help.internal.*;
+import org.eclipse.help.internal.base.*;
import org.eclipse.help.internal.workingset.*;
/**
@@ -34,13 +34,13 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
HttpServletRequest request,
HttpServletResponse response,
String locale) {
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER) {
+ if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
wSetManager =
new InfocenterWorkingSetManager(request, response, locale);
} else {
- wSetManager = HelpSystem.getWorkingSetManager(locale);
+ wSetManager = BaseHelpSystem.getWorkingSetManager(locale);
if (!workingSetsSynchronized
- && HelpSystem.getMode() == HelpSystem.MODE_WORKBENCH) {
+ && BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH) {
// upon startup in workbench mode, make sure working sets are in synch with those from UI
workingSetsSynchronized = true;
((WorkingSetManager)wSetManager).synchronizeWorkingSets();
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/XMLGenerator.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/XMLGenerator.java
index 6d11f3c44..e3134908b 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/XMLGenerator.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/servlet/XMLGenerator.java
@@ -11,7 +11,8 @@
package org.eclipse.help.internal.webapp.servlet;
import java.io.*;
-import org.eclipse.help.internal.util.*;
+import org.eclipse.help.internal.base.*;
+import org.eclipse.help.internal.base.util.*;
import org.eclipse.help.internal.webapp.*;
/**
* Helper class to generate xml files.
@@ -51,7 +52,7 @@ public class XMLGenerator {
println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
} catch (IOException ioe) {
HelpWebappPlugin.logError(
- Resources.getString("E014", outFile.getAbsolutePath()),
+ HelpBaseResources.getString("E014", outFile.getAbsolutePath()),
ioe);
}
}
@@ -69,7 +70,7 @@ public class XMLGenerator {
if (out.checkError())
if (outFile != null)
HelpWebappPlugin.logError(
- Resources.getString("E015", outFile.getAbsolutePath()),
+ HelpBaseResources.getString("E015", outFile.getAbsolutePath()),
null);
out = null;
}
diff --git a/org.eclipse.help/.options b/org.eclipse.help/.options
index 2b9c34121..adc49bf89 100644
--- a/org.eclipse.help/.options
+++ b/org.eclipse.help/.options
@@ -1,4 +1,3 @@
org.eclipse.help/debug = true
org.eclipse.help/debug/context = false
org.eclipse.help/debug/protocols = false
-org.eclipse.help/debug/search = false
diff --git a/org.eclipse.help/.project b/org.eclipse.help/.project
index 30cca9a67..b158d9445 100644
--- a/org.eclipse.help/.project
+++ b/org.eclipse.help/.project
@@ -3,10 +3,8 @@
<name>org.eclipse.help</name>
<comment></comment>
<projects>
- <project>org.apache.lucene</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.runtime</project>
- <project>org.eclipse.help.appserver</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/org.eclipse.help/build.properties b/org.eclipse.help/build.properties
index b85135c27..7ba1a6267 100644
--- a/org.eclipse.help/build.properties
+++ b/org.eclipse.help/build.properties
@@ -10,5 +10,5 @@
###############################################################################
source.help.jar=src/
src.includes=schema/,about.html
-bin.includes=doc/,dtd/,html/,livehelp.js,plugin.xml,preferences.ini,*.jar,plugin.properties,about.html,.options
+bin.includes=dtd/,livehelp.js,plugin.xml,preferences.ini,*.jar,plugin.properties,about.html,.options
diff --git a/org.eclipse.help/doc/banner_prod.jpg b/org.eclipse.help/doc/banner_prod.jpg
deleted file mode 100644
index 667cd67bf..000000000
--- a/org.eclipse.help/doc/banner_prod.jpg
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help/doc/book.css b/org.eclipse.help/doc/book.css
deleted file mode 100644
index 139eb28a0..000000000
--- a/org.eclipse.help/doc/book.css
+++ /dev/null
@@ -1 +0,0 @@
-P.Code { display: block; text-align: left; text-indent: 0.00pt; margin-top: 0.000000pt; margin-bottom: 0.000000pt; margin-right: 0.000000pt; margin-left: 15pt; font-size: 10.000000pt; font-weight: medium; font-style: Regular; color: #4444CC; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Courier New"; } H6.CaptionFigColumn { display: block; text-align: left; text-indent: 0.000000pt; margin-top: 3.000000pt; margin-bottom: 11.000000pt; margin-right: 0.000000pt; margin-left: 0.000000pt; font-size: 9.000000pt; font-weight: medium; font-style: Italic; color: #000000; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Arial"; } P.Note { display: block; text-align: left; text-indent: 0pt; margin-top: 19.500000pt; margin-bottom: 19.500000pt; margin-right: 0.000000pt; margin-left: 30pt; font-size: 11.000000pt; font-weight: medium; font-style: Italic; color: #000000; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Arial"; } EM.UILabel { font-weight: Bold; font-style: Regular; text-decoration: none; vertical-align: baseline; text-transform: none; } EM.CodeName { font-weight: Bold; font-style: Regular; text-decoration: none; vertical-align: baseline; text-transform: none; font-family:"Courier New"; } /* following font face declarations need to be removed for DBCS */ body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-family: Arial, Helvetica, sans-serif; color: #000000} pre { font-family: Courier, monospace} /* end font face declarations */ /* following font size declarations should be OK for DBCS */ body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-size: 10pt; } pre { font-size: 10pt} /* end font size declarations */ body { background: #FFFFFF} h1 { font-size: 18pt; margin-top: 5; margin-bottom: 1 } h2 { font-size: 14pt; margin-top: 25; margin-bottom: 3 } h3 { font-size: 11pt; margin-top: 20; margin-bottom: 3 } h4 { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic } p { margin-top: 10px; margin-bottom: 10px } pre { margin-left: 6; font-size: 9pt } a:link { color: #0000FF } a:hover { color: #000080 } a:visited { text-decoration: underline } ul { margin-top: 0; margin-bottom: 10 } li { margin-top: 0; margin-bottom: 0 } li p { margin-top: 0; margin-bottom: 0 } ol { margin-top: 0; margin-bottom: 10 } dl { margin-top: 0; margin-bottom: 10 } dt { margin-top: 0; margin-bottom: 0; font-weight: bold } dd { margin-top: 0; margin-bottom: 0 } strong { font-weight: bold} em { font-style: italic} var { font-style: italic} div.revision { border-left-style: solid; border-left-width: thin; border-left-color: #7B68EE; padding-left:5 } th { font-weight: bold } \ No newline at end of file
diff --git a/org.eclipse.help/doc/contents_view.gif b/org.eclipse.help/doc/contents_view.gif
deleted file mode 100644
index 20e0ff988..000000000
--- a/org.eclipse.help/doc/contents_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help/doc/help_home.html b/org.eclipse.help/doc/help_home.html
deleted file mode 100644
index 3f1c1f465..000000000
--- a/org.eclipse.help/doc/help_home.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-
-<head>
-<meta http-equiv="Content-Language" content="en-us">
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>Using Eclipse help system</title>
-<LINK REL="STYLESHEET" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
-</head>
-
-<body style="margin-top: 0; margin-left: 0; margin-right: 0;">
-<table height=45 width="100%" cellspacing="0" cellpadding="0" border="0" style="background:black;">
- <tr><td align=left valign="center"><img src="banner_prod.jpg" alt="Eclipse icon"></td></tr>
-</table>
-
-<table width="100%" cellspacing="0" cellpadding="10" border="0">
-<tr><td>
-<h2>Using Eclipse help system</h2>
-<p>Browse topics in the <b>Contents</b> frame
- (<img src="contents_view.gif" width="16" height="16" alt="Contents icon">)
-on the left. Click on topics to
- display them. Use the <b>Back</b> and <b>Forward</b> buttons
- to navigate within history of viewed topics.</p>
-
-<h3>Searching</h3>
-<p>To quickly locate topics on particular subject in the entire documentation set,
- enter a query in the <b>Search</b> field. Click
- (<img src="search_results_view.gif" width="16" height="16" alt="Search icon">)
- icon to display Search view. You can narrow <b>scope</b> of the search by selecting
- only sections that you are interested in.</p>
-
-<h3>Synchronizing</h3>
-<p>After you run a search and find a topic you were looking for, click the <b>
- Synchronize</b> button (<img src="synch_toc_nav.gif" width="16" height="16" alt="Synchronize icon">)
- to match the navigation tree up with the current topic. You might also find
- it useful to synchronize after following in-topic links.</p>
-
-<h3>More information</h3>
-<p>If you cannot find solution to your question in the on-line help,
- visit <b><a href="http://eclipse.org/" target="_new">eclipse.org</a></b>
- web site, read articles, and participate in the eclipse community.</p>
-
-<p><br>
-<a href="hglegal2003.htm"><img src="ngibmcpy2003.gif" alt=
-"(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"></a>
-</p>
-
-</td></tr></table>
-</body>
-
-</html> \ No newline at end of file
diff --git a/org.eclipse.help/doc/hglegal2003.htm b/org.eclipse.help/doc/hglegal2003.htm
deleted file mode 100644
index 47c8540c8..000000000
--- a/org.eclipse.help/doc/hglegal2003.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <LINK REL="stylesheet" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved.
-</body>
-</html>
diff --git a/org.eclipse.help/doc/ngibmcpy2003.gif b/org.eclipse.help/doc/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1..000000000
--- a/org.eclipse.help/doc/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help/doc/org_eclipse_help.html b/org.eclipse.help/doc/org_eclipse_help.html
deleted file mode 100644
index 18568a3e4..000000000
--- a/org.eclipse.help/doc/org_eclipse_help.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
-
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
-
- <meta name="GENERATOR"
- content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Help System Extension Points</title>
-</head>
-<body text="#000000" bgcolor="#ffffff" link="#0000ff" vlink="#800080"
- alink="#ff0000">
-<center>
-<h1>Help System Preferences</h1>
-</center>
-
-The following preferences settings can be used with the help system:
-<ul>
- <li><b>help_home</b>: The page to show inn the content area when opening
-help. Specify your html page as <i>/pluginId/path/to/home.html</i>. Currently,
-the default home is /org.eclipse.help/doc/help_home.html.</li>
- <li><b>linksView</b>: set to true or false to control the visibility of
-the related links view. Note: this option has no effect in the infocenter.</li>
- <li><b>bookmarksView</b>: set to true or false to control the visibility
-of the bookmarks view. Note: this option has no effect in the infocenter.</li>
- <li><b>windowTitlePrefix</b>: set to true or false to control the title
-of the browser window. If true, the title will have a form "Help -
-&lt;PRODUCT_NAME&gt;", otherwise the title will be "&lt;PRODDUCT_NAME&gt;",
-where &lt;PRODUCT_NAME&gt; is the name of Eclipse product set in the primary
-feature. Default is true.</li>
- <li><b>loadBookAtOnceLimit</b>: the maximum number of topics
-a book can have, for the navigation to be loaded by the browser as one document.
-Navigation for larger books is loaded dynamically, few levels at a time.
-More topics are downloaded as necessary, when branches are expanded. Default is 1000</li>
- <li><b>dynamicLoadDepthsHint</b>: suggested number of levels in topic navigation
-downloaded to the browser for large books. The value needs to be greater than 0.
-The actual number of levels can differ for wide tree if suggested number of levels
-contains large number of topics. Default is 3.</li>
- <li><b>baseTOCS</b>: ordered list of help TOC's (books) as they would appear
-on the bookshelf. All the other TOCS will be follow these books. Non-present
-TOC's on this list will be ignored. Use the location of each TOC as <i>/pluginId/path/to/toc.xml</i>.</li>
- <li><b>imagesDirectory</b>: directory containing images used in the help
-view. Images must have the same name as those in the org.eclipse.help.webapp
-plugin. Use the /pluginID/directory format. Default is "images".</li>
- <li><b>advanced.toolbarBackground</b>: CSS background for toolbars.&nbsp;
-Value is used in browsers that display advanced help UI.&nbsp; Default is
-"ButtonFace"</li>
- <li><b>advanced.viewBackground</b>: CSS background for navigation views.&nbsp;
-Value is used in browsers that display advanced help UI.&nbsp; Default is
-"Window"</li>
- <li><b>advanced.toolbarFont</b>: CSS font for toolbars.&nbsp; Value is used
-in browsers that display advanced help UI.&nbsp; Default is "icon"</li>
- <li><b>advanced.viewFont</b>: CSS font for navigation views.&nbsp; Value
-is used in browsers that display advanced help UI.&nbsp; Default is "icon"</li>
- <li><b>basic.toolbarBackground</b>: background color for toolbars.&nbsp;
-Value is used in browsers displaying basic help UI.&nbsp; Default is "#D4D0C8"</li>
- <li><b>basic.viewBackground</b>: background color for navigation views.&nbsp;
-Value is used in browsers displaying basic help UI.&nbsp; Default is "#FFFFFF"</li>
- <li><b>productIndex</b>: plug-in ID of a plugin containing prebuilt documentation
-index. &nbsp;If present, the index retrieved from the plug-in will be used
-as a starting point in creation of documentation index for use by help search.&nbsp;
-Default is ""<br></li>
- <li><b>locales</b>: list of locales (space separated) that infocenter will recognize and provide a customized
-content for. If locales (or languages) accepted by client browser are not matched with
-any locales in this list, the browser will be served content for default locale - the server locale,
-or locale specified by eclipse -nl command line option. If list is not specified, the browser will be
-served contents for its preferred locale. Note: not providing this option may result in a large
-memory and disk space requirements as navigations and indexes will be created for each distinct
-preferred locale among browsers accessing the infocenter.
-Thos preference can be overridden by command line option when launching infocenter.
-Default is ""<br></li>
-</ul>
-<p><br>
-<a href="hglegal2003.htm"><img src="ngibmcpy2003.gif"
- alt="(c) Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved."
- border="0"></a></p>
-<br>
-<br>
-</body>
-</html>
diff --git a/org.eclipse.help/doc/search_results_view.gif b/org.eclipse.help/doc/search_results_view.gif
deleted file mode 100644
index 6f9036cb1..000000000
--- a/org.eclipse.help/doc/search_results_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help/doc/synch_toc_nav.gif b/org.eclipse.help/doc/synch_toc_nav.gif
deleted file mode 100644
index 2bc7cab3b..000000000
--- a/org.eclipse.help/doc/synch_toc_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help/plugin.properties b/org.eclipse.help/plugin.properties
index 2e4db0d18..6181f1f30 100644
--- a/org.eclipse.help/plugin.properties
+++ b/org.eclipse.help/plugin.properties
@@ -10,20 +10,6 @@
###############################################################################
help_plugin_name = Help System Core
providerName=Eclipse.org
-support_extension_point_name = Pluggable Help Support
toc_extension_point_name = Help Table of Contents Contributions
-webapp_extension_point_name = Help Web Application
-contributions_extension_point_name = Help Contributions
contexts_extension_point_name = Context Help
content_producer_extension_point_name = Help Content Producer
-app_server = Application Server
-prebuilt_index = Prebuilt Index
-lucene_analyzer = Lucene Text Analyzer
-browser_extension_point_name = Web Browser
-mozilla = Mozilla
-mozilla_adapter = Mozilla Adapter
-netscape = Netscape
-netscape_adapter = Netscape Adapter
-custom_browser = Custom Browser (user defined program)
-simple_browser = Simple Browser Adapter
-defaultBrowser = Default Web Browser (Change in System Preferences)
diff --git a/org.eclipse.help/plugin.xml b/org.eclipse.help/plugin.xml
index 42a81ffb8..fd28d282a 100644
--- a/org.eclipse.help/plugin.xml
+++ b/org.eclipse.help/plugin.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
<plugin
id="org.eclipse.help"
name="%help_plugin_name"
@@ -12,19 +13,10 @@
<packages prefixes="org.eclipse.help"/>
</library>
</runtime>
- <requires>
- <import plugin="org.apache.lucene"/>
- <import plugin="org.eclipse.help.appserver"/>
- </requires>
-
<!-- Extension points -->
<extension-point id="contexts" name="%contexts_extension_point_name" schema="schema/contexts.exsd"/>
- <extension-point id="luceneAnalyzer" name="%lucene_analyzer" schema="schema/luceneAnalyzer.exsd"/>
- <extension-point id="support" name="%support_extension_point_name" schema="schema/support.exsd"/>
<extension-point id="toc" name="%toc_extension_point_name" schema="schema/toc.exsd"/>
- <extension-point id="webapp" name="%webapp_extension_point_name" schema="schema/webapp.exsd"/>
- <extension-point id="browser" name="%browser_extension_point_name" schema="schema/browser.exsd"/>
<extension-point id="contentProducer" name="%content_producer_extension_point_name" schema="schema/contentProducer.exsd"/>
<!-- Help URL protocols -->
@@ -35,188 +27,5 @@
protocol="help">
</handler>
</extension>
-<!-- Stand-alone infocenter application -->
- <extension
- id="infocenterApplication"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.eclipse.help.internal.HelpApplication">
- <parameter
- name="mode"
- value="infocenter">
- </parameter>
- </run>
- </application>
- </extension>
-<!-- Stand-alone help application -->
- <extension
- id="helpApplication"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.eclipse.help.internal.HelpApplication">
- <parameter
- name="mode"
- value="standalone">
- </parameter>
- </run>
- </application>
- </extension>
-<!-- Pre-indexing tool -->
- <extension
- id="indexTool"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.eclipse.help.internal.IndexToolApplication">
- </run>
- </application>
- </extension>
-<!-- Text Analyzers for search -->
- <extension
- id="org.eclipse.help.Analyzer_en"
- point="org.eclipse.help.luceneAnalyzer">
- <analyzer
- locale="en"
- class="org.eclipse.help.internal.search.Analyzer_en">
- </analyzer>
- </extension>
- <extension
- id="org.eclipse.help.Analyzer_de"
- point="org.eclipse.help.luceneAnalyzer">
- <analyzer
- locale="de"
- class="org.apache.lucene.analysis.de.GermanAnalyzer">
- </analyzer>
- </extension>
-<!-- Web Browsers -->
- <extension
- point="org.eclipse.help.browser">
- <browser
- name="%mozilla_adapter"
- id="org.eclipse.help.mozillaLinux">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="mozilla">
- </parameter>
- <parameter
- name="executableName"
- value="%mozilla">
- </parameter>
- <parameter
- name="os"
- value="Linux">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%netscape_adapter"
- id="org.eclipse.help.netscapeLinux">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="netscape">
- </parameter>
- <parameter
- name="executableName"
- value="%netscape">
- </parameter>
- <parameter
- name="os"
- value="Linux">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%netscape_adapter"
- id="org.eclipse.help.netscapeAIX">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="netscape">
- </parameter>
- <parameter
- name="executableName"
- value="%netscape">
- </parameter>
- <parameter
- name="os"
- value="AIX">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%mozilla_adapter"
- id="org.eclipse.help.mozillaHPUX">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="mozilla">
- </parameter>
- <parameter
- name="executableName"
- value="%mozilla">
- </parameter>
- <parameter
- name="os"
- value="HP">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%netscape_adapter"
- id="org.eclipse.help.netscapeHPUX">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="netscape">
- </parameter>
- <parameter
- name="executableName"
- value="%netscape">
- </parameter>
- <parameter
- name="os"
- value="HP">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%netscape_adapter"
- id="org.eclipse.help.netscapeSolaris">
- <factoryclass
- class="org.eclipse.help.internal.browser.MozillaFactory">
- <parameter
- name="executable"
- value="netscape">
- </parameter>
- <parameter
- name="executableName"
- value="%netscape">
- </parameter>
- <parameter
- name="os"
- value="SunOS">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- factoryclass="org.eclipse.help.internal.browser.macosx.DefaultBrowserFactory"
- name="%defaultBrowser"
- id="org.eclipse.help.defaultBrowserMacOSX">
- </browser>
- <browser
- factoryclass="org.eclipse.help.internal.browser.CustomBrowserFactory"
- name="%custom_browser"
- id="org.eclipse.help.custombrowser">
- </browser>
- </extension>
</plugin>
diff --git a/org.eclipse.help/preferences.ini b/org.eclipse.help/preferences.ini
index 52154b324..2c57c6b49 100644
--- a/org.eclipse.help/preferences.ini
+++ b/org.eclipse.help/preferences.ini
@@ -1,54 +1,9 @@
-#banner=/org.eclipse.help.webapp/advanced/banner.html
-#banner_height=45
-help_home=/org.eclipse.help/doc/help_home.html
-linksView=true
-bookmarksView=true
-windowTitlePrefix=true
-
-########################################
-# Customization for handling large books
-########################################
-
-# number of topics in a book, above which topics in navigation will be loaded dynamically downloaded
-loadBookAtOnceLimit=1000
-# suggested number of children levels dynamically loaded when a topic is expanded, value must be > 1
-dynamicLoadDepthsHint=3
-
-##############################
-# Customization for jsp pages
-##############################
-
-# /pluginid/dir or directory relative to directories inside org.eclipse.help.webapp plugin
-imagesDirectory=images
-
-# colors for advanced web UI implementation
-advanced.toolbarBackground=ButtonFace
-advanced.viewBackground=Window
-
-# fonts for advanced web UI implementation
-advanced.toolbarFont=icon
-advanced.viewFont=icon
-
-# colors for basic web UI implementation
-basic.toolbarBackground=#D4D0C8
-basic.viewBackground=#FFFFFF
-
-# Toc ordering
+# Toc ordering. Ordered list of help TOC's (books) as they would appear
+# on the bookshelf. All the other TOCS will be follow these books.
+# Non-present TOC's on this list will be ignored. Use the location of each TOC
+# as /pluginId/path/to/toc.xml.
baseTOCS= /org.eclipse.platform.doc.user/toc.xml,\
/org.eclipse.jdt.doc.user/toc.xml,\
/org.eclipse.platform.doc.isv/toc.xml,\
/org.eclipse.jdt.doc.isv/toc.xml,\
/org.eclipse.pde.doc.user/toc.xml
-
-########################################
-# Customization for infocenter languages
-########################################
-
-# list of locales that infocenter will recognize and provide a customized content for; if locales
-# (or languages) accepted by client browser are not matched with any locales in this list,
-# the browser will be served content for default locale - the server locale, or locale specified
-# by eclipse -nl command line option; if list is not specified, the browser will be served contents
-# for its preferred locale; note: not providing this option may result in a large memory and disk
-# space requirements as navigations and indexes will be created for each distinct preferred locale
-# among browsers accessing the infocenter.
-# locales=en ja zh_CN zh_TW \ No newline at end of file
diff --git a/org.eclipse.help/schema/browser.exsd b/org.eclipse.help/schema/browser.exsd
deleted file mode 100644
index 5109f89ea..000000000
--- a/org.eclipse.help/schema/browser.exsd
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help" id="browser" name="Browser"/>
- </appInfo>
- <documentation>
- For providing web browsers capable of displaying html documents at a given URL.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="browser" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="browser">
- <complexType>
- <sequence>
- <element ref="factoryclass"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- the unique ID of the browser.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="factoryclass" type="string">
- <annotation>
- <documentation>
- the implementation class for the browser factory. This class must implement the &lt;samp&gt;org.eclipse.help.browser.IBrowserFactory&lt;/samp&gt; interface. This attribute may be omitted, and the nested &lt;samp&gt;factoryclass&lt;/samp&gt; element may be provided instead.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.browser.IBrowserFactory"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- the name of the browser (translatable).
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="factoryclass">
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the implementation class for the browser factory. This class must implement the &lt;samp&gt;org.eclipse.help.browser.IBrowserFactory&lt;/samp&gt; interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.browser.IBrowserFactory"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="parameter">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- name of a parameter passed to the implementation class
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- value of a parameter passed to the implementation class
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is a sample usage of the browser extension point:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.help.browser&quot;&gt;
- &lt;browser
- id=&quot;org.eclipse.myPlugin.myBrowserID&quot;
- factoryClass=&quot;org.eclipse.myPlugin.myPackage.MyFactoryClass&quot;
- name=&quot;My Browser&quot;&gt;
- &lt;/browser&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The supplied factory class must implement the &lt;samp&gt;org.eclipse.help.browser.IBrowserFactory&lt;/samp&gt; interface.
-Methods in that interface determine whether the factory is available on the given system, i.e. is capable
-of supplying browser instances, and create browser instances that implement IBrowser interface.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The &lt;samp&gt;org.eclipse.help&lt;/samp&gt; and &lt;samp&gt;org.eclipse.help.ui&lt;/samp&gt; plug-ins contain implementation of browsers on common platforms.
-Other plug-ins can provide different implementations. In the preferences, the user can select the default
-browser from among available browsers.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2003 IBM Corporation and others.&lt;br&gt;
-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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.help/schema/luceneAnalyzer.exsd b/org.eclipse.help/schema/luceneAnalyzer.exsd
deleted file mode 100644
index aac71e677..000000000
--- a/org.eclipse.help/schema/luceneAnalyzer.exsd
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help" id="luceneAnalyzer" name="Lucene Analyzer"/>
- </appInfo>
- <documentation>
- This extension point is used to register text analyzers for use by help when indexing and searching documentation.
-&lt;p&gt;
-Help exploits capabilities of the Lucene search engine, that allows indexing of token streams (streams of words).
-Analyzers create tokens from the character stream. They examine text content and provide tokens for use with the index.
-The text stream can be tokenized in many unique ways. A trivial analyzer can tokenize streams at white space,
-a different one can perform filtering of tokens, based on the application needs.
-Since the documentation is mostly human-readable text, it is desired that analyzers used by the help system
-perform language and grammar aware tokenization and normalization of indexed text.
-For some languages, the quality of search increases significantly if stop word removal and stemming is performed
-on the indexed text.
-&lt;p&gt;
-The analyzer contributed to this extension point will override the one provided by the Eclipse help system for a given locale.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="analyzer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="analyzer">
- <complexType>
- <attribute name="locale" type="string" use="required">
- <annotation>
- <documentation>
- a string identifying locale for which the supplied analyzer is
-to bue sued.
-If two letters, language is provided, and the analyzer will be
-available to all locales of that language.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified name of the Java class extending &lt;samp&gt;org.apache.lucene.analysis.Analyzer&lt;/samp&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.apache.lucene.analysis.Analyzer"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Following is an example of Lucene Analyzer configuration:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension id=&quot;com.xyx.XYZ&quot; point=&quot;org.eclipse.help.luceneAnalyzer&quot;&gt;
- &lt;analyzer locale=&quot;ll_CC&quot; class=&quot;com.xyz.ll_CCAnalyzer&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The value of the &lt;samp&gt;locale&lt;/samp&gt; attribute must represent either a five- or two-charcter locale string.
-If the analyzer is configured for a language by specifying two-letter language designation, the analyzer is
-going to be used for all locales of this language. If the analyzer is configured that matchs a five-character
-locale, it is going to be used instead.
-&lt;p&gt;
-The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must represent a class that extends &lt;samp&gt;org.apache.lucene.analysis.Analyzer&lt;/samp&gt;.
-It is recommended that this analyzer performs lowercase filtering for languages where it is possible to increase
-number of search hits by making search case-sensitive.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Eclipse help system provides analyzers for all languages. For English and German, the analyzers perform stop word filtering, lowercase filtering, and stemming. For all the other languages the supplied analyzer only performs lowercase filtering.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2003 IBM Corporation and others.&lt;br&gt;
-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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.help/schema/support.exsd b/org.eclipse.help/schema/support.exsd
deleted file mode 100644
index da95233d3..000000000
--- a/org.eclipse.help/schema/support.exsd
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help" id="support" name="Support"/>
- </appInfo>
- <documentation>
- Support for configuring a help system UI. The platform should be configured with no more than one help system UI.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="config" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="config">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the implementation class for displaying online and context-sensitive
-help. This class must implement the &lt;samp&gt;org.eclipse.help.IHelp&lt;/samp&gt;
-interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.IHelp"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is a sample usage of the support extension point:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.help.support&quot;&gt;
- &lt;config class=&quot;com.example.XYZHelpUI&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The supplied class must implement the &lt;samp&gt;org.eclipse.help.IHelp&lt;/samp&gt; interface. Methods in that interface
-determine what happens when a user asks for online help or context-sensitive help.
-The implementation should access the help information contributed via the &lt;samp&gt;org.eclipse.help.contexts&lt;/samp&gt; and
-&lt;samp&gt;org.eclipse.help.toc&lt;/samp&gt; extension points.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The &lt;samp&gt;org.eclipse.help.ui&lt;/samp&gt; plug-in contains an implementation of the help system UI.
-Although this plug-in is supplied with the Eclipse platform, it is entirely optional and can be safely
-omitted from the platform configuration.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2003 IBM Corporation and others.&lt;br&gt;
-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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.help/schema/webapp.exsd b/org.eclipse.help/schema/webapp.exsd
deleted file mode 100644
index d59a4dfdb..000000000
--- a/org.eclipse.help/schema/webapp.exsd
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help" id="webapp" name="webapp"/>
- </appInfo>
- <documentation>
- Internal extension point for registering the name of the help web application plugin.
-&lt;p&gt; It is assumed that the web application root is the plugin directory &lt;/p&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="webapp"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="webapp">
- <complexType>
- <attribute name="default" type="boolean" use="default" value="false">
- <annotation>
- <documentation>
- When set to true, this is the default help web application plugin. Normally, only the platform contributed default implementation should set this attribute to true.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 2.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is a sample usage of the webapp extension point:
-&lt;p&gt;
-&lt;samp&gt;
-&amp;lt;extension point=&quot;org.eclipse.help.webapp&quot;&amp;gt;
-&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;webapp default=&quot;true&quot; /&amp;gt;
-&lt;br&gt; &amp;lt;/extension&amp;gt;
-&lt;/samp&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- There is no API to implement. The plugin must be structured as a standard web application.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The Eclipse Platform provides the default implementation in the org.eclipse.help.webapp plugin.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2003 IBM Corporation and others.&lt;br&gt;
-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 &lt;a href=&quot;http://www.eclipse.org/legal/cpl-v10.html&quot;&gt;http://www.eclipse.org/legal/cpl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.help/src/help.properties b/org.eclipse.help/src/help.properties
deleted file mode 100644
index aff3d6522..000000000
--- a/org.eclipse.help/src/help.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 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
-###############################################################################
-# ====================================
-# Eclipse Help System Properties File
-# ====================================
-
-Error = Error
-File4 = File {0} cannot be read.
-File = File
-Exception_occured = Exception occurred while saving table {0} to file {1}.
-Plugin = Plugin
-# search
-Search_cancelled = Search cancelled
-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.
-TocFileParser.PCE = SAXParser implementation could not be loaded.
-ContextsFileParser.PCE = SAXParser implementation could not be loaded.
-WorkingSetManager.PCE = DocumentBuilder implementation could not be loaded.
-WorkingSetManager.transformer = Problems occurred while saving working sets.
-
-
-# Error Messages
-# --------------
-E001 = Error parsing URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
-E002 = Failed to parse URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
-E003 = Warning parsing URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
-E005 = Error in launching help.
-E006 = The following errors occurred:\n
-E007 = The following contribution files were ignored because of errors:\n
-E008 = Parser Errors:\n
-E009 = Error loading file {0}.
-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}
-E024 = Error parsing Table of Contents file, URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
-E025 = Failed to parse Table of Contents file, URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
-E026 = Error loading Table of Contents file {0}.
-E033 = Error occurred processing file {0}.
-E034 = Core exception occurred, trying to create URL to file {0}.
-E035 = Core exception occurred, trying to create URL to directory {0}.
-E036 = IOException occurred, when resolving URL {0}.
-E037 = IOException occurred, when accessing Zip file {0}. File might not be locally available.
-E038 = IOException occurred, when resolving URL {0}.
-E039 = Problems occurred reading plug-in preferences.
-E040 = Problems occurred while saving working set file.
-E041 = Problems occurred while restoring working set state.
-E042 = Help web application failed to run.
-E042 = Standalone 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.
-E044 = Exception occurred creating help content producer for plug-in{0}.
-
-
-# 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.
-
-# Warning Messages
-# ----------------
-WW001 = Documentation is not installed. \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/HelpSystem.java b/org.eclipse.help/src/org/eclipse/help/HelpSystem.java
new file mode 100644
index 000000000..b45a590c8
--- /dev/null
+++ b/org.eclipse.help/src/org/eclipse/help/HelpSystem.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2003 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
+ *******************************************************************************/
+package org.eclipse.help;
+
+import java.io.*;
+import java.net.*;
+
+import org.eclipse.core.boot.*;
+import org.eclipse.help.internal.*;
+
+/**
+ * This class provides general access to help content contributed to the
+ * <code>"org.eclipse.help.toc"</code> and
+ * <code>"org.eclipse.help.contexts"</code> extension points.
+ * <p>
+ * This class provides static methods only; it is not intended to be instantiated
+ * or subclassed.
+ * </p>
+ *
+ * @since 3.0
+ */
+public final class HelpSystem {
+
+ /**
+ * This class is not intended to be instantiated.
+ */
+ private HelpSystem() {
+ // do nothing
+ }
+
+ /**
+ * Computes and returns context information for the given context id.
+ *
+ * @param contextId the context id
+ * @return the context, or <code>null</code> if none
+ */
+ public static IContext getContext(String contextId) {
+ return HelpPlugin.getContextManager().getContext(contextId);
+ }
+
+ /**
+ * Returns the list of all integrated tables of contents available.
+ * Each entry corresponds of a different help "book".
+ *
+ * @return an array of TOC's
+ */
+ public static IToc[] getTocs() {
+ return HelpPlugin.getTocManager().getTocs(BootLoader.getNL());
+ }
+
+ /**
+ * Returns an open input stream on the contents of the specified help
+ * resource. The client is responsible for closing the stream when finished.
+ *
+ * @param href the URL (as a string) of the help resource
+ * <p>Valid href are as described in
+ * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref}
+ * </p>
+ * @return an input stream containing the contents of the help resource,
+ * or <code>null</code> if the help resource could not be found and opened
+ */
+ public static InputStream getHelpContent(String href) {
+ try {
+ URL helpURL = new URL("help:" + href);
+ return helpURL.openStream();
+ } catch (IOException ioe) {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.help/src/org/eclipse/help/IHelp.java b/org.eclipse.help/src/org/eclipse/help/IHelp.java
index 7a53ec7cb..19c12347d 100644
--- a/org.eclipse.help/src/org/eclipse/help/IHelp.java
+++ b/org.eclipse.help/src/org/eclipse/help/IHelp.java
@@ -10,23 +10,15 @@
*******************************************************************************/
package org.eclipse.help;
/**
- * Interface to the help system UI.
- * <p>
- * The Eclipse platform defines an extension point
- * (<code>"org.eclipse.help.support"</code>) for plugging in a help system UI.
- * The help system UI is entirely optional.
- * Clients may provide a UI for presenting help to the user by implementing this
- * interface and including the name of their class in the
- * <code>&lt;config&gt;</code> element in an extension to the platform's help
- * support extension point (<code>"org.eclipse.help.support"</code>).
- * </p>
- * <p>
- * Note that an implementation of the help system UI is provided by the
- * <code>"org.eclipse.help.ui"</code> plug-in (This plug-in is not
- * mandatory, and can be removed). Since the platform can only make use of a
- * single help system UI implementation, make sure that the platform is not
- * configured with more than one plug-in trying to extend this extension point.
- * </p>
+ * Former interface to the help system UI.
+ *
+ * @deprecated This interface became obsolete in 3.0, along with the extension
+ * point that it was associated with. The functionality provided by this
+ * interface is available elsewhere.
+ * Use {@link org.eclipse.help.HelpSystem#getTocs HelpSystem.getTocs()}
+ * and {@link org.eclipse.help.HelpSystem#getContext HelpSystem.getContext(String)}
+ * to obtain help resources. Use various display methods of
+ * {@link org.eclipse.ui.help.WorkbenchHelp WorkbenchHelp} to display help resources.
*/
public interface IHelp {
@@ -36,6 +28,7 @@ public interface IHelp {
* This method is called by the platform to launch the help system UI
* </p>
* @since 2.0
+ * @deprecated Use WorkbenchHelp.displayHelp() instead.
*/
public void displayHelp();
@@ -54,6 +47,7 @@ public interface IHelp {
* @param x horizontal position
* @param y verifical position
* @since 2.0
+ * @deprecated Use WorkbenchHelp.displayContext(context,x,y) instead.
*/
public void displayContext(IContext context, int x, int y);
@@ -75,6 +69,7 @@ public interface IHelp {
* @param y verifical position
* @see #getContext(String)
* @since 2.0
+ * @deprecated Use WorkbenchHelp.displayContext(HelpSystem.getContext(contextId),x,y) instead.
*/
public void displayContext(String contextId, int x, int y);
@@ -92,6 +87,7 @@ public interface IHelp {
* {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
* </p>
* @since 2.0
+ * @deprecated Use WorkbenchHelp.displayHelpResource(href) instead.
*/
public void displayHelpResource(String href);
@@ -106,10 +102,10 @@ public interface IHelp {
* @see IHelp#displayHelpResource(String)
* @param helpResource the help resource to display.
* @since 2.0
+ * @deprecated Use WorkbenchHelp.displayHelpResource(helpResource.getHref()) instead.
*/
public void displayHelpResource(IHelpResource helpResource);
-
/**
* Displays help content for the toc with the given URL.
* <p>
@@ -125,7 +121,7 @@ public interface IHelp {
* @param toc the URL of the toc as specified in
* the <code>"org.eclipse.help.toc"</code> extenstion
* point
- * @deprecated use displayHelpResource(toc) instead
+ * @deprecated Use WorkbenchHelp.displayHelpResource(toc) instead.
*/
public void displayHelp(String toc);
@@ -148,11 +144,10 @@ public interface IHelp {
* @param toc the URL of the toc
* @param selectedTopic the help topic url.
* @see #displayHelp(java.lang.String)
- * @deprecated use displayHelpResource(selectedTopic).
+ * @deprecated Use WorkbenchHelp.displayHelpResource(selectedTopic) instead.
*/
public void displayHelp(String toc, String selectedTopic);
-
/**
* Displays context-sensitive help for context with the given context id.
* <p>
@@ -167,7 +162,7 @@ public interface IHelp {
* @param x horizontal position
* @param y verifical position
* @see #getContext(String)
- * @deprecated use displayContext(contextId, x, y)
+ * @deprecated Use WorkbenchHelp.displayContext(HelpSystem.getContext(contextId),x,y) instead.
*/
public void displayHelp(String contextId, int x, int y);
@@ -185,7 +180,7 @@ public interface IHelp {
* @param context the context to display
* @param x horizontal position
* @param y verifical position
- * @deprecated use displayContext(context, x, y)
+ * @deprecated Use WorkbenchHelp.displayContext(context,x,y) instead.
*/
public void displayHelp(IContext context, int x, int y);
@@ -194,6 +189,7 @@ public interface IHelp {
*
* @param contextId the context id
* @return the context, or <code>null</code> if none
+ * @deprecated Use HelpSystem.getContext(contextId) instead.
*/
public IContext getContext(String contextId);
@@ -201,11 +197,15 @@ public interface IHelp {
* Returns the list of all integrated tables of contents available.
* @return an array of TOC's
* @since 2.0
+ * @deprecated Use HelpSystem.getTocs() instead.
*/
public IToc[] getTocs();
+
/**
* Returns <code>true</code> if the context-sensitive help
* window is currently being displayed, <code>false</code> if not.
+ *
+ * @deprecated Use WorkbenchHelp.isContextHelpDisplayed() instead.
*/
public boolean isContextHelpDisplayed();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java b/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java
index 227fd6de1..486c0c09e 100644
--- a/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java
+++ b/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java
@@ -12,7 +12,7 @@ package org.eclipse.help;
/**
* Live Help Extension. Classes that implement this interface
* can be used as live help extensions.
- * When user clicks live help link on the help document,
+ * When user clicks a live help link in a help document,
* the class will be loaded and run.
* @since 2.0
*/
diff --git a/org.eclipse.help/src/org/eclipse/help/browser/IBrowser.java b/org.eclipse.help/src/org/eclipse/help/browser/IBrowser.java
deleted file mode 100644
index f99fdfd68..000000000
--- a/org.eclipse.help/src/org/eclipse/help/browser/IBrowser.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.browser;
-/**
- * Represents a web browser that can be used
- * by clients to display documents for the given URLs.
- * @since 2.1
- */
-public interface IBrowser {
- /**
- * Closes the browser.
- */
- public void close();
- /**
- * Queries the browser if close
- * method is supported.
- * @return true if the method is fully implemented
- */
- public boolean isCloseSupported();
- /**
- * Displays document with the given URL,
- * and makes the browser visible.
- * This method starts the browser if necessary.
- * @param url the URL to display in the browser
- */
- public void displayURL(String url) throws Exception;
- /**
- * Queries the browser if setLocation
- * method is supported.
- * @return true if the method is fully implemented
- */
- public boolean isSetLocationSupported();
- /**
- * Queries the browser if setSize
- * method is supported.
- * @return true if the method is fully implemented
- */
- public boolean isSetSizeSupported();
- /**
- * Causes browser to be moved to the specified
- * location. If the actual browser is not visible,
- * the next time it becomes visible, it will be shown
- * at the give location
- * @param x horizontal coordinates of the left-top
- * external corner
- * @param y vertical coordinates of the left-top
- * external corner
- */
- public void setLocation(int x, int y);
- /**
- * Causes browser to be resized to the specified
- * size. If the actual browser is not visible,
- * the next time it becomes visible, it will be shown
- * with the give size.
- * @param width width in pixels
- * @param height height in pixels
- * external corner
- */
- public void setSize(int width, int height);
-}
-
diff --git a/org.eclipse.help/src/org/eclipse/help/browser/IBrowserFactory.java b/org.eclipse.help/src/org/eclipse/help/browser/IBrowserFactory.java
deleted file mode 100644
index acd5ff2c1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/browser/IBrowserFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.browser;
-/**
- * Implementators of org.eclipse.help.browser
- * extension points must provide implementation of this
- * interface.
- * @since 2.1
- */
-public interface IBrowserFactory {
- /**
- * Checks whether the factory can work on the user system.
- * @return false if the factory cannot work on this system;
- * for example the required native browser required
- * by browser adapters that it creates is not installed.
- */
- public boolean isAvailable();
- /**
- * Obtains a new instance of a web browser.
- * @return instance of IBrowser
- */
- public IBrowser createBrowser();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/browser/package.html b/org.eclipse.help/src/org/eclipse/help/browser/package.html
deleted file mode 100644
index 656a98351..000000000
--- a/org.eclipse.help/src/org/eclipse/help/browser/package.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides interfaces that need to be implemented by
-web browser adapters.
-<h2>
-Package Specification</h2>
-Help System, requires web browser to display help document.&nbsp; Since
-availability of web browsers differ from system to system, it is possible
-to configure browser adapters in addition to ones provided by Help System.&nbsp; The browser (or browser adapter) can be configured by
-providing extension for <tt>org.eclipse.help.browser</tt> extension point.&nbsp;
-If more than one browser is available on a user system, the default browser
-can be designated in Help preference page.
-<p>In general terms, implementing a web browser involves:
-<ul>
-<li>
-Implementing standalone UI element having the <tt>IBrowser</tt> API, and
-capable of displaying HTML documents given a URL.</li>
-
-<li>
-Providing a factory for managing of browsers on a particular system, by
-implementing <tt>IBrowserFactory</tt> interface.</li>
-
-<li>
-Declaring an extension of the <tt>org.eclipse.help.browser</tt> extension
-point that mentions the name of that factory class.</li>
-</ul>
-Note that browser factory will be created on every system.&nbsp; If the
-factory is not capable of creating a browser on some system configurations,
-due to missing prerequisites e.t.c., its <tt>isAvailable()</tt> method
-should be returning false on these systems.
-
-</body>
-</html>
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/DefaultHelpSupport.java b/org.eclipse.help/src/org/eclipse/help/internal/DefaultHelpSupport.java
deleted file mode 100644
index 0d4c63827..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/DefaultHelpSupport.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal;
-import java.io.*;
-import java.net.*;
-
-import org.eclipse.core.boot.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.internal.context.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * This class is the default implementation of the pluggable help support.
- * In is registered into the support extension point, and all
- * requests to display help are delegated to this class.
- */
-public class DefaultHelpSupport implements IHelp {
-
- /**
- * BaseHelpViewer constructor.
- */
- public DefaultHelpSupport() {
- super();
- }
-
- /**
- * Displays help.
- */
- public void displayHelp() {
- // Do not start help view if documentaton is not available, display error
- if (getTocs().length == 0) {
- // There is no documentation
- HelpSystem.getDefaultErrorUtil().displayError(
- Resources.getString("WW001"));
- //Documentation is not installed.
- return;
- }
-
- displayHelpURL(null);
- }
-
- /**
- * Displays context-sensitive help for specified context
- * @param contexts the context to display
- * @param x int positioning information
- * @param y int positioning information
- */
- public void displayContext(IContext context, int x, int y) {
- // no implementation
- }
-
- /**
- * Displays context-sensitive help for specified context
- * @param contextIds context identifier
- * @param x int positioning information
- * @param y int positioning information
- */
- public void displayContext(String contextId, int x, int y) {
- IContext context = HelpSystem.getContextManager().getContext(contextId);
- displayContext(context, x, y);
- }
-
- /**
- * Displays a help resource
- */
- public void displayHelpResource(IHelpResource helpResource) {
- if (helpResource instanceof IToc) {
- try {
- displayHelpURL(
- "toc="
- + URLEncoder.encode(helpResource.getHref(), "UTF-8"));
- } catch (UnsupportedEncodingException uee) {
- }
- } else if (helpResource instanceof ITopic) {
- String topicURL = getTopicURL(helpResource.getHref());
- if (getNoframesURL(topicURL) != null) {
- displayHelpURL(getNoframesURL(topicURL));
- return;
- }
- try {
- displayHelpURL("topic=" + URLEncoder.encode(topicURL, "UTF-8"));
- } catch (UnsupportedEncodingException uee) {
- }
-
- } else
- displayHelpResource(helpResource.getHref());
- }
-
- /**
- * Displays a help resource specified as a url.
- * <ul>
- * <li>a URL in a format that can be returned by
- * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
- * <li>a URL query in the format format <em>key=value&amp;key=value ...</em>
- * The valid keys are: "tab", "toc", "topic", "contextId".
- * For example, <em>toc="/myplugin/mytoc.xml"&amp;topic="/myplugin/references/myclass.html"</em>
- * is valid.
- * </ul>
- */
- public void displayHelpResource(String href) {
- // check if this is a toc
- IToc toc = HelpSystem.getTocManager().getToc(href, BootLoader.getNL());
- if (toc != null)
- displayHelpResource(toc);
- else if (
- href != null
- && (href.startsWith("tab=")
- || href.startsWith("toc=")
- || href.startsWith("topic=")
- || href.startsWith(
- "contextId="))) { // assume it is a query string
- displayHelpURL(href);
- } else // assume this is a topic
- if (getNoframesURL(href) != null) {
- displayHelpURL(getNoframesURL(href));
- return;
- }
- try {
- displayHelpURL("topic=" + URLEncoder.encode(href, "UTF-8"));
- } catch (UnsupportedEncodingException uee) {
- }
-
- }
-
- /**
- * Displays the specified table of contents.
- */
- public void displayHelp(String tocFileHref) {
- displayHelp(tocFileHref, null);
- }
- /**
- * Display help and selected specified topic.
- */
- public void displayHelp(
- String toc,
- String topic) { // Do not start help view if documentaton is not available, display error
- if (getTocs().length == 0) {
- // There is no documentation
- HelpSystem.getDefaultErrorUtil().displayError(
- Resources.getString("WW001"));
- //Documentation is not installed.
- return;
- }
-
- String query = null;
- if (toc != null) {
- query = "toc=" + toc;
- if (topic != null)
- try {
- query =
- query
- + "&topic="
- + URLEncoder.encode(getTopicURL(topic), "UTF-8");
- } catch (UnsupportedEncodingException uee) {
- }
- } else {
- try {
- if (topic != null)
- query =
- "topic="
- + URLEncoder.encode(getTopicURL(topic), "UTF-8");
- } catch (UnsupportedEncodingException uee) {
- }
- }
-
- displayHelpURL(query);
- }
- /**
- * Displays context-sensitive help for specified context
- * @deprecated
- */
- public void displayHelp(String contextId, int x, int y) {
- displayContext(contextId, x, y);
- }
- /**
- * Displays context-sensitive help for specified context
- * @deprecated
- */
- public void displayHelp(IContext context, int x, int y) {
- displayContext(context, x, y);
- }
- /**
- * Display help for the a given topic and related topics.
- * @param topic topic to be displayed by the help browse
- * @param relatedTopics topics that will populate related topics view
- */
- public void displayHelp(IContext context, IHelpResource topic) {
- if (context == null || topic == null || topic.getHref() == null)
- return;
- String topicURL = getTopicURL(topic.getHref());
- if (getNoframesURL(topicURL) != null) {
- displayHelpURL(getNoframesURL(topicURL));
- return;
- }
- try {
- String url =
- "tab=links"
- + "&contextId="
- + URLEncoder.encode(getContextID(context), "UTF-8")
- + "&topic="
- + URLEncoder.encode(topicURL, "UTF-8");
- displayHelpURL(url);
- } catch (UnsupportedEncodingException uee) {
- }
- }
- /**
- * Display help to search view for given query
- * and selected topic.
- * @param query search query in URL format key=value&key=value
- * @param topic selected from the search results
- */
- public void displaySearch(String searchQuery, String topic) {
- if (searchQuery == null || topic == null)
- return;
- try {
- String url =
- "tab=search&"
- + searchQuery
- + "&topic="
- + URLEncoder.encode(getTopicURL(topic), "UTF-8");
- displayHelpURL(url);
- } catch (UnsupportedEncodingException uee) {
- }
- }
- /**
- * Displays the specified url.
- * The url can contain query parameters to identify how help displays the document
- */
- void displayHelpURL(String helpURL) {
- if (!HelpSystem.ensureWebappRunning()) {
- HelpSystem.getDefaultErrorUtil().displayError(
- Resources.getString("E043"));
- return;
- }
-
- try {
- if (helpURL == null || helpURL.length() == 0) {
- HelpSystem.getHelpBrowser().displayURL(getBaseURL());
- } else if (
- helpURL.startsWith("tab=")
- || helpURL.startsWith("toc=")
- || helpURL.startsWith("topic=")
- || helpURL.startsWith("contextId=")) {
- HelpSystem.getHelpBrowser().displayURL(
- getBaseURL() + "?" + helpURL);
- } else {
- HelpSystem.getHelpBrowser().displayURL(helpURL);
- }
- } catch (Exception e) {
- HelpSystem.getDefaultErrorUtil().displayError(e.getMessage());
- }
- }
- /**
- * Computes context information for a given context ID.
- * @param contextID java.lang.String ID of the context
- * @return IContext
- */
- public IContext getContext(String contextID) {
- //return HelpSystem.getContextManager().getContext(contextID);
- return new ContextProxy(contextID);
- }
- /**
- * Returns the list of all integrated tables of contents available.
- * @return an array of TOC's
- */
- public IToc[] getTocs() {
- return HelpSystem.getTocManager().getTocs(BootLoader.getNL());
- }
-
- /**
- * Returns <code>true</code> if the context-sensitive help
- * window is currently being displayed, <code>false</code> if not.
- */
- public boolean isContextHelpDisplayed() {
- return false;
- }
-
- private String getContextID(IContext context) {
- if (context instanceof Context)
- return ((Context) context).getID();
- if (context instanceof ContextProxy)
- return ((ContextProxy) context).getID();
- return HelpSystem.getContextManager().addContext(context);
- }
-
- private String getBaseURL() {
- return "http://"
- + WebappManager.getHost()
- + ":"
- + WebappManager.getPort()
- + "/help/index.jsp";
- }
-
- private String getTopicURL(String topic) {
- if (topic == null)
- return null;
- if (topic.startsWith("../"))
- topic = topic.substring(2);
- /*
- if (topic.startsWith("/")) {
- String base = "http://" + AppServer.getHost() + ":" + AppServer.getPort();
- base += "/help/content/help:";
- topic = base + topic;
- }
- */
- return topic;
- }
- /**
- * If href contains URL parameter noframes=true
- * return href with that paramter removed, otherwise returns null
- * @param href
- * @return String or null
- */
- private String getNoframesURL(String href) {
- if (href == null) {
- return null;
- }
- int ix = href.indexOf("?noframes=true&");
- if (ix >= 0) {
- //remove noframes=true&
- return href.substring(0, ix + 1)
- + href.substring(ix + "?noframes=true&".length());
-
- }
- ix = href.indexOf("noframes=true");
- if (ix > 0) {
- //remove &noframes=true
- return href.substring(0, ix - 1)
- + href.substring(ix + "noframes=true".length());
- }
- // can be displayed in frames
- return null;
-
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpApplication.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpApplication.java
deleted file mode 100644
index 60054ea27..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpApplication.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.*;
-
-import org.eclipse.core.boot.IPlatformRunnable;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.appserver.WebappManager;
-
-/**
- * Help application.
- * Starts webserver and help web application for use
- * by infocenter and stand-alone help.
- * Application takes a parameter "mode", that can take values:
- * "infocenter" - when help system should run as infocenter,
- * "standalone" - when help system should run as standalone.
- */
-public class HelpApplication
- implements IPlatformRunnable, IExecutableExtension {
- private static final String APPLICATION_LOCK_FILE = ".applicationlock";
- private static final int STATUS_EXITTING = 0;
- private static final int STATUS_RESTARTING = 2;
- private static final int STATUS_RUNNING = 1;
- private static int status = STATUS_RUNNING;
- private File metadata;
- private FileLock lock;
- /**
- * Causes help service to stop and exit
- */
- public static void stop() {
- status = STATUS_EXITTING;
- }
- /**
- * Causes help service to exit and start again
- */
- public static void restart() {
- if (status != STATUS_EXITTING) {
- status = STATUS_RESTARTING;
- }
- }
- /**
- * Runs help service application.
- */
- public Object run(Object args) throws Exception {
- if (status == STATUS_RESTARTING) {
- return EXIT_RESTART;
- }
-
- metadata = new File(Platform.getLocation().toFile(), ".metadata/");
- if (!HelpSystem.ensureWebappRunning()) {
- System.out.println(
- "Help web application could not start. Check log file for details.");
- return EXIT_OK;
- }
-
- if (status == STATUS_RESTARTING) {
- return EXIT_RESTART;
-
- }
- writeHostAndPort();
- obtainLock();
-
- // main program loop
- while (status == STATUS_RUNNING) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException ie) {
- break;
- }
- }
- releaseLock();
- if (status == STATUS_RESTARTING) {
- return EXIT_RESTART;
- } else {
- return EXIT_OK;
- }
- }
- /**
- * @see IExecutableExtension
- */
- public void setInitializationData(
- IConfigurationElement configElement,
- String propertyName,
- Object data) {
- String value = (String) ((Map) data).get("mode");
- if ("infocenter".equalsIgnoreCase(value)) {
- HelpSystem.setMode(HelpSystem.MODE_INFOCENTER);
- } else if ("standalone".equalsIgnoreCase(value)) {
- HelpSystem.setMode(HelpSystem.MODE_STANDALONE);
- }
- }
- private void writeHostAndPort() throws IOException {
- Properties p = new Properties();
- p.put("host", WebappManager.getHost());
- p.put("port", "" + WebappManager.getPort());
-
- File hostPortFile = new File(metadata, ".connection");
- hostPortFile.deleteOnExit();
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(hostPortFile);
- p.store(out, null);
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException ioe2) {
- }
- }
- }
-
- }
- private void obtainLock() {
- File lockFile = new File(metadata, APPLICATION_LOCK_FILE);
- try {
- RandomAccessFile raf = new RandomAccessFile(lockFile, "rw");
- lock = raf.getChannel().lock();
- } catch (IOException ioe) {
- lock = null;
- }
- }
- private void releaseLock() {
- if (lock != null) {
- try {
- lock.channel().close();
- } catch (IOException ioe) {
- }
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
index 31d936eeb..754332b65 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
@@ -10,23 +10,30 @@
*******************************************************************************/
package org.eclipse.help.internal;
import org.eclipse.core.runtime.*;
+import org.eclipse.help.internal.context.*;
+import org.eclipse.help.internal.toc.*;
/**
- * Simple plugin for help system.
+ * Help System Core plug-in
*/
public class HelpPlugin extends Plugin {
public final static String PLUGIN_ID = "org.eclipse.help";
// debug options
public static boolean DEBUG = false;
- public static boolean DEBUG_CONSOLELOG = false;
public static boolean DEBUG_CONTEXT = false;
public static boolean DEBUG_PROTOCOLS = false;
- public static boolean DEBUG_SEARCH = false;
-
protected static HelpPlugin plugin;
- /**
- * Logs an Error message with an exception. Note that the message should already
- * be localized to proper locale.
- * ie: Resources.getString() should already have been called
+
+ public final static String BASE_TOCS_KEY = "baseTOCS";
+
+ protected TocManager tocManager;
+ protected static Object tocManagerCreateLock = new Object();
+ protected ContextManager contextManager;
+
+ private IHelpRoleManager roleManager;
+ /**
+ * Logs an Error message with an exception. Note that the message should
+ * already be localized to proper locale. ie: Resources.getString() should
+ * already have been called
*/
public static synchronized void logError(String message, Throwable ex) {
if (message == null)
@@ -35,10 +42,10 @@ public class HelpPlugin extends Plugin {
new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex);
HelpPlugin.getDefault().getLog().log(errorStatus);
}
- /**
- * Logs a Warning message with an exception. Note that the message should already
- * be localized to proper local.
- * ie: Resources.getString() should already have been called
+ /**
+ * Logs a Warning message with an exception. Note that the message should
+ * already be localized to proper local. ie: Resources.getString() should
+ * already have been called
*/
public static synchronized void logWarning(String message) {
if (HelpPlugin.DEBUG) {
@@ -56,15 +63,14 @@ public class HelpPlugin extends Plugin {
}
/**
- * HelpViewerPlugin constructor. It is called as part of plugin
- * activation.
+ * Plugin constructor. It is called as part of plugin activation.
*/
public HelpPlugin(IPluginDescriptor descriptor) {
super(descriptor);
plugin = this;
}
/**
- * @return the singleton instance of the help plugin
+ * @return the singleton instance of the plugin
*/
public static HelpPlugin getDefault() {
return plugin;
@@ -72,93 +78,111 @@ public class HelpPlugin extends Plugin {
/**
* Shuts down this plug-in and discards all plug-in state.
* <p>
- * This method should be re-implemented in subclasses that need to do something
- * when the plug-in is shut down. Implementors should call the inherited method
- * to ensure that any system requirements can be met.
+ * This method should be re-implemented in subclasses that need to do
+ * something when the plug-in is shut down. Implementors should call the
+ * inherited method to ensure that any system requirements can be met.
* </p>
* <p>
* Plug-in shutdown code should be robust. In particular, this method
- * should always make an effort to shut down the plug-in. Furthermore,
- * the code should not assume that the plug-in was started successfully,
- * as this method will be invoked in the event of a failure during startup.
+ * should always make an effort to shut down the plug-in. Furthermore, the
+ * code should not assume that the plug-in was started successfully, as
+ * this method will be invoked in the event of a failure during startup.
* </p>
* <p>
* Note 1: If a plug-in has been started, this method will be automatically
* invoked by the platform when the platform is shut down.
* </p>
* <p>
- * Note 2: This method is intended to perform simple termination
- * of the plug-in environment. The platform may terminate invocations
- * that do not complete in a timely fashion.
+ * Note 2: This method is intended to perform simple termination of the
+ * plug-in environment. The platform may terminate invocations that do not
+ * complete in a timely fashion.
* </p>
* <b>Cliens must never explicitly call this method.</b>
- *
- * @exception CoreException if this method fails to shut down
- * this plug-in
+ *
+ * @exception CoreException
+ * if this method fails to shut down this plug-in
*/
public void shutdown() throws CoreException {
- HelpSystem.shutdown();
}
/**
* Starts up this plug-in.
* <p>
* This method should be overridden in subclasses that need to do something
- * when this plug-in is started. Implementors should call the inherited method
- * to ensure that any system requirements can be met.
+ * when this plug-in is started. Implementors should call the inherited
+ * method to ensure that any system requirements can be met.
* </p>
* <p>
* If this method throws an exception, it is taken as an indication that
- * plug-in initialization has failed; as a result, the plug-in will not
- * be activated; moreover, the plug-in will be marked as disabled and
+ * plug-in initialization has failed; as a result, the plug-in will not be
+ * activated; moreover, the plug-in will be marked as disabled and
* ineligible for activation for the duration.
* </p>
* <p>
- * Plug-in startup code should be robust. In the event of a startup failure,
- * the plug-in's <code>shutdown</code> method will be invoked automatically,
- * in an attempt to close open files, etc.
+ * Plug-in startup code should be robust. In the event of a startup
+ * failure, the plug-in's <code>shutdown</code> method will be invoked
+ * automatically, in an attempt to close open files, etc.
* </p>
* <p>
- * Note 1: This method is automatically invoked by the platform
- * the first time any code in the plug-in is executed.
+ * Note 1: This method is automatically invoked by the platform the first
+ * time any code in the plug-in is executed.
* </p>
* <p>
- * Note 2: This method is intended to perform simple initialization
- * of the plug-in environment. The platform may terminate initializers
- * that do not complete in a timely fashion.
+ * Note 2: This method is intended to perform simple initialization of the
+ * plug-in environment. The platform may terminate initializers that do not
+ * complete in a timely fashion.
* </p>
* <b>Cliens must never explicitly call this method.</b>
- *
- * @exception CoreException if this plug-in did not start up properly
+ *
+ * @exception CoreException
+ * if this plug-in did not start up properly
*/
public void startup() throws CoreException {
// Setup debugging options
DEBUG = isDebugging();
if (DEBUG) {
- DEBUG_CONSOLELOG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help/debug/consolelog")); //$NON-NLS-1$
- DEBUG_CONTEXT = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help/debug/context")); //$NON-NLS-1$
- DEBUG_PROTOCOLS = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help/debug/protocols")); //$NON-NLS-1$
- DEBUG_SEARCH = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.help/debug/search")); //$NON-NLS-1$
+ DEBUG_CONTEXT = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/context")); //$NON-NLS-1$
+ DEBUG_PROTOCOLS = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/protocols")); //$NON-NLS-1$
}
-
- HelpSystem.startup();
}
-
/**
- * Initializes the default preferences settings for this plug-in.
- *
- * @since 2.0
- */
- protected void initializeDefaultPluginPreferences() {
- Preferences prefs = getPluginPreferences();
+ * Used to obtain Toc Naviagiont Manager
+ *
+ * @return instance of TocManager
+ */
+ public static TocManager getTocManager() {
+ if (getDefault().tocManager == null) {
+ synchronized (tocManagerCreateLock) {
+ if (getDefault().tocManager == null) {
+ getDefault().tocManager = new TocManager();
+ }
+ }
+ }
+ return getDefault().tocManager;
+ }
+ /**
+ * Used to obtain Context Manager returns an instance of ContextManager
+ */
+ public static ContextManager getContextManager() {
+ if (getDefault().contextManager == null)
+ getDefault().contextManager = new ContextManager();
+ return getDefault().contextManager;
+ }
- String os = System.getProperty("os.name").toLowerCase();
- boolean isWindows = os.indexOf("windows") != -1;
+ /**
+ * Used to obtain Role Manager
+ *
+ * @return instance of IHelpRoleManager
+ */
+ public static IHelpRoleManager getRoleManager() {
+ return getDefault().roleManager;
+ }
- if (isWindows)
- prefs.setDefault(
- "custom_browser_path",
- "\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\" %1");
- else
- prefs.setDefault("custom_browser_path", "mozilla %1");
+ /**
+ * Sets the role manager
+ *
+ * @param roleManager
+ */
+ public static void setRoleManager(IHelpRoleManager roleManager) {
+ getDefault().roleManager = roleManager;
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java
new file mode 100644
index 000000000..20ea3f4b9
--- /dev/null
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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
+ *******************************************************************************/
+package org.eclipse.help.internal;
+
+import java.text.*;
+import java.util.*;
+
+import org.eclipse.core.boot.*;
+
+/**
+ * Uses a resource bundle to load images and strings from
+ * a property file.
+ */
+public class HelpResources {
+ private static ResourceBundle resBundle;
+ static {
+ resBundle = ResourceBundle.getBundle(HelpResources.class.getName());
+ }
+ /**
+ * Resources constructor.
+ */
+ public HelpResources() {
+ super();
+ }
+ /**
+ * Returns a string from a property file
+ */
+ public static String getString(String name) {
+ try {
+ return resBundle.getString(name);
+ } catch (Exception e) {
+ return name;
+ }
+
+ }
+ /**
+ * Returns a string from a property file
+ */
+ public static String getString(String name, String replace0) {
+ try {
+ String stringFromPropertiesFile = resBundle.getString(name);
+ stringFromPropertiesFile =
+ MessageFormat.format(
+ stringFromPropertiesFile,
+ new Object[] { replace0 });
+ return stringFromPropertiesFile;
+ } catch (Exception e) {
+ return name;
+ }
+
+ }
+ private static Locale getDefaultLocale() {
+ String nl = BootLoader.getNL();
+ // sanity test
+ if (nl == null)
+ return Locale.getDefault();
+
+ // break the string into tokens to get the Locale object
+ StringTokenizer locales = new StringTokenizer(nl, "_");
+ if (locales.countTokens() == 1)
+ return new Locale(locales.nextToken(), "");
+ else if (locales.countTokens() == 2)
+ return new Locale(locales.nextToken(), locales.nextToken());
+ else if (locales.countTokens() == 3)
+ return new Locale(
+ locales.nextToken(),
+ locales.nextToken(),
+ locales.nextToken());
+ else
+ return Locale.getDefault();
+ }
+}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties b/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties
new file mode 100644
index 000000000..665d1157a
--- /dev/null
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties
@@ -0,0 +1,37 @@
+###############################################################################
+# Copyright (c) 2000, 2003 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
+###############################################################################
+# ====================================
+# Eclipse Help System Properties File
+# ====================================
+
+
+# Error Messages
+# --------------
+E001 = Error parsing URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
+E002 = Failed to parse URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
+E003 = Warning parsing URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
+E006 = The following errors occurred:\n
+E007 = The following contribution files were ignored because of errors:\n
+E008 = Parser Errors:\n
+E009 = Error loading file {0}.
+E024 = Error parsing Table of Contents file, URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
+E025 = Failed to parse Table of Contents file, URL: {0} at line: {1,number,integer}, column: {2,number,integer}.\n{3}
+E026 = Error loading Table of Contents file {0}.
+E033 = Error occurred processing file {0}.
+E034 = Core exception occurred, trying to create URL to file {0}.
+E035 = Core exception occurred, trying to create URL to directory {0}.
+E036 = IOException occurred, when resolving URL {0}.
+E037 = IOException occurred, when accessing Zip file {0}. File might not be locally available.
+E038 = IOException occurred, when resolving URL {0}.
+E039 = Problems occurred reading plug-in preferences.
+E044 = Exception occurred creating help content producer for plug-in{0}.
+TocFileParser.PCE = SAXParser implementation could not be loaded.
+ContextsFileParser.PCE = SAXParser implementation could not be loaded.
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpSystem.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpSystem.java
deleted file mode 100644
index f766dcf9c..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpSystem.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal;
-import java.util.*;
-
-import org.eclipse.core.boot.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.internal.browser.*;
-import org.eclipse.help.internal.context.*;
-import org.eclipse.help.internal.search.*;
-import org.eclipse.help.internal.toc.*;
-import org.eclipse.help.internal.util.*;
-import org.eclipse.help.internal.workingset.*;
-
-/**
- * The actual implementation of the help system plugin.
- */
-public final class HelpSystem {
- protected static final HelpSystem instance = new HelpSystem();
-
- private final static String WEBAPP_EXTENSION_ID = "org.eclipse.help.webapp";
- private static final String WEBAPP_DEFAULT_ATTRIBUTE = "default";
-
- private static final String HELP_SUPPORT_EXTENSION_ID =
- "org.eclipse.help.support";
- private static final String HELP_SUPPORT_CLASS_ATTRIBUTE = "class";
-
- public final static String BASE_TOCS_KEY = "baseTOCS";
- public final static String BOOKMARKS = "bookmarks";
- public final static String WORKING_SETS = "workingSets";
- public final static String WORKING_SET = "workingSet";
- public final static int MODE_WORKBENCH = 0;
- public final static int MODE_INFOCENTER = 1;
- public final static int MODE_STANDALONE = 2;
-
- protected TocManager tocManager;
- protected ContextManager contextManager;
- protected SearchManager searchManager;
- protected HashMap workingSetManagers;
- private int mode = MODE_WORKBENCH;
- private boolean webappStarted = false;
- private IErrorUtil defaultErrorMessenger;
- private IBrowser browser;
- private IHelp helpSupport = null;
- private boolean webappRunning = false;
-
- private IHelpRoleManager roleManager;
-
- /**
- * HelpSystem constructor comment.
- */
- private HelpSystem() {
- super();
- }
- /**
- * Used to obtain Context Manager
- * returns an instance of ContextManager
- */
- public static ContextManager getContextManager() {
- if (getInstance().contextManager == null)
- getInstance().contextManager = new ContextManager();
- return getInstance().contextManager;
- }
-
- public static HelpSystem getInstance() {
- return instance;
- }
- /**
- * Used to obtain Toc Naviagiont Manager
- * @return instance of TocManager
- */
- public static TocManager getTocManager() {
- if (getInstance().tocManager == null) {
- synchronized (HelpSystem.class) {
- if (getInstance().tocManager == null) {
- getInstance().tocManager = new TocManager();
- }
- }
- }
- return getInstance().tocManager;
- }
- /**
- * Used to obtain Search Manager
- * @return instance of SearchManager
- */
- public static SearchManager getSearchManager() {
- if (getInstance().searchManager == null) {
- synchronized (HelpSystem.class) {
- if (getInstance().searchManager == null) {
- getInstance().searchManager = new SearchManager();
- }
- }
- }
- return getInstance().searchManager;
- }
- /**
- * Used to obtain Working Set Manager
- * @return instance of WorkingSetManager
- */
- public static WorkingSetManager getWorkingSetManager() {
- return getWorkingSetManager(BootLoader.getNL());
- }
-
- public static synchronized WorkingSetManager getWorkingSetManager(String locale) {
- if (getInstance().workingSetManagers == null) {
- getInstance().workingSetManagers = new HashMap();
- }
- WorkingSetManager wsmgr =
- (WorkingSetManager) getInstance().workingSetManagers.get(locale);
- if (wsmgr == null) {
- wsmgr = new WorkingSetManager(locale);
- getInstance().workingSetManagers.put(locale, wsmgr);
- }
- return wsmgr;
- }
-
- public static synchronized IBrowser getHelpBrowser() {
- if (getInstance().browser == null)
- getInstance().browser =
- BrowserManager.getInstance().createBrowser();
- return getInstance().browser;
- }
-
- public static synchronized IHelp getHelpSupport() {
- if (getInstance().helpSupport == null)
- getInstance().helpSupport = getInstance().initHelpSupport();
- return getInstance().helpSupport;
- }
- /**
- */
- public HelpSystem newInstance() {
- return null;
- }
-
- /**
- * Shuts down the Help System.
- * @exception CoreException if this method fails to shut down
- * this plug-in
- */
- public static void shutdown() throws CoreException {
- if (HelpPlugin.DEBUG) {
- System.out.println("Help System is shutting down.");
- }
- if (getInstance().searchManager != null) {
- getInstance().searchManager.close();
- }
- // stop the web apps
- WebappManager.stop("help");
- if (getMode() != MODE_WORKBENCH)
- WebappManager.stop("helpControl");
-
- // close any browsers created
- BrowserManager.getInstance().closeAll();
-
- if (HelpPlugin.DEBUG) {
- System.out.println("Help System is shut down.");
- }
- }
- /**
- * Called by Platform after loading the plugin
- */
- public static void startup() {
- try {
- setDefaultErrorUtil(new IErrorUtil() {
- public void displayError(String msg) {
- System.out.println(msg);
- }
-
- public void displayError(String msg, Thread uiThread) {
- System.out.println(msg);
- }
-
- });
- HelpPlugin.getDefault().getPluginPreferences();
- } catch (Exception e) {
- HelpPlugin.getDefault().getLog().log(
- new Status(
- Status.ERROR,
- HelpPlugin
- .getDefault()
- .getDescriptor()
- .getUniqueIdentifier(),
- 0,
- Resources.getString("E005"),
- e));
- }
- if (HelpPlugin.DEBUG) {
- System.out.println("Help System started.");
- }
- }
- public static boolean ensureWebappRunning() {
- if (!getInstance().webappStarted) {
- getInstance().webappStarted = true;
-
- String webappPlugin = getWebappPlugin();
-
- if (getMode() != MODE_WORKBENCH) {
- // start the help control web app
- try {
- WebappManager.start(
- "helpControl",
- webappPlugin,
- Path.EMPTY);
- } catch (CoreException e) {
- HelpPlugin.logError(Resources.getString("E043"), e);
- return false;
- }
- }
- // start the help web app
- try {
- WebappManager.start("help", webappPlugin, Path.EMPTY);
- } catch (CoreException e) {
- HelpPlugin.logError(Resources.getString("E042"), e);
- return false;
- }
- getInstance().webappRunning = true;
-
- }
- return getInstance().webappRunning;
- }
-
- /**
- * Returns the mode.
- * @return int
- */
- public static int getMode() {
- return getInstance().mode;
- }
-
- /**
- * Sets the mode.
- * @param mode The mode to set
- */
- public static void setMode(int mode) {
- getInstance().mode = mode;
- }
-
- /**
- * Sets the error messenger
- */
- public static void setDefaultErrorUtil(IErrorUtil em) {
- getInstance().defaultErrorMessenger = em;
- }
-
- /**
- * Returns the default error messenger. When no UI is present, all
- * errors are sent to System.out.
- * @return IErrorMessenger
- */
- public static IErrorUtil getDefaultErrorUtil() {
- return getInstance().defaultErrorMessenger;
- }
-
- /**
- * Returns the plugin id that defines the help webapp
- */
- private static String getWebappPlugin() {
-
- // get the webapp extension from the system plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- IExtensionPoint point =
- pluginRegistry.getExtensionPoint(WEBAPP_EXTENSION_ID);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- if (extensions.length != 0) {
- // We need to pick up the non-default configuration
- IConfigurationElement[] elements =
- extensions[0].getConfigurationElements();
-
- for (int i = 0; i < elements.length; i++) {
- String defaultValue =
- elements[i].getAttribute(WEBAPP_DEFAULT_ATTRIBUTE);
- if (defaultValue == null || defaultValue.equals("false")) {
- return elements[i]
- .getDeclaringExtension()
- .getDeclaringPluginDescriptor()
- .getUniqueIdentifier();
- }
- }
- // if reached this point, then then pick the first (default) webapp
- if (elements.length > 0)
- return elements[0]
- .getDeclaringExtension()
- .getDeclaringPluginDescriptor()
- .getUniqueIdentifier();
- }
- }
-
- // if all fails
- return "org.eclipse.help.webapp";
- }
-
- /**
- * Instantiate the help support
- */
- private IHelp initHelpSupport() {
- if (helpSupport == null) {
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- IExtensionPoint point =
- pluginRegistry.getExtensionPoint(HELP_SUPPORT_EXTENSION_ID);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- if (extensions.length != 0) {
- // There should only be one extension/config element so we just take the first
- IConfigurationElement[] elements =
- extensions[0].getConfigurationElements();
- if (elements.length != 0) { // Instantiate the help support
- try {
- helpSupport =
- (IHelp) elements[0].createExecutableExtension(
- HELP_SUPPORT_CLASS_ATTRIBUTE);
- } catch (CoreException e) {
- // may need to change this
- HelpPlugin.getDefault().getLog().log(e.getStatus());
- }
- }
- }
- }
- }
-
- // if no extension point found or instantiated, use default impl
- if (helpSupport == null)
- helpSupport = new DefaultHelpSupport();
-
- return helpSupport;
- }
- /**
- * Obtains Name of the Eclipse product
- * @return String
- */
- public static String getProductName() {
- IPlatformConfiguration c = BootLoader.getCurrentPlatformConfiguration();
- String primaryFeatureId = c.getPrimaryFeatureIdentifier();
- IPluginDescriptor pfd =
- Platform.getPluginRegistry().getPluginDescriptor(primaryFeatureId);
- if (pfd == null)
- return ""; // no primary feature installed
- return pfd.getLabel();
- }
-
- /**
- * Used to obtain Role Manager
- * @return instance of IHelpRoleManager
- * EXPERIMENTAL
- */
- public static IHelpRoleManager getRoleManager() {
- return getInstance().roleManager;
- }
-
- /**
- * Sets the role manager
- * @param roleManager
- * EXPERIMENTAL
- */
- public static void setRoleManager(IHelpRoleManager roleManager) {
- getInstance().roleManager = roleManager;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/IHelpRoleManager.java b/org.eclipse.help/src/org/eclipse/help/internal/IHelpRoleManager.java
index d1fdbb58e..3843c471e 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/IHelpRoleManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/IHelpRoleManager.java
@@ -12,20 +12,21 @@
package org.eclipse.help.internal;
/**
- *
* @since 3.0
*/
public interface IHelpRoleManager {
/**
* Checks if href is valid in the actives roles
+ *
* @param href
* @return
*/
public boolean isEnabled(String href);
-
+
/**
* Enables all the roles whose activity binding pattersn match the href
+ *
* @param href
*/
public void enabledActivities(String href);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/IndexToolApplication.java b/org.eclipse.help/src/org/eclipse/help/internal/IndexToolApplication.java
deleted file mode 100644
index a239a2a80..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/IndexToolApplication.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.eclipse.core.boot.*;
-import org.eclipse.core.runtime.*;
-
-/**
- * application org.eclipse.help.indexTool
- */
-public class IndexToolApplication
- implements IPlatformRunnable, IExecutableExtension {
-
- /**
- * Constructor for IndexToolApplication.
- */
- public IndexToolApplication() {
- super();
- }
-
- /**
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- public void setInitializationData(
- IConfigurationElement config,
- String propertyName,
- Object data)
- throws CoreException {
- }
-
- /**
- * @see org.eclipse.core.boot.IPlatformRunnable#run(java.lang.Object)
- */
- public Object run(Object args) throws Exception {
- try {
- String directory = System.getProperty("indexOutput");
- if (directory == null || directory.length() == 0) {
- throw new Exception("indexOutput property is not set.");
- }
- String localeStr = System.getProperty("indexLocale");
- if (localeStr == null || localeStr.length() < 2) {
- throw new Exception("indexLocale property is not set.");
- }
- Locale locale;
- if (localeStr.length() >= 5) {
- locale =
- new Locale(
- localeStr.substring(0, 2),
- localeStr.substring(3, 5));
- } else {
- locale = new Locale(localeStr.substring(0, 2), "");
- }
- preindex(directory, locale);
- } catch (Exception e) {
- System.out.println(e);
- e.printStackTrace();
- HelpPlugin.logError("Preindexing failed", e);
- }
- return EXIT_OK;
- }
-
- private void preindex(String outputDir, Locale locale) throws Exception {
- String helpStatePath =
- HelpPlugin.getDefault().getStateLocation().toOSString();
- String relIndexPath = "nl" + File.separator + locale.toString();
- File indexPath =
- new File(helpStatePath + File.separator + relIndexPath);
- // clean
- if (indexPath.exists()) {
- delete(indexPath);
- }
- // index
- HelpSystem.getSearchManager().updateIndex(
- new NullProgressMonitor(),
- HelpSystem.getSearchManager().getIndex(locale.toString()));
- // zip up
- File d =
- new File(outputDir, "nl" + File.separator + locale.getLanguage());
- if (locale.getCountry().length() > 0) {
- d = new File(d, locale.getCountry());
- }
- if (!d.exists())
- d.mkdirs();
- ZipOutputStream zout =
- new ZipOutputStream(
- new FileOutputStream(new File(d, "doc_index.zip")));
- try {
- zipDirectory(indexPath, zout, null);
- } finally {
- zout.close();
- }
- }
- /**
- * Recursively deletes directory and files.
- * @param file
- * @throws IOException
- */
- private static void delete(File file) throws IOException {
- if (file.isDirectory()) {
- File files[] = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- delete(files[i]);
- }
- }
- if (!file.delete()) {
- throw new IOException("Cannot delete file " + file);
- }
- }
- /**
- * Adds files in a directory to a zip stream
- * @param dir directory with files to zip
- * @param zout ZipOutputStream
- * @param base directory prefix for file entries inside the zip or null
- * @throws Exception
- */
- private static void zipDirectory(
- File dir,
- ZipOutputStream zout,
- String base)
- throws IOException {
- byte buffer[] = new byte[8192];
- String[] files = dir.list();
- if (files == null || files.length == 0)
- return;
- for (int i = 0; i < files.length; i++) {
- String path;
- if (base == null) {
- path = files[i];
- } else {
- path = base + "/" + files[i];
- }
- File f = new File(dir, files[i]);
- if (f.isDirectory())
- zipDirectory(f, zout, path);
- else {
- ZipEntry zentry = new ZipEntry(path);
- zout.putNextEntry(zentry);
- FileInputStream inputStream = new FileInputStream(f);
- int len;
- while ((len = inputStream.read(buffer)) != -1)
- zout.write(buffer, 0, len);
- inputStream.close();
- zout.flush();
- zout.closeEntry();
- }
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/RuntimeHelpStatus.java b/org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java
index 6d4d6c973..12bbac1d2 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/RuntimeHelpStatus.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java
@@ -8,13 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.help.internal.util;
+package org.eclipse.help.internal;
-import java.util.ArrayList;
+import java.util.*;
-import org.eclipse.core.runtime.Status;
-import org.xml.sax.SAXParseException;
+import org.eclipse.core.runtime.*;
+import org.xml.sax.*;
/**
* This class is intended to capture all runtime exception happening during
@@ -91,7 +91,7 @@ public class RuntimeHelpStatus {
public synchronized String toString() {
StringBuffer fullText = new StringBuffer();
if (!errorList.isEmpty()) {
- fullText.append(Resources.getString("E006"));
+ fullText.append(HelpResources.getString("E006"));
fullText.append("******************** \n");
for (int i = 0; i < errorList.size(); i++) {
fullText.append(((Status) (errorList.get(i))).getMessage());
@@ -104,7 +104,7 @@ public class RuntimeHelpStatus {
if (!parserErrorMessagesList.isEmpty()) {
// display the files that failed to parse
- fullText.append(Resources.getString("E007"));
+ fullText.append(HelpResources.getString("E007"));
fullText.append("******************** \n");
for (int i = 0; i < badFilesList.size(); i++) {
fullText.append(((String) (badFilesList.get(i))));
@@ -114,7 +114,7 @@ public class RuntimeHelpStatus {
fullText.append("\n");
// and the parse error message
- fullText.append(Resources.getString("E008"));
+ fullText.append(HelpResources.getString("E008"));
fullText.append("******************** \n");
for (int i = 0; i < parserErrorMessagesList.size(); i++) {
fullText.append(((String) (parserErrorMessagesList.get(i))));
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserDescriptor.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserDescriptor.java
deleted file mode 100644
index 94663efb8..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-import org.eclipse.help.browser.IBrowserFactory;
-
-public class BrowserDescriptor {
- private String browserID;
- private String browserLabel;
- private IBrowserFactory factory;
- /**
- * @param id ID of a browser as specified in plugin.xml
- * @param label name of the browser
- * @param factory the factory that creates instances
- * of this browser
- */
- public BrowserDescriptor(String id, String label, IBrowserFactory factory) {
- this.browserID = id;
- this.browserLabel = label;
- this.factory = factory;
- }
- public String getID() {
- return browserID;
- }
- public String getLabel() {
- return browserLabel;
- }
- public IBrowserFactory getFactory() {
- return factory;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserLog.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserLog.java
deleted file mode 100644
index 25ab904df..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserLog.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-
-import java.io.*;
-import java.text.*;
-import java.util.Date;
-
-import org.eclipse.help.internal.HelpPlugin;
-
-/**
- * Log for messages output by external browser processes.
- */
-public class BrowserLog {
- private static BrowserLog instance;
- private String logFileName;
- private boolean newSession;
- DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy kk:mm:ss.SS");
- String LN=System.getProperty("line.separator");
- /**
- * Constructor
- */
- private BrowserLog() {
- try {
- newSession = true;
- logFileName =
- HelpPlugin
- .getDefault()
- .getStateLocation()
- .append("browser.log")
- .toOSString();
- } catch (Exception e) {
- // can get here if platform is shutting down
- }
- }
- /**
- * Obtains singleton
- */
- private static BrowserLog getInstance() {
- if (instance == null) {
- instance = new BrowserLog();
- }
- return instance;
- }
- /**
- * Appends a line to the browser.log
- */
- public static synchronized void log(String message) {
- getInstance().append(message);
- }
- private void append(String message) {
- if (logFileName == null) {
- return;
- }
- Writer outWriter = null;
- try {
- outWriter =
- new BufferedWriter(
- new OutputStreamWriter(
- new FileOutputStream(logFileName, true),
- "UTF-8"));
- if (newSession) {
- newSession = false;
- outWriter.write(
- LN + formatter.format(new Date()) + " NEW SESSION"+LN);
- }
- outWriter.write(
- formatter.format(new Date()) + " " + message + LN);
- outWriter.flush();
- outWriter.close();
- } catch (Exception e) {
- if (outWriter != null) {
- try {
- outWriter.close();
- } catch (IOException ioe) {
- }
- }
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserManager.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserManager.java
deleted file mode 100644
index c4599b10b..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/BrowserManager.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Creates browser by delegating
- * to appropriate browser adapter
- */
-public class BrowserManager {
- public static final String DEFAULT_BROWSER_ID_KEY = "default_browser";
- private static BrowserManager instance;
- private boolean initialized = false;
- private BrowserDescriptor currentBrowserDesc;
- private BrowserDescriptor defaultBrowserDesc;
- private BrowserDescriptor[] browsersDescriptors;
- private Collection browsers = new ArrayList();
- /**
- * Private Constructor
- */
- private BrowserManager() {
- }
- /**
- * Initialize
- */
- private void init() {
- initialized = true;
-
- // Find all available browsers
- browsersDescriptors = createBrowserDescriptors();
-
- // 1. set default browser from preferences
- String defBrowserID =
- HelpPlugin.getDefault().getPluginPreferences().getDefaultString(
- DEFAULT_BROWSER_ID_KEY);
- if (defBrowserID != null && (!"".equals(defBrowserID))) {
- setDefaultBrowserID(defBrowserID);
- }
-
- if (defaultBrowserDesc == null) {
- // No default browser in properties!
- // Set default browser to prefered implementation
- if (System.getProperty("os.name").startsWith("Win")) {
- setDefaultBrowserID("org.eclipse.help.ui.iexplorer");
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID("org.eclipse.help.ui.systembrowser");
- }
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID("org.eclipse.help.custombrowser");
- }
-
- } else if (System.getProperty("os.name").startsWith("Linux")) {
- setDefaultBrowserID("org.eclipse.help.mozillaLinux");
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID("org.eclipse.help.netscapeLinux");
- }
-
- } else if (System.getProperty("os.name").startsWith("SunOS")) {
- setDefaultBrowserID("org.eclipse.help.netscapeSolaris");
- } else if (System.getProperty("os.name").startsWith("AIX")) {
- setDefaultBrowserID("org.eclipse.help.netscapeAIX");
- } else if (
- System.getProperty("os.name").toLowerCase().startsWith("hp")) {
- setDefaultBrowserID("org.eclipse.help.mozillaHPUX");
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID("org.eclipse.help.netscapeHPUX");
- }
- } else {
- setDefaultBrowserID("org.eclipse.help.mozillaLinux");
- }
- }
- if (defaultBrowserDesc == null) {
- // No default browser in properties!
- // Set default browser to one of the available
- if (browsersDescriptors.length > 0)
- defaultBrowserDesc = browsersDescriptors[0];
- }
- if (defaultBrowserDesc == null) {
- // If no browsers at all, use the Null Browser Adapter
- defaultBrowserDesc =
- new BrowserDescriptor(
- "",
- "Null Browser",
- new IBrowserFactory() {
- public boolean isAvailable() {
- return true;
- }
- public IBrowser createBrowser() {
- return new IBrowser() {
- public void close() {
- }
- public void displayURL(String url) {
- String msg =
- Resources.getString("no_browsers", url);
- HelpPlugin.logError(msg, null);
- HelpSystem.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) {
- }
- };
- }
- });
- }
-
- // initialize current browser
- String curBrowserID =
- HelpPlugin.getDefault().getPluginPreferences().getString(
- DEFAULT_BROWSER_ID_KEY);
- if (curBrowserID != null && (!"".equals(curBrowserID))) {
- setCurrentBrowserID(curBrowserID);
- } else {
- setCurrentBrowserID(getDefaultBrowserID());
- }
-
- }
- /**
- * Obtains singleton instance.
- */
- public static BrowserManager getInstance() {
- if (instance == null)
- instance = new BrowserManager();
- return instance;
- }
- /**
- * Creates all adapters, and returns
- * available ones.
- */
- private BrowserDescriptor[] createBrowserDescriptors() {
- if (this.browsersDescriptors != null)
- return this.browsersDescriptors;
- Collection bDescriptors = new ArrayList();
- IConfigurationElement configElements[] =
- Platform.getPluginRegistry().getConfigurationElementsFor(
- "org.eclipse.help",
- "browser");
- for (int i = 0; i < configElements.length; i++) {
- if (!configElements[i].getName().equals("browser"))
- continue;
- String id = configElements[i].getAttribute("id");
- if (id == null)
- continue;
- String label = configElements[i].getAttribute("name");
- if (label == null)
- continue;
- try {
- Object adapter =
- configElements[i].createExecutableExtension("factoryclass");
- if (!(adapter instanceof IBrowserFactory))
- continue;
- if (((IBrowserFactory) adapter).isAvailable()) {
- bDescriptors.add(
- new BrowserDescriptor(
- id,
- label,
- (IBrowserFactory) adapter));
- }
- } catch (CoreException ce) {
- }
- }
- this.browsersDescriptors =
- (BrowserDescriptor[]) bDescriptors.toArray(
- new BrowserDescriptor[bDescriptors.size()]);
- return this.browsersDescriptors;
- }
- /**
- * Obtains browsers descriptors.
- */
- public BrowserDescriptor[] getBrowserDescriptors() {
- if (!initialized) {
- init();
- }
- return this.browsersDescriptors;
- }
- /**
- * Gets the currentBrowserID.
- * @return Returns a String or null if not set
- */
- public String getCurrentBrowserID() {
- if (!initialized) {
- init();
- }
- if (currentBrowserDesc == null)
- return null;
- return currentBrowserDesc.getID();
- }
- /**
- * Gets the currentBrowserID.
- * @return Returns a String or null if not set
- */
- public String getDefaultBrowserID() {
- if (!initialized) {
- init();
- }
- if (defaultBrowserDesc == null)
- return null;
- return defaultBrowserDesc.getID();
- }
- /**
- * Sets the currentBrowserID.
- * If browser of given ID does not exists,
- * the method does nothing
- * @param currentAdapterrID The ID of the adapter to to set as current
- */
- public void setCurrentBrowserID(String currentAdapterID) {
- if (!initialized) {
- init();
- }
- for (int i = 0; i < browsersDescriptors.length; i++) {
- if (browsersDescriptors[i].getID().equals(currentAdapterID)) {
- currentBrowserDesc = browsersDescriptors[i];
- return;
- }
- }
- }
- /**
- * Sets the defaultBrowserID.
- * If browser of given ID does not exists,
- * the method does nothing
- * @param currentAdapterrID The ID of the adapter to to set as current
- */
- private void setDefaultBrowserID(String defaultAdapterID) {
- if (!initialized) {
- init();
- }
- for (int i = 0; i < browsersDescriptors.length; i++) {
- if (browsersDescriptors[i].getID().equals(defaultAdapterID)) {
- defaultBrowserDesc = browsersDescriptors[i];
- return;
- }
- }
- }
- /**
- * Creates web browser
- */
- public IBrowser createBrowser() {
- if (!initialized) {
- init();
- }
- return new CurrentBrowser(
- createBrowserAdapter(),
- getCurrentBrowserID());
- }
- /**
- * Creates web browser
- */
- private IBrowser createBrowserAdapter() {
- IBrowser browser = currentBrowserDesc.getFactory().createBrowser();
- browsers.add(browser);
- return browser;
- }
- /**
- * Closes all browsers created
- */
- public void closeAll() {
- if (!initialized) {
- // nothing to do, do not initialize
- return;
- }
- for (Iterator it = browsers.iterator(); it.hasNext();) {
- IBrowser browser = (IBrowser) it.next();
- browser.close();
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/CurrentBrowser.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/CurrentBrowser.java
deleted file mode 100644
index e5f638b88..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/CurrentBrowser.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-
-import org.eclipse.help.browser.IBrowser;
-
-/**
- * Wrapper for individual browsers
- * contributed through extension point.
- */
-public class CurrentBrowser implements IBrowser {
- private IBrowser browserAdapter;
- private String browserAdapterId;
- /**
- * new adapter selected in preferences but not yet shown
- */
- private IBrowser newBrowserAdapter = null;
- private String newBrowserAdapterId = null;
- private boolean locationSet = false;
- private boolean sizeSet = false;
- private int x;
- private int y;
- private int width;
- private int height;
-
- public CurrentBrowser(IBrowser browserImpl, String browserAdapterId) {
- this.browserAdapter = browserImpl;
- this.browserAdapterId = browserAdapterId;
- }
- /**
- * @see org.eclipse.help.browser.IBrowser#close()
- */
- public void close() {
- browserAdapter.close();
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#isCloseSupported()
- */
- public boolean isCloseSupported() {
- return browserAdapter.isCloseSupported();
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#displayURL(java.lang.String)
- */
- public void displayURL(String url) throws Exception {
- checkDefaultAdapter();
- if (newBrowserAdapter != null) {
- browserAdapter.close();
-
- browserAdapter = newBrowserAdapter;
- newBrowserAdapter = null;
- browserAdapterId = newBrowserAdapterId;
- newBrowserAdapterId = null;
-
- if (locationSet) {
- browserAdapter.setLocation(x, y);
- }
- if (sizeSet) {
- browserAdapter.setSize(width, height);
- }
- }
- browserAdapter.displayURL(url);
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#isSetLocationSupported()
- */
- public boolean isSetLocationSupported() {
- checkDefaultAdapter();
- if (newBrowserAdapterId == null) {
- return browserAdapter.isSetLocationSupported();
- } else {
- return browserAdapter.isSetLocationSupported()
- || newBrowserAdapter.isSetLocationSupported();
- }
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#isSetSizeSupported()
- */
- public boolean isSetSizeSupported() {
- checkDefaultAdapter();
- if (newBrowserAdapterId == null) {
- return browserAdapter.isSetSizeSupported();
- } else {
- return browserAdapter.isSetSizeSupported()
- || newBrowserAdapter.isSetSizeSupported();
- }
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#setLocation(int, int)
- */
- public void setLocation(int x, int y) {
- checkDefaultAdapter();
- browserAdapter.setLocation(x, y);
- locationSet = true;
- this.x = x;
- this.y = y;
- }
-
- /**
- * @see org.eclipse.help.browser.IBrowser#setSize(int, int)
- */
- public void setSize(int width, int height) {
- checkDefaultAdapter();
- browserAdapter.setSize(width, height);
- sizeSet = true;
- this.width = width;
- this.height = height;
- }
- /*
- * Checks wheter default adapter has changed.
- * If yes, sets the newBrowserAdapter field
- */
- private void checkDefaultAdapter() {
- if (browserAdapterId
- != BrowserManager.getInstance().getCurrentBrowserID()) {
- newBrowserAdapter = BrowserManager.getInstance().createBrowser();
- newBrowserAdapterId =
- BrowserManager.getInstance().getCurrentBrowserID();
- }
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowser.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowser.java
deleted file mode 100644
index 70010b51e..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowser.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-
-import java.util.*;
-
-import org.eclipse.core.boot.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- *
- */
-public class CustomBrowser implements IBrowser {
- public static final String CUSTOM_BROWSER_PATH_KEY = "custom_browser_path";
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#close()
- */
- public void close() {
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isCloseSupported()
- */
- public boolean isCloseSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#displayURL(java.lang.String)
- */
- public void displayURL(String url) throws Exception {
- String path =
- HelpPlugin.getDefault().getPluginPreferences().getString(
- CustomBrowser.CUSTOM_BROWSER_PATH_KEY);
-
- String[] command = prepareCommand(path, url);
-
- try {
- Process pr = Runtime.getRuntime().exec(command);
- Thread outConsumer = new StreamConsumer(pr.getInputStream());
- outConsumer.setName("Custom browser adapter output reader");
- outConsumer.start();
- Thread errConsumer = new StreamConsumer(pr.getErrorStream());
- errConsumer.setName("Custom browser adapter error reader");
- errConsumer.start();
- } catch (Exception e) {
- HelpPlugin.logError(
- Resources.getString("CustomBrowser.errorLaunching", url, path),
- e);
- throw new Exception(
- Resources.getString("CustomBrowser.errorLaunching", url, path));
- }
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isSetLocationSupported()
- */
- public boolean isSetLocationSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isSetSizeSupported()
- */
- public boolean isSetSizeSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#setLocation(int, int)
- */
- public void setLocation(int x, int y) {
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#setSize(int, int)
- */
- public void setSize(int width, int height) {
- }
-
- /**
- * Creates the final command to launch.
- * @param path
- * @param url
- * @return String[]
- */
- private String[] prepareCommand(String path, String url) {
- ArrayList tokenList = new ArrayList();
- //Divide along quotation marks
- StringTokenizer qTokenizer =
- new StringTokenizer(path.trim(), "\"", true);
- boolean withinQuotation = false;
- String quotedString = "";
- while (qTokenizer.hasMoreTokens()) {
- String curToken = qTokenizer.nextToken();
- if (curToken.equals("\"")) {
- if (withinQuotation) {
- if (BootLoader
- .OS_WIN32
- .equalsIgnoreCase(BootLoader.getOS())) {
- // need to quote URLs on Windows
- tokenList.add("\"" + quotedString + "\"");
- } else {
- // qotes prevent launching on Unix 35673
- tokenList.add(quotedString);
- }
- } else {
- quotedString = "";
- }
- withinQuotation = !withinQuotation;
- continue;
- } else if (withinQuotation) {
- quotedString = curToken;
- continue;
- } else {
- //divide unquoted strings along white space
- StringTokenizer parser = new StringTokenizer(curToken.trim());
- while (parser.hasMoreTokens()) {
- tokenList.add(parser.nextToken());
- }
- }
- }
- // substitute %1 by url
- boolean substituted = false;
- for (int i = 0; i < tokenList.size(); i++) {
- String token = (String) tokenList.get(i);
- if ("%1".equals(token)) {
- tokenList.set(i, url);
- substituted = true;
- } else if ("\"%1\"".equals(token)) {
- tokenList.set(i, "\"" + url + "\"");
- substituted = true;
- }
- }
- // add the url if not substituted already
- if (!substituted)
- tokenList.add(url);
-
- String[] command = new String[tokenList.size()];
- tokenList.toArray(command);
- return command;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java
deleted file mode 100644
index 5d61967bc..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-
-import org.eclipse.help.browser.*;
-
-/**
- * Produces Custom Browser
- */
-public class CustomBrowserFactory implements IBrowserFactory {
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowserFactory#isAvailable()
- */
- public boolean isAvailable() {
- return true;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowserFactory#createBrowser()
- */
- public IBrowser createBrowser() {
- return new CustomBrowser();
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java
deleted file mode 100644
index 1d2947766..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-import java.io.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Browser adapter for browsers supporting
- * -remote openURL command line option
- * i.e. Mozilla and Netscape.
- */
-public class MozillaBrowserAdapter implements IBrowser {
- // delay that it takes mozilla to start responding
- // to remote command after mozilla has been called
- private static final int DELAY = 5000;
- private long browserFullyOpenedAt = 0;
- private BrowserThread lastBrowserThread = null;
- private int x, y;
- private int width, height;
- private boolean setLocationPending = false;
- private boolean setSizePending = false;
- private String executable;
- private String executableName;
- private Thread uiThread;
- /**
- * Constructor
- * @executable executable filename to launch
- * @executableName name of the program to display when error occurs
- */
- MozillaBrowserAdapter(String executable, String executableName) {
- this.uiThread = Thread.currentThread();
- this.executable = executable;
- this.executableName = executableName;
- }
- /*
- * @see IBrowser#close()
- */
- public void close() {
- }
- /*
- * @see IBrowser#displayURL(String)
- */
- public void displayURL(String url) {
- if (lastBrowserThread != null)
- lastBrowserThread.exitRequested = true;
- if (setLocationPending || setSizePending) {
- url = createPositioningURL(url);
- }
- lastBrowserThread = new BrowserThread(url);
- lastBrowserThread.start();
- 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)
- */
- public void setLocation(int x, int y) {
- this.x = x;
- this.y = y;
- setLocationPending = true;
- }
- /*
- * @see IBrowser#setSize(int, int)
- */
- public void setSize(int width, int height) {
- this.width = width;
- this.height = height;
- setSizePending = true;
- }
- private synchronized String createPositioningURL(String url) {
- IPath pluginPath = HelpPlugin.getDefault().getStateLocation();
- File outFile =
- pluginPath
- .append("mozillaPositon")
- .append("position.html")
- .toFile();
- try {
- outFile.getParentFile().mkdirs();
- PrintWriter writer =
- new PrintWriter(
- new BufferedWriter(
- new OutputStreamWriter(
- new FileOutputStream(outFile),
- "UTF8")),
- false);
- writer.println(
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
- writer.println("<html><head>");
- writer.println(
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">");
- writer.print("<title></title><script language=\"JavaScript\">");
- if (setSizePending)
- writer.print("window.resizeTo(" + width + "," + height + ");");
- if (setLocationPending)
- writer.print("window.moveTo(" + x + "," + y + ");");
- writer.print("location.replace(\"" + url + "\");");
- writer.print("</script></head><body>");
- writer.print("<a href=\"" + url + "\">--&gt;</a>");
- writer.print("</body></html>");
- writer.close();
- return "file://" + outFile.getAbsolutePath();
- } catch (IOException ioe) {
- // return the original url
- 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
- */
- private int openBrowser(String browserCmd) {
- try {
- Process pr = Runtime.getRuntime().exec(browserCmd);
- StreamConsumer outputs =
- new StreamConsumer(pr.getInputStream());
- (outputs).start();
- StreamConsumer errors = new StreamConsumer(pr.getErrorStream());
- (errors).start();
- pr.waitFor();
- int ret = pr.exitValue();
-
- if (ret == 0 && errorsInOutput(outputs, errors)) {
- return -1;
- }
- return ret;
- } catch (InterruptedException e) {
- } catch (IOException e) {
- String msg =
- Resources.getString(
- "MozillaBrowserAdapter.executeFailed",
- executableName);
- HelpPlugin.logError(msg, e);
- HelpSystem.getDefaultErrorUtil().displayError(msg, uiThread);
- // return success, so second command does not execute
- return 0;
- }
- return -1;
- }
- /**
- * On some OSes 0 is always returned by netscape -remote.
- * It is necessary to examine ouput to find out failure
- * @param outputs
- * @param errors
- * @return
- * @throws InterruptedException
- */
- private boolean errorsInOutput(
- StreamConsumer outputs,
- StreamConsumer errors) {
- try {
- outputs.join(1000);
- if (outputs.getLastLine() != null
- && (outputs.getLastLine().indexOf("No running window found")
- >= 0
- || outputs.getLastLine().indexOf("not running on display")
- >= 0)) {
- return true;
- }
- errors.join(1000);
- if (errors.getLastLine() != null
- && (errors.getLastLine().indexOf("No running window found")
- >= 0
- || errors.getLastLine().indexOf("not running on display")
- >= 0)) {
- return true;
- }
- } catch (InterruptedException ie) {
- // ignore
- }
- return false;
- }
- public void run() {
- // If browser is opening, wait until it fully opens,
- waitForBrowser();
- if (exitRequested)
- return;
- if (openBrowser(executable + " -remote openURL(" + url + ")")
- == 0) {
- return;
- }
- if (exitRequested)
- return;
- browserFullyOpenedAt = System.currentTimeMillis() + DELAY;
- openBrowser(executable + " " + url);
- }
- private void waitForBrowser() {
- while (System.currentTimeMillis() < browserFullyOpenedAt)
- try {
- if (exitRequested)
- return;
- Thread.sleep(100);
- } catch (InterruptedException ie) {
- }
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaFactory.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaFactory.java
deleted file mode 100644
index fac09f953..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/MozillaFactory.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-public class MozillaFactory implements IBrowserFactory, IExecutableExtension {
- private String executable;
- private String executableName;
- private String os;
- private MozillaBrowserAdapter browserInstance = null;
- /**
- * Constructor.
- */
- public MozillaFactory() {
- super();
- }
- /*
- * @see IBrowserFactory#isAvailable()
- */
- public boolean isAvailable() {
- if (!System
- .getProperty("os.name")
- .toLowerCase()
- .startsWith(os.toLowerCase())) {
- return false;
- }
- try {
- Process pr = Runtime.getRuntime().exec("which " + executable);
- StreamConsumer outputs = new StreamConsumer(pr.getInputStream());
- (outputs).start();
- StreamConsumer errors = new StreamConsumer(pr.getErrorStream());
- (errors).start();
- pr.waitFor();
- int ret = pr.exitValue();
- if (ret == 0) {
- return !errorsInOutput(outputs, errors);
- } else {
- return false;
- }
- } catch (InterruptedException e) {
- return false;
- } catch (IOException e) {
- // launching which failed, assume browser executable is present
- return true;
- }
- }
- /**
- * On some OSes 0 is always returned by "which" command
- * it is necessary to examine ouput to find out failure.
- * @param outputs
- * @param errors
- * @return
- * @throws InterruptedException
- */
- private boolean errorsInOutput(
- StreamConsumer outputs,
- StreamConsumer errors) {
- try {
- outputs.join(1000);
- if (outputs.getLastLine() != null
- && outputs.getLastLine().indexOf("no " + executable + " in")
- >= 0) {
- return true;
- }
- errors.join(1000);
- if (errors.getLastLine() != null
- && errors.getLastLine().indexOf("no " + executable + " in")
- >= 0) {
- return true;
- }
- } catch (InterruptedException ie) {
- // ignore
- }
- return false;
- }
- /*
- * @see IBrowserFactory#createBrowser()
- */
- public IBrowser createBrowser() {
- // Create single browser for all clients
- if (browserInstance == null) {
- browserInstance =
- new MozillaBrowserAdapter(executable, executableName);
- }
- return browserInstance;
- }
- /**
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- */
- public void setInitializationData(
- IConfigurationElement config,
- String propertyName,
- Object data)
- throws CoreException {
- try {
- Hashtable params = (Hashtable) data;
- executable = (String) params.get("executable");
- executableName = (String) params.get("executableName");
- os = (String) params.get("os");
- } catch (Exception e) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- HelpPlugin.PLUGIN_ID,
- IStatus.OK,
- Resources.getString("MozillaFactory.dataMissing"),
- e));
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/StreamConsumer.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/StreamConsumer.java
deleted file mode 100644
index 305460def..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/StreamConsumer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser;
-import java.io.*;
-
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Used to receive output from processes
- */
-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;
- while (null != (line = bReader.readLine())) {
- lastLine = line;
- BrowserLog.log(line);
- }
- bReader.close();
- } catch (IOException ioe) {
- HelpPlugin.logError(Resources.getString("WE001"), ioe);
- }
- }
- /**
- * @return last line obtained or null
- */
- public String getLastLine() {
- return lastLine;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java
deleted file mode 100644
index 3b526241b..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser.macosx;
-
-import java.io.IOException;
-
-import org.eclipse.help.browser.IBrowser;
-
-public class DefaultBrowserAdapter implements IBrowser {
-
- private static DefaultBrowserAdapter fgInstance;
-
- static DefaultBrowserAdapter getInstance() {
- if (fgInstance == null)
- fgInstance= new DefaultBrowserAdapter();
- return fgInstance;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#close()
- */
- public void close() {
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#displayURL(String)
- */
- public void displayURL(String url) {
- /*
- * Code from Marc-Antoine Parent
- */
- try {
- Runtime.getRuntime().exec(
- new String[] {
- "/usr/bin/osascript",
- "-e",
- "open location \"" + url +"\""
- }
- );
- } catch (IOException e) {
- // ignore silently
- }
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isCloseSupported()
- */
- public boolean isCloseSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isSetLocationSupported()
- */
- public boolean isSetLocationSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#isSetSizeSupported()
- */
- public boolean isSetSizeSupported() {
- return false;
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#setLocation(int, int)
- */
- public void setLocation(int x, int y) {
- }
-
- /**
- * @see org.eclipse.help.ui.browser.IBrowser#setSize(int, int)
- */
- public void setSize(int width, int height) {
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java b/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java
deleted file mode 100644
index 1e4951122..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.browser.macosx;
-
-import org.eclipse.help.browser.*;
-
-
-public class DefaultBrowserFactory implements IBrowserFactory {
-
- public DefaultBrowserFactory() {
- super();
- }
-
- /*
- * @see IBrowserFactory#isAvailable()
- */
- public boolean isAvailable() {
- return System.getProperty("os.name").equals("Mac OS X");
- /*
- * we assume that every Mac OS X has an "/usr/bin/osascript"
- * so we don't test any further
- */
- }
-
- /*
- * @see IBrowserFactory#createBrowser()
- */
- public IBrowser createBrowser() {
- return DefaultBrowserAdapter.getInstance();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextProxy.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextProxy.java
deleted file mode 100644
index 186d6b1ee..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextProxy.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.context;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.HelpSystem;
-/**
- * IContext Implementation that performs lazy lookup of
- * context ID and HelpContext instantiation.
- * when any of the IContext methods are called.
- */
-public class ContextProxy implements IContext {
- private String contextID;
- private IContext context = null;
- private boolean used = false;
- /**
- * ContextImpl constructor.
- */
- public ContextProxy(String contextId) {
- super();
- this.contextID = contextId;
- }
- /**
- * Returns a list of related topics for this help context.
- *
- * @return a list of related help topics
- */
- public IHelpResource[] getRelatedTopics() {
- if (!used) {
- context = HelpSystem.getContextManager().getContext(contextID);
- used = true;
- }
- if (context == null)
- return null;
- return context.getRelatedTopics();
- }
- /**
- * Returns the text description for this context.
- *
- * @return the text description
- */
- public String getText() {
- if (!used) {
- context = HelpSystem.getContextManager().getContext(contextID);
- used = true;
- }
- if (context == null)
- return null;
- return context.getText();
- }
- public String getID() {
- return contextID;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
index 370ed849a..ff6b8bd2b 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
@@ -34,8 +34,8 @@ public class ContextsFileParser extends DefaultHandler {
this.builder = builder;
}
/**
- * Receive notification of character data.
- */
+ * Receive notification of character data.
+ */
public void characters(char ch[], int start, int length)
throws SAXException {
if (seenDescription)
@@ -47,8 +47,8 @@ public class ContextsFileParser extends DefaultHandler {
}
}
/**
- * Receive notification of the end of an element.
- */
+ * Receive notification of the end of an element.
+ */
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
// make sure that no error has already occurred before adding to stack.
@@ -93,13 +93,13 @@ public class ContextsFileParser extends DefaultHandler {
String param3 = ex.getMessage();
String message =
MessageFormat.format(
- Resources.getString(messageID),
+ HelpResources.getString(messageID),
new Object[] { param0, param1, param2, param3 });
return message;
}
/**
- * Receive notification of the beginning of an element.
- */
+ * Receive notification of the beginning of an element.
+ */
public void startElement(
String namespaceURI,
String localName,
@@ -115,7 +115,7 @@ public class ContextsFileParser extends DefaultHandler {
// the current StringBuffer of description.
// ie: there are many bold start tags in the stack, but we appended
// the tag only once to the description string.
- // eg: (b) some text (b) more test (/b) more text (/b) will result
+ // eg: (b) some text (b) more test (/b) more text (/b) will result
// in all of the sentence being bold.
if (!(stack.peek()).equals(ContextsNode.BOLD_TAG))
buffer.append(ContextsNode.BOLD_TAG);
@@ -158,15 +158,14 @@ public class ContextsFileParser extends DefaultHandler {
is.close();
} catch (ParserConfigurationException pce) {
HelpPlugin.logError(
- Resources.getString("ContextsFileParser.PCE"),
+ HelpResources.getString("ContextsFileParser.PCE"),
pce);
} catch (SAXException se) {
HelpPlugin.logError("", se);
} catch (IOException ioe) {
- String msg = Resources.getString("E009", file);
+ String msg = HelpResources.getString("E009", file);
HelpPlugin.logError(msg, ioe);
- // now pass it to the RuntimeHelpStatus object explicitly because
- // we
+ // now pass it to the RuntimeHelpStatus object explicitly because we
// still need to display errors even if Logging is turned off.
RuntimeHelpStatus.getInstance().addParseError(msg, file);
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java b/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
index 8b7dd9615..6561dadc7 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
@@ -16,7 +16,7 @@ import java.util.*;
import org.eclipse.core.boot.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.appserver.*;
+//import org.eclipse.help.internal.appserver.*;
import org.eclipse.help.internal.util.*;
/**
* URLConnection to help documents in plug-ins
@@ -83,12 +83,13 @@ public class HelpURLConnection extends URLConnection {
if (plugin == null) {
throw new IOException("Resource not found.");
}
- if (plugin
- .equals(
- AppserverPlugin.getDefault().getContributingServerPlugin())) {
- // Do not return documents from app server implementation plug-in
- throw new IOException("Resource not found.");
- }
+ // TODO fix so it compiles
+// if (plugin
+// .equals(
+// AppserverPlugin.getDefault().getContributingServerPlugin())) {
+// // Do not return documents from app server implementation plug-in
+// throw new IOException("Resource not found.");
+// }
if (getFile() == null || "".equals(getFile())) {
throw new IOException("Resource not found.");
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/ASCIIReader.java b/org.eclipse.help/src/org/eclipse/help/internal/search/ASCIIReader.java
deleted file mode 100644
index 2cec12f93..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/ASCIIReader.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-
-/**
- * High performance reader. Assumes the input stream is ASCII.
- */
-public class ASCIIReader extends Reader {
- private InputStream stream;
- int bufSize;
- byte[] buf;
- /**
- * @param stream InputStream
- * @param bufSize size of internal buffer
- */
- public ASCIIReader(InputStream stream, int bufSize) {
- this.stream = stream;
- this.bufSize = bufSize;
- buf = new byte[bufSize];
- }
-
- /**
- * @see java.io.Reader#read(char, int, int)
- */
- public int read(char[] cbuf, int off, int len) throws IOException {
- int n = stream.read(buf, 0, Math.min(bufSize, len));
- for (int i = 0; i < n; i++) {
- cbuf[off + i] = (char) buf[i];
- }
- return n;
- }
-
- /**
- * @see java.io.Reader#close()
- */
- public void close() throws IOException {
- stream.close();
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java b/org.eclipse.help/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java
deleted file mode 100644
index e4f9b0134..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import org.apache.lucene.analysis.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Text Analyzer Descriptor. Encapsulates Lucene Analyzer
- */
-public class AnalyzerDescriptor {
- private Analyzer luceneAnalyzer;
- private String id;
- private String lang;
-
- /**
- * Constructor
- */
- public AnalyzerDescriptor(String locale) {
-
- // try creating the analyzer for the specified locale (usually lang_country)
- this.luceneAnalyzer = createAnalyzer(locale);
-
- // try creating configured analyzer for the language only
- if (this.luceneAnalyzer == null) {
- String language = null;
- if (locale.length() > 2) {
- language = locale.substring(0, 2);
- this.luceneAnalyzer = createAnalyzer(language);
- }
- }
-
- // if all fails, create default analyzer
- if (this.luceneAnalyzer == null) {
- this.id =
- HelpPlugin.getDefault().getDescriptor().getUniqueIdentifier()
- + "#"
- + HelpPlugin
- .getDefault()
- .getDescriptor()
- .getVersionIdentifier()
- .toString();
- this.luceneAnalyzer = new DefaultAnalyzer(locale);
- this.lang = locale;
- }
-
- }
- /**
- * Gets the analyzer.
- * @return Returns a Analyzer
- */
- public Analyzer getAnalyzer() {
- return new SmartAnalyzer(lang, luceneAnalyzer);
- }
-
- /**
- * Gets the id.
- * @return Returns a String
- */
- public String getId() {
- return id;
- }
-
- /**
- * Gets the language for the analyzer
- * @return Returns a String
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Creates analyzer for a locale,
- * if it is configured in the org.eclipse.help.luceneAnalyzer
- * extension point. The identifier of the analyzer and locale and lang are also set.
- * @return Analyzer or null if no analyzer is configured
- * for given locale.
- */
- private Analyzer createAnalyzer(String locale) {
- // find extension point
- IConfigurationElement configElements[] =
- Platform.getPluginRegistry().getConfigurationElementsFor(
- HelpPlugin.PLUGIN_ID,
- "luceneAnalyzer");
- for (int i = 0; i < configElements.length; i++) {
- if (!configElements[i].getName().equals("analyzer"))
- continue;
- String analyzerLocale = configElements[i].getAttribute("locale");
- if (analyzerLocale == null || !analyzerLocale.equals(locale))
- continue;
- try {
- Object analyzer =
- configElements[i].createExecutableExtension("class");
- if (!(analyzer instanceof Analyzer))
- continue;
- else {
- String pluginId =
- configElements[i]
- .getDeclaringExtension()
- .getDeclaringPluginDescriptor()
- .getUniqueIdentifier();
- String pluginVersion =
- configElements[i]
- .getDeclaringExtension()
- .getDeclaringPluginDescriptor()
- .getVersionIdentifier()
- .toString();
- this.luceneAnalyzer = (Analyzer) analyzer;
- this.id = pluginId + "#" + pluginVersion;
- this.lang = locale;
- if (HelpPlugin.PLUGIN_ID.equals(pluginId)) {
- // The analyzer is contributed by help plugin.
- // Continue in case there is another analyzer for the same locale
- // let another analyzer take precendence over one from help
- } else {
- // the analyzer does not come from help
- return this.luceneAnalyzer;
- }
- }
- } catch (CoreException ce) {
- HelpPlugin.logError(
- Resources.getString(
- "ES23",
- configElements[i].getAttribute("class"),
- locale),
- ce);
- }
- }
-
- return this.luceneAnalyzer;
- }
- /**
- * Checks whether analyzer is compatible with a given analyzer
- * @param analyzerId id of analyzer used in the past by the index;
- * id has a form: pluginID#pluginVersion
- * @return true when it is known that given analyzer is compatible with
- * this analyzer
- */
- public boolean isCompatible(String analyzerId) {
- if (id.equals(analyzerId)) {
- return true;
- }
- // analyzers between versions 2.0.1 and 3.0.0 of org.eclipse.help plugin
- // are compatible (logic unchanged), index can be preserved between them
- if (analyzerId.compareTo(HelpPlugin.PLUGIN_ID + "#2.0.1") >= 0
- && analyzerId.compareTo(HelpPlugin.PLUGIN_ID + "#3.0.0") <= 0
- && id.compareTo(HelpPlugin.PLUGIN_ID + "#2.0.1") >= 0
- && id.compareTo(HelpPlugin.PLUGIN_ID + "#3.0.0") <= 0) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/Analyzer_en.java b/org.eclipse.help/src/org/eclipse/help/internal/search/Analyzer_en.java
deleted file mode 100644
index b15681516..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/Analyzer_en.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import java.io.Reader;
-
-import org.apache.lucene.analysis.*;
-/**
- * Lucene Analyzer for English.
- * LowerCaseTokenizer->StopFilter->PorterStemFilter
- */
-public class Analyzer_en extends Analyzer {
- Analyzer stopAnalyzer;
- /**
- * Constructor for Analyzer_en.
- */
- public Analyzer_en() {
- super();
- stopAnalyzer = new StopAnalyzer(STOP_WORDS);
- }
- /**
- * Creates a TokenStream which tokenizes all the text
- * in the provided Reader.
- */
- public final TokenStream tokenStream(String fieldName, Reader reader) {
- return new PorterStemFilter(stopAnalyzer.tokenStream(fieldName, reader));
- }
- /**
- * Array of English stop words.
- * Differs from StandardAnalyzer's default stop words by
- * not having "for", "if", and "this" that are java keywords.
- */
- 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" };
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/DefaultAnalyzer.java b/org.eclipse.help/src/org/eclipse/help/internal/search/DefaultAnalyzer.java
deleted file mode 100644
index 21fbfa3c2..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/DefaultAnalyzer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.apache.lucene.analysis.*;
-import org.eclipse.core.boot.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-/**
- * Lucene Analyzer.
- * LowerCaseTokenizer->WordTokenStream (uses word breaking in java.text)
- */
-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
- Locale userLocale = getLocale(localeString);
-
- // Check if the locale is supported by BreakIterator
- // check here to do it only once.
- Locale[] availableLocales = BreakIterator.getAvailableLocales();
- for (int i = 0; i < availableLocales.length; i++) {
- if (userLocale.equals(availableLocales[i])) {
- locale = userLocale;
- break;
- }
- }
- if (locale == null && userLocale.getDisplayVariant().length() > 0) {
- // Check if the locale without variant is supported by BreakIterator
- Locale countryLocale =
- new Locale(userLocale.getLanguage(), userLocale.getCountry());
- for (int i = 0; i < availableLocales.length; i++) {
- if (countryLocale.equals(availableLocales[i])) {
- locale = countryLocale;
- break;
- }
- }
- }
- if (locale == null && userLocale.getCountry().length() > 0) {
- // Check if at least the language is supported by BreakIterator
- Locale language = new Locale(userLocale.getLanguage(), "");
- for (int i = 0; i < availableLocales.length; i++) {
- if (language.equals(availableLocales[i])) {
- locale = language;
- break;
- }
- }
- }
-
- if (locale == null) {
- // Locale is not supported, will use en_US
- HelpPlugin.logError(
- Resources.getString("ES24", localeString),
- null);
- locale = new Locale("en", "US");
- }
- }
- /**
- * Creates a TokenStream which tokenizes all the text
- * in the provided Reader.
- */
- public final TokenStream tokenStream(String fieldName, Reader reader) {
- return new LowerCaseFilter(
- new WordTokenStream(fieldName, reader, locale));
- }
-
- /**
- * Creates a Locale object out of a string representation
- */
- private Locale getLocale(String clientLocale) {
- if (clientLocale == null)
- clientLocale = BootLoader.getNL();
- if (clientLocale == null)
- clientLocale = Locale.getDefault().toString();
-
- // break the string into tokens to get the Locale object
- StringTokenizer locales = new StringTokenizer(clientLocale, "_");
- if (locales.countTokens() == 1)
- return new Locale(locales.nextToken(), "");
- else if (locales.countTokens() == 2)
- return new Locale(locales.nextToken(), locales.nextToken());
- else if (locales.countTokens() == 3)
- return new Locale(
- locales.nextToken(),
- locales.nextToken(),
- locales.nextToken());
- else
- return Locale.getDefault();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/HTMLDocParser.java b/org.eclipse.help/src/org/eclipse/help/internal/search/HTMLDocParser.java
deleted file mode 100644
index c7a95e426..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/HTMLDocParser.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import org.apache.lucene.demo.html.*;
-import org.eclipse.help.internal.*;
-
-/**
- * Parser HTML documents.
- * Extracts document encoding from header,
- * and delegates to lucene HTML parser for extraction
- * of title, summary, and content.
- */
-public class HTMLDocParser {
- // maximum number of characters that will be searched
- // from the beginning of HTML document to charset declaration
- 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";
-
- // states for parsing elements
- final int STATE_ELEMENT_START = 0;
- final int STATE_ELEMENT_AFTER_LT = 1;
- final int STATE_ELEMENT_AFTER_LT_SLASH = 2;
- final int STATE_ELEMENT_META = 3;
- // states for parsing HTTP-EQUIV attribute
- final int STATE_HTTP_START = 0;
- final int STATE_HTTP_AFTER_NAME = 1;
- final int STATE_HTTP_AFTER_EQ = 2;
- final int STATE_HTTP_DONE = 3;
- // states for parsing CONTENT attribute
- final int STATE_CONTENT_START = 0;
- final int STATE_CONTENT_AFTER_NAME = 1;
- final int STATE_CONTENT_AFTER_EQ = 2;
- final int STATE_CONTENT_DONE = 3;
-
- private HTMLParser htmlParser;
- private InputStream inputStream = null;
- /**
- * @param url
- * @throws IOException
- */
- public void openDocument(URL url) throws IOException {
- inputStream = url.openStream();
-
- String encoding = getCharsetFromHTML(inputStream);
- try {
- inputStream.close();
- } catch (IOException closeIOE) {
- }
- inputStream = url.openStream();
- if (encoding != null) {
- try {
- htmlParser =
- new HTMLParser(
- new InputStreamReader(inputStream, encoding));
-
- } catch (UnsupportedEncodingException uee) {
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- this.getClass().getName()
- + " JVM does not support encoding "
- + encoding
- + " specified in document "
- + url.getPath()
- + ". Default encoding will be used during indexing.");
- }
- htmlParser = new HTMLParser(new InputStreamReader(inputStream));
- }
- } else {
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- this.getClass().getName()
- + " Encoding not found in document "
- + url.getPath()
- + ". Default encoding will be used during indexing.");
- }
- htmlParser = new HTMLParser(new InputStreamReader(inputStream));
- }
- }
- /**
- * Releases resources (closes streams)
- */
- public void closeDocument() {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException closeIOE) {
- }
- }
- }
- public String getTitle() throws IOException {
- if (htmlParser == null) {
- throw new NullPointerException();
- }
- try {
- return htmlParser.getTitle();
- } catch (InterruptedException ie) {
- return "";
- }
- }
- public String getSummary() throws IOException {
- if (htmlParser == null) {
- throw new NullPointerException();
- }
- try {
- return htmlParser.getSummary();
- } catch (InterruptedException ie) {
- return "";
- }
- }
- public Reader getContentReader() throws IOException {
- if (htmlParser == null) {
- throw new NullPointerException();
- }
- return htmlParser.getReader();
- }
- /**
- * Private.
- * Parses HTML to extract document encoding specified in HTTP
- * equivalent META tag in the document header. Example of such META tag is
- * <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
- * @return String or null if encoding not found
- */
- public String getCharsetFromHTML(InputStream is) {
- // Set up an ascii reader for the document (documents should not use
- // other characters before encoding is defined)
- Reader asciiReader = new ASCIIReader(is, MAX_OFFSET);
- StreamTokenizer tokenizer = new StreamTokenizer(asciiReader);
-
- // tokenizer.eolIsSignificant(false);// default false
- // tokenizer.slashSlashComments(false); // default false
- // tokenizer.slashStarComments(false);// default false
- tokenizer.lowerCaseMode(false);
-
- // tokenizer.quoteChar('\"'); // default quote char
- tokenizer.ordinaryChar('\''); // default quote char
- tokenizer.ordinaryChar('/'); // default comment character
-
- String charset = getCharsetFromHTMLTokens(tokenizer);
- if (asciiReader != null) {
- try {
- asciiReader.close();
- } catch (IOException ioe) {
- }
- }
- return charset;
- }
- public String getCharsetFromHTMLTokens(StreamTokenizer tokenizer) {
- // keeps track of content attribute attribute until parsing
- // of the meta tag is complete
- String contentValue = null;
-
- // initialize states
- int stateContent = STATE_HTTP_START;
- int stateElement = STATE_ELEMENT_START;
- int stateHttp = STATE_HTTP_START;
-
- try {
- // in the worst case, process tokens until end of file
- for (int token = tokenizer.nextToken();
- token != StreamTokenizer.TT_EOF;
- token = tokenizer.nextToken()) {
- // debug tokens
- // if (token == StreamTokenizer.TT_WORD) {
- // System.out.println("word =" + tokenizer.sval);
- // } else if (token == StreamTokenizer.TT_NUMBER) {
- // System.out.println("number =" + tokenizer.nval);
- // } else if (token == StreamTokenizer.TT_EOL) {
- // System.out.println("endofline=");
- // } else if ((char) token == '\"') {
- // System.out.println("\" =" + tokenizer.sval);
- //
- // } else {
- // System.out.println("else =" + (char) token);
- // }
-
- // process input based depending on current state
- switch (stateElement) {
- case STATE_ELEMENT_START :
- if (token == '<') {
- stateElement = STATE_ELEMENT_AFTER_LT;
- } // else do nothing, cannot be beginning of META tag
- break;
- case STATE_ELEMENT_AFTER_LT :
- if (token == StreamTokenizer.TT_WORD) {
- // some element opened
- if (ELEMENT_META
- .equalsIgnoreCase(tokenizer.sval)) {
- // META element opened
- stateElement = STATE_ELEMENT_META;
- // initialize state of attributes
- stateHttp = STATE_HTTP_START;
- stateContent = STATE_CONTENT_START;
- contentValue = null;
- } else if (
- ELEMENT_BODY.equalsIgnoreCase(
- tokenizer.sval)) {
- // body element opened, we are too far, stop processing input
- return null;
- } else {
- // some other element opened, start from initial state
- stateElement = STATE_ELEMENT_START;
- }
- } else if (token == '/') {
- // can be begging of head closing
- stateElement = STATE_ELEMENT_AFTER_LT_SLASH;
- } else {
- // not an element opened, could be openning of declaration
- // or element closing e.t.c.
- stateElement = STATE_ELEMENT_START;
- }
- break;
- case STATE_ELEMENT_AFTER_LT_SLASH :
- if (token == StreamTokenizer.TT_WORD
- && ELEMENT_HEAD.equalsIgnoreCase(tokenizer.sval)) {
- // head element closed, we are too far, stop processing input
- return null;
- } else {
- stateElement = STATE_ELEMENT_START;
- }
- break;
- default : // STATE_META_IN :
- switch (token) {
- case '>' :
- // no longer inside META, start from initial state
- stateElement = STATE_ELEMENT_START;
- break;
- case StreamTokenizer.TT_WORD :
- // string inside META tag, can be attribute name
- if (ATTRIBUTE_HTTP
- .equalsIgnoreCase(tokenizer.sval)) {
- // found HTTP-EQUIV attribute name
- stateHttp = STATE_HTTP_AFTER_NAME;
- } else if (
- ATTRIBUTE_CONTENT.equalsIgnoreCase(
- tokenizer.sval)) {
- // found CONTENT attribute name
- stateContent = STATE_CONTENT_AFTER_NAME;
- } else if (
- stateHttp == STATE_HTTP_AFTER_EQ
- && ATTRIBUTE_HTTP_VALUE.equalsIgnoreCase(
- tokenizer.sval)) {
- // value of HTTP-EQUIV attribute (unquoted)
- // we found <META ... HTTP-EQUIV=content-type
- stateHttp = STATE_HTTP_DONE;
- } else {
- // some other attribute name or string,
- // reset states of seeked attributes,
- // unless successfully processed earlier
- if (stateHttp != STATE_HTTP_DONE) {
- stateHttp = STATE_HTTP_START;
- }
- if (stateContent != STATE_CONTENT_DONE) {
- stateContent = STATE_CONTENT_START;
- }
- }
- break;
- case '=' :
- // = inside META tag, can separate interesing us
- // attribute names from values
- if (stateHttp == STATE_HTTP_AFTER_NAME) {
- // we have HTTP-EQUIV=
- stateHttp = STATE_HTTP_AFTER_EQ;
- } else if (
- stateContent == STATE_CONTENT_AFTER_NAME) {
- // we have CONTENT=
- stateContent = STATE_CONTENT_AFTER_EQ;
- } else {
- // equal sign after some other attribute name or string,
- // reset states of seeked attributes,
- // unless successfully processed earlier
- if (stateHttp != STATE_HTTP_DONE) {
- stateHttp = STATE_HTTP_START;
- }
- if (stateContent != STATE_CONTENT_DONE) {
- stateContent = STATE_CONTENT_START;
- }
- }
- break;
- case '\"' :
- // quoted string inside META tag, can be attribute value
- if (stateHttp == STATE_HTTP_AFTER_EQ) {
- // value of HTTP-EQUIV attribute
- if (ATTRIBUTE_HTTP_VALUE
- .equalsIgnoreCase(tokenizer.sval)) {
- // we found <META ... HTTP-EQUIV="content-type"
- stateHttp = STATE_HTTP_DONE;
- }
- } else if (
- stateContent == STATE_CONTENT_AFTER_EQ) {
- // value of CONTENT attribute
- stateContent = STATE_CONTENT_DONE;
- // save the value of the attribute
- // if attribue HTTP-EQUIV="content-type" is found
- // in the same META tag, this value might have
- // Content-type entity header
- contentValue = tokenizer.sval;
- } else {
- // value for the attribute is missing
- // reset states of seeked attributes,
- // unless successfully processed earlier
- if (stateHttp != STATE_HTTP_DONE) {
- stateHttp = STATE_HTTP_START;
- }
- if (stateContent != STATE_CONTENT_DONE) {
- stateContent = STATE_CONTENT_START;
- }
- }
- break;
- default :
- // other unexpected token inside META tag
- // reset states of seeked attributes,
- // unless successfully processed earlier
- if (stateHttp != STATE_HTTP_DONE) {
- stateHttp = STATE_HTTP_START;
- }
- if (stateContent != STATE_CONTENT_DONE) {
- stateContent = STATE_CONTENT_START;
- }
- break;
- }
- break;
- }
- if (contentValue != null
- && stateHttp == STATE_HTTP_DONE
- && stateContent == STATE_CONTENT_DONE) {
- // <META HTTP-EQUIV="content-type" CONTENT="*******"
- // parse vale of content attribute to extract encoding
- return getCharsetFromHTTP(contentValue);
- }
-
- }
- } catch (IOException ioe) {
- return null;
- }
- // end of file
- return null;
- }
- /**
- * Parses HTTP1.1 Content-Type entity-header field
- * for example, Content-Type: text/html; charset=ISO-8859-4,
- * and extracts charset parameter value of the media sub type.
- * @param media-type, for example Content-Type: text/html; charset=ISO-8859-4
- * @return value of charset parameter, for example ISO-8859-4
- * or null if parameter does not exist
- */
- public String getCharsetFromHTTP(String contentValue) {
- StringTokenizer t = new StringTokenizer(contentValue, ";");
- while (t.hasMoreTokens()) {
- String parameter = t.nextToken().trim();
- if (parameter.toLowerCase().startsWith("charset=")) {
- String charset =
- parameter.substring("charset=".length()).trim();
- if (charset.length() > 0) {
- return charset;
- }
- }
- }
- return null;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchHitCollector.java b/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchHitCollector.java
deleted file mode 100644
index 10ee4cebf..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchHitCollector.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import org.apache.lucene.search.Hits;
-
-/**
- * Search hit coollector. The search engine adds hits to it.
- */
-public interface ISearchHitCollector {
- /**
- * Adds hits to the result
- * @param Hits hits
- */
- public void addHits(Hits hits, String wordsSearched);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchQuery.java b/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchQuery.java
deleted file mode 100644
index e30b1e894..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/ISearchQuery.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.util.Collection;
-
-public interface ISearchQuery {
- /**
- * Obtains names of fields in addition to default field
- */
- public Collection getFieldNames();
- /**
- * Obtains search word (user query)
- */
- public String getSearchWord();
- /**
- * @return true if search only in specified fields, not the default field
- */
- public boolean isFieldSearch();
- /**
- * Obtains locale
- */
- public String getLocale();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/IndexingOperation.java b/org.eclipse.help/src/org/eclipse/help/internal/search/IndexingOperation.java
deleted file mode 100644
index eaf6093a4..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/IndexingOperation.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.net.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.toc.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Indexing Operation represents a long operation,
- * which performs indexing of the group (Collection) of documents.
- * It is used Internally by SlowIndex and returned by its getIndexUpdateOperation() method.
- */
-class IndexingOperation {
- private int numAdded;
- private int numRemoved;
- private SearchIndex index = null;
- // Constants for alocating progress among subtasks.
- // The goal is to have a ratio among them
- // that results in work accumulating at a constant rate.
- private final static int WORK_PREPARE = 1; // * all documents
- private final static int WORK_DELETEDOC = 5; // * removed documents
- private final static int WORK_INDEXDOC = 50; // * added documents
- private final static int WORK_SAVEINDEX = 2; // * all documents
- private int workTotal;
- /**
- * Construct indexing operation.
- * @param ix ISearchIndex already opened
- * @param removedDocs collection of removed documents, including changed ones
- * @param addedDocs collection of new documents, including changed ones
- */
- public IndexingOperation(SearchIndex ix) {
- this.index = ix;
- }
-
- private void checkCancelled(IProgressMonitor pm)
- throws OperationCanceledException {
- if (pm.isCanceled())
- throw new OperationCanceledException();
- }
- /**
- * Executes indexing, given the progress monitor.
- * @param monitor progres monitor to be used during this long operation
- * for reporting progress
- * @throws OperationCanceledException if indexing was cancelled
- * @throws Exception if error occured
- */
- protected void execute(IProgressMonitor pm)
- throws OperationCanceledException, IndexingException {
- Collection removedDocs = getRemovedDocuments(index);
- numRemoved = removedDocs.size();
- Collection addedDocs = getAddedDocuments(index);
- numAdded = addedDocs.size();
-
- workTotal =
- (numRemoved + numAdded) * WORK_PREPARE
- + numAdded * WORK_INDEXDOC
- + (numRemoved + numAdded) * WORK_SAVEINDEX;
-
- if (numRemoved > 0) {
- workTotal += (numRemoved + numAdded) * WORK_PREPARE
- + numRemoved * WORK_DELETEDOC
- + (numRemoved + numAdded) * WORK_SAVEINDEX;
- }
- // if collection is empty, we may return right away
- // need to check if we have to do anything to the progress monitor
- if (numRemoved + numAdded <= 0) {
- pm.done();
- return;
- }
-
- LazyProgressMonitor monitor = new LazyProgressMonitor(pm);
- monitor.beginTask("", workTotal);
- removeDocuments(monitor, removedDocs);
- addDocuments(monitor, addedDocs);
- monitor.done();
- }
-
- private void addDocuments(IProgressMonitor pm, Collection addedDocs)
- throws IndexingException {
- // Do not check here if (addedDocs.size() > 0), always perform add batch
- // to ensure that index is created and saved even if no new documents exist
-
- // now add all the new documents
- if (!index.beginAddBatch()) {
- throw new IndexingException();
- }
- try {
- checkCancelled(pm);
- pm.worked((numRemoved + numAdded) * WORK_PREPARE);
- pm.subTask(Resources.getString("UpdatingIndex"));
- for (Iterator it = addedDocs.iterator(); it.hasNext();) {
- URL doc = (URL) it.next();
- index.addDocument(getName(doc), doc);
- checkCancelled(pm);
- pm.worked(WORK_INDEXDOC);
- }
- } catch (OperationCanceledException oce) {
- // Need to perform rollback on the index
- pm.subTask(Resources.getString("Undoing_document_adds"));
- // if (!index.abortUpdate())
- // throw new Exception();
- throw oce;
- }
- pm.subTask(Resources.getString("Writing_index"));
- if (!index.endAddBatch())
- throw new IndexingException();
- }
-
- private void removeDocuments(IProgressMonitor pm, Collection removedDocs)
- throws IndexingException {
-
- pm.subTask(Resources.getString("Preparing_for_indexing"));
- checkCancelled(pm);
-
- if (numRemoved > 0) {
- if (!index.beginDeleteBatch())
- throw new IndexingException();
- try {
- checkCancelled(pm);
- pm.worked((numRemoved + numAdded) * WORK_PREPARE);
- pm.subTask(Resources.getString("UpdatingIndex"));
- for (Iterator it = removedDocs.iterator(); it.hasNext();) {
- URL doc = (URL) it.next();
- index.removeDocument(getName(doc));
- checkCancelled(pm);
- pm.worked(WORK_DELETEDOC);
- }
- } catch (OperationCanceledException oce) {
- // Need to perform rollback on the index
- pm.subTask(Resources.getString("Undoing_document_deletions"));
- // if (!index.abortUpdate())
- // throw new Exception();
- throw oce;
- }
- if (!index.endDeleteBatch()) {
- throw new IndexingException();
- }
- pm.worked((numRemoved + numAdded) * WORK_SAVEINDEX);
- }
- }
- /**
- * Returns the document identifier. Currently we use the
- * document file name as identifier.
- */
- private String getName(URL doc) {
- String name = doc.getFile();
- // remove query string if any
- int i = name.indexOf('?');
- if (i != -1)
- name = name.substring(0, i);
- return name;
- }
- public class IndexingException extends Exception {
- }
- /**
- * Returns the documents to be added to index.
- * The collection consists of the associated PluginURL objects.
- */
- private Collection getAddedDocuments(SearchIndex index) {
- // Get the list of added plugins
- Collection addedPlugins = index.getDocPlugins().getAdded();
- if (addedPlugins == null || addedPlugins.isEmpty())
- return new ArrayList(0);
- // get the list of all navigation urls.
- Set urls = getAllDocuments(index.getLocale());
- Set addedDocs = new HashSet(urls.size());
- for (Iterator docs = urls.iterator(); docs.hasNext();) {
- 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);
- if (!addedPlugins.contains(plugin)) {
- continue;
- }
-
- URL url = getIndexableURL(doc);
- if (url != null) {
- addedDocs.add(url);
- }
- }
- return addedDocs;
- }
-
- /**
- * Returns the documents to be removed from index.
- * The collection consists of the associated PluginURL objects.
- */
- private Collection getRemovedDocuments(SearchIndex index) {
- // Get the list of removed plugins
- Collection removedPlugins = index.getDocPlugins().getRemoved();
- if (removedPlugins == null || removedPlugins.isEmpty())
- return new ArrayList(0);
- // get the list of indexed docs. This is a hashtable (url, plugin)
- HelpProperties indexedDocs = index.getIndexedDocs();
- Set removedDocs = new HashSet(indexedDocs.size());
- for (Iterator docs = indexedDocs.keySet().iterator();
- docs.hasNext();
- ) {
- 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);
- if (!removedPlugins.contains(plugin)) {
- continue;
- }
-
- URL url = getIndexableURL(doc);
- if (url != null) {
- removedDocs.add(url);
- }
- }
- return removedDocs;
- }
- /**
- * Adds the topic and its subtopics to the list of documents
- */
- private void add(ITopic topic, Set hrefs) {
- String href = topic.getHref();
- if (href != null && !href.equals("") && !href.startsWith("http://"))
- hrefs.add(href);
- ITopic[] subtopics = topic.getSubtopics();
- for (int i = 0; i < subtopics.length; i++)
- add(subtopics[i], hrefs);
- }
- /**
- * Returns the collection of href's for all the help topics.
- */
- private Set getAllDocuments(String locale) {
- HashSet hrefs = new HashSet();
- IToc[] tocs = HelpSystem.getTocManager().getTocs(locale);
- for (int i = 0; i < tocs.length; i++) {
- ITopic[] topics = tocs[i].getTopics();
- for (int j = 0; j < topics.length; j++) {
- add(topics[j], hrefs);
- }
- if (tocs[i] instanceof Toc) {
- topics = ((Toc) tocs[i]).getExtraTopics();
- for (int j = 0; j < topics.length; j++) {
- add(topics[j], hrefs);
- }
- }
- ITopic tocDescriptionTopic = tocs[i].getTopic(null);
- if (tocDescriptionTopic != null)
- add(tocDescriptionTopic, hrefs);
- }
- return hrefs;
- }
- /**
- * Checks if document is indexable, and creates
- * a URL to obtain contents.
- * @param url specified in the navigation
- * @return URL to obtain document content or null
- */
- private URL getIndexableURL(String url) {
- String fileName = url.toLowerCase();
- if (fileName.endsWith(".htm")
- || fileName.endsWith(".html")
- || fileName.endsWith(".txt")
- || fileName.endsWith(".xml")) {
- // indexable
- } else if (
- fileName.indexOf(".htm#") >= 0
- || fileName.indexOf(".html#") >= 0
- || fileName.indexOf(".xml#") >= 0) {
- url = url.substring(0, url.lastIndexOf('#'));
- // its a fragment, index whole document
- } else {
- // not indexable
- return null;
- }
-
- try {
- return new URL("help:" + url + "?lang=" + index.getLocale());
- } catch (MalformedURLException mue) {
- return null;
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/LazyProgressMonitor.java b/org.eclipse.help/src/org/eclipse/help/internal/search/LazyProgressMonitor.java
deleted file mode 100644
index 8e277db13..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/LazyProgressMonitor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import org.eclipse.core.runtime.IProgressMonitor;
-import java.lang.String;
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-/**
- * Progress Monitor, that accumulates work without
- * communicating it immidiately to the underlying monitor.
- * The work is sent in larger chunks for performance reasons.
- */
-class LazyProgressMonitor extends ProgressMonitorWrapper {
- // maximum number of times worked() should be called
- // on underlying progress monitor
- private static final int MAX_STEPS = 100;
- private final IProgressMonitor monitor;
- private int totalWork;
- private int work;
- private int lastWorked;
- private int treshold;
- protected LazyProgressMonitor(IProgressMonitor monitor) {
- super(monitor);
- this.monitor = monitor;
- }
- /**
- * @see IProgressMonitor#beginTask
- */
- public void beginTask(String name, int totalWork) {
- if (totalWork > 0) {
- this.totalWork = totalWork;
- }
- monitor.beginTask(name, totalWork);
- work = 0;
- lastWorked = 0;
- treshold = 1 + totalWork / MAX_STEPS;
- }
- /**
- * @see IProgressMonitor#worked
- */
- public void worked(int newWork) {
- this.work += newWork;
- if (work >= treshold) {
- monitor.worked(work - lastWorked);
- lastWorked = work;
- treshold = work + 1 + totalWork / MAX_STEPS;
- }
-
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/ParsedDocument.java b/org.eclipse.help/src/org/eclipse/help/internal/search/ParsedDocument.java
deleted file mode 100644
index 36c0391e3..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/ParsedDocument.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-
-/**
- * Parsed Document.
- * It can be used to obtain multiple readers for the same document.
- */
-public class ParsedDocument {
- // Limit on how many characters will be indexed
- // from a large document
- private static final int charsLimit = 1000000;
- Reader reader;
- boolean read;
- char[] docChars;
-
- /**
- * Constructor for ParsedDocument.
- * @param reader reader obtained from the parser
- */
- public ParsedDocument(Reader reader) {
- this.reader = reader;
- this.read = false;
- }
- public Reader newContentReader() {
- if (!read) {
- read = true;
- readDocument();
- }
- return new CharArrayReader(docChars);
- }
- private void readDocument() {
- CharArrayWriter writer = new CharArrayWriter();
- char[] buf = new char[4096];
- int n;
- int charsWritten = 0;
- try {
- while (0 <= (n = reader.read(buf))) {
- if (charsWritten < charsLimit) {
- if (n > charsLimit - charsWritten) {
- // do not exceed the specified limit of characters
- writer.write(buf, 0, charsLimit - charsWritten);
- charsWritten = charsLimit;
- } else {
- writer.write(buf, 0, n);
- charsWritten += n;
- }
- } else {
- // do not break out of the loop
- // keep reading to avoid breaking pipes
- }
- }
- } catch (IOException ioe) {
- // do not do anything, will use characters read so far
- } finally {
- try {
- reader.close();
- } catch (IOException ioe2) {
- }
- }
- docChars = writer.toCharArray();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/ProgressDistributor.java b/org.eclipse.help/src/org/eclipse/help/internal/search/ProgressDistributor.java
deleted file mode 100644
index c15e53e3c..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/ProgressDistributor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Distributes progress information from this monitor
- * to multiple monitors.
- */
-public class ProgressDistributor implements IProgressMonitor {
- private int totalWork = -1;
- private int worked = 0;
- private boolean done = false;
- String taskName;
- String subTaskName;
- /**
- * Map work indexed by montitor
- */
- private Collection monitors = new ArrayList();
-
- /**
- * @see IProgressMonitor#beginTask(String, int)
- */
- public synchronized void beginTask(String name, int totalWork) {
- this.totalWork = totalWork;
- this.worked=0;
- this.done=false;
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- m.beginTask(name, totalWork);
- }
- }
-
- /**
- * @see IProgressMonitor#done()
- */
- public synchronized void done() {
- done = true;
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- m.done();
- }
- }
-
- /**
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- }
-
- /**
- * @see IProgressMonitor#isCanceled()
- */
- public synchronized boolean isCanceled() {
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- if(m.isCanceled()){
- return true;
- }
- }
- return false;
- }
-
- /**
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean value) {
- }
-
- /**
- * @see IProgressMonitor#setTaskName(String)
- */
- public synchronized void setTaskName(String name) {
- taskName = name;
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- m.setTaskName(name);
- }
- }
-
- /**
- * @see IProgressMonitor#subTask(String)
- */
- public synchronized void subTask(String name) {
- subTaskName = name;
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- m.subTask(name);
- }
- }
-
- /**
- * @see IProgressMonitor#worked(int)
- */
- public synchronized void worked(int work) {
- worked += work;
- for (Iterator it = monitors.iterator(); it.hasNext();) {
- IProgressMonitor m = (IProgressMonitor) it.next();
- m.worked(work);
- }
- }
- public synchronized void addMonitor(IProgressMonitor m) {
- if (totalWork > -1)
- m.beginTask(taskName, totalWork);
- if (subTaskName != null)
- m.subTask(subTaskName);
- if (worked > 0)
- m.worked(worked);
- if (done)
- m.done();
- monitors.add(m);
- }
- public synchronized void removeMonitor(IProgressMonitor m) {
- monitors.remove(m);
- }
- public synchronized void operationCanceled(){
- totalWork = -1;
- worked = 0;
- done = false;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryBuilder.java b/org.eclipse.help/src/org/eclipse/help/internal/search/QueryBuilder.java
deleted file mode 100644
index e23ab3638..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryBuilder.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import java.io.*;
-import java.util.*;
-
-import org.apache.lucene.analysis.*;
-import org.apache.lucene.index.*;
-import org.apache.lucene.search.*;
-import org.eclipse.help.internal.*;
-/**
- * Build query acceptable by the search engine.
- */
-public class QueryBuilder {
- // Maximum allowed number of terms
- private static final int MAX_TERMS = 10;
- // Maximum allowed number of ORs
- private static final int MAX_UNIONS = 4;
- // Maximum allowed number terms with wild cards
- private static final int MAX_WILD_TERMS = 2;
- // Query from user
- private String searchWords;
- // Descriptor of Analyzer to process the query words
- private AnalyzerDescriptor analyzerDesc;
- // Analyzer to process the query words
- private Analyzer analyzer;
-
- // List of QueryWordsToken
- private List analyzedTokens;
-
- // List of words to highlight
- private List highlightWords = new ArrayList();
-
- private Locale locale;
-
- /**
- * Creates a query builder for the search word. The search word is processed
- * by a lexical analyzer.
- */
- public QueryBuilder(String searchWords, AnalyzerDescriptor analyzerDesc) {
- this.searchWords = searchWords;
- String language = analyzerDesc.getLang();
- if (language.length() >= 5) {
- this.locale =
- new Locale(language.substring(0, 2), language.substring(3, 5));
- } else {
- this.locale = new Locale(language.substring(0, 2), "");
- }
- this.analyzerDesc = analyzerDesc;
- this.analyzer = analyzerDesc.getAnalyzer();
- }
- /**
- * Splits user query into tokens and returns a list of QueryWordsToken's.
- */
- private List tokenizeUserQuery(String searchWords) {
- List tokenList = new ArrayList();
- //Divide along quotation marks
- StringTokenizer qTokenizer =
- new StringTokenizer(searchWords.trim(), "\"", true);
- boolean withinQuotation = false;
- String quotedString = "";
- 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 (withinQuotation) {
- // check for too many terms
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER
- && ++termCount > MAX_TERMS) {
- throw new QueryTooComplexException();
- }
-
- tokenList.add(QueryWordsToken.exactPhrase(quotedString));
- } else {
- quotedString = "";
- }
- withinQuotation = !withinQuotation;
- continue;
- } else if (withinQuotation) {
- quotedString = curToken;
- continue;
- } else {
- //divide unquoted strings along white space
- StringTokenizer parser = new StringTokenizer(curToken.trim());
- while (parser.hasMoreTokens()) {
- String token = parser.nextToken();
- if (token.equalsIgnoreCase(QueryWordsToken.AND().value)) {
- tokenList.add(QueryWordsToken.AND());
- } else if (
- token.equalsIgnoreCase(QueryWordsToken.OR().value)) {
- // Check for too many OR terms
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER
- && ++orCount > MAX_UNIONS) {
- throw new QueryTooComplexException();
- }
-
- tokenList.add(QueryWordsToken.OR());
- } else if (
- token.equalsIgnoreCase(QueryWordsToken.NOT().value)) {
- tokenList.add(QueryWordsToken.NOT());
- } else {
- // check for too many terms
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER
- && ++termCount > MAX_TERMS) {
- throw new QueryTooComplexException();
- }
-
- tokenList.add(QueryWordsToken.word(token));
- }
- }
- }
- }
- return tokenList;
- }
- /**
- * Apply the Analyzer to the search tokens and return the list of processed QueryWordsToken's.
- */
- private List analyzeTokens(List tokens) {
- List newTokens = new ArrayList();
- int wildCardTermCount = 0;
- for (int i = 0; i < tokens.size(); i++) {
- QueryWordsToken token = (QueryWordsToken) tokens.get(i);
- if (token.type == QueryWordsToken.WORD) {
- int questionMIndex = token.value.indexOf('?');
- int starIndex = token.value.indexOf('*');
- if (starIndex >= 0 || questionMIndex >= 0) {
- if (HelpSystem.getMode() == HelpSystem.MODE_INFOCENTER
- && ++wildCardTermCount > MAX_WILD_TERMS) {
- throw new QueryTooComplexException();
- }
-
- if (questionMIndex != 0 && starIndex != 0) {
- newTokens.add(
- QueryWordsToken.word(
- token.value.toLowerCase(locale)));
-
- // add word to the list of words to highlight
- if (!highlightWords.contains(token.value)) {
- highlightWords.add(token.value);
- }
- } else {
- // wild card not allowed as the first character
- }
- } else {
- List wordList =
- analyzeText(analyzer, "contents", token.value);
-
- if (wordList.size() > 0) {
- if (!highlightWords.contains(token.value)) {
- // add original word to the list of words to highlight
- highlightWords.add(token.value);
- }
-
- if (wordList.size() == 1) {
- String word = (String) wordList.get(0);
- newTokens.add(QueryWordsToken.word(word));
-
- // add analyzed word to the list of words to highlight
- // this is required to highlight stemmed words
- if (!highlightWords.contains(word)) {
- highlightWords.add(word);
- }
- } else {
- QueryWordsPhrase phrase = QueryWordsToken.phrase();
- for (Iterator it = wordList.iterator();
- it.hasNext();
- ) {
- String word = (String) it.next();
- phrase.addWord(word);
-
- // add each analyzed word to the list of words to highlight
- // this is only required to highlight stemmed words.
- // Adding words should not be done when DefaultAnalyzer is used,
- // because it does not perform stemming and common words removal
- // which would result in common characters highlighted all over (bug 30263)
- if (!analyzerDesc
- .getId()
- .startsWith(HelpPlugin.PLUGIN_ID + "#")) {
- if (!highlightWords.contains(word)) {
- highlightWords.add(word);
- }
- }
- }
- newTokens.add(phrase);
- }
- }
-
- }
- } else if (// forget ANDs
- /*token.type == SearchQueryToken.AND
- ||*/
- token.type == QueryWordsToken.OR
- || token.type == QueryWordsToken.NOT)
- newTokens.add(token);
- else if (token.type == QueryWordsToken.EXACT_PHRASE) {
- List wordList =
- analyzeText(analyzer, "exact_contents", token.value);
-
- if (wordList.size() > 0) {
- if (!highlightWords.contains(token.value)) {
- // add original word to the list of words to highlight
- highlightWords.add(token.value);
- }
- }
-
- QueryWordsExactPhrase phrase = QueryWordsToken.exactPhrase();
- for (Iterator it = wordList.iterator(); it.hasNext();) {
- String word = (String) it.next();
- phrase.addWord(word);
-
- // add analyzed word to the list of words to highlight
- // if (!highlightWords.contains(word))
- // highlightWords.add(word);
- }
- // add phrase only if not empty
- if (phrase.getWords().size() > 0) {
- newTokens.add(phrase);
- }
- }
- }
- return newTokens;
- }
- /**
- * Get a list of tokens corresponding to a search word or phrase
- * @return List of String
- */
- private List analyzeText(
- Analyzer analyzer,
- String fieldName,
- String text) {
- List words = new ArrayList(1);
- Reader reader = new StringReader(text);
- TokenStream tStream = analyzer.tokenStream(fieldName, reader);
- Token tok;
- try {
- while (null != (tok = tStream.next())) {
- words.add(tok.termText());
- }
- reader.close();
- } catch (IOException ioe) {
- }
- return words;
- }
- /**
- * Obtains Lucene Query from tokens
- * @return Query or null if no query could be created
- */
- private Query createLuceneQuery(
- List searchTokens,
- String[] fieldNames,
- float[] boosts) {
- // Get queries for parts separated by OR
- List requiredQueries =
- getRequiredQueries(searchTokens, fieldNames, boosts);
- if (requiredQueries.size() == 0)
- return null;
- else if (requiredQueries.size() <= 1)
- return (Query) requiredQueries.get(0);
- else /*if (requiredQueries.size() > 1) */
- // OR queries
- return (orQueries(requiredQueries));
- }
- /**
- * Obtains Lucene queries for token sequences separated at OR.
- * @return List of Query (could be empty)
- */
- private List getRequiredQueries(
- List tokens,
- String[] fieldNames,
- float[] boosts) {
- List oredQueries = new ArrayList();
- ArrayList requiredQueryTokens = new ArrayList();
- for (int i = 0; i < tokens.size(); i++) {
- QueryWordsToken token = (QueryWordsToken) tokens.get(i);
- if (token.type != QueryWordsToken.OR) {
- requiredQueryTokens.add(token);
- } else {
- Query reqQuery =
- getRequiredQuery(requiredQueryTokens, fieldNames, boosts);
- if (reqQuery != null)
- oredQueries.add(reqQuery);
- requiredQueryTokens = new ArrayList();
- }
- }
- Query reqQuery =
- getRequiredQuery(requiredQueryTokens, fieldNames, boosts);
- if (reqQuery != null)
- oredQueries.add(reqQuery);
- return oredQueries;
- }
- private Query orQueries(Collection queries) {
- BooleanQuery bq = new BooleanQuery();
- for (Iterator it = queries.iterator(); it.hasNext();) {
- Query q = (Query) it.next();
- bq.add(q, false, false);
- }
- return bq;
- }
- /**
- * Obtains Lucene Query for tokens containing only AND and NOT operators.
- * @return BooleanQuery or null if no query could be created from the tokens
- */
- private Query getRequiredQuery(
- List requiredTokens,
- String[] fieldNames,
- float[] boosts) {
- BooleanQuery retQuery = new BooleanQuery();
- boolean requiredTermExist = false;
- // Parse tokens left to right
- QueryWordsToken operator = null;
- for (int i = 0; i < requiredTokens.size(); i++) {
- QueryWordsToken token = (QueryWordsToken) requiredTokens.get(i);
- if (token.type == QueryWordsToken.AND
- || token.type == QueryWordsToken.NOT) {
- operator = token;
- continue;
- }
- // Creates queries for all fields
- Query qs[] = new Query[fieldNames.length];
- for (int f = 0; f < fieldNames.length; f++) {
- qs[f] = token.createLuceneQuery(fieldNames[f], boosts[f]);
- }
- // creates the boolean query of all fields
- Query q = qs[0];
- if (fieldNames.length > 1) {
- BooleanQuery allFieldsQuery = new BooleanQuery();
- for (int f = 0; f < fieldNames.length; f++)
- allFieldsQuery.add(qs[f], false, false);
- q = allFieldsQuery;
- }
- if (operator != null && operator.type == QueryWordsToken.NOT) {
- retQuery.add(q, false, true); // add as prohibited
- } else {
- retQuery.add(q, true, false); // add as required
- requiredTermExist = true;
- }
- }
- if (!requiredTermExist) {
- return null; // cannot search for prohibited only
- }
- return retQuery;
- }
- private Query getLuceneQuery(String[] fieldNames, float[] boosts) {
- Query luceneQuery =
- createLuceneQuery(analyzedTokens, fieldNames, boosts);
- return luceneQuery;
- }
- /**
- * @param fieldNames - Collection of field names of type String (e.g. "h1");
- * the search will be performed on the given fields
- * @param fieldSearch - boolean indicating if field only search
- * should be performed; if set to false, default field "contents"
- * and all other fields will be searched
- */
- public Query getLuceneQuery(Collection fieldNames, boolean fieldSearchOnly)
- throws QueryTooComplexException {
- // split search query into tokens
- List userTokens = tokenizeUserQuery(searchWords);
- analyzedTokens = analyzeTokens(userTokens);
- return buildLuceneQuery(fieldNames, fieldSearchOnly);
- }
- /**
- * @param fieldNames - Collection of field names of type String (e.g. "h1");
- * the search will be performed on the given fields
- * @param fieldSearch - boolean indicating if field only search
- * should be performed; if set to false, default field "contents"
- * and all other fields will be searched
- */
- private Query buildLuceneQuery(
- Collection fieldNames,
- boolean fieldSearchOnly) {
- String[] fields;
- float[] boosts;
- if (fieldSearchOnly) {
- fields = new String[fieldNames.size()];
- boosts = new float[fieldNames.size()];
- Iterator fieldNamesIt = fieldNames.iterator();
- for (int i = 0; i < fieldNames.size(); i++) {
- fields[i] = (String) fieldNamesIt.next();
- boosts[i] = 5.0f;
- }
- } else {
- fields = new String[fieldNames.size() + 1];
- boosts = new float[fieldNames.size() + 1];
- Iterator fieldNamesIt = fieldNames.iterator();
- for (int i = 0; i < fieldNames.size(); i++) {
- fields[i] = (String) fieldNamesIt.next();
- boosts[i] = 5.0f;
- }
- fields[fieldNames.size()] = "contents";
- boosts[fieldNames.size()] = 1.0f;
- }
- Query query = getLuceneQuery(fields, boosts);
- query = improveRankingForUnqotedPhrase(query, fields, boosts);
- return query;
- }
- /**
- * If user query contained only words (no quotaions nor operators)
- * extends query with term phrase representing entire user query
- * i.e for user string a b, the query a AND b will be extended
- * to "a b" OR a AND b
- */
- private Query improveRankingForUnqotedPhrase(
- Query query,
- String[] fields,
- float[] boosts) {
- if (query == null)
- return query;
- // check if all tokens are words
- for (int i = 0; i < analyzedTokens.size(); i++)
- if (((QueryWordsToken) analyzedTokens.get(i)).type
- != QueryWordsToken.WORD)
- return query;
- // Create phrase query for all tokens and OR with original query
- BooleanQuery booleanQuery = new BooleanQuery();
- booleanQuery.add(query, false, false);
- PhraseQuery[] phraseQueries = new PhraseQuery[fields.length];
- for (int f = 0; f < fields.length; f++) {
- phraseQueries[f] = new PhraseQuery();
- for (int i = 0; i < analyzedTokens.size(); i++) {
- Term t =
- new Term(
- fields[f],
- ((QueryWordsToken) analyzedTokens.get(i)).value);
- phraseQueries[f].add(t);
- }
- phraseQueries[f].setBoost(10 * boosts[f]);
- booleanQuery.add(phraseQueries[f], false, false);
- }
- return booleanQuery;
- }
- /**
- * Obtains analyzed terms from query as one string.
- * Words are double quoted, and separated by space.
- * The analyzed words are needed for highlighting
- * word roots.
- */
- public String gethighlightTerms() {
- StringBuffer buf = new StringBuffer();
- for (Iterator it = highlightWords.iterator(); it.hasNext();) {
- buf.append('"');
- buf.append(it.next());
- buf.append("\" ");
- }
-
- return buf.toString();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryTooComplexException.java b/org.eclipse.help/src/org/eclipse/help/internal/search/QueryTooComplexException.java
deleted file mode 100644
index a36ec3e33..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryTooComplexException.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-/**
- * Thrown to save resources, and not perform search
- * if search query seems too complicated.
- */
-public class QueryTooComplexException extends RuntimeException {
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java b/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java
deleted file mode 100644
index a9ac202f1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import java.util.*;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.*;
-/**
- * Represents a quoted token in user search query words
- */
-public class QueryWordsExactPhrase extends QueryWordsToken {
- private List words;
- public QueryWordsExactPhrase() {
- super(QueryWordsToken.EXACT_PHRASE, "");
- words = new ArrayList();
- }
- public void addWord(String word) {
- words.add(word);
- if (words.size() <= 1)
- value = word;
- else
- value += " " + word;
- }
- public List getWords() {
- return words;
- }
- /**
- * Creates a lucene query for a field
- */
- public Query createLuceneQuery(String field, float boost)
- {
- PhraseQuery q = new PhraseQuery();
- for (Iterator it = getWords().iterator(); it.hasNext();)
- {
- String word = (String) it.next();
- Term t = new Term("exact_"+field, word);
- q.add(t);
- q.setBoost(boost);
- }
- return q;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsPhrase.java b/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsPhrase.java
deleted file mode 100644
index 476ca5eb1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsPhrase.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import java.util.*;
-
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.*;
-/**
- * Represents a phrase (not quoted) token in user search query words
- * It consists of several words created by an analyzer
- */
-public class QueryWordsPhrase extends QueryWordsToken {
- private List words;
- public QueryWordsPhrase() {
- super(QueryWordsToken.PHRASE, "");
- words = new ArrayList();
- }
- public void addWord(String word) {
- words.add(word);
- if (words.size() <= 1)
- value = word;
- else
- value += " " + word;
- }
- public List getWords() {
- return words;
- }
- /**
- * Creates a lucene query for a field
- */
- public Query createLuceneQuery(String field, float boost)
- {
- PhraseQuery q = new PhraseQuery();
- for (Iterator it = getWords().iterator(); it.hasNext();)
- {
- String word = (String) it.next();
- Term t = new Term(field, word);
- q.add(t);
- q.setBoost(boost);
- }
- return q;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsToken.java b/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsToken.java
deleted file mode 100644
index 4e52f48b7..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/QueryWordsToken.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.*;
-/**
- * Represents a token in user search query words
- */
-public class QueryWordsToken {
- public static final int AND = 0;
- public static final int OR = 1;
- public static final int NOT = 2;
- 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");
- public int type;
- public String value;
- protected QueryWordsToken(int type, String value) {
- this.type = type;
- this.value = value;
- }
- /**
- * Creates a lucene query for a field
- */
- public Query createLuceneQuery(String field, float boost) {
- Query q;
- if (value.indexOf('?') >= 0 || value.indexOf('*') >= 0) {
- Term t = new Term("exact_"+field, value);
- q = new WildcardQuery(t);
- ((WildcardQuery) q).setBoost(boost);
- } else {
- Term t = new Term(field, value);
- q = new TermQuery(t);
- ((TermQuery) q).setBoost(boost);
- }
- // after updating Lucene, set boost on a Query class
- return q;
- }
- public static QueryWordsToken AND() {
- return fAND;
- }
- public static QueryWordsToken OR() {
- return fOR;
- }
- public static QueryWordsToken NOT() {
- return fNOT;
- }
- public static QueryWordsToken word(String word) {
- return new QueryWordsToken(QueryWordsToken.WORD, word);
- }
- public static QueryWordsPhrase phrase() {
- return new QueryWordsPhrase();
- }
- public static QueryWordsExactPhrase exactPhrase() {
- return new QueryWordsExactPhrase();
- }
- public static QueryWordsExactPhrase exactPhrase(String word) {
- QueryWordsExactPhrase token = new QueryWordsExactPhrase();
- token.addWord(word);
- return token;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchHit.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchHit.java
deleted file mode 100644
index be59f8dd0..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchHit.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import org.eclipse.help.IToc;
-
-/**
- * Search hit.
- */
-public class SearchHit {
- private String href;
- private String label;
- private float score;
- private IToc toc;
- /**
- * Constructor
- * @param toc TOC containing topic or null
- */
- public SearchHit(String href, String label, float score, IToc toc) {
- this.href = href;
- this.label = label;
- this.score = score;
- this.toc = toc;
- }
- /**
- * Gets the href.
- * @return Returns a String
- */
- public String getHref() {
- return href;
- }
-
- /**
- * Gets the label.
- * @return Returns a String
- */
- public String getLabel() {
- return label;
- }
- /**
- * Gets the score.
- * @return Returns a float
- */
- public float getScore() {
- return score;
- }
-
- /**
- * Gets the toc.
- * @return Returns IToc or null
- */
- public IToc getToc() {
- return toc;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- public void setScore(float score) {
- this.score = score;
- }
-
- public void setToc(IToc toc) {
- this.toc = toc;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchIndex.java
deleted file mode 100644
index e94816fa4..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchIndex.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.apache.lucene.document.*;
-import org.apache.lucene.index.*;
-import org.apache.lucene.search.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * 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 AnalyzerDescriptor analyzerDescriptor;
- private PluginVersionInfo docPlugins;
- private String indexedDocsFile;
- // 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 String dependenciesVersionFile;
- private File inconsistencyFile;
- private HTMLDocParser parser;
- private IndexSearcher searcher;
- private HelpProperties dependencies;
- /**
- * Constructor.
- * @param locale the locale this index uses
- * @param analyzerDesc the analyzer used to index
- */
- public SearchIndex(String locale, AnalyzerDescriptor analyzerDesc) {
- this(
- locale,
- analyzerDesc,
- new File(
- HelpPlugin.getDefault().getStateLocation().toOSString()
- + File.separator
- + "nl"
- + File.separator
- + locale));
- }
- /**
- * Constructor.
- * @param locale the locale this index uses
- * @param analyzerDesc the analyzer used to index
- */
- public SearchIndex(
- String locale,
- AnalyzerDescriptor analyzerDesc,
- File indexDir) {
- super();
- this.locale = locale;
- this.indexDir = indexDir;
- this.analyzerDescriptor = analyzerDesc;
- inconsistencyFile =
- new File(indexDir.getParentFile(), locale + ".inconsistent");
- dependenciesVersionFile =
- "nl"
- + File.separator
- + locale
- + File.separator
- + DEPENDENCIES_VERSION_FILENAME;
- indexedDocsFile =
- "nl" + File.separator + locale + File.separator + INDEXED_DOCS_FILE;
- parser = new HTMLDocParser();
- if (!exists()) {
- unzipProductIndex();
- }
- }
- /**
- * Indexes one document from a stream.
- * Index has to be open and close outside of this method
- * @param name the document identifier (could be a URL)
- * @param url the URL of the document
- * @return true if success
- */
- public boolean addDocument(String name, URL url) {
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- "SearchIndex.addDocument(" + name + ", " + url + ")");
- }
- try {
- Document doc = new Document();
- doc.add(Field.Keyword("name", name));
-
- try {
- try {
- parser.openDocument(url);
- } catch (IOException ioe) {
- HelpPlugin.logError(
- Resources.getString("ES25", name),
- null);
- return false;
- }
- ParsedDocument parsed =
- new ParsedDocument(parser.getContentReader());
-
- doc.add(Field.Text("contents", parsed.newContentReader()));
- doc.add(
- Field.Text("exact_contents", parsed.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.UnIndexed("summary", parser.getSummary()));
- iw.addDocument(doc);
- } finally {
- parser.closeDocument();
- }
- indexedDocs.put(name, "0");
- return true;
- } catch (IOException e) {
- HelpPlugin.logError(
- Resources.getString("ES16", name, indexDir.getAbsolutePath()),
- e);
- return false;
- }
- }
-
- /**
- * Starts additions.
- * To be called before adding documents.
- */
- public boolean beginAddBatch() {
- try {
- if (iw != null) {
- iw.close();
- }
- boolean create = false;
- if (!exists()) {
- create = true;
- indexDir.mkdirs();
- if (!indexDir.exists())
- return false; // unable to setup index directory
- }
- indexedDocs =
- new HelpProperties(indexedDocsFile, HelpPlugin.getDefault());
- indexedDocs.restore();
- setInconsistent(true);
- iw =
- new IndexWriter(
- indexDir,
- analyzerDescriptor.getAnalyzer(),
- create);
- iw.mergeFactor = 20;
- iw.maxFieldLength = 1000000;
- return true;
- } catch (IOException e) {
- HelpPlugin.logError(Resources.getString("ES17"), e);
- return false;
- }
- }
- /**
- * Starts deletions.
- * To be called before deleting documents.
- */
- public boolean beginDeleteBatch() {
- try {
- if (ir != null) {
- ir.close();
- }
- indexedDocs =
- new HelpProperties(indexedDocsFile, HelpPlugin.getDefault());
- indexedDocs.restore();
- setInconsistent(true);
- ir = IndexReader.open(indexDir);
- return true;
- } catch (IOException e) {
- HelpPlugin.logError(Resources.getString("ES18"), e);
- return false;
- }
- }
- /**
- * Deletes a single document from the index.
- * @param name - document name
- * @return true if success
- */
- public boolean removeDocument(String name) {
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println("SearchIndex.removeDocument(" + name + ")");
- }
- Term term = new Term("name", name);
- try {
- ir.delete(term);
- indexedDocs.remove(name);
- } catch (IOException e) {
- HelpPlugin.logError(
- Resources.getString("ES22", name, indexDir.getAbsolutePath()),
- e);
- return false;
- }
- return true;
- }
- /**
- * Finish additions.
- * To be called after adding documents.
- */
- public boolean endAddBatch() {
- try {
- if (iw == null)
- return false;
- iw.optimize();
- iw.close();
- // save the update info:
- // - all the docs
- // - plugins (and their version) that were indexed
- indexedDocs.save();
- indexedDocs = null;
- getDocPlugins().save();
- saveDependencies();
- setInconsistent(false);
- return true;
- } catch (IOException e) {
- HelpPlugin.logError(Resources.getString("ES19"), e);
- return false;
- }
- }
- /**
- * Finish deletions.
- * To be called after deleting documents.
- */
- public boolean endDeleteBatch() {
- try {
- if (ir == null)
- return false;
- ir.close();
- // save the update info:
- // - all the docs
- // - plugins (and their version) that were indexed
- indexedDocs.save();
- indexedDocs = null;
- getDocPlugins().save();
- saveDependencies();
- setInconsistent(false);
- return true;
- } catch (IOException e) {
- HelpPlugin.logError(Resources.getString("ES20"), e);
- return false;
- }
- }
- /**
- * Checks if index exists and is usable.
- * @return true if index exists
- */
- public boolean exists() {
- return indexDir.exists() && !isInconsistent();
- // assume index exists if directory does
- }
- /**
- * Performs a query search on this index
- * @param fieldNames - Collection of field names of type String (e.g. "h1");
- * the search will be performed on the given fields
- * @param fieldSearch - boolean indicating if field only search
- * should be performed; if set to false, default field "contents"
- * and all other fields will be searched
- * @param searchResult SearchResult that will contain all the hits
- * @return - an array of document ids.
- * Later, we can extend this to return more data (rank, # of occs, etc.)
- */
- public void search(ISearchQuery searchQuery, ISearchHitCollector collector)
- throws QueryTooComplexException {
- try {
- QueryBuilder queryBuilder =
- new QueryBuilder(
- searchQuery.getSearchWord(),
- analyzerDescriptor);
- Query luceneQuery =
- queryBuilder.getLuceneQuery(
- searchQuery.getFieldNames(),
- searchQuery.isFieldSearch());
- String highlightTerms = queryBuilder.gethighlightTerms();
- if (luceneQuery != null) {
- if (searcher == null) {
- openSearcher();
- }
- Hits hits = searcher.search(luceneQuery);
- collector.addHits(hits, highlightTerms);
- }
- } catch (QueryTooComplexException qe) {
- throw qe;
- } catch (Exception e) {
- HelpPlugin.logError(
- Resources.getString("ES21", searchQuery.getSearchWord()),
- e);
- }
- }
- public String getLocale() {
- return locale;
- }
- /**
- * Returns the list of all the plugins in this session
- * that have declared a help contribution.
- */
- public PluginVersionInfo getDocPlugins() {
- if (docPlugins == null) {
- Iterator docPluginsIterator =
- HelpSystem.getTocManager().getContributingPlugins().iterator();
- docPlugins =
- new PluginVersionInfo(
- "nl"
- + File.separator
- + locale
- + File.separator
- + INDEXED_CONTRIBUTION_INFO_FILE,
- docPluginsIterator,
- HelpPlugin.getDefault(),
- !exists());
- }
- return docPlugins;
- }
- /**
- * We use HelpProperties, but a list would suffice.
- * We only need the key values.
- * @return HelpProperties, keys are URLs of indexed documents
- */
- public HelpProperties getIndexedDocs() {
- HelpProperties indexedDocs =
- new HelpProperties(indexedDocsFile, HelpPlugin.getDefault());
- if (exists())
- indexedDocs.restore();
- return indexedDocs;
- }
- /**
- * Gets properties with versions of Lucene plugin and Analyzer
- * used for indexing
- */
- private HelpProperties getDependencies() {
- if (dependencies == null) {
- dependencies =
- new HelpProperties(
- dependenciesVersionFile,
- HelpPlugin.getDefault());
- dependencies.restore();
- }
- return dependencies;
- }
- /**
- * Gets analyzer identifier from a file.
- */
- private String readAnalyzerId() {
- String analyzerVersion = getDependencies().getProperty("analyzer");
- if (analyzerVersion == null) {
- return "";
- }
- return analyzerVersion;
- }
- /**
- * Gets Lucene plugin version from a file.
- */
- private boolean isLuceneCompatible() {
- String usedLuceneVersion = getDependencies().getProperty("lucene");
- String currentLuceneVersion = "";
- IPluginDescriptor lucenePluginDescriptor =
- Platform.getPluginRegistry().getPluginDescriptor(LUCENE_PLUGIN_ID);
- if (lucenePluginDescriptor != null) {
- currentLuceneVersion =
- lucenePluginDescriptor.getVersionIdentifier().toString();
- }
- // Later might add code to return true for other known cases
- // of compatibility between post 1.2.1 versions.
- return currentLuceneVersion.equals(usedLuceneVersion);
- }
- /**
- * Saves Lucene version and analyzer identifier to a file.
- */
- private void saveDependencies() {
- getDependencies().put("analyzer", analyzerDescriptor.getId());
-
- IPluginDescriptor lucenePluginDescriptor =
- Platform.getPluginRegistry().getPluginDescriptor(LUCENE_PLUGIN_ID);
- if (lucenePluginDescriptor != null) {
- getDependencies().put(
- "lucene",
- lucenePluginDescriptor.getVersionIdentifier().toString());
- } else {
- getDependencies().put("lucene", "");
- }
- getDependencies().save();
- }
- /**
- * @return Returns true if index has been left in inconsistent state
- * If analyzer has changed to incompatible one,
- * index is treated as inconsistent as well.
- */
- public boolean isInconsistent() {
- if (inconsistencyFile.exists()) {
- return true;
- }
- return !isLuceneCompatible()
- || !analyzerDescriptor.isCompatible(readAnalyzerId());
- }
- /**
- * Writes or deletes inconsistency flag file
- */
- public void setInconsistent(boolean inconsistent) {
- if (inconsistent) {
- try {
- // parent directory already created by beginAddBatch on new index
- FileOutputStream fos = new FileOutputStream(inconsistencyFile);
- fos.close();
- } catch (IOException ioe) {
- }
- } else
- inconsistencyFile.delete();
- }
-
- public synchronized void openSearcher() throws IOException {
- if (searcher == null) {
- searcher = new IndexSearcher(indexDir.getAbsolutePath());
- }
- }
- /**
- * Closes IndexReader used by Searcher.
- * Should be called on platform shutdown,
- * when no more reading from index is performed.
- */
- public void close() {
- if (searcher != null) {
- try {
- searcher.close();
- } catch (IOException ioe) {
- }
- }
- }
- /**
- * Returns the indexDir.
- * @return File
- */
- public File getIndexDir() {
- return indexDir;
- }
- /**
- * Finds and unzips prebuild index specified in preferences
- */
- private void unzipProductIndex() {
- String indexPluginId =
- HelpPlugin.getDefault().getPluginPreferences().getString(
- "productIndex");
- if (indexPluginId == null || indexPluginId.length() <= 0) {
- return;
- }
- InputStream zipIn =
- ResourceLocator.openFromPlugin(
- indexPluginId,
- "doc_index.zip",
- getLocale());
- if (zipIn == null) {
- return;
- }
- byte[] buf = new byte[8192];
- File destDir = getIndexDir();
- ZipInputStream zis = new ZipInputStream(zipIn);
- FileOutputStream fos = null;
- try {
- ZipEntry zEntry;
- while ((zEntry = zis.getNextEntry()) != null) {
- // if it is empty directory, create it
- if (zEntry.isDirectory()) {
- new File(destDir, zEntry.getName()).mkdirs();
- continue;
- }
- // if it is a file, extract it
- String filePath = zEntry.getName();
- int lastSeparator = filePath.lastIndexOf("/");
- String fileDir = "";
- if (lastSeparator >= 0) {
- fileDir = filePath.substring(0, lastSeparator);
- }
- //create directory for a file
- new File(destDir, fileDir).mkdirs();
- //write file
- File outFile = new File(destDir, filePath);
- fos = new FileOutputStream(outFile);
- int n = 0;
- while ((n = zis.read(buf)) >= 0) {
- fos.write(buf, 0, n);
- }
- fos.close();
- }
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- "SearchIndex: Prebuilt index restored to " + destDir + ".");
- }
-
- } catch (IOException ioe) {
- if (fos != null) {
- try {
- fos.close();
- } catch (IOException ioe2) {
- }
- }
- } finally {
- try {
- zipIn.close();
- if (zis != null)
- zis.close();
- } catch (IOException ioe) {
- }
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchManager.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchManager.java
deleted file mode 100644
index 1c743d805..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchManager.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Manages indexing and search for all infosets
- */
-public class SearchManager {
- /** Search indexes, by locale */
- private Map indexes = new HashMap();
- /** Caches analyzer descriptors for each locale */
- private Map analyzerDescriptors = new HashMap();
- /** Progress Distributors indexed by index */
- private Map progressDistibutors = new HashMap();
-
- /**
- * Constructs a Search manager.
- */
- public SearchManager() {
- super();
- }
- public SearchIndex getIndex(String locale) {
- synchronized (indexes) {
- Object index = indexes.get(locale);
- if (index == null) {
- index = new SearchIndex(locale, getAnalyzer(locale));
- indexes.put(locale, index);
- }
- return (SearchIndex) index;
- }
- }
- private ProgressDistributor getProgressDistributor(SearchIndex index) {
- synchronized (progressDistibutors) {
- Object distributor = progressDistibutors.get(index);
- if (distributor == null) {
- distributor = new ProgressDistributor();
- progressDistibutors.put(index, distributor);
- }
- return (ProgressDistributor) distributor;
- }
- }
- /**
- * Obtains AnalyzerDescriptor that indexing and search should
- * use for a given locale.
- * @param locale 2 or 5 character locale representation
- */
- private AnalyzerDescriptor getAnalyzer(String locale) {
- // get an analyzer from cache
- AnalyzerDescriptor analyzerDesc =
- (AnalyzerDescriptor) analyzerDescriptors.get(locale);
- if (analyzerDesc != null)
- return analyzerDesc;
-
- // obtain configured analyzer for this locale
- analyzerDesc = new AnalyzerDescriptor(locale);
- // save analyzer in the cache
- analyzerDescriptors.put(locale, analyzerDesc);
- String lang = analyzerDesc.getLang();
- if (locale != null && !locale.equals(lang))
- analyzerDescriptors.put(lang, analyzerDesc);
-
- return analyzerDesc;
- }
-
- /**
- * Searches index for documents containing an expression.
- */
- public void search(
- ISearchQuery searchQuery,
- ISearchHitCollector collector,
- IProgressMonitor pm)
- throws QueryTooComplexException {
- SearchIndex index = getIndex(searchQuery.getLocale());
- try {
- updateIndex(pm, index);
- if (!index.exists()) {
- //no indexable documents, hence no index
- //or index is corrupted
- return;
- }
- } catch (IndexingOperation.IndexingException ie) {
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- this.getClass().getName()
- + " IndexUpdateException occured.");
- }
- }
- index.search(searchQuery, collector);
- }
- /**
- * Returns true when the index in the specified locale
- * must be updated.
- */
- private boolean isIndexingNeeded(SearchIndex index) {
- if (!index.exists()) {
- return true;
- }
- return index.getDocPlugins().detectChange();
- }
- /**
- * Updates index. Checks if all contributions were indexed.
- * If not, it indexes them (Currently reindexes everything).
- * @throws OperationCanceledException if indexing was cancelled
- * @throws Exception if error occured
- */
- public void updateIndex(IProgressMonitor pm, SearchIndex index)
- throws OperationCanceledException, IndexingOperation.IndexingException {
- ProgressDistributor progressDistrib = getProgressDistributor(index);
- progressDistrib.addMonitor(pm);
- try {
- synchronized (this) {
- if (!isIndexingNeeded(index)) {
- pm.beginTask("", 1);
- pm.worked(1);
- pm.done();
- progressDistrib.removeMonitor(pm);
- return;
- }
- if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println(
- "SearchManager indexing " + index.getLocale());
- }
- // Perform indexing
- try {
- PluginVersionInfo versions = index.getDocPlugins();
- if (versions == null) {
- pm.beginTask("", 1);
- pm.worked(1);
- pm.done();
- progressDistrib.removeMonitor(pm);
- return;
- }
- IndexingOperation indexer = new IndexingOperation(index);
- indexer.execute(progressDistrib);
- } catch (OperationCanceledException oce) {
- progressDistrib.operationCanceled();
- HelpPlugin.logWarning(
- Resources.getString("Search_cancelled"));
- throw oce;
- }
- }
- } finally {
- progressDistrib.removeMonitor(pm);
- }
- }
- /**
- * Closes all indexes.
- */
- public void close() {
- for (Iterator it = indexes.values().iterator(); it.hasNext();) {
- ((SearchIndex) it.next()).close();
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchProgressMonitor.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
deleted file mode 100644
index 73b25f5cf..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.util.*;
-
-import org.apache.lucene.search.*;
-import org.eclipse.core.boot.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-
-/**
- * Progress monitor for search
- * @since 2.0
- */
-public class SearchProgressMonitor implements IProgressMonitor {
-
- // Progress monitors, indexed by locale
- private static Map progressMonitors = new HashMap();
-
- // Dummy collector for triggering a progress monitor
- private static ISearchHitCollector dummy_collector;
-
- private boolean started, done, canceled;
- private int totalWork = IProgressMonitor.UNKNOWN;
- private int currWork;
-
- static {
- dummy_collector = new ISearchHitCollector() {
- public void addHits(Hits h, String s) {
- }
- };
- }
-
- /**
- * Constructor.
- */
- public SearchProgressMonitor() {
- started = done = canceled = false;
- }
- public void beginTask(String name, int totalWork) {
- this.totalWork = totalWork;
- this.started = true;
- }
-
- public void done() {
- currWork = totalWork;
- this.done = true;
- this.started = true;
- }
-
- public void setTaskName(String name) {
- }
-
- public void subTask(String name) {
- }
-
- public void worked(int work) {
- currWork += work;
- if (currWork > totalWork)
- currWork = totalWork;
- else if (currWork < 0)
- currWork = 0;
- }
-
- public void internalWorked(double work) {
- }
-
- public int getPercentage() {
- if (done) {
- return 100;
- }
- if (totalWork == IProgressMonitor.UNKNOWN)
- return 0;
- if (currWork >= totalWork)
- return 100;
- return (int) (100 * currWork / totalWork);
- }
- /**
- * Gets the isCancelled.
- * @return Returns a boolean
- */
- public boolean isCanceled() {
- return canceled;
- }
-
- /**
- * Sets the isCanceled.
- * @param isCancelled The isCanceled to set
- */
- public void setCancelled(boolean canceled) {
- this.canceled = canceled;
- }
-
- /**
- * Gets the isStarted.
- * @return Returns a boolean
- */
- public boolean isStarted() {
- return started;
- }
-
- /**
- * Gets the isDone.
- * @return Returns a boolean
- */
- public boolean isDone() {
- return done;
- }
-
- /**
- * Sets the isCanceled.
- * @param isCanceled The isCanceled to set
- */
- public void setCanceled(boolean canceled) {
- this.canceled = canceled;
- }
-
- /**
- * Returns a progress monitor for specified query and locale
- */
- public static synchronized SearchProgressMonitor getProgressMonitor(final String locale) {
-
- // return an existing progress monitor if there is one
- if (progressMonitors.get(locale) != null)
- return (SearchProgressMonitor) progressMonitors.get(locale);
-
- final SearchProgressMonitor pm = new SearchProgressMonitor();
- progressMonitors.put(locale, pm);
-
- // spawn a thread that will cause indexing if needed
- Thread indexer = new Thread(new Runnable() {
- public void run() {
- try {
- HelpSystem.getSearchManager().search(
- new DummySearchQuery(locale),
- dummy_collector,
- pm);
- } catch (OperationCanceledException oce) {
- // operation cancelled
- // throw out the progress monitor
- progressMonitors.remove(locale);
- } catch (Exception e) {
- progressMonitors.remove(locale);
- if (BootLoader.isRunning()) {
- HelpPlugin.logError(
- Resources.getString("search_index_update_error"),
- e);
- }else{
- // Platform has shut down
- }
- }
- }
- });
- indexer.setName("HelpSearchIndexer");
- indexer.start();
- // give pm chance to start
- // this will avoid seing progress if there is no work to do
- while (!pm.isStarted()) {
- try {
- Thread.sleep(50);
- } catch (InterruptedException ie) {
- }
- if (progressMonitors.get(locale) == null)
- // operation got canceled
- break;
- }
-
- 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";
- }
- /**
- * @return true if search only in specified fields, not the default field
- */
- public boolean isFieldSearch() {
- return false;
- }
- /**
- * Obtains locale
- */
- public String getLocale() {
- return l;
- }
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchQuery.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchQuery.java
deleted file mode 100644
index d651d41c0..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchQuery.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.util.*;
-
-import org.eclipse.core.boot.*;
-
-/**
- * An implementation of ISearchQuery.
- */
-public class SearchQuery implements ISearchQuery {
- Collection fieldNames;
- boolean fieldSearch;
- String locale;
- String searchWord;
- public SearchQuery() {
- this("", false, new ArrayList(), BootLoader.getNL());
- }
- public SearchQuery(
- String searchWord,
- boolean fieldSearch,
- Collection fieldNames,
- String locale) {
- this.searchWord = searchWord;
- this.fieldSearch = fieldSearch;
- this.fieldNames = fieldNames;
- this.locale = locale;
- }
- /**
- * Returns the fieldNames.
- * @return Collection
- */
- public Collection getFieldNames() {
- return fieldNames;
- }
-
- /**
- * Returns the fieldSearch.
- * @return boolean
- */
- public boolean isFieldSearch() {
- return fieldSearch;
- }
-
- /**
- * Returns the locale.
- * @return String
- */
- public String getLocale() {
- return locale;
- }
-
- /**
- * Returns the searchWord.
- * @return String
- */
- public String getSearchWord() {
- return searchWord;
- }
-
- /**
- * Sets the fieldNames.
- * @param fieldNames The fieldNames to set
- */
- public void setFieldNames(Collection fieldNames) {
- this.fieldNames = fieldNames;
- }
-
- /**
- * Sets the fieldSearch.
- * @param fieldSearch The fieldSearch to set
- */
- public void setFieldSearch(boolean fieldSearch) {
- this.fieldSearch = fieldSearch;
- }
-
- /**
- * Sets the locale.
- * @param locale The locale to set
- */
- public void setLocale(String locale) {
- this.locale = locale;
- }
-
- /**
- * Sets the searchWord.
- * @param searchWord The searchWord to set
- */
- public void setSearchWord(String searchWord) {
- this.searchWord = searchWord;
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchResults.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SearchResults.java
deleted file mode 100644
index 6c6bf40c3..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SearchResults.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-import java.util.*;
-
-import org.apache.lucene.search.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-import org.eclipse.help.internal.workingset.*;
-
-/**
- * Search result collector.
- * Performs filtering and collects hits into an array of SearchHit
- */
-public class SearchResults implements ISearchHitCollector {
- // Collection of WorkingSet
- private ArrayList scopes;
- private int maxHits;
- private String locale;
- protected SearchHit[] searchHits = new SearchHit[0];
- /**
- * Constructor
- * @param workingSets working sets or null if no filtering
- */
- public SearchResults(WorkingSet[] workingSets, int maxHits, String locale) {
- this.maxHits = maxHits;
- this.locale = locale;
- this.scopes = getScopes(workingSets);
- }
- /**
- * Adds hits to the result
- * @param Hits hits
- */
- public void addHits(Hits hits, String highlightTerms) {
- String urlEncodedWords = URLCoder.encode(highlightTerms);
- List searchHitList = new ArrayList();
- float scoreScale = 1.0f;
- boolean scoreScaleSet = false;
- // need to keep track of previous score to work around
- // workaround for bug in Lucene 1.2.0 final
- float lastScore = Float.MAX_VALUE;
- for (int h = 0; h < hits.length() && h < maxHits; h++) {
- org.apache.lucene.document.Document doc;
- float score;
- try {
- doc = hits.doc(h);
- score = hits.score(h);
- } catch (IOException ioe) {
- continue;
- }
- String href = doc.get("name");
-
- IToc toc = null; // the TOC containing the topic
- AdaptableHelpResource scope = null;
- // the scope for the topic, if any
- if (scopes == null) {
- toc = getTocForTopic(href, locale);
- } else {
- scope = getScopeForTopic(href);
- if (scope == null)
- continue;
- else if (scope instanceof AdaptableToc)
- toc = (IToc) scope.getAdapter(IToc.class);
- else // scope is AdaptableTopic
- toc = (IToc) scope.getParent().getAdapter(IToc.class);
- }
-
- // adjust score
- if (!scoreScaleSet) {
- if (score > 0) {
- lastScore = score;
- scoreScale = 0.99f / score;
- score = 1;
- }
- scoreScaleSet = true;
- } else {
- // workaround for bug in Lucene 1.2.0 final
- // http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12273
- if (score > lastScore) {
- scoreScale = scoreScale * lastScore / score;
- }
- lastScore = score;
- //
- score = score * scoreScale + 0.01f;
- }
-
- // Set the document label
- String label = doc.get("raw_title");
- if ("".equals(label) && toc != null) {
- if (scope != null) {
- label = scope.getTopic(href).getLabel();
- } else
- label = toc.getTopic(href).getLabel();
- }
- if (label == null || "".equals(label))
- label = href;
-
- // Set document href
- href = href + "?resultof=" + urlEncodedWords;
- searchHitList.add(new SearchHit(href, label, score, toc));
- }
- searchHits =
- (SearchHit[]) searchHitList.toArray(
- new SearchHit[searchHitList.size()]);
-
- }
- /**
- * Finds a topic within a scope
- */
- private AdaptableHelpResource getScopeForTopic(String href) {
- for (int i = 0; i < scopes.size(); i++) {
- AdaptableHelpResource scope = (AdaptableHelpResource) scopes.get(i);
- if (scope.getTopic(href) != null)
- return scope;
- }
- return null;
- }
-
- /**
- * Finds a topic in a toc
- * or within a scope if specified
- */
- private IToc getTocForTopic(String href, String locale) {
- IToc[] tocs = HelpSystem.getTocManager().getTocs(locale);
- for (int i = 0; i < tocs.length; i++) {
- ITopic topic = tocs[i].getTopic(href);
- if (topic != null)
- return tocs[i];
- }
- return null;
- }
-
- /**
- * Gets the searchHits.
- * @return Returns a SearchHit[]
- */
- public SearchHit[] getSearchHits() {
- return searchHits;
- }
-
- /**
- * Returns a collection of adaptable help resources that are roots for
- * filtering.
- * @return Collection
- */
- private ArrayList getScopes(WorkingSet[] wSets) {
- if (wSets == null)
- return null;
-
- scopes = new ArrayList(wSets.length);
- for (int w=0; w<wSets.length;w++) {
- AdaptableHelpResource[] elements = wSets[w].getElements();
- for (int i = 0; i < elements.length; i++)
- scopes.add(elements[i]);
- }
- return scopes;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/SmartAnalyzer.java b/org.eclipse.help/src/org/eclipse/help/internal/search/SmartAnalyzer.java
deleted file mode 100644
index be8b555b7..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/SmartAnalyzer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.Reader;
-
-import org.apache.lucene.analysis.*;
-
-/**
- * Smart Analyzer. Chooses underlying implementation
- * based on the field which text is analyzed.
- */
-public class SmartAnalyzer extends Analyzer {
- Analyzer pluggedInAnalyzer;
- Analyzer exactAnalyzer;
-
- /**
- * Constructor for SmartAnalyzer.
- */
- public SmartAnalyzer(String locale, Analyzer pluggedInAnalyzer) {
- super();
- this.pluggedInAnalyzer = pluggedInAnalyzer;
- this.exactAnalyzer = new DefaultAnalyzer(locale);
- }
- /**
- * Creates a TokenStream which tokenizes all the text
- * in the provided Reader.
- * Delegates to DefaultAnalyzer when field used to search for exact match,
- * and to plugged-in analyzer for other fields.
- */
- public final TokenStream tokenStream(String fieldName, Reader reader) {
- if (fieldName != null && fieldName.startsWith("exact_")) {
- return exactAnalyzer.tokenStream(fieldName, reader);
- }
- return pluggedInAnalyzer.tokenStream(fieldName, reader);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/search/WordTokenStream.java b/org.eclipse.help/src/org/eclipse/help/internal/search/WordTokenStream.java
deleted file mode 100644
index 68d58c486..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/search/WordTokenStream.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.search;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.apache.lucene.analysis.*;
-
-/**
- * WordTokenStream obtains tokens containing words
- * appropriate for use with Lucene search engine.
- */
-public final class WordTokenStream extends TokenStream {
- private static final int BUF_LEN = 4096;
- private static final int TOKENS_LEN = 512;
- private final String fieldName;
- private final Reader reader;
- private final BreakIterator boundary;
- private final ArrayList tokens;
- private int token;
- private int noTokens;
- private final char[] cbuf;
- /**
- * Constructor
- */
- public WordTokenStream(String fieldName, Reader reader, Locale locale) {
- this.fieldName = fieldName;
- this.reader = reader;
- boundary = BreakIterator.getWordInstance(locale);
- cbuf = new char[BUF_LEN];
- tokens = new ArrayList(TOKENS_LEN);
-
- }
- /**
- * @see TokenStream#next()
- */
- public final Token next() throws IOException {
- while (token >= noTokens) {
- // read BUF_LEN of chars
- int l;
- while ((l = reader.read(cbuf)) <= 0) {
- if (l < 0) {
- // EOF
- reader.close();
- return null;
- }
- }
- StringBuffer strbuf = new StringBuffer(l + 80);
- strbuf.append(cbuf, 0, l);
- // read more until white space (or EOF)
- int c;
- while (0 <= (c = reader.read())) {
- strbuf.append((char) c);
- if (c == ' ' || c == '\r' || c == '\n' || c == '\t') {
- break;
- }
- }
-
- String str = strbuf.toString();
- boundary.setText(str);
-
- int start = boundary.first();
- tokens.clear();
- wordsbreak : for (
- int end = boundary.next();
- end != BreakIterator.DONE;
- start = end, end = boundary.next()) {
- // determine if it is a word
- // any letter or digit between boundaries means it is a word
- for (int i = start; i < end; i++) {
- if (Character.isLetterOrDigit(str.charAt(i))) {
- // it is a word
- tokens.add(
- new Token(str.substring(start, end), start, end));
- continue wordsbreak;
- }
- }
- }
-
- if (c < 0) {
- reader.close();
- tokens.add((Token) null);
- }
- noTokens = tokens.size();
- token = 0;
- }
-
- return (Token) tokens.get(token++);
-
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/Eclipse.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/Eclipse.java
deleted file mode 100644
index 967eccb6d..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/Eclipse.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.io.*;
-import java.util.List;
-
-/**
- * Eclipse launcher. Spawns eclipse executable
- * or org.eclipse.core.launcher.Main.
- */
-public class Eclipse extends Thread {
- // Eclipse exit codes
- private static final int NEEDS_RESTART = 23;
- // Launching status
- public static final int STATUS_INIT = 0;
- public static final int STATUS_STARTED = 1;
- public static final int STATUS_ERROR = 2;
-
- File dir;
- String[] cmdarray;
- private int status = STATUS_INIT;
- private Exception exception;
- Process pr;
- private EclipseLifeCycleListener lifeCycleListener;
- /**
- * Constructor
- */
- public Eclipse(EclipseLifeCycleListener listener) {
- super();
- this.lifeCycleListener = listener;
- this.setName("Eclipse");
- this.dir = Options.getEclipseHome();
- }
- private void prepareCommand() throws Exception {
- if (Options.useExe()) {
- prepareEclipseCommand();
- ensureEclipseExeExists();
- } else {
- prepareJavaCommand();
- ensureStartupJarExists();
- }
- ensureVmExists();
- }
- private void prepareEclipseCommand() {
- List vmArgs = Options.getVmArgs();
- List eclipseArgs = Options.getEclipseArgs();
- cmdarray = new String[3 + vmArgs.size() + 1 + eclipseArgs.size()];
- cmdarray[0] =
- new File(Options.getEclipseHome(), "eclipse").getAbsolutePath();
- cmdarray[1] = "-vm";
- cmdarray[2] = Options.getVm();
- for (int i = 0; i < eclipseArgs.size(); i++) {
- cmdarray[3 + i] = (String) eclipseArgs.get(i);
- }
- cmdarray[3 + eclipseArgs.size()] = "-vmargs";
- for (int i = 0; i < vmArgs.size(); i++) {
- cmdarray[4 + eclipseArgs.size() + i] = (String) vmArgs.get(i);
- }
- }
- private void prepareJavaCommand() {
- List vmArgs = Options.getVmArgs();
- List eclipseArgs = Options.getEclipseArgs();
- cmdarray = new String[1 + vmArgs.size() + 3 + eclipseArgs.size()];
- cmdarray[0] = Options.getVm();
- 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";
- for (int i = 0; i < eclipseArgs.size(); i++) {
- cmdarray[4 + vmArgs.size() + i] = (String) eclipseArgs.get(i);
- }
- }
- /**
- * Launches Eclipse process and waits for it.
- */
- public void run() {
- try {
- prepareCommand();
- if (Options.isDebug()) {
- printCommand();
- }
- do {
- pr = Runtime.getRuntime().exec(cmdarray, (String[]) null, dir);
- (new StreamConsumer(pr.getInputStream())).start();
- (new StreamConsumer(pr.getErrorStream())).start();
- if (status == STATUS_INIT) {
- // started first time
- status = STATUS_STARTED;
- }
- try {
- pr.waitFor();
- } catch (InterruptedException e) {
- }
- if (Options.isDebug()) {
- System.out.println(
- "Eclipse exited with status code " + pr.exitValue());
- if (pr.exitValue() == NEEDS_RESTART) {
- System.out.println(
- "Updates are installed, Eclipse will be restarted.");
- }
- }
- } while (pr.exitValue() == NEEDS_RESTART);
- } catch (Exception exc) {
- exception = exc;
- status = STATUS_ERROR;
- } finally {
- if (status == STATUS_INIT) {
- status = STATUS_ERROR;
- }
- if (status == STATUS_ERROR) {
- exception = new Exception("Unknown exception.");
- }
- lifeCycleListener.eclipseEnded();
- }
- }
- /**
- * Reads a stream
- */
- public class StreamConsumer extends Thread {
- BufferedReader bReader;
- public StreamConsumer(InputStream inputStream) {
- super();
- this.setName("Eclipse out/err consumer");
- this.setDaemon(true);
- bReader = new BufferedReader(new InputStreamReader(inputStream));
- }
- public void run() {
- try {
- String line;
- while (null != (line = bReader.readLine())) {
- System.out.println(line);
- }
- bReader.close();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
- }
- }
- private void ensureVmExists() throws Exception {
- File vmExe = new File(Options.getVm());
- if (vmExe.exists() && !vmExe.isDirectory()) {
- return;
- }
- vmExe = new File(Options.getVm() + ".exe");
- if (vmExe.exists() && !vmExe.isDirectory()) {
- return;
- }
- throw new Exception(
- "File "
- + vmExe.getAbsolutePath()
- + " does not exists. Pass a correct -vm option");
- }
- private void ensureEclipseExeExists() throws Exception {
- File eclipseExe =
- new File(
- Options.getEclipseHome(),
- "eclipse"
- + (System.getProperty("os.name").startsWith("Win")
- ? ".exe"
- : ""));
- if (eclipseExe.exists() && !eclipseExe.isDirectory()) {
- return;
- }
- throw new Exception(
- "File "
- + eclipseExe.getAbsolutePath()
- + " does not exists. Pass a correct -eclipsehome option");
- }
- private void ensureStartupJarExists() throws Exception {
- File startupJar = new File(Options.getEclipseHome(), "startup.jar");
- if (startupJar.exists() && !startupJar.isDirectory()) {
- return;
- }
- throw new Exception(
- "File "
- + startupJar.getAbsolutePath()
- + " does not exists. Pass a correct -eclipsehome option");
- }
- /**
- * @return Exception
- */
- public Exception getException() {
- return exception;
- }
-
- /**
- * @return int
- */
- public int getStatus() {
- return status;
- }
- private void printCommand() {
- System.out.println("Launch command is:");
- for (int i = 0; i < cmdarray.length; i++) {
- System.out.println(" " + (String) cmdarray[i]);
- }
-
- }
- /**
- * Forcibly kill Eclipse process.
- */
- public void killProcess() {
- if (pr != null) {
- pr.destroy();
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseConnection.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseConnection.java
deleted file mode 100644
index 5427660a3..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseConnection.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.io.*;
-import java.net.*;
-import java.util.Properties;
-
-/**
- * This program is used to start or stop Eclipse
- * Infocenter application.
- * It should be launched from command line.
- */
-public class EclipseConnection {
- // help server host
- private String host;
- // help server port
- private String port;
-
- public EclipseConnection() {
- }
-
- public String getPort() {
- return port;
- }
-
- public String getHost() {
- return host;
- }
-
- public void reset() {
- host = null;
- port = null;
- }
-
- public boolean isValid() {
- return (host != null && port != null);
- }
-
- public void connect(URL url) throws InterruptedException, Exception {
- try {
- HttpURLConnection connection =
- (HttpURLConnection) url.openConnection();
- if (Options.isDebug()) {
- System.out.println("Connection to control servlet created.");
- }
- connection.connect();
- if (Options.isDebug()) {
- System.out.println("Connection to control servlet connected.");
- }
- int code = connection.getResponseCode();
- if (Options.isDebug()) {
- System.out.println(
- "Response code from control servlet=" + code);
- }
- connection.disconnect();
- return;
- } catch (IOException ioe) {
- if (Options.isDebug()) {
- ioe.printStackTrace();
- }
- }
- }
-
- /**
- * Obtains host and port from the file.
- * Retries several times if file does not exists,
- * and help might be starting up.
- */
- public void renew() throws Exception {
- Properties p = new Properties();
- FileInputStream is = null;
- try {
- is = new FileInputStream(Options.getConnectionFile());
- p.load(is);
- is.close();
- } catch (IOException ioe) {
- // it is ok, eclipse might have just exited
- throw ioe;
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ioe2) {
- }
- }
- }
- host = (String) p.get("host");
- port = (String) p.get("port");
- if (Options.isDebug()) {
- System.out.println("Help server host=" + host);
- }
- if (Options.isDebug()) {
- System.out.println("Help server port=" + port);
- }
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseController.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseController.java
deleted file mode 100644
index 1973a344e..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseController.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.io.*;
-import java.net.*;
-import java.nio.channels.*;
-
-/**
- * This program is used to start or stop Eclipse Infocenter application. It
- * should be launched from command line.
- */
-public class EclipseController implements EclipseLifeCycleListener {
-
- // control servlet path
- private static final String CONTROL_SERVLET_PATH =
- "/helpControl/control.html";
-
- // application to launch
- protected String applicationId;
-
- // Eclipse connection params
- protected EclipseConnection connection;
-
- public Eclipse eclipse = null;
- // Inter process lock
- private FileLock lock;
- private boolean eclipseEnded = false;
- /**
- * Constructs help system
- *
- * @param applicationID
- * ID of Eclipse help application
- * @param args
- * array of String options and their values Option <code>-eclipseHome dir</code>
- * specifies Eclipse installation directory. It must be provided,
- * when current directory is not the same as Eclipse installation
- * directory. Additionally, most options accepted by Eclipse
- * execuable are supported.
- */
- public EclipseController(String applicationId, String[] args) {
-
- this.applicationId = applicationId;
- Options.init(applicationId, args);
- connection = new EclipseConnection();
- }
-
- /**
- * @see org.eclipse.help.standalone.Help#shutdown()
- */
- public final synchronized void shutdown() throws Exception {
- try {
- obtainLock();
- sendHelpCommandInternal("shutdown", new String[0]);
- } catch (MalformedURLException mue) {
- mue.printStackTrace();
- } catch (InterruptedException ie) {
- } finally {
- releaseLock();
- }
- }
-
- /**
- * @see org.eclipse.help.standalone.Help#start()
- */
- public final synchronized void start() throws Exception {
- try {
- obtainLock();
- startEclipse();
- } finally {
- releaseLock();
- }
-
- }
-
- /**
- * Ensures the application is running, and sends command to the control
- * servlet. If connection fails, retries several times, in case webapp is
- * starting up.
- */
- protected final synchronized void sendHelpCommand(
- String command,
- String[] parameters)
- throws Exception {
- try {
- obtainLock();
- sendHelpCommandInternal(command, parameters);
- } finally {
- releaseLock();
- }
-
- }
-
- /**
- * Starts Eclipse if not yet running.
- */
- private void startEclipse() throws Exception {
- boolean fullyRunning = isApplicationRunning();
- if (fullyRunning) {
- return;
- }
- if (Options.isDebug()) {
- System.out.println(
- "Using workspace " + Options.getWorkspace().getAbsolutePath());
- }
- // delete old connection file
- Options.getConnectionFile().delete();
- connection.reset();
-
- if (Options.isDebug()) {
- System.out.println(
- "Ensured old .connection file is deleted. Launching Eclipse.");
- }
- eclipseEnded = false;
- eclipse = new Eclipse(this);
- eclipse.start();
- fullyRunning = isApplicationRunning();
- while (!eclipseEnded && !fullyRunning) {
- try {
- Thread.sleep(250);
- } catch (InterruptedException ie) {
- }
- fullyRunning = isApplicationRunning();
- }
- if (eclipseEnded) {
- if (eclipse.getStatus() == Eclipse.STATUS_ERROR) {
- throw eclipse.getException();
- }
- return;
- }
- if (Options.isDebug()) {
- System.out.println("Eclipse launched");
- }
- // in case controller is killed
- Runtime.getRuntime().addShutdownHook(new EclipseCleaner());
- }
- private void sendHelpCommandInternal(String command, String[] parameters)
- throws Exception {
- if (!"shutdown".equalsIgnoreCase(command)) {
- startEclipse();
- }
- if (!isApplicationRunning()) {
- return;
- }
- if (!connection.isValid()) {
- connection.renew();
- }
- try {
- URL url = createCommandURL(command, parameters);
- if ("shutdown".equalsIgnoreCase(command)
- && Options.getConnectionFile().exists()) {
- connection.connect(url);
- long timeLimit = System.currentTimeMillis() + 60 * 1000;
- while (Options.getConnectionFile().exists()) {
- Thread.sleep(200);
- if (System.currentTimeMillis() > timeLimit) {
- System.out.println(
- "Shutting down is taking too long. Will not wait.");
- break;
- }
- }
-
- } else {
- connection.connect(url);
- }
- } catch (MalformedURLException mue) {
- mue.printStackTrace();
- } catch (InterruptedException ie) {
- }
- }
-
- /**
- * Builds a URL that communicates the specified command to help control
- * servlet.
- *
- * @param command
- * standalone help system command e.g. "displayHelp"
- * @param parameters
- * array of parameters of the command e.g.
- * {"http://www.eclipse.org"}
- */
- private URL createCommandURL(String command, String[] parameters)
- throws MalformedURLException {
- StringBuffer urlStr = new StringBuffer();
- urlStr.append("http://");
- urlStr.append(connection.getHost());
- urlStr.append(":");
- urlStr.append(connection.getPort());
- urlStr.append(CONTROL_SERVLET_PATH);
- urlStr.append("?command=");
- urlStr.append(command);
- for (int i = 0; i < parameters.length; i++) {
- urlStr.append("&");
- urlStr.append(parameters[i]);
- }
- if (Options.isDebug()) {
- System.out.println("Control servlet URL=" + urlStr.toString());
- }
- return new URL(urlStr.toString());
- }
-
- public void eclipseEnded() {
- connection.reset();
- }
- private void obtainLock() throws IOException {
- if (lock != null) {
- // we already have lock
- return;
- }
- if (!Options.getLockFile().exists()) {
- Options.getLockFile().getParentFile().mkdirs();
- }
- RandomAccessFile raf =
- new RandomAccessFile(Options.getLockFile(), "rw");
- lock = raf.getChannel().lock();
- if (Options.isDebug()) {
- System.out.println("Lock obtained.");
- }
- }
- private void releaseLock() {
- if (lock != null) {
- try {
- lock.channel().close();
- if (Options.isDebug()) {
- System.out.println("Lock released.");
- }
- lock = null;
- } catch (IOException ioe) {
- }
- }
- }
- /**
- * Tests whether HelpApplication is running by testing if .applicationlock
- * is locked
- */
- private boolean isApplicationRunning() {
- File applicationLockFile =
- new File(Options.getLockFile().getParentFile(), ".applicationlock");
- RandomAccessFile randomAccessFile = null;
- FileLock applicationLock = null;
- try {
- randomAccessFile = new RandomAccessFile(applicationLockFile, "rw");
- applicationLock = randomAccessFile.getChannel().tryLock();
- } catch (IOException ioe) {
- } finally {
- if (applicationLock != null) {
- try {
- applicationLock.release();
- } catch (IOException ioe) {
- }
- }
- if (randomAccessFile != null) {
- try {
- randomAccessFile.close();
- } catch (IOException ioe) {
- }
- }
- if (Options.isDebug()) {
- System.out.println(
- "isApplicationRunning? " + (applicationLock == null));
- }
- }
- return applicationLock == null;
- }
- public class EclipseCleaner extends Thread {
- public void run() {
- if (eclipse != null) {
- eclipse.killProcess();
- }
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java
deleted file mode 100644
index cb91e1f5e..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-/**
- * Notified when Eclipse process exits.
- */
-public interface EclipseLifeCycleListener {
- public void eclipseEnded();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/Options.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/Options.java
deleted file mode 100644
index 6cd9cf234..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/Options.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.io.File;
-import java.util.*;
-
-/**
- * Options for starting stand alone help and infocenter.
- */
-public class Options {
- // debugging
- private static boolean debug = false;
- // use eclipse.exe
- private static boolean useExe = true;
- // Eclipse installation directory
- private static File eclipseHome;
- // workspace directory to be used by Eclipse
- private static File workspace;
- // Eclipse .lock file
- private static File lockFile;
- // .hostport file to obtain help server host and port from Eclipse help application
- private static File hostPortFile;
- // vm to use
- private static String vm;
- // arguments to pass to Eclipse
- private static List vmArgs;
- // arguments to pass to VM
- private static List eclipseArgs;
- // help command to execute
- private static List helpCommand;
- // host to override appserver preferences
- private static String host;
- // port to override appserver preferences
- private static String port;
- // time to wait for help system to start,
- // before sending command is possible
- private static int serverTimeout;
- /**
- * Initializes options.
- * @param appId eclipse application id
- * @param args array of String options and their values
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory.
- * It must be provided, when current directory is not the same
- * as Eclipse installation directory.
- * Additionally, most options accepted by Eclipse execuable are supported.
- */
- public static void init(String appId, String[] args) {
- // convert array of arguments to a list
- List list = new ArrayList();
- for (int i = 0; i < args.length; i++) {
- list.add(args[i]);
- }
-
- init(appId, list);
- }
- /**
- * Initializes options.
- * @param appId eclipse application id
- * @param options list of options and their values
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory.
- * It must be provided, when current directory is not the same
- * as Eclipse installation directory.
- * Additionally, most options accepted by Eclipse execuable are supported.
- */
- public static void init(String appId, List options) {
- // Initialize eclipseArgs with all passed options
- eclipseArgs = new ArrayList();
- eclipseArgs.addAll(options);
-
- // consume -command option
- helpCommand = extractOption(eclipseArgs, "-command");
- if (helpCommand == null) {
- helpCommand = new ArrayList(0);
- }
-
- // read -debug option
- if (getOption(eclipseArgs, "-debug") != null) {
- debug = true;
- System.out.println("Debugging is on.");
- }
- // consume -noexec option
- if (extractOption(eclipseArgs, "-noexec") != null) {
- useExe = false;
- }
- // consume -eclipsehome (accept eclipse_home too) option
- List homes = extractOption(eclipseArgs, "-eclipseHome");
- if (homes == null || homes.isEmpty()) {
- homes = extractOption(eclipseArgs, "-eclipse_Home");
- }
- if (homes != null && !homes.isEmpty()) {
- eclipseHome = new File((String) homes.get(0));
- } else {
- eclipseHome = new File(System.getProperty("user.dir"));
- }
-
- // read -data option
- List workspaces = getOption(eclipseArgs, "-data");
- if (workspaces != null && !workspaces.isEmpty()) {
- workspace = new File((String) workspaces.get(0));
- } else {
- workspace = new File(eclipseHome, "workspace");
- }
- lockFile = new File(workspace, "/.metadata/.helplock");
- hostPortFile = new File(workspace, "/.metadata/.connection");
-
- // consume -host option
- List hosts = extractOption(eclipseArgs, "-host");
- if (hosts != null && hosts.size() > 0) {
- host = (String) hosts.get(0);
- }
-
- // consume -port option
- List ports = extractOption(eclipseArgs, "-port");
- if (ports != null && ports.size() > 0) {
- port = (String) ports.get(0);
- }
-
- // consume -servertimout option
- serverTimeout = 0;
- List timeouts = extractOption(eclipseArgs, "-servertimeout");
- if (timeouts != null && timeouts.size() > 0) {
- try {
- int timeout = Integer.parseInt((String) timeouts.get(0));
- if (timeout >= 0) {
- serverTimeout = timeout;
- }
- } catch (NumberFormatException nfe) {
- }
- }
-
- // consume -vm option
- List vms = extractOption(eclipseArgs, "-vm");
- 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";
- }
- vm =
- System.getProperty("java.home")
- + File.separator
- + "bin"
- + File.separator
- + executable;
- }
-
- // consume -vmargs option
- vmArgs = new ArrayList(0);
- List passedVmArgs = extractOption(eclipseArgs, "-vmargs");
- 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");
- eclipseArgs.add(1, appId);
-
- // add -nosplash option (prevent splash)
- extractOption(eclipseArgs, "-showsplash");
- extractOption(eclipseArgs, "-endsplash");
- extractOption(eclipseArgs, "-nosplash");
- eclipseArgs.add(0, "-nosplash");
-
- // add server_host and/or port to -vmargs option
- if (host != null || port != null) {
- if (host != null) {
- vmArgs.add("-Dserver_host=" + host);
- }
- if (port != null) {
- vmArgs.add("-Dserver_port=" + port);
- }
- }
- }
-
- /**
- * Returns true if debugging is enabled
- */
- public static boolean isDebug() {
- return debug;
- }
-
- public static File getConnectionFile() {
- return hostPortFile;
- }
-
- public static File getLockFile() {
- return lockFile;
- }
-
- public static File getEclipseHome() {
- return eclipseHome;
- }
-
- public static File getWorkspace() {
- return workspace;
- }
-
- public static List getHelpCommand() {
- return helpCommand;
- }
-
- public static List getEclipseArgs() {
- return eclipseArgs;
- }
-
- /**
- * Returns the serverTimeout.
- * @return number of seconds to wait for the server,
- * 0 when not set, and default should be used
- */
- public static int getServerTimeout() {
- return serverTimeout;
- }
-
- /**
- * Removes specified option and its list of values
- * from a list of options
- * @param optionName name of the option e.g. -data
- * @return List of String values of the specified option,
- * or null if option is not present
- */
- private static List extractOption(List options, String optionName) {
- List values = null;
- for (int i = 0; i < options.size();) {
- if (optionName.equalsIgnoreCase((String) options.get(i))) {
- if (values == null) {
- values = new ArrayList(1);
- }
- // found the option, remove option
- options.remove(i);
- // remove option parameters
- while (i < options.size()) {
- if (((String) options.get(i)).startsWith("-")
- && !optionName.equals("-vmargs")) {
- // start of next option
- break;
- }
- // note, and remove option value
- values.add(options.get(i));
- options.remove(i);
- }
- } else {
- i++;
- }
- }
- return values;
- }
-
- /**
- * Obtains specified option and its list of values
- * from a list of options
- * @param optionName name of the option e.g. -data
- * @param options List of Eclipse options
- * @return List of String values of the specified option,
- * or null if option is not present
- */
- private static List getOption(List options, String optionName) {
- List values = null;
- for (int i = 0; i < options.size(); i++) {
- if (optionName.equalsIgnoreCase((String) options.get(i))) {
- if (values == null) {
- values = new ArrayList(1);
- }
- // read option parameters
- for (int j = i + 1; j < options.size(); j++) {
- if (((String) options.get(j)).startsWith("-")
- && !optionName.equals("-vmargs")) {
- // start of next option
- i = j;
- break;
- }
- values.add(options.get(j));
- }
- }
- }
- return values;
- }
- public static String getVm() {
- return vm;
- }
- public static List getVmArgs() {
- return vmArgs;
- }
- /**
- * Returns the useExe.
- * @return boolean
- */
- public static boolean useExe() {
- return useExe;
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneHelp.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneHelp.java
deleted file mode 100644
index 3fb01fa73..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneHelp.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.util.List;
-
-import org.eclipse.help.internal.HelpPlugin;
-
-/**
- * This is a standalone help system. It takes care of
- * launching the eclipse with its help system implementation,
- * and controling it.
- * This class can be used instantiated and used in a Java program,
- * or can be launched from command line to execute single help action.
- *
- * Usage as a Java component:
- * <ul>
- * <li> create an instantance of this class and then hold onto
- * this instance for the duration of your application</li>
- * <li> call start() </li>
- * <li> call displayHelp(...) or displayContext(..) any number of times </li>
- * <li> at the end, call shutdown(). </li>
- * </ul>
- */
-public class StandaloneHelp extends EclipseController {
- // ID of the application to run
- private static final String HELP_APPLICATION_ID =
- HelpPlugin.PLUGIN_ID + ".helpApplication";
-
- /**
- * Constructs help system
- * @param args array of String options and their values
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory.
- * It must be provided, when current directory is not the same
- * as Eclipse installation directory.
- * Additionally, most options accepted by Eclipse execuable are supported.
- * @param applicationID ID of Eclipse help application
- */
- public StandaloneHelp(String[] args) {
- super(HELP_APPLICATION_ID, args);
- }
-
- /**
- * @see org.eclipse.help.standalone.Infocenter#main(String[])
- */
- public static void main(String[] args) {
- try {
- StandaloneHelp help = new StandaloneHelp(args);
-
- List helpCommand = Options.getHelpCommand();
-
- if (help.executeCommand(helpCommand)) {
- return;
- } else {
- printMainUsage();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @see org.eclipse.help.standalone.Help#displayContext(java.lang.String,int,int)
- */
- public void displayContext(String contextId, int x, int y) {
- }
-
- /**
- * @see org.eclipse.help.standalone.Help#displayContextInfopop(java.lang.String,int,int)
- */
- public void displayContextInfopop(String contextId, int x, int y) {
- }
- /**
- * @see org.eclipse.help.standalone.Help#displayHelp()
- */
- public void displayHelp() throws Exception {
- sendHelpCommand("displayHelp", new String[0]);
- }
-
- /**
- * @see org.eclipse.help.standalone.Help#displayHelp(java.lang.String)
- */
- public void displayHelp(String href) throws Exception {
- sendHelpCommand("displayHelp", new String[] { "href=" + href });
- }
-
- /**
- * @return true if commands contained a known command
- * and it was executed
- */
- private boolean executeCommand(List helpCommands) throws Exception {
-
- if (helpCommands.size() <= 0) {
- return false;
- }
- String command = (String) helpCommands.get(0);
-
- if ("start".equalsIgnoreCase(command)) {
- start();
- return true;
- } else if ("shutdown".equalsIgnoreCase(command)) {
- shutdown();
- return true;
- } else if ("displayHelp".equalsIgnoreCase(command)) {
- if (helpCommands.size() >= 2) {
- displayHelp((String) helpCommands.get(1));
- } else {
- displayHelp();
- }
- return true;
- } else if ("displayContext".equalsIgnoreCase(command)) {
- if (helpCommands.size() >= 4) {
- displayContext(
- (String) helpCommands.get(1),
- Integer.parseInt((String) helpCommands.get(2)),
- Integer.parseInt((String) helpCommands.get(3)));
-
- return true;
- }
- } else if ("displayContextInfopop".equalsIgnoreCase(command)) {
- if (helpCommands.size() >= 4) {
- displayContextInfopop(
- (String) helpCommands.get(1),
- Integer.parseInt((String) helpCommands.get(2)),
- Integer.parseInt((String) helpCommands.get(3)));
- return true;
- }
- }
-
- return false;
- }
- /**
- * Prints usage of this class as a program.
- */
- private static void printMainUsage() {
- 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]]");
- System.out.println();
- System.out.println("where:");
- System.out.println(" href is the URL of the help resource to display,");
- System.out.println(
- " eclipseInstallPath specifies Eclipse installation directory; this directory is a parent to \"plugins\" directory and eclipse executable; the option must be provided, when current directory from which infocenter is launched, is not the same as Eclipse installation directory,");
- System.out.println(
- " helpServerHost specifies host name of the interface that help server will use,");
- System.out.println(
- " helpServerPort specifies port number that help server will use,");
- System.out.println(
- " platform options are other options that are supported by Eclipse Executable.");
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java b/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java
deleted file mode 100644
index 3f2fff2df..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.standalone;
-
-import java.util.List;
-
-import org.eclipse.help.internal.HelpPlugin;
-
-/**
- * This program is used to start or stop Eclipse
- * Infocenter application.
- */
-public class StandaloneInfocenter extends EclipseController {
- // ID of the application to run
- private static final String INFOCENTER_APPLICATION_ID =
- HelpPlugin.PLUGIN_ID + ".infocenterApplication";
-
- /**
- * Constructs help system
- * @param args array of String options and their values
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory.
- * It must be provided, when current directory is not the same
- * as Eclipse installation directory.
- * Additionally, most options accepted by Eclipse execuable are supported.
- * @param applicationID ID of Eclipse help application
- */
- public StandaloneInfocenter(String[] args) {
- super(INFOCENTER_APPLICATION_ID, args);
- }
-
- /**
- * @see org.eclipse.help.standalone.Infocenter#main(String[])
- */
- public static void main(String[] args) {
- try {
- StandaloneInfocenter infocenter = new StandaloneInfocenter(args);
-
- List helpCommand = Options.getHelpCommand();
-
- if (infocenter.executeCommand(helpCommand)) {
- return;
- } else {
- printMainUsage();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @return true if commands contained a known command
- * and it was executed
- */
- private boolean executeCommand(List helpCommand) throws Exception {
- if (helpCommand.size() <= 0) {
- return false;
- }
- String command = (String) helpCommand.get(0);
- if ("start".equalsIgnoreCase(command)) {
- start();
- return true;
- } else if ("shutdown".equalsIgnoreCase(command)) {
- shutdown();
- return true;
- }
- return false;
- }
-
- /**
- * Prints usage of this class as a program.
- */
- private static void printMainUsage() {
- 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]]");
- System.out.println();
- System.out.println("where:");
- System.out.println(
- " eclipseInstallPath specifies Eclipse installation directory; this directory is a parent to \"plugins\" directory and eclipse executable; the option must be provided, when current directory from which infocenter is launched, is not the same as Eclipse installation directory,");
- System.out.println(
- " helpServerHost specifies host name of the interface that help server will use,");
- System.out.println(
- " helpServerPort specifies port number that help server will use,");
- System.out.println(
- " noexec option indicates that Eclipse executable should not be used, ");
- System.out.println(
- " platform options are other options that are supported by Eclipse Executable.");
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java
index b1618e96c..e9bf69c2c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java
@@ -17,7 +17,6 @@ import java.util.zip.*;
import org.eclipse.core.runtime.*;
import org.eclipse.help.*;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
/**
* Toc created from files in a extra directory in a plugin.
*/
@@ -90,7 +89,7 @@ public class DirectoryToc {
}
} catch (CoreException ce) {
HelpPlugin.logError(
- Resources.getString("E034", "/" + pluginID + "/doc.zip"),
+ HelpResources.getString("E034", "/" + pluginID + "/doc.zip"),
ce);
}
if (url != null) {
@@ -112,7 +111,7 @@ public class DirectoryToc {
}
} catch (CoreException ce) {
HelpPlugin.logError(
- Resources.getString("E035", "/" + pluginID + "/" + directory),
+ HelpResources.getString("E035", "/" + pluginID + "/" + directory),
ce);
}
if (url != null) {
@@ -137,7 +136,7 @@ public class DirectoryToc {
realZipURL = Platform.resolve(url);
} catch (IOException ioe) {
HelpPlugin.logError(
- Resources.getString("E036", url.toString()),
+ HelpResources.getString("E036", url.toString()),
ioe);
return new ArrayList(0);
}
@@ -148,7 +147,7 @@ public class DirectoryToc {
zipFile.close();
} catch (IOException ioe) {
HelpPlugin.logError(
- Resources.getString("E037", realZipURL.getFile()),
+ HelpResources.getString("E037", realZipURL.getFile()),
ioe);
return new ArrayList(0);
}
@@ -200,7 +199,7 @@ public class DirectoryToc {
realURL = Platform.resolve(url);
} catch (IOException ioe) {
HelpPlugin.logError(
- Resources.getString("E038", url.toString()),
+ HelpResources.getString("E038", url.toString()),
ioe);
return col;
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java
index 46bdd1e1b..9b487b401 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java
@@ -13,7 +13,6 @@ package org.eclipse.help.internal.toc;
import java.util.*;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
public class TocBuilder {
// list of all toc files
@@ -69,7 +68,7 @@ public class TocBuilder {
TocFileParser parser = new TocFileParser(this);
parser.parse(tocFile);
} catch (Exception e) {
- String msg = Resources.getString("E033", tocFile.getHref());
+ String msg = HelpResources.getString("E033", tocFile.getHref());
HelpPlugin.logError(msg, e);
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
index 412cf9be7..8329ccc28 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
@@ -20,7 +20,8 @@ import org.eclipse.help.internal.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
/**
- * Used to create TocFile's Toc object from contributed toc xml file.
+ * Used to create TocFile's Toc object
+ * from contributed toc xml file.
*/
class TocFileParser extends DefaultHandler {
protected TocBuilder builder;
@@ -40,8 +41,7 @@ class TocFileParser extends DefaultHandler {
*/
public void error(SAXParseException ex) throws SAXException {
String message = getMessage("E024", ex);
- //Error parsing Table of Contents file, URL: %1 at Line:%2 Column:%3
- // %4
+ //Error parsing Table of Contents file, URL: %1 at Line:%2 Column:%3 %4
HelpPlugin.logError(message, null);
RuntimeHelpStatus.getInstance().addParseError(
message,
@@ -53,8 +53,7 @@ class TocFileParser extends DefaultHandler {
public void fatalError(SAXParseException ex) throws SAXException {
// create message string from exception
String message = getMessage("E025", ex);
- //Failed to parse Table of Contents file, URL: %1 at Line:%2 Column:%3
- // %4
+ //Failed to parse Table of Contents file, URL: %1 at Line:%2 Column:%3 %4
HelpPlugin.logError(message, ex);
RuntimeHelpStatus.getInstance().addParseError(
message,
@@ -67,7 +66,7 @@ class TocFileParser extends DefaultHandler {
String param3 = ex.getMessage();
String message =
MessageFormat.format(
- Resources.getString(messageID),
+ HelpResources.getString(messageID),
new Object[] { param0, param1, param2, param3 });
return message;
}
@@ -92,19 +91,18 @@ class TocFileParser extends DefaultHandler {
parserPool.releaseParser(parser);
}
} catch (ParserConfigurationException pce) {
- String msg = Resources.getString("TocFileParser.PCE");
+ String msg = HelpResources.getString("TocFileParser.PCE");
//SAXParser implementation could not be loaded.
HelpPlugin.logError(msg, pce);
} catch (SAXException se) {
- String msg = Resources.getString("E026", file);
+ String msg = HelpResources.getString("E026", file);
//Error loading Table of Contents file %1.
HelpPlugin.logError(msg, se);
} catch (IOException ioe) {
- String msg = Resources.getString("E026", file);
+ String msg = HelpResources.getString("E026", file);
//Error loading Table of Contents file %1.
HelpPlugin.logError(msg, ioe);
- // now pass it to the RuntimeHelpStatus object explicitly because
- // we
+ // now pass it to the RuntimeHelpStatus object explicitly because we
// still need to display errors even if Logging is turned off.
RuntimeHelpStatus.getInstance().addParseError(msg, file);
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
index d0ea9ac29..8e38c1d39 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
@@ -11,11 +11,10 @@
package org.eclipse.help.internal.toc;
import java.util.*;
-import org.eclipse.core.boot.BootLoader;
+import org.eclipse.core.boot.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.help.IToc;
+import org.eclipse.help.*;
import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.Resources;
/**
* Manages the navigation model. It keeps track of all the tables of contents.
@@ -48,7 +47,7 @@ public class TocManager {
*/
public boolean isTocInRole(int toc, String locale) {
IToc[] tocs = getTocs(locale); // build them all
- IHelpRoleManager roleManager = HelpSystem.getRoleManager();
+ IHelpRoleManager roleManager = HelpPlugin.getRoleManager();
if (roleManager == null) {
return true;
}
@@ -157,7 +156,7 @@ public class TocManager {
ArrayList orderedTocs = new ArrayList();
try {
Preferences pref = HelpPlugin.getDefault().getPluginPreferences();
- String preferredTocs = pref.getString(HelpSystem.BASE_TOCS_KEY);
+ String preferredTocs = pref.getString(HelpPlugin.BASE_TOCS_KEY);
if (preferredTocs != null) {
StringTokenizer suggestdOrderedInfosets =
new StringTokenizer(preferredTocs, " ;,");
@@ -167,7 +166,7 @@ public class TocManager {
}
}
} catch (Exception e) {
- HelpPlugin.logError(Resources.getString("E039"), e);
+ HelpPlugin.logError(HelpResources.getString("E039"), e);
}
return orderedTocs;
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/HelpProperties.java b/org.eclipse.help/src/org/eclipse/help/internal/util/HelpProperties.java
deleted file mode 100644
index 10c373111..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/HelpProperties.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.util;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-
-/**
- * Properties stored in HelpPlugin work area.
- */
-public class HelpProperties extends Properties {
- private File file = null;
- protected String name = null;
- /**
- * Creates empty Properties.
- * @param name name of the table;
- */
- public HelpProperties(String name) {
- this(name, HelpPlugin.getDefault());
- }
-
- /**
- * Creates empty Properties for the specified plugin
- * @param name name of the file;
- * @param plugin the plugin
- */
- public HelpProperties(String name, Plugin plugin) {
- super();
- this.name = name;
- file = new File(plugin.getStateLocation().toFile().getPath(), name);
- }
-
- /**
- * Restores contents of the Properties from a file.
- * @return true if persistant data was read in
- */
- public boolean restore() {
- InputStream in = null;
- boolean loaded = false;
- clear();
- // Test if we have a contribution file to start with
- // If this is a clean start, then we will not have a
- // contribution file. return false.
- if (!file.exists())
- return loaded;
- try {
- in = new FileInputStream(file);
- super.load(in);
- loaded = true;
- } catch (IOException ioe00) {
- HelpPlugin.logError(
- Resources.getString("File4", file.getName()),
- null);
- } finally {
- if (in != null)
- try {
- in.close();
- } catch (IOException ioe10) {
- }
- }
- return loaded;
- }
- /**
- * Saves contents of the table to a file.
- * @return true if operation was successful
- */
- public boolean save() {
- OutputStream out = null;
- boolean ret = false;
- try {
- out = new FileOutputStream(file);
- super.store(out, "This is a generated file; do not edit.");
- ret = true;
- } catch (IOException ioe00) {
- HelpPlugin.logError(
- Resources.getString(
- "Exception_occured",
- name,
- file.getAbsolutePath()),
- ioe00);
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- } catch (IOException ioe01) {
- }
- }
- return ret;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/IErrorUtil.java b/org.eclipse.help/src/org/eclipse/help/internal/util/IErrorUtil.java
deleted file mode 100644
index 2dbb346df..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/IErrorUtil.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.util;
-
-
-/**
- * Utility interface for displaying an error message.
- * Basic help (no UI) will just output to the System.out,
- * but when a UI is present, it will display a message
- */
-public interface IErrorUtil {
- public void displayError(String msg);
- public void displayError(String msg, Thread uiThread);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/PluginVersionInfo.java b/org.eclipse.help/src/org/eclipse/help/internal/util/PluginVersionInfo.java
deleted file mode 100644
index d1f5f803a..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/PluginVersionInfo.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.util;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.model.*;
-import org.eclipse.help.internal.HelpPlugin;
-/**
- * Table of plugins. Records all plugins, their version, corresponding fragments versions
- * The values are String in format:
- * pluginID\npluginVersion\nfragment1ID\nfragment1Version\nfragment2ID\nfragment2Version
- */
-public class PluginVersionInfo extends HelpProperties {
- // Separates plugins and versions in value strings
- static final String SEPARATOR = "\n";
- Plugin basePlugin = HelpPlugin.getDefault();
- boolean doComparison = true;
- boolean hasChanged = false;
- boolean ignoreSavedVersions;
- Collection added = new ArrayList();
- Collection removed = new ArrayList();
- /**
- * Creates table of current contributing plugins and their fragments with versions.
- * @param name the name of the file to serialize the data to
- * @param it iterator of current contributions (IConfigurationElement type)
- * @param basePlugin use this plugin's state location to store the data
- * @param ignoreSavedVersion if true, will cause detect change
- * to ignore saved plugin version and behave like there was nothing saved
- */
- public PluginVersionInfo(
- String name,
- Iterator it,
- Plugin basePlugin,
- boolean ignoreSavedVersions) {
- super(name, basePlugin);
- this.basePlugin = basePlugin;
- this.ignoreSavedVersions = ignoreSavedVersions;
- if (it == null)
- return;
- // create table of current contributions
- for (; it.hasNext();) {
- IPluginDescriptor plugin = (IPluginDescriptor) it.next();
- StringBuffer pluginVersionAndFragments = new StringBuffer();
- pluginVersionAndFragments.append(plugin.getUniqueIdentifier());
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(
- plugin.getVersionIdentifier().toString());
- if (plugin instanceof PluginDescriptorModel) {
- PluginFragmentModel[] fragmentModels =
- ((PluginDescriptorModel) plugin).getFragments();
- if (fragmentModels != null) {
- for (int f = 0; f < fragmentModels.length; f++) {
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(
- fragmentModels[f].getId());
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(
- fragmentModels[f].getVersion());
- }
- }
- }
- this.put(
- plugin.getUniqueIdentifier(),
- pluginVersionAndFragments.toString());
-
- }
- }
- /**
- * Detects changes in contributions or their version
- * since last time the contribution table was saved.
- * @return true if contributions have changed
- */
- public boolean detectChange() {
- if (!doComparison)
- return hasChanged;
- // Create table of contributions present before last save()
- HelpProperties oldContrs = new HelpProperties(this.name, basePlugin);
- if (!ignoreSavedVersions) {
- oldContrs.restore();
- }
- // check if contributions changed
- hasChanged = false;
- for (Enumeration keysEnum = this.keys(); keysEnum.hasMoreElements();) {
- String oneContr = (String) keysEnum.nextElement();
- if (!oldContrs.containsKey(oneContr)) {
- // plugin has been added
- added.add(oneContr);
- } else {
- String versions = (String) this.get(oneContr);
- String oldVersions = (String) oldContrs.get(oneContr);
- if (!compare(versions, oldVersions)) {
- // plugin version changed or fragments changed
- added.add(oneContr);
- }
- }
- }
- for (Enumeration keysEnum = oldContrs.keys();
- keysEnum.hasMoreElements();
- ) {
- String oneContr = (String) keysEnum.nextElement();
- if (!this.containsKey(oneContr)) {
- // plugin has been removed
- removed.add(oneContr);
- } else {
- String versions = (String) this.get(oneContr);
- String oldVersions = (String) oldContrs.get(oneContr);
- if (!compare(versions, oldVersions)) {
- // plugin version changed or fragments changed
- removed.add(oneContr);
- }
- }
- }
- hasChanged = added.size() > 0 || removed.size() > 0;
- doComparison = false;
- return hasChanged;
- }
- /**
- * @return String - Collection of IDs of contributions that were added
- * or upgraded
- */
- public Collection getAdded() {
- if (doComparison)
- detectChange();
- return added;
- }
- /**
- * @return String - Collection of IDs of contributions that were removed
- * or upgraded
- */
- public Collection getRemoved() {
- if (doComparison)
- detectChange();
- return removed;
- }
- /**
- * Saves contributions to a file.
- * After this method is called, calls to detectChange() will return false.
- * @return true if operation was successful
- */
- public boolean save() {
- if (super.save()) {
- doComparison = false;
- hasChanged = false;
- ignoreSavedVersions = false;
- added = new ArrayList();
- removed = new ArrayList();
- return true;
- }
- return false;
- }
- /**
- * Compares plugins and versions represented as a string for equality
- * String have form id1\nverison1\nid2\nversion2
- * String are equal of they contain the same set of IDs and their corresponding version equal
- * @return true if plugins and versions match
- */
- private boolean compare(String versions, String oldVersions) {
- Map versionMap = new HashMap();
- for (StringTokenizer t =
- new StringTokenizer(versions, SEPARATOR, false);
- t.hasMoreTokens();
- ) {
- String pluginOrFragment = t.nextToken();
- if (t.hasMoreTokens()) {
- versionMap.put(pluginOrFragment, t.nextToken());
- }
- }
- Map oldVersionMap = new HashMap();
- for (StringTokenizer t =
- new StringTokenizer(oldVersions, SEPARATOR, false);
- t.hasMoreTokens();
- ) {
- String pluginOrFragment = t.nextToken();
- if (t.hasMoreTokens()) {
- oldVersionMap.put(pluginOrFragment, t.nextToken());
- }
- }
- return versionMap.equals(oldVersionMap);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
index 34fbec0ea..e27240374 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
@@ -82,7 +82,7 @@ public class ResourceLocator {
}
} catch (CoreException ce) {
HelpPlugin.logError(
- Resources.getString(
+ HelpResources.getString(
"E044",
plugin.getUniqueIdentifier()),
ce);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/Resources.java b/org.eclipse.help/src/org/eclipse/help/internal/util/Resources.java
deleted file mode 100644
index 14e608ae1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/Resources.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.util;
-
-import java.text.*;
-import java.util.*;
-
-import org.eclipse.core.boot.*;
-
-/**
- * Uses a resource bundle to load images and strings from
- * a property file.
- */
-public class Resources {
- private static ResourceBundle resBundle;
- static {
- resBundle = ResourceBundle.getBundle("help", getDefaultLocale());
- }
- /**
- * Resources constructor.
- */
- public Resources() {
- super();
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(String name) {
- try {
- return resBundle.getString(name);
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(String name, String replace0) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] { replace0 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(
- String name,
- String replace0,
- String replace1) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] { replace0, replace1 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(
- String name,
- String replace0,
- String replace1,
- String replace2) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] { replace0, replace1, replace2 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(
- String name,
- String replace0,
- String replace1,
- String replace2,
- String replace3) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] { replace0, replace1, replace2, replace3 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(
- String name,
- String replace0,
- String replace1,
- String replace2,
- String replace3,
- String replace4) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] {
- replace0,
- replace1,
- replace2,
- replace3,
- replace4 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
- /**
- * Returns a string from a property file
- */
- public static String getString(
- String name,
- String replace0,
- String replace1,
- String replace2,
- String replace3,
- String replace4,
- String replace5) {
- try {
- String stringFromPropertiesFile = resBundle.getString(name);
- stringFromPropertiesFile =
- MessageFormat.format(
- stringFromPropertiesFile,
- new Object[] {
- replace0,
- replace1,
- replace2,
- replace3,
- replace4,
- replace5 });
- return stringFromPropertiesFile;
- } catch (Exception e) {
- return name;
- }
-
- }
-
- private static Locale getDefaultLocale() {
- String nl = BootLoader.getNL();
- // sanity test
- if (nl == null)
- return Locale.getDefault();
-
- // break the string into tokens to get the Locale object
- StringTokenizer locales = new StringTokenizer(nl, "_");
- if (locales.countTokens() == 1)
- return new Locale(locales.nextToken(), "");
- else if (locales.countTokens() == 2)
- return new Locale(locales.nextToken(), locales.nextToken());
- else if (locales.countTokens() == 3)
- return new Locale(
- locales.nextToken(),
- locales.nextToken(),
- locales.nextToken());
- else
- return Locale.getDefault();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/TString.java b/org.eclipse.help/src/org/eclipse/help/internal/util/TString.java
deleted file mode 100644
index 9e89154a9..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/TString.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.util;
-import java.util.StringTokenizer;
-/**
- * This class provides static methods for some of the
- * very used IString operations
- */
-public class TString {
- private static final String ALPHABET =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- private static final String ALPHANUMERIC =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- private static final String NUMERIC = "0123456789";
- // change all occurrences of oldPat to newPat
- public static String change(String in, String oldPat, String newPat) {
- if (oldPat.length() == 0)
- return in;
- if (oldPat.length() == 1 && newPat.length() == 1)
- return in.replace(oldPat.charAt(0), newPat.charAt(0));
- if (in.indexOf(oldPat) < 0)
- return in;
- int lastIndex = 0;
- int newIndex = 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();
- } else {
- newString.append(in.substring(lastIndex));
- break;
- }
- }
- 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 = " ";
- 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(Resources.getString("E019", token, word(in, 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 = " ";
- 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(" "))
- 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 "";
- else {
- String ret = new String();
- while (st.hasMoreTokens()) {
- ret = st.nextToken();
- if (--i == 0)
- return ret;
- }
- }
- return "";
- }
- public static String words(String in, int i) {
- StringTokenizer st = new StringTokenizer(in);
- if (i <= 0 || i > st.countTokens())
- return "";
- else {
- while (st.hasMoreTokens()) {
- if (--i == 0)
- break;
- st.nextToken();
- }
- if (st.hasMoreTokens())
- return st.nextToken("");
- else
- return "";
- }
- }
- /**
- * 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((int) chars[j], 16).toUpperCase();
- switch (charInHex.length()) {
- case 1 :
- encodedChars.append("\\u000").append(charInHex);
- break;
- case 2 :
- encodedChars.append("\\u00").append(charInHex);
- break;
- case 3 :
- encodedChars.append("\\u0").append(charInHex);
- break;
- default :
- encodedChars.append("\\u").append(charInHex);
- 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();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java
deleted file mode 100644
index dcee80007..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.w3c.dom.Element;
-
-/**
- * Makes help resources adaptable and persistable
- */
-public abstract class AdaptableHelpResource implements IAdaptable, IHelpResource {
- protected IHelpResource element;
- protected IAdaptable parent;
-
- /**
- * This constructor will be called when wrapping help resources.
- */
- public AdaptableHelpResource(IHelpResource element) {
- this.element = element;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IHelpResource.class)
- return element;
- else
- return null;
- }
-
- public abstract void saveState(Element element);
-
- public abstract AdaptableHelpResource[] getChildren();
-
- public IAdaptable getParent() {
- return parent;
- }
-
- protected void setParent(IAdaptable parent) {
- this.parent = parent;
- }
-
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, the name is the same.
- * false otherwise
- */
- public boolean equals(Object object) {
- if (this == object)
- return true;
- else if (object instanceof AdaptableHelpResource)
- return (element == ((AdaptableHelpResource)object).element);
- else if (object instanceof IHelpResource)
- return element == object;
- else
- return false;
- }
-
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- public int hashCode() {
- if (element == null)
- return -1;
- else
- return element.hashCode();
- }
-
- /**
- * Returns a descendant topic with a specified href
- */
- public abstract ITopic getTopic(String href);
-
- /**
- * @see org.eclipse.help.IHelpResource#getHref()
- */
- public String getHref() {
- return element.getHref();
- }
-
- /**
- * @see org.eclipse.help.IHelpResource#getLabel()
- */
- public String getLabel() {
- return element.getLabel();
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableToc.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableToc.java
deleted file mode 100644
index fb1627714..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableToc.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-
-import org.eclipse.help.*;
-import org.w3c.dom.Element;
-
-/**
- * Makes help resources adaptable and persistable
- */
-public class AdaptableToc extends AdaptableHelpResource {
-
- protected AdaptableTopic[] children;
-
- /**
- * This constructor will be called when wrapping help resources.
- */
- AdaptableToc(IToc element) {
- super(element);
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IToc.class)
- return element;
- else
- return super.getAdapter(adapter);
- }
-
- public AdaptableHelpResource[] getChildren() {
- if (children == null) {
- ITopic[] topics = ((IToc)element).getTopics();
- children = new AdaptableTopic[topics.length];
- for (int i = 0; i < topics.length; i++) {
- children[i] = new AdaptableTopic(topics[i]);
- children[i].setParent(this);
- }
- }
- return children;
- }
-
- /**
- * @see org.eclipse.help.IToc#getTopic(java.lang.String)
- */
- public ITopic getTopic(String href) {
- return ((IToc)element).getTopic(href);
- }
-
- /**
- * @see org.eclipse.help.IToc#getTopics()
- */
- public ITopic[] getTopics() {
- return ((IToc)element).getTopics();
- }
-
- public void saveState(Element element) {
- element.setAttribute("toc", getHref());
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java
deleted file mode 100644
index 2e47d9e23..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.help.IToc;
-
-/**
- * Makes help resources adaptable and persistable
- */
-public class AdaptableTocsArray implements IAdaptable {
-
- IToc[] element;
- AdaptableToc[] children;
- HashMap map;
-
- /**
- * This constructor will be called when wrapping help resources.
- */
- public AdaptableTocsArray(IToc[] tocs) {
- this.element = tocs;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IToc[].class)
- return element;
- else
- return null;
- }
-
- public IAdaptable[] getChildren() {
-
- if (children == null) {
- children = new AdaptableToc[element.length];
- for (int i = 0; i < element.length; i++) {
- children[i] = new AdaptableToc(element[i]);
- children[i].setParent(this);
- }
- }
- return children;
-
- }
-
- public AdaptableToc getAdaptableToc(String href) {
- if (map == null) {
- getChildren(); // make sure children are initialized
- map = new HashMap(children.length);
- for (int i=0; i<children.length; i++)
- map.put(children[i].getHref(), children[i]);
- }
- return (AdaptableToc)map.get(href);
- }
-
- IToc[] asArray() {
- return element;
- }
-
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, the name is the same.
- * false otherwise
- */
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (!(object instanceof AdaptableTocsArray)) {
- return false;
- }
-
- AdaptableTocsArray res = (AdaptableTocsArray) object;
- return (Arrays.equals(asArray(), res.asArray()));
-
- }
-
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- public int hashCode() {
- if (element == null)
- return -1;
- else
- return element.hashCode();
- }
-}
-
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTopic.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTopic.java
deleted file mode 100644
index a3c9ba4d5..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/AdaptableTopic.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-
-import java.util.*;
-import java.util.Map;
-
-import org.eclipse.help.*;
-import org.eclipse.help.internal.util.FastStack;
-import org.w3c.dom.Element;
-
-/**
- * Makes help resources adaptable and persistable
- */
-public class AdaptableTopic extends AdaptableHelpResource {
- /**
- * Map of all topics with this topic as ancestor
- */
- private Map topicMap;
-
- /**
- * This constructor will be called when wrapping help resources.
- */
- AdaptableTopic(ITopic element) {
- super(element);
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == ITopic.class)
- return element;
- else
- return super.getAdapter(adapter);
- }
-
- public AdaptableHelpResource[] getChildren() {
- return new AdaptableHelpResource[0];
- }
-
- /**
- * @see org.eclipse.help.ITopic#getSubtopics()
- */
- public ITopic[] getSubtopics() {
- return ((ITopic)element).getSubtopics();
- }
-
- /**
- * Returns a topic with the specified href.
- * <br> It is possible that multiple tocs have
- * the same href, in which case there is no guarantee
- * which one is returned.
- * @param href The topic's href value.
- */
- public ITopic getTopic(String href) {
- if (href == null)
- return null;
-
- if (topicMap == null) {
- // traverse TOC and fill in the topicMap
- topicMap = new HashMap();
- topicMap.put(getHref(),element);
- FastStack stack = new FastStack();
- ITopic[] topics = getSubtopics();
- for (int i = 0; i < topics.length; i++)
- stack.push(topics[i]);
- while (!stack.isEmpty()) {
- ITopic topic = (ITopic) stack.pop();
- if (topic != null) {
- String topicHref = topic.getHref();
- if (topicHref != null) {
- topicMap.put(topicHref, topic);
- }
- ITopic[] subtopics = topic.getSubtopics();
- for (int i = 0; i < subtopics.length; i++)
- stack.push(subtopics[i]);
- }
- }
- }
- return (ITopic) topicMap.get(href);
- }
-
- public void saveState(Element element) {
- AdaptableToc toc = (AdaptableToc)getParent();
- toc.saveState(element);
- AdaptableHelpResource[] topics = toc.getChildren();
- for (int i=0; i<topics.length; i++)
- if (topics[i] == this)
- element.setAttribute("topic", String.valueOf(i));
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java
deleted file mode 100644
index b95f74953..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-import java.io.*;
-
-/**
- * The working set manager stores help working sets. Working sets are persisted
- * whenever one is added or removed.
- * @since 3.0
- */
-public interface IHelpWorkingSetManager {
-
- public AdaptableTocsArray getRoot();
- /**
- * Adds a new working set and saves it
- */
- public void addWorkingSet(WorkingSet workingSet) throws IOException;
-
- /**
- * Creates a new working set
- */
- public WorkingSet createWorkingSet(
- String name,
- AdaptableHelpResource[] elements);
-
- /**
- * Returns a working set by name
- *
- */
- public WorkingSet getWorkingSet(String name);
-
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#getWorkingSets()
- */
- public WorkingSet[] getWorkingSets();
-
- /**
- * Removes specified working set
- */
- public void removeWorkingSet(WorkingSet workingSet);
-
- /**
- * Persists all working sets. Should only be called by the webapp working
- * set dialog.
- *
- * @param changedWorkingSet the working set that has changed
- */
- public void workingSetChanged(WorkingSet changedWorkingSet)
- throws IOException;
-
- public AdaptableToc getAdaptableToc(String href);
-
- public AdaptableTopic getAdaptableTopic(String id);
-
- public String getCurrentWorkingSet();
-
- public void setCurrentWorkingSet(String workingSet);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/PropertyChange.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/PropertyChange.java
deleted file mode 100644
index 3575b9f9f..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/PropertyChange.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-import java.util.*;
-
-/**
- * Utility classes copied from the org.eclipse.core.runtime.Preferences class.
- */
-public class PropertyChange {
-
-
- /**
- * Listener for property changes.
- * <p>
- * Usage:
- * <pre>
- * Preferences.IPropertyChangeListener listener =
- * new Preferences.IPropertyChangeListener() {
- * public void propertyChange(Preferences.PropertyChangeEvent event) {
- * ... // code to deal with occurrence of property change
- * }
- * };
- * emitter.addPropertyChangeListener(listener);
- * ...
- * emitter.removePropertyChangeListener(listener);
- * </pre>
- * </p>
- */
- public interface IPropertyChangeListener extends EventListener {
-
- /**
- * Notification that a property has changed.
- * <p>
- * This method gets called when the observed object fires a property
- * change event.
- * </p>
- *
- * @param event the property change event object describing which
- * property changed and how
- */
- public void propertyChange(PropertyChangeEvent event);
- }
-
- /**
- * An event object describing a change to a named property.
- * <p>
- * The preferences object reports property change events for internal state
- * changes that may be of interest to external parties. A special listener
- * interface (<code>Preferences.IPropertyChangeListener</code>) is
- * defined for this purpose. Listeners are registered via the
- * <code>Preferences.addPropertyChangeListener</code> method.
- * </p>
- * <p>
- * Clients cannot instantiate or subclass this class.
- * </p>
- *
- * @see #addPropertyChangeListener
- * @see #IPropertyChangeListener
- */
- public static class PropertyChangeEvent extends EventObject {
-
- /**
- * The name of the changed property.
- */
- private String propertyName;
-
- /**
- * The old value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object oldValue;
-
- /**
- * The new value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object newValue;
-
- /**
- * Creates a new property change event.
- *
- * @param source the object whose property has changed
- * @param property the property that has changed (must not be
- * <code>null</code>)
- * @param oldValue the old value of the property, or
- * <code>null</code> if none
- * @param newValue the new value of the property, or
- * <code>null</code> if none
- */
- PropertyChangeEvent(
- Object source,
- String property,
- Object oldValue,
- Object newValue) {
-
- super(source);
- if (property == null) {
- throw new IllegalArgumentException();
- }
- this.propertyName = property;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- /**
- * Returns the name of the property that changed.
- * <p>
- * Warning: there is no guarantee that the property name returned
- * is a constant string. Callers must compare property names using
- * <code>equals</code>, not ==.
- *</p>
- *
- * @return the name of the property that changed
- */
- public String getProperty() {
- return propertyName;
- }
-
- /**
- * Returns the new value of the property.
- *
- * @return the new value, or <code>null</code> if not known
- * or not relevant
- */
- public Object getNewValue() {
- return newValue;
- }
-
- /**
- * Returns the old value of the property.
- *
- * @return the old value, or <code>null</code> if not known
- * or not relevant
- */
- public Object getOldValue() {
- return oldValue;
- }
- }
-
- /**
- * Internal class is used to maintain a list of listeners.
- * It is a fairly lightweight object, occupying minimal space when
- * no listeners are registered.
- * <p>
- * Note that the <code>add</code> method checks for and eliminates
- * duplicates based on identity (not equality). Likewise, the
- * <code>remove</code> method compares based on identity.
- * </p>
- * <p>
- * Use the <code>getListeners</code> method when notifying listeners.
- * Note that no garbage is created if no listeners are registered.
- * The recommended code sequence for notifying all registered listeners
- * of say, <code>FooListener.eventHappened</code>, is:
- * <pre>
- * Object[] listeners = myListenerList.getListeners();
- * for (int i = 0; i &lt; listeners.length; ++i) {
- * ((FooListener) listeners[i]).eventHappened(event);
- * }
- * </pre>
- * </p>
- */
- public static class ListenerList {
- /**
- * The initial capacity of the list. Always >= 1.
- */
- private int capacity;
-
- /**
- * The current number of listeners.
- * Maintains invariant: 0 <= size <= listeners.length.
- */
- private int size;
-
- /**
- * The list of listeners. Initially <code>null</code> but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null IFF size != 0
- */
- private Object[] listeners = null;
-
- /**
- * The empty array singleton instance, returned by getListeners()
- * when size == 0.
- */
- private static final Object[] EmptyArray = new Object[0];
-
- /**
- * Creates a listener list with an initial capacity of 3.
- */
- public ListenerList() {
- this(3);
- }
-
- /**
- * Creates a listener list with the given initial capacity.
- *
- * @param capacity the number of listeners which this list can initially
- * accept without growing its internal representation; must be at
- * least 1
- */
- public ListenerList(int capacity) {
- if (capacity < 1) {
- throw new IllegalArgumentException();
- }
- this.capacity = capacity;
- }
-
- /**
- * Adds the given listener to this list. Has no effect if an identical
- * listener is already registered.
- *
- * @param listener the listener
- */
- public void add(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
- if (size == 0) {
- listeners = new Object[capacity];
- } else {
- // check for duplicates using identity
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- return;
- }
- }
- // grow array if necessary
- if (size == listeners.length) {
- System.arraycopy(listeners, 0, listeners = new Object[size * 2 + 1], 0, size);
- }
- }
- listeners[size++] = listener;
- }
-
- /**
- * Returns an array containing all the registered listeners.
- * The resulting array is unaffected by subsequent adds or removes.
- * If there are no listeners registered, the result is an empty array
- * singleton instance (no garbage is created).
- * Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on
- * the notification itself.
- *
- * @return the list of registered listeners
- */
- public Object[] getListeners() {
- if (size == 0)
- return EmptyArray;
- Object[] result = new Object[size];
- System.arraycopy(listeners, 0, result, 0, size);
- return result;
- }
-
- /**
- * Returns whether this listener list is empty.
- *
- * @return <code>true</code> if there are no registered listeners, and
- * <code>false</code> otherwise
- */
- public boolean isEmpty() {
- return size == 0;
- }
-
- /**
- * Removes the given listener from this list. Has no effect if an
- * identical listener was not already registered.
- *
- * @param listener the listener
- */
- public void remove(Object listener) {
- if (listener == null) {
- throw new IllegalArgumentException();
- }
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- if (size == 1) {
- listeners = null;
- size = 0;
- } else {
- System.arraycopy(listeners, i + 1, listeners, i, --size - i);
- listeners[size] = null;
- }
- return;
- }
- }
- }
-
- /**
- * Returns the number of registered listeners.
- *
- * @return the number of registered listeners
- */
- public int size() {
- return size;
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSet.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSet.java
deleted file mode 100644
index 57fe978b3..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSet.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-import java.util.*;
-
-import org.w3c.dom.*;
-
-public class WorkingSet {
- private String name;
- private List elements;
-
- public WorkingSet(String name) {
- this(name, (List)null);
- }
-
- public WorkingSet(String name, List elements) {
- this.name = name;
- if (elements == null)
- elements = new ArrayList();
-
- this.elements = elements;
- }
-
- public WorkingSet(String name, AdaptableHelpResource[] elements) {
- this.name = name;
- if (elements == null)
- elements = new AdaptableHelpResource[0];
-
- this.elements = new ArrayList(elements.length);
- for (int i=0; i<elements.length; i++) {
- this.elements.add(elements[i]);
- }
- }
-
- public void removeElement(AdaptableHelpResource element) {
- // Note: this is based on equality of IHelpResource and AdaptableHelpResource
- elements.remove(element);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String newName) {
- if (newName == null)
- return;
- name = newName;
- }
-
- public AdaptableHelpResource[] getElements() {
- AdaptableHelpResource[] array = new AdaptableHelpResource[elements.size()];
- elements.toArray(array);
- return array;
- }
-
- public void setElements(AdaptableHelpResource[] elements) {
- this.elements = new ArrayList(elements.length);
- for (int i=0; i<elements.length; i++)
- this.elements.add(elements[i]);
- }
-
- public void saveState(Element parent) {
- Document doc = parent.getOwnerDocument();
- Element ws = doc.createElement("workingSet");
- ws.setAttribute("name", name);
- parent.appendChild(ws);
-
- for (Iterator it=elements.iterator(); it.hasNext(); ) {
- Element child = doc.createElement("item");
- AdaptableHelpResource helpResource = (AdaptableHelpResource)it.next();
- helpResource.saveState(child);
- ws.appendChild(child);
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java
deleted file mode 100644
index 5c92986a9..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-
-import java.text.Collator;
-import java.util.Comparator;
-
-/**
- * Compares two working sets by name.
- */
-public class WorkingSetComparator implements Comparator {
- private Collator fCollator = Collator.getInstance();
-
- /**
- * Implements Comparator.
- *
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- String name1 = null;
- String name2 = null;
-
- if (o1 instanceof WorkingSet)
- name1 = ((WorkingSet) o1).getName();
-
- if (o2 instanceof WorkingSet)
- name2 = ((WorkingSet) o2).getName();
-
- if (name1 == null || name2 == null)
- return -1;
-
- return fCollator.compare(name1, name2);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetManager.java b/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
deleted file mode 100644
index eb8c25514..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.internal.workingset;
-
-import java.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.stream.*;
-
-import org.eclipse.core.boot.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * The working set manager stores help working sets. Working sets are persisted
- * whenever one is added or removed.
- * @since 2.1
- */
-public class WorkingSetManager implements IHelpWorkingSetManager {
-
- // Note: keep the following constants in sych with the values defined in IWorkingSetManager.
- // They are needed to synch the ui and the help working sets, as help should run w/o ui plugins.
-
- /**
- * Change event id when a working set is added
- * newValue of the PropertyChangeEvent will be the added working set.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_ADD = "workingSetAdd";
- /**
- * Change event id when a working set is removed
- * newValue of the PropertyChangeEvent will be null.
- * oldValue will be the removed working set.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_REMOVE = "workingSetRemove";
- /**
- * Change event id when the working set contents changed
- * newValue of the PropertyChangeEvent will be the changed working set.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_CONTENT_CHANGE =
- "workingSetContentChange";
- /**
- * Change event id when the working set name changed.
- * newValue of the PropertyChangeEvent will be the changed working set.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_NAME_CHANGE = "workingSetNameChange"; //$NON-NLS-1$
-
- /**
- * Synchronize event id. When other working sets repositories are used,
- * one may want to keep things in synch.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SETS_SYNCH = "workingSetsSynch";
-
- // Working set persistence
- private static final String WORKING_SET_STATE_FILENAME = "workingsets.xml";
- private SortedSet workingSets = new TreeSet(new WorkingSetComparator());
- private String locale;
- private PropertyChange.ListenerList propertyChangeListeners =
- new PropertyChange.ListenerList();
- private AdaptableTocsArray root;
-
- private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- private static final TransformerFactory transformerFactory = TransformerFactory.newInstance();
-
- /**
- * Constructor
- * @param locale
- */
- public WorkingSetManager(String locale) {
- this.locale = locale != null ? locale : BootLoader.getNL();
- restoreState();
- }
-
- public AdaptableTocsArray getRoot() {
- if (root == null)
- root =
- new AdaptableTocsArray(
- HelpSystem.getTocManager().getTocs(locale));
- return root;
- }
-
- /**
- * Adds a new working set and saves it
- */
- public void addWorkingSet(WorkingSet workingSet) {
- if (workingSet == null || workingSets.contains(workingSet))
- return;
- workingSets.add(workingSet);
- saveState();
- firePropertyChange(CHANGE_WORKING_SET_ADD, null, workingSet);
- }
-
- /**
- */
- public void addPropertyChangeListener(
- PropertyChange.IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
-
- /**
- * Creates a new working set
- */
- public WorkingSet createWorkingSet(
- String name,
- AdaptableHelpResource[] elements) {
- return new WorkingSet(name, elements);
- }
-
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, it has the same
- * working sets. false otherwise
- */
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof WorkingSetManager) {
- WorkingSetManager workingSetManager = (WorkingSetManager) object;
- return workingSetManager.workingSets.equals(workingSets);
- }
- return false;
- }
-
- /**
- * Notify property change listeners about a change to the list of
- * working sets.
- *
- * @param changeId one of
- * CHANGE_WORKING_SET_ADD
- * CHANGE_WORKING_SET_REMOVE
- * CHANGE_WORKING_SET_CONTENT_CHANGE
- * CHANGE_WORKING_SET_NAME_CHANGE
- * @param oldValue the removed working set or null if a working set
- * was added or changed.
- * @param newValue the new or changed working set or null if a working
- * set was removed.
- */
- private void firePropertyChange(
- String changeId,
- Object oldValue,
- Object newValue) {
- final PropertyChange.PropertyChangeEvent event =
- new PropertyChange.PropertyChangeEvent(
- this,
- changeId,
- oldValue,
- newValue);
-
- Object[] listeners = propertyChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- (
- (
- PropertyChange
- .IPropertyChangeListener) listeners[i])
- .propertyChange(
- event);
- }
- }
- /**
- * Returns a working set by name
- *
- */
- public WorkingSet getWorkingSet(String name) {
- if (name == null || workingSets == null)
- return null;
-
- Iterator iter = workingSets.iterator();
- while (iter.hasNext()) {
- WorkingSet workingSet = (WorkingSet) iter.next();
- if (name.equals(workingSet.getName()))
- return workingSet;
- }
- return null;
- }
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- public int hashCode() {
- return workingSets.hashCode();
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#getWorkingSets()
- */
- public WorkingSet[] getWorkingSets() {
- return (WorkingSet[]) workingSets.toArray(
- new WorkingSet[workingSets.size()]);
- }
- /**
- * Returns the file used as the persistence store
- *
- * @return the file used as the persistence store
- */
- private File getWorkingSetStateFile() {
- IPath path = HelpPlugin.getDefault().getStateLocation();
- path = path.append(locale);
- path = path.append(WORKING_SET_STATE_FILENAME);
- return path.toFile();
- }
-
- /**
- * Removes specified working set
- */
- public void removeWorkingSet(WorkingSet workingSet) {
- workingSets.remove(workingSet);
- saveState();
- firePropertyChange(CHANGE_WORKING_SET_REMOVE, workingSet, null);
- }
-
- /**
- * Reads the persistence store and creates the working sets
- * stored in it.
- */
- public boolean restoreState() {
- File stateFile = getWorkingSetStateFile();
-
- if (stateFile.exists()) {
- try {
- FileInputStream input = new FileInputStream(stateFile);
- InputStreamReader reader = new InputStreamReader(input, "utf-8"); //$NON-NLS-1$
-
- InputSource inputSource = new InputSource(reader);
- inputSource.setSystemId(stateFile.toString());
-
- DocumentBuilder parser = documentBuilderFactory.newDocumentBuilder();
- Document d=parser.parse(inputSource);
-
- Element rootElement = d.getDocumentElement();
- restoreWorkingSetState(rootElement);
- input.close();
-
- return true;
- } catch (ParserConfigurationException pce) {
- String msg = Resources.getString("WorkingSetManager.PCE");
- HelpPlugin.logError(msg, pce);
- HelpPlugin.logError(Resources.getString("E041"), pce);
- return false;
- } catch (SAXException se) {
- String msg = Resources.getString("E018", stateFile.toString());
- HelpPlugin.logError(msg, se);
- HelpPlugin.logError(Resources.getString("E041"), se);
- return false;
- } catch (IOException ioe) {
- String msg = Resources.getString("E018", stateFile.toString());
- HelpPlugin.logError(msg, ioe);
- HelpPlugin.logError(Resources.getString("E041"), ioe);
- return false;
- }
- }
- return false;
- }
-
- /**
- * Recreates all working sets from the persistence store
- * and adds them to the receiver.
- *
- * @param parent the xml element containing serialized working sets
- */
- private void restoreWorkingSetState(Element parent) {
- NodeList workingSets = parent.getChildNodes();
-
- for (int i = 0; i < workingSets.getLength(); i++) {
- if (workingSets.item(i).getNodeType() != Element.ELEMENT_NODE)
- continue;
-
- WorkingSet workingSet =
- restoreWorkingSet((Element) workingSets.item(i));
- if (workingSet != null) {
- this.workingSets.add(workingSet);
- }
- }
- }
-
- /**
- * Recreates a working set from the persistence store.
- *
- * @param memento the persistence store
- * @return the working set created from the memento or null if
- * creation failed.
- */
- private WorkingSet restoreWorkingSet(Element workingSetNode) {
-
- String name = workingSetNode.getAttribute("name");
- NodeList items = workingSetNode.getElementsByTagName("item");
- 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");
- if (href == null || href.length() == 0)
- continue;
-
- String child_pos = item.getAttribute("topic");
- int pos = -1;
- if (child_pos != null) {
- try {
- pos = Integer.parseInt(child_pos);
- } catch (Exception e) {
- }
- }
-
- AdaptableHelpResource toc = getAdaptableToc(href);
-
- if (toc == null)
- return null;
-
- if (pos == -1) {
- // Create the adaptable toc.
- helpResources.add(toc);
- } else {
- // Create the adaptable topic
- AdaptableTopic[] topics = (AdaptableTopic[]) toc.getChildren();
- if (pos >= 0 && topics.length > pos)
- helpResources.add(topics[pos]);
- }
- }
-
- AdaptableHelpResource[] elements =
- new AdaptableHelpResource[helpResources.size()];
- helpResources.toArray(elements);
-
- WorkingSet ws = createWorkingSet(name, elements);
-
- return ws;
- }
-
- /**
- */
- public void removePropertyChangeListener(
- PropertyChange.IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
-
- /**
- * Saves the working sets in the persistence store
- */
- public synchronized boolean saveState() {
- File stateFile=null;
- try {
- DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
- Document doc = docBuilder.newDocument();
- Element rootElement = doc.createElement("workingSets");
- doc.appendChild(rootElement);
-
- saveWorkingSetState(rootElement);
-
- stateFile = getWorkingSetStateFile();
- stateFile.getParentFile().mkdir();
- FileOutputStream stream = new FileOutputStream(stateFile);
-
- Transformer transformer=transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- DOMSource source = new DOMSource(doc);
- StreamResult result = new StreamResult(stream);
-
- transformer.transform(source,result);
- stream.close();
- return true;
- }catch (ParserConfigurationException pce){
- String msg = Resources.getString("WorkingSetManager.PCE");
- HelpPlugin.logError(msg, pce);
- return false;
- }catch (TransformerException e){
- String message = Resources.getString("WorkingSetManager.transformer");
- HelpPlugin.logError(message, null);
- return false;
- } catch (IOException e) {
- if(stateFile!=null){
- stateFile.delete();
- }
- String message = Resources.getString("E040");
- HelpPlugin.logError(message, null);
- return false;
- }
- }
-
- /**
- * Saves all persistable working sets in the persistence store.
- *
- * @param parent: the xml node to save to
- */
- private void saveWorkingSetState(Element parent) {
- Iterator iterator = workingSets.iterator();
-
- while (iterator.hasNext()) {
- WorkingSet workingSet = (WorkingSet) iterator.next();
- workingSet.saveState(parent);
- }
- }
- /**
- * Persists all working sets. Should only be called by the webapp working
- * set dialog.
- *
- * @param changedWorkingSet the working set that has changed
- */
- public void workingSetChanged(WorkingSet changedWorkingSet) {
- saveState();
- firePropertyChange(
- CHANGE_WORKING_SET_NAME_CHANGE,
- null,
- changedWorkingSet);
- firePropertyChange(
- CHANGE_WORKING_SET_CONTENT_CHANGE,
- null,
- changedWorkingSet);
- }
-
- /**
- * Synchronizes the working sets. Should only be called by the webapp
- * working set manager dialog.
- *
- * @param changedWorkingSet the working set that has changed
- */
- public void synchronizeWorkingSets() {
- firePropertyChange(CHANGE_WORKING_SETS_SYNCH, null, null);
- }
-
- public AdaptableToc getAdaptableToc(String href) {
- return getRoot().getAdaptableToc(href);
- }
-
- public AdaptableTopic getAdaptableTopic(String id) {
-
- if (id == null || id.length() == 0)
- return null;
-
- // toc id's are hrefs: /pluginId/path/to/toc.xml
- // topic id's are based on parent toc id and index of topic: /pluginId/path/to/toc.xml_index_
- int len = id.length();
- if (id.charAt(len - 1) == '_') {
- // This is a first level topic
- String indexStr =
- id.substring(id.lastIndexOf('_', len - 2) + 1, len - 1);
- int index = 0;
- try {
- index = Integer.parseInt(indexStr);
- } catch (Exception e) {
- }
-
- String tocStr = id.substring(0, id.lastIndexOf('_', len - 2));
- AdaptableToc toc = getAdaptableToc(tocStr);
- if (toc == null)
- return null;
- IAdaptable[] topics = toc.getChildren();
- if (index < 0 || index >= topics.length)
- return null;
- else
- return (AdaptableTopic) topics[index];
- }
-
- return null;
- }
- public String getCurrentWorkingSet() {
- return HelpPlugin.getDefault().getPluginPreferences().getString(
- HelpSystem.WORKING_SET);
- }
-
- public void setCurrentWorkingSet(String workingSet) {
- HelpPlugin.getDefault().getPluginPreferences().setValue(
- HelpSystem.WORKING_SET,
- workingSet);
- HelpPlugin.getDefault().savePluginPreferences();
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/package.html b/org.eclipse.help/src/org/eclipse/help/package.html
index 5c34d6b43..8ab6f51be 100644
--- a/org.eclipse.help/src/org/eclipse/help/package.html
+++ b/org.eclipse.help/src/org/eclipse/help/package.html
@@ -7,36 +7,14 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Provides core support for the Eclipse platform online
-help system.
+Provides core help system for the platform.
<h2>
Package Specification</h2>
There is a general mechanism (defined at the plug-in level) by which individual
plug-ins contribute online help and context-sensitive help for their component.
-The help system UI is responsible for accessing this information and displaying
-it to the user.
-<p>The actual help system UI implementation is an optional piece that plugs
-in to the platform's standard <tt>org.eclipse.help.support</tt> extension
-point. At most one such help system UI should be contributed in any given
-configuration of the platform. In general terms, implementing a help system
-UI involves:
-<ul>
-<li>
-Implementing the <tt>IHelp</tt> interface to display help to the user.</li>
-<li>
-Declaring an extension of the <tt>org.eclipse.help.support</tt> extension
-point that mentions the name of that class.</li>
-
-<li>
-Ensuring that the platform is not configured with any other plug-ins which
-contribute to the <tt>org.eclipse.help.support</tt> extension point.</li>
-</ul>
-Note that the platform declares a plug-in (<tt>org.eclipse.help.workbench</tt>)
-which implements the help system UI. This plug-in would need to be omitted
-from the platform configuration when using a replacement.
-<br>&nbsp;
-<br>&nbsp;
-<br>&nbsp;
+This package defines interfaces for data objects managed by help systems, as well
+as <code>HelpSystem</code> class which static methods can be used to obtain objects
+managed by the help system.
</body>
</html>
diff --git a/org.eclipse.help/src/org/eclipse/help/standalone/Help.java b/org.eclipse.help/src/org/eclipse/help/standalone/Help.java
deleted file mode 100644
index 04043958b..000000000
--- a/org.eclipse.help/src/org/eclipse/help/standalone/Help.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.standalone;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import org.eclipse.help.internal.standalone.StandaloneHelp;
-
-/**
- * This is a standalone help system. It takes care of
- * launching the Eclipse with its help system implementation,
- * and controling it.
- * This class can be instantiated and used in a Java program,
- * or can be launched from command line to execute single help action.
- *
- * Usage as a Java component:
- * <ul>
- * <li> create an instantance of this class and then hold onto
- * this instance for the duration of your application</li>
- * <li> call start() </li>
- * <li> call displayHelp(...) or displayContext(..) any number of times </li>
- * <li> at the end, call shutdown(). </li>
- * </ul>
- */
-public class Help {
- private StandaloneHelp help;
-
- /**
- * Constructs help system
- * @param options array of String options and their values
- * <p>
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory. This directory is a parent to "plugins" directory
- * and eclipse executable. The option must be provided, when current directory
- * from which infocenter is launched, is
- * not the same as Eclipse installation directory.
- * <p>
- * Option <code>-host helpServerHost</code> specifies host name
- * of the interface that help server will use.
- * It overrides host name specified in the application server plugin preferences.
- * <p>
- * Option <code>-port helpServerPort</code> specifies port number
- * that help server will use.
- * It overrides port number specified in the application server plugin preferences.
- * <p>
- * Option <code>-servertimeout timeout</code> number of seconds waiting
- * to connect to the help server while executing commands, such as shutdown.
- * shutdown. Default is 40s. You may need to use this option when
- * running from a slow media such as a CD-ROM.
- * <p>
- * Additionally, most options accepted by Eclipse execuable are supported.
- */
- public Help(String[] options) {
- help = new StandaloneHelp(options);
- }
- /**
- * This contstructs the stand alone help.
- * @param pluginsDir directory containing Eclipse plugins
- * @deprecated use Help#Help(String[])
- */
- public Help(String pluginsDir) {
- File plugins = new File(pluginsDir);
- String install = plugins.getParent();
- ArrayList options = new ArrayList(2);
- if (install != null) {
- options = new ArrayList(2);
- options.add("-eclipseHome");
- options.add(install);
- }
- String[] args = new String[options.size()];
- options.toArray(args);
- help = new StandaloneHelp(args);
- }
- /**
- * Starts the stand alone help system.
- */
- public void start() throws Exception {
- help.start();
- }
- /**
- * Shuts-down the stand alone help system.
- */
- public void shutdown() throws Exception {
- help.shutdown();
- }
- /**
- * Displays help.
- */
- public void displayHelp() throws Exception {
- help.displayHelp();
- }
-
- /**
- * Displays specified help resource.
- * @param href the href of the table of contents
- */
- public void displayHelp(String href) throws Exception {
- help.displayHelp(href);
- }
-
- /**
- * Displays context sensitive help.
- * @param contextId context id
- * @param x x coordinate
- * @param y y coordinate
- */
- public void displayContext(String contextId, int x, int y)
- throws Exception {
- help.displayContext(contextId, x, y);
- }
-
- /**
- * Displays context sensitive help in infopop.
- * @param contextId context id
- * @param x x coordinate
- * @param y y coordinate
- */
- public void displayContextInfopop(String contextId, int x, int y)
- throws Exception {
- help.displayContextInfopop(contextId, x, y);
- }
-
- /**
- * Controls standalone help system from command line.
- * @param args array of String containing options
- * Options are:
- * <code>-command start | shutdown | (displayHelp [href]) [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [-servertimeout timeout] [platform options] [-vmargs JavaVMarguments]</code>
- * where
- * <ul>
- * <li><code>href</code> is the URL of the help resource to display,</li>
- * <li><code>eclipseInstallPath</code> specifies Eclipse installation directory;
- * it must be provided, when current directory is not the same
- * as Eclipse installation directory,</li>
- * <li><code>helpServerHost</code> specifies host name of the interface
- * that help server will use, it overrides host name specified
- * the application server plugin preferences</li>
- * <li><code>helpServerPort</code> specifies port number
- * that help server will use, it overrides port number specified
- * the application server plugin preferences.</li>
- * <li><code>timeout</code> number of seconds waiting
- * to connect to the help server while executing commands,
- * such as shutdown. Default is 40s. You may need to
- * use this option when running from a slow media such as a CD-ROM.
- * <li><code>platform options</code> are other options that are supported by Eclipse Executable.</li>
- * <ul>
- */
- public static void main(String[] args) {
- StandaloneHelp.main(args);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/standalone/Infocenter.java b/org.eclipse.help/src/org/eclipse/help/standalone/Infocenter.java
deleted file mode 100644
index 3b3a74b9f..000000000
--- a/org.eclipse.help/src/org/eclipse/help/standalone/Infocenter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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
- *******************************************************************************/
-package org.eclipse.help.standalone;
-
-import org.eclipse.help.internal.standalone.StandaloneInfocenter;
-
-/**
- * This is a standalone infocenter. It takes care of
- * launching the Eclipse with its help system implementation.
- * This class can be instantiated and used in a Java program,
- * or can be launched from command line.
- *
- * Usage as a Java component:
- * <ul>
- * <li> create an instantance of this class</li>
- * <li> call start(), infocenter will run </li>
- * <li> when no longer needed call shutdown(). </li>
- * </ul>
- */
-public class Infocenter {
- private StandaloneInfocenter infocenter;
- /**
- * Constructs Infocenter
- * @param options array of String options and their values
- * <p>
- * Option <code>-eclipseHome dir</code> specifies Eclipse
- * installation directory. This directory is a parent to "plugins" directory
- * and eclipse executable. The option must be provided, when current directory
- * from which infocenter is launched, is
- * not the same as Eclipse installation directory.
- * <p>
- * Option <code>-host helpServerHost</code> specifies host name
- * of the interface that help server will use.
- * It overrides host name specified in the application server plugin preferences.
- * <p>
- * Option <code>-port helpServerPort</code> specifies port number
- * that help server will use.
- * It overrides port number specified in the application server plugin preferences.
- * <p>
- * Option <code>-servertimeout timeout</code> number of seconds waiting
- * to connect to the help server while executing commands, such as shutdown.
- * shutdown. Default is 40s. You may need to use this option when
- * running from a slow media such as a CD-ROM.
- * <p>
- * Option <code>-noexec</code> indicates that
- * Eclipse executable should not be used.
- * <p>
- * Additionally, most options accepted by Eclipse execuable are supported.
- */
- public Infocenter(String[] options) {
- infocenter = new StandaloneInfocenter(options);
- }
- /**
- * Starts the stand alone infocenter.
- */
- public void start() throws Exception {
- infocenter.start();
- }
- /**
- * Shuts-down the stand alone infocenter.
- */
- public void shutdown() throws Exception {
- infocenter.shutdown();
- }
- /**
- * Controls start up and shut down of infocenter from command line.
- * @param args array of String containing options
- * Options are:
- * <code>-command start | shutdown [-eclipsehome eclipseInstallPath] [-host helpServerHost] [-port helpServerPort] [-servertimeout timeout] [-noexec] [platform options] [-vmargs JavaVMarguments]</code>
- * where
- * <ul>
- * <li><code>eclipseInstallPath</code> specifies Eclipse installation directory;
- * it must be provided, when current directory is not the same
- * as Eclipse installation directory,</li>
- * <li><code>helpServerHost</code> specifies host name of the interface
- * that help server will use, it overrides host name specified
- * the application server plugin preferences</li>
- * <li><code>helpServerPort</code> specifies port number
- * that help server will use, it overrides port number specified
- * the application server plugin preferences.</li>
- * <li><code>timeout</code> number of seconds waiting
- * to connect to the help server while executing commands,
- * such as shutdown. Default is 40s. You may need to
- * use this option when running from a slow media such as a CD-ROM.
- * <li><code>-noexec</code> option indicates that
- * Eclipse executable should not be used.</li>
- * <li><code>platform options</code> are other options that are supported by Eclipse Executable.</li>
- * <ul>
- */
- public static void main(String[] args) {
- StandaloneInfocenter.main(args);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/standalone/package.html b/org.eclipse.help/src/org/eclipse/help/standalone/package.html
deleted file mode 100644
index ded158b98..000000000
--- a/org.eclipse.help/src/org/eclipse/help/standalone/package.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides access to infocenter and stand alone help system.&nbsp;
-Classes in this package are not supposed to be called by Eclipse plugins,
-they are intended to be called from outside of Eclipse environment.
-<h2>
-Package Specification</h2>The help system in Eclipse can be used to run an information center or as a stand alone help system for use by other products.&nbsp; Access
-to the help system is provided
-<TT>org.eclipse.help.standalone.Infocenter </TT> and
-<TT>org.eclipse.help.standalone.Help </TT>
-classes.
-<P>To start or stop the infocenter, use the Infocenter class. The class can be used as a stand alone program, launched from a command line, or can be instantiated and used from a Java program.</P>
-<p>To start, stop the stand alone help system or cause it to display help on a user machine, use the Help class. The class can be used as a stand alone program, launched from a command line, or can be instantiated and used from a Java program.</P>
-<P>There
-is a general mechanism (defined at the plug-in level) by which individual
-plug-ins contribute on-line help and context-sensitive help for their component.
-This Eclipse mechanism for contributing help content needs to be used.&nbsp;
-The stand alone help system is responsible for accessing this information
-and displaying it to the user. The infocenter, unlike the stand alone help system, does not launch UI on the machine that it is running on. When infocenter is started the help content can be obtained by connecting to a help server (port specified in Tomcat plugin preferences) using HTTP connection.</P></body>
-</html>

Back to the top