Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.base/.classpath7
-rw-r--r--org.eclipse.help.base/.cvsignore5
-rw-r--r--org.eclipse.help.base/.options2
-rw-r--r--org.eclipse.help.base/.project28
-rw-r--r--org.eclipse.help.base/about.html30
-rw-r--r--org.eclipse.help.base/build.properties14
-rw-r--r--org.eclipse.help.base/doc/book.css1
-rw-r--r--org.eclipse.help.base/doc/contents_view.gifbin583 -> 0 bytes
-rw-r--r--org.eclipse.help.base/doc/e_synch_toc_nav.gifbin166 -> 0 bytes
-rw-r--r--org.eclipse.help.base/doc/help_banner.jpgbin28968 -> 0 bytes
-rw-r--r--org.eclipse.help.base/doc/help_home.html51
-rw-r--r--org.eclipse.help.base/doc/hglegal2003.htm14
-rw-r--r--org.eclipse.help.base/doc/ngibmcpy2003.gifbin1101 -> 0 bytes
-rw-r--r--org.eclipse.help.base/doc/search_results_view.gifbin356 -> 0 bytes
-rw-r--r--org.eclipse.help.base/plugin.properties21
-rw-r--r--org.eclipse.help.base/plugin.xml137
-rw-r--r--org.eclipse.help.base/preferences.ini118
-rw-r--r--org.eclipse.help.base/schema/browser.exsd175
-rw-r--r--org.eclipse.help.base/schema/luceneAnalyzer.exsd142
-rw-r--r--org.eclipse.help.base/schema/webapp.exsd111
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/browser/IBrowser.java69
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/browser/IBrowserFactory.java31
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/browser/package.html41
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java275
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpApplication.java139
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBasePlugin.java172
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.java174
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties73
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java239
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpActivitySupport.java47
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java156
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java103
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java22
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java338
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserDescriptor.java41
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserLog.java88
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java350
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/CurrentBrowser.java136
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java154
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java34
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java231
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java132
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java46
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java87
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java41
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/ASCIIReader.java50
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java162
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java74
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java104
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java381
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/ISearchHitCollector.java24
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/ISearchQuery.java32
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java300
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/LazyProgressMonitor.java57
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/ParsedDocument.java73
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java188
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/ProgressDistributor.java132
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java437
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryTooComplexException.java18
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java50
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java51
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java81
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchHit.java79
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java521
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndexWithIndexingProgress.java33
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java195
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java219
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java102
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java166
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java45
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/WordTokenStream.java101
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java218
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java106
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java275
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java17
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java307
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java161
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java100
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java103
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java70
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java104
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java101
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java69
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/PropertyChange.java306
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java84
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java43
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java507
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java159
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/standalone/Infocenter.java101
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/standalone/package.html27
-rw-r--r--org.eclipse.help/.classpath7
-rw-r--r--org.eclipse.help/.cvsignore5
-rw-r--r--org.eclipse.help/.options3
-rw-r--r--org.eclipse.help/.project28
-rw-r--r--org.eclipse.help/about.html30
-rw-r--r--org.eclipse.help/build.properties14
-rw-r--r--org.eclipse.help/dtd/contexts.dtd13
-rw-r--r--org.eclipse.help/dtd/toc.dtd14
-rw-r--r--org.eclipse.help/livehelp.js61
-rw-r--r--org.eclipse.help/plugin.properties15
-rw-r--r--org.eclipse.help/plugin.xml26
-rw-r--r--org.eclipse.help/preferences.ini9
-rw-r--r--org.eclipse.help/schema/contentProducer.exsd156
-rw-r--r--org.eclipse.help/schema/contexts.exsd170
-rw-r--r--org.eclipse.help/schema/toc.exsd294
-rw-r--r--org.eclipse.help/src/org/eclipse/help/HelpSystem.java87
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IContext.java45
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IHelp.java211
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IHelpContentProducer.java47
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IHelpResource.java63
-rw-r--r--org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java27
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IToc.java47
-rw-r--r--org.eclipse.help/src/org/eclipse/help/ITopic.java30
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java161
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java96
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties36
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/ITocsChangedListener.java15
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java131
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/Context.java89
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java183
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/Contexts.java25
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsBuilder.java121
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java64
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java179
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java59
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/IStyledContext.java31
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java25
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/PluginsContexts.java27
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/RelatedTopic.java47
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/model/IAnchorElement.java20
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/model/ILinkElement.java20
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/model/INavigationElement.java27
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/model/ITocElement.java49
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/model/ITopicElement.java22
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java311
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLStreamHandler.java39
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/Anchor.java73
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java241
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/HrefUtil.java99
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/ITocNode.java32
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/Link.java52
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.java255
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java151
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.java144
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java182
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java225
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.java83
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.java133
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/FastStack.java45
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java252
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java61
-rw-r--r--org.eclipse.help/src/org/eclipse/help/package.html20
-rw-r--r--org.eclipse.ui.intro/empty_swt.properties31
153 files changed, 24 insertions, 15842 deletions
diff --git a/org.eclipse.help.base/.classpath b/org.eclipse.help.base/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/org.eclipse.help.base/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.help.base/.cvsignore b/org.eclipse.help.base/.cvsignore
deleted file mode 100644
index b003c493a..000000000
--- a/org.eclipse.help.base/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-build.xml
-helpbase.jar
-helpbase.jar.bin.log
-org.eclipse.help.base_* \ No newline at end of file
diff --git a/org.eclipse.help.base/.options b/org.eclipse.help.base/.options
deleted file mode 100644
index 093a2919d..000000000
--- a/org.eclipse.help.base/.options
+++ /dev/null
@@ -1,2 +0,0 @@
-org.eclipse.help.base/debug = true
-org.eclipse.help.base/debug/search = false
diff --git a/org.eclipse.help.base/.project b/org.eclipse.help.base/.project
deleted file mode 100644
index ca441a53a..000000000
--- a/org.eclipse.help.base/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.help.base</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.help.base/about.html b/org.eclipse.help.base/about.html
deleted file mode 100644
index 72c7ec251..000000000
--- a/org.eclipse.help.base/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>22nd August, 2003</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/org.eclipse.help.base/build.properties b/org.eclipse.help.base/build.properties
deleted file mode 100644
index f03604e57..000000000
--- a/org.eclipse.help.base/build.properties
+++ /dev/null
@@ -1,14 +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
-###############################################################################
-source.helpbase.jar=src/
-src.includes=schema/,about.html
-bin.includes=doc/,plugin.xml,preferences.ini,*.jar,plugin.properties,about.html,.options
-
diff --git a/org.eclipse.help.base/doc/book.css b/org.eclipse.help.base/doc/book.css
deleted file mode 100644
index 139eb28a0..000000000
--- a/org.eclipse.help.base/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.base/doc/contents_view.gif b/org.eclipse.help.base/doc/contents_view.gif
deleted file mode 100644
index 9e665d5c7..000000000
--- a/org.eclipse.help.base/doc/contents_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.base/doc/e_synch_toc_nav.gif b/org.eclipse.help.base/doc/e_synch_toc_nav.gif
deleted file mode 100644
index 4353fd5be..000000000
--- a/org.eclipse.help.base/doc/e_synch_toc_nav.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.base/doc/help_banner.jpg b/org.eclipse.help.base/doc/help_banner.jpg
deleted file mode 100644
index 9dc73f9e5..000000000
--- a/org.eclipse.help.base/doc/help_banner.jpg
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.base/doc/help_home.html b/org.eclipse.help.base/doc/help_home.html
deleted file mode 100644
index 8cf0fdd36..000000000
--- a/org.eclipse.help.base/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 the 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=60 width="100%" cellspacing="0" cellpadding="0" border="0" style="background:#7168D1;">
- <tr><td align=left valign="center"><img src="help_banner.jpg" alt="Eclipse icon"></td></tr>
-</table>
-
-<table width="100%" cellspacing="0" cellpadding="10" border="0">
-<tr><td>
-<h2>Using the Eclipse help system</h2>
-<p>Browse topics in the <b>Contents</b> frame
- <nobr>(<img src="contents_view.gif" width="16" height="16" alt="Contents icon">)</nobr>
-on the left. Click on a topic to have it
- displayed. Use the <b>Back</b> and <b>Forward</b> buttons
- to navigate within the history of viewed topics.</p>
-
-<h3>Searching</h3>
-<p>To quickly locate topics on a particular subject in the documentation,
- enter a query in the <b>Search</b> field. Use the <b>Search</b> frame
- <nobr>(<img src="search_results_view.gif" width="16" height="16" alt="Search icon">)</nobr>
- to display the Search view. You can narrow the <b>scope</b> of your search by selecting
- only the sections 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 <nobr>(<img src="e_synch_toc_nav.gif" width="16" height="16" alt="Synchronize icon">)</nobr>
- to match the navigation tree 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 the answer to your question in the on-line help,
- visit our website at <b><a href="http://eclipse.org/" target="_new">eclipse.org</a></b>
- to find 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.base/doc/hglegal2003.htm b/org.eclipse.help.base/doc/hglegal2003.htm
deleted file mode 100644
index 47c8540c8..000000000
--- a/org.eclipse.help.base/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.base/doc/ngibmcpy2003.gif b/org.eclipse.help.base/doc/ngibmcpy2003.gif
deleted file mode 100644
index c786e43e1..000000000
--- a/org.eclipse.help.base/doc/ngibmcpy2003.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.base/doc/search_results_view.gif b/org.eclipse.help.base/doc/search_results_view.gif
deleted file mode 100644
index aa3dcfd62..000000000
--- a/org.eclipse.help.base/doc/search_results_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.help.base/plugin.properties b/org.eclipse.help.base/plugin.properties
deleted file mode 100644
index 9ffe1ed9a..000000000
--- a/org.eclipse.help.base/plugin.properties
+++ /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
-###############################################################################
-help_base_plugin_name = Help System Base
-providerName=Eclipse.org
-webapp_extension_point_name = Help Web Application
-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)
-defaultBrowser = Default Web Browser (Change in System Preferences)
diff --git a/org.eclipse.help.base/plugin.xml b/org.eclipse.help.base/plugin.xml
deleted file mode 100644
index 0d3878cf4..000000000
--- a/org.eclipse.help.base/plugin.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.help.base"
- name="%help_base_plugin_name"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.help.internal.base.HelpBasePlugin">
-
- <runtime>
- <library name="helpbase.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.help"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.apache.lucene"/>
- <import plugin="org.eclipse.help" export="true"/>
- <import plugin="org.eclipse.help.appserver"/>
- <import plugin="org.eclipse.core.runtime"/>
- </requires>
-
-
-<!-- Extension points -->
- <extension-point id="luceneAnalyzer" name="%lucene_analyzer" schema="schema/luceneAnalyzer.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"/>
-
-<!-- Stand-alone infocenter application -->
- <extension
- id="infocenterApplication"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run
- class="org.eclipse.help.internal.base.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.base.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.base.IndexToolApplication">
- </run>
- </application>
- </extension>
-<!-- Text Analyzers for search -->
- <extension
- id="org.eclipse.help.base.Analyzer_en"
- point="org.eclipse.help.base.luceneAnalyzer">
- <analyzer
- locale="en"
- class="org.eclipse.help.internal.search.Analyzer_en">
- </analyzer>
- </extension>
- <extension
- id="org.eclipse.help.base.Analyzer_de"
- point="org.eclipse.help.base.luceneAnalyzer">
- <analyzer
- locale="de"
- class="org.apache.lucene.analysis.de.GermanAnalyzer">
- </analyzer>
- </extension>
-<!-- Web Browsers -->
- <extension
- point="org.eclipse.help.base.browser">
- <browser
- name="%mozilla_adapter"
- id="org.eclipse.help.base.mozilla">
- <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, AIX, HP, SunOS">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- name="%netscape_adapter"
- id="org.eclipse.help.base.netscape">
- <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, AIX, HP, SunOS">
- </parameter>
- </factoryclass>
- </browser>
- <browser
- factoryclass="org.eclipse.help.internal.browser.macosx.DefaultBrowserFactory"
- name="%defaultBrowser"
- id="org.eclipse.help.base.defaultBrowserMacOSX">
- </browser>
- <browser
- factoryclass="org.eclipse.help.internal.browser.CustomBrowserFactory"
- name="%custom_browser"
- id="org.eclipse.help.base.custombrowser">
- </browser>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.help.base/preferences.ini b/org.eclipse.help.base/preferences.ini
deleted file mode 100644
index 49931d253..000000000
--- a/org.eclipse.help.base/preferences.ini
+++ /dev/null
@@ -1,118 +0,0 @@
-#####################
-# Layout of help view
-#####################
-
-# Location of the banner page to display in the top frame.
-# Example: banner=/org.eclipse.help.webapp/advanced/banner.html
-banner=
-
-# Hight of the banner frame
-# Example: banner_height=60
-banner_height=
-
-# The page to show in the content area when opening help.
-# Specify your html page as /pluginId/path/to/home.html.
-# Currently, the default home is /org.eclipse.help/doc/help_home.html.
-help_home=/org.eclipse.help.base/doc/help_home.html
-
-# Set to true or false to control the visibility of the related links view.
-# Note: this option has no effect in the infocenter.
-linksView=true
-
-# Set to true or false to control the visibility of the bookmarks view.
-# Note: this option has no effect in the infocenter.
-bookmarksView=true
-
-# Set to true or false to control the title of the browser window.
-# If true, the title will have a form "Help - <PRODUCT_NAME>",
-# otherwise the title will be "<PRODDUCT_NAME>", where <PRODUCT_NAME>
-# is the name of Eclipse product set in the primary feature.
-windowTitlePrefix=true
-
-
-###################################################
-# Browsing books with many topics
-###################################################
-
-# 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.
-loadBookAtOnceLimit=1000
-
-# 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.
-dynamicLoadDepthsHint=3
-
-
-##############################
-# Style of help view
-##############################
-
-# 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.
-imagesDirectory=images
-
-# CSS background for toolbars.
-# Value is used in browsers that display advanced help UI.
-advanced.toolbarBackground=ButtonFace
-
-# CSS background for navigation views.
-# Value is used in browsers that display advanced help UI.
-advanced.viewBackground=Window
-
-# CSS font for toolbars.
-# Value is used in browsers that display advanced help UI.
-advanced.toolbarFont=icon
-
-# CSS font for navigation views.
-# Value is used in browsers that display advanced help UI.
-advanced.viewFont=icon
-
-# Background color for toolbars.
-# Value is used in browsers displaying basic help UI.
-basic.toolbarBackground=#D4D0C8
-
-# background color for navigation views.
-# Value is used in browsers displaying basic help UI.
-basic.viewBackground=#FFFFFF
-
-######################
-# 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.
-# Example: locales=en ja zh_CN zh_TW
-locales=
-
-######################
-# Browsers
-######################
-# Use embedded when possible, or always external
-#always_external_browser=
-# Default external browser
-#default_browser=
-# Executable path for custom browser
-#custom_browser_path=
-
-######################
-# Display of topics from disabled activities
-######################
-# Help system filteres topics from disabled activities. This option controls this behavior
-# and existence of Show All Topics button.
-#
-# Accepted values: never, off, on, always
-# never - topic from disabled activites are not shown
-# off - user can choose to show all topics, disabled topics intially hidden
-# on - user can choose to show all topics, all topics intially shown
-# always - topic from disabled activites are shown (filtering disabled)
-showDisabledActivityTopics=off
diff --git a/org.eclipse.help.base/schema/browser.exsd b/org.eclipse.help.base/schema/browser.exsd
deleted file mode 100644
index 53fadfcdd..000000000
--- a/org.eclipse.help.base/schema/browser.exsd
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help.base">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help.base" 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="since"/>
- </appInfo>
- <documentation>
- 3.0 (originally added in release 2.0 as org.eclipse.help.ui.browser)
- </documentation>
- </annotation>
-
- <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.base.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.base&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.base/schema/luceneAnalyzer.exsd b/org.eclipse.help.base/schema/luceneAnalyzer.exsd
deleted file mode 100644
index 267210bf4..000000000
--- a/org.eclipse.help.base/schema/luceneAnalyzer.exsd
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help.base">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help.base" 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="since"/>
- </appInfo>
- <documentation>
- 3.0 (originally added in release 2.0 as org.eclipse.help.luceneAnalyzer)
- </documentation>
- </annotation>
-
- <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.base.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.base/schema/webapp.exsd b/org.eclipse.help.base/schema/webapp.exsd
deleted file mode 100644
index a5381f19a..000000000
--- a/org.eclipse.help.base/schema/webapp.exsd
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help.base">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help.base" 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>
- 3.0 (originally added in release 2.1 as org.eclipse.help.webapp)
- </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.base.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.base/src/org/eclipse/help/browser/IBrowser.java b/org.eclipse.help.base/src/org/eclipse/help/browser/IBrowser.java
deleted file mode 100644
index b55d26847..000000000
--- a/org.eclipse.help.base/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 the 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 the 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.base/src/org/eclipse/help/browser/IBrowserFactory.java b/org.eclipse.help.base/src/org/eclipse/help/browser/IBrowserFactory.java
deleted file mode 100644
index 4e5921d62..000000000
--- a/org.eclipse.help.base/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 <code>org.eclipse.help.base.browser</code>
- * 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.base/src/org/eclipse/help/browser/package.html b/org.eclipse.help.base/src/org/eclipse/help/browser/package.html
deleted file mode 100644
index 06a0a015a..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/browser/package.html
+++ /dev/null
@@ -1,41 +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>
-Base 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 with the base.&nbsp;
-The browser (or browser adapter) can be configured by
-providing extension for <tt>org.eclipse.help.base.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.base.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.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
deleted file mode 100644
index 5f90337a8..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
+++ /dev/null
@@ -1,275 +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.base;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.internal.base.util.*;
-import org.eclipse.help.internal.browser.*;
-import org.eclipse.help.internal.search.*;
-import org.eclipse.help.internal.workingset.*;
-
-/**
- * Base Help System.
- */
-public final class BaseHelpSystem {
- protected static final BaseHelpSystem instance = new BaseHelpSystem();
-
- private final static String WEBAPP_EXTENSION_ID =
- HelpBasePlugin.PLUGIN_ID + ".webapp";
- private static final String WEBAPP_DEFAULT_ATTRIBUTE = "default";
-
- 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 SearchManager searchManager;
- protected WorkingSetManager workingSetManager;
- private int mode = MODE_WORKBENCH;
- private boolean webappStarted = false;
- private IErrorUtil defaultErrorMessenger;
- private IBrowser browser;
- private IBrowser internalBrowser;
- private HelpDisplay helpDisplay = null;
- private boolean webappRunning = false;
-
- /**
- * Constructor.
- */
- private BaseHelpSystem() {
- super();
- }
- public static BaseHelpSystem getInstance() {
- return instance;
- }
- /**
- * Used to obtain Search Manager
- * @return instance of SearchManager
- */
- public static SearchManager getSearchManager() {
- if (getInstance().searchManager == null) {
- synchronized (BaseHelpSystem.class) {
- if (getInstance().searchManager == null) {
- getInstance().searchManager = new SearchManager();
- }
- }
- }
- return getInstance().searchManager;
- }
- /**
- * Used to obtain Working Set Manager
- * @return instance of WorkingSetManager
- */
- public static synchronized WorkingSetManager getWorkingSetManager() {
- if (getInstance().workingSetManager == null) {
- getInstance().workingSetManager = new WorkingSetManager();
- }
- return getInstance().workingSetManager;
- }
-
- public static synchronized IBrowser getHelpBrowser(boolean forceExternal) {
- if (!forceExternal) {
- if (getInstance().internalBrowser == null)
- getInstance().internalBrowser = BrowserManager.getInstance()
- .createBrowser(false);
- return getInstance().internalBrowser;
- } else {
- if (getInstance().browser == null)
- getInstance().browser = BrowserManager.getInstance()
- .createBrowser(true);
- return getInstance().browser;
- }
- }
-
- public static synchronized HelpDisplay getHelpDisplay() {
- if (getInstance().helpDisplay == null)
- getInstance().helpDisplay = new HelpDisplay();
- return getInstance().helpDisplay;
- }
- /**
- */
- public BaseHelpSystem newInstance() {
- return null;
- }
-
- /**
- * Shuts down the BaseHelpSystem.
- * @exception CoreException if this method fails to shut down
- * this plug-in
- */
- public static void shutdown() throws CoreException {
- if (HelpBasePlugin.DEBUG) {
- System.out.println("Base Help System is shutting down.");
- }
- // close any browsers created
- BrowserManager.getInstance().closeAll();
-
- if (getInstance().searchManager != null) {
- getInstance().searchManager.close();
- }
- // stop the web apps
- WebappManager.stop("help");
- if (getMode() != MODE_WORKBENCH)
- WebappManager.stop("helpControl");
-
- if (HelpBasePlugin.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);
- }
-
- });
- HelpBasePlugin.getDefault().getPluginPreferences();
- } catch (Exception e) {
- HelpBasePlugin.getDefault().getLog().log(
- new Status(
- IStatus.ERROR,
- HelpBasePlugin.PLUGIN_ID,
- 0,
- HelpBaseResources.getString("E005"),
- e));
- }
- if (HelpBasePlugin.DEBUG) {
- System.out.println("Base 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) {
- HelpBasePlugin.logError(
- HelpBaseResources.getString("E042"),
- e);
- return false;
- }
- }
- // start the help web app
- try {
- WebappManager.start("help", webappPlugin, Path.EMPTY);
- } catch (CoreException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("E043"), 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
- IExtensionPoint point =
- Platform.getExtensionRegistry().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()
- .getNamespace();
- }
- }
- // if reached this point, then then pick the first (default) webapp
- if (elements.length > 0)
- return elements[0]
- .getDeclaringExtension()
- .getNamespace();
- }
- }
-
- // if all fails
- return "org.eclipse.help.webapp";
- }
-
- /**
- * Obtains name of the Eclipse product
- *
- * @return String
- */
- public static String getProductName() {
- IProduct product = Platform.getProduct();
- if (product == null) {
- return "";
- }
- String name = product.getName();
- return name == null ? "" : name;
- }
-
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpApplication.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpApplication.java
deleted file mode 100644
index 2cef16e0b..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpApplication.java
+++ /dev/null
@@ -1,139 +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.base;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.appserver.*;
-
-/**
- * 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 (!BaseHelpSystem.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)) {
- BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
- } else if ("standalone".equalsIgnoreCase(value)) {
- BaseHelpSystem.setMode(BaseHelpSystem.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.base/src/org/eclipse/help/internal/base/HelpBasePlugin.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBasePlugin.java
deleted file mode 100644
index 68fc2cd20..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBasePlugin.java
+++ /dev/null
@@ -1,172 +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.base;
-import java.io.*;
-import java.net.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.datalocation.*;
-import org.osgi.framework.*;
-/**
- * Help Base plug-in.
- *
- * @since 3.0
- */
-public class HelpBasePlugin extends Plugin {
-
- public final static String PLUGIN_ID = "org.eclipse.help.base";
- // debug options
- public static boolean DEBUG = false;
- public static boolean DEBUG_SEARCH = false;
-
- protected static HelpBasePlugin plugin;
- private static BundleContext bundleContext;
-
- private File configurationDirectory;
-
- private IHelpActivitySupport helpActivitySupport =
- new IHelpActivitySupport() {
- public boolean isEnabled(String href) {
- return true;
- }
- public boolean isEnabledTopic(String href, String locale) {
- return true;
- }
- public void enableActivities(String href) {
- }
- public boolean isFilteringEnabled(){
- return false;
- }
- public void setFilteringEnabled(boolean enabled){
- }
- public boolean isUserCanToggleFiltering(){
- return false;
- }
- };
- /**
- * 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)
- message = "";
- Status errorStatus =
- new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex);
- HelpBasePlugin.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
- */
- public static synchronized void logWarning(String message) {
- if (HelpBasePlugin.DEBUG) {
- if (message == null)
- message = "";
- Status warningStatus =
- new Status(
- IStatus.WARNING,
- PLUGIN_ID,
- IStatus.OK,
- message,
- null);
- HelpBasePlugin.getDefault().getLog().log(warningStatus);
- }
- }
-
- /**
- * @return the singleton instance of the Help Base plugin
- */
- public static HelpBasePlugin getDefault() {
- return plugin;
- }
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin.savePluginPreferences();
- BaseHelpSystem.shutdown();
- plugin = null;
- bundleContext = null;
- super.stop(context);
- }
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- bundleContext = context;
- // Setup debugging options
- DEBUG = isDebugging();
- if (DEBUG) {
- DEBUG_SEARCH = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/search")); //$NON-NLS-1$
- }
-
- // determine configuration location for this plug-in
- Location location = Platform.getConfigurationLocation();
- if(location != null){
- URL configURL = location.getURL();
- if(configURL != null &configURL.getProtocol().startsWith("file")){
- configurationDirectory = new File (configURL.getFile(), PLUGIN_ID);
- }
- }
- if(configurationDirectory ==null){
- configurationDirectory = getStateLocation().toFile();
- }
- //
- BaseHelpSystem.startup();
- }
-
- /**
- * Initializes the default preferences settings for this plug-in.
- */
- protected void initializeDefaultPluginPreferences() {
- Preferences prefs = getPluginPreferences();
-
- String os = System.getProperty("os.name").toLowerCase();
- boolean isWindows = os.indexOf("windows") != -1;
-
- if (isWindows)
- prefs.setDefault(
- "custom_browser_path",
- "\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\" %1");
- else
- prefs.setDefault("custom_browser_path", "mozilla %1");
- }
-
- /**
- * Used to obtain directory where configuration
- * (like help index) can be stored
- */
- public static File getConfigurationDirectory() {
- return getDefault().configurationDirectory;
- }
-
- /**
- * Used to obtain help activity support
- *
- * @return instance of IHelpActivitySupport
- */
- public static IHelpActivitySupport getActivitySupport() {
- return getDefault().helpActivitySupport;
- }
-
- /**
- * Sets the activity support
- *
- * @param activitySupport
- */
- public static void setActivitySupport(IHelpActivitySupport activitySupport) {
- getDefault().helpActivitySupport = activitySupport;
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.java
deleted file mode 100644
index 39d77d21d..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.java
+++ /dev/null
@@ -1,174 +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.base;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * Uses a resource bundle to load images and strings from
- * a property file.
- */
-public class HelpBaseResources {
- private static ResourceBundle resBundle;
- static {
- resBundle = ResourceBundle.getBundle(HelpBaseResources.class.getName());
- }
- /**
- * Resources constructor.
- */
- public HelpBaseResources() {
- 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;
- }
-
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties
deleted file mode 100644
index be5c477d6..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpBaseResources.properties
+++ /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
-###############################################################################
-# ====================================
-# 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 = Plug-in
-# 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.
-WorkingSetManager.PCE = DocumentBuilder implementation could not be loaded.
-WorkingSetManager.transformer = Problems occurred while saving working sets.
-
-
-# Error Messages
-# --------------
-E005 = Error in launching help.
-E011 = No context information found for {0} plugin
-E014 = Error accessing file: {0}
-E015 = Errors occurred generating file: {0}
-E017 = IO Error occurred reading file {0}.
-E018 = Error occurred parsing file {0}.
-E019 = Expected: {0} but got: {1}
-E040 = Problems occurred while saving working set file.
-E041 = Problems occurred while restoring working set state.
-E042 = Help web application failed to run.
-E042 = Stand-alone help control web application failed to run.
-E043 = Help cannot be displayed. The embedded application server could not run help web application. Check the log for details.
-HelpDisplay.exceptionMessage = An exception occurred while launching help. Refer to the log for more details.
-HelpDisplay.exception = An exception occurred while launching help.
-
-
-# Search
-ES16 = IO exception occurred while adding document {0} to index {1}.
-ES17 = Exception occurred in search indexing at beginAddBatch .
-ES18 = Exception occurred in search indexing at beginDeleteBatch .
-ES19 = Exception occurred in search indexing at endAddBatch.
-ES20 = Exception occurred in search indexing at endDeleteBatch.
-ES21 = Exception occurred performing search for: {0}.
-ES22 = IO exception occurred while removing document {0} from index {1}.
-ES23 = Exception occurred creating text analyzer {0} for {1} locale.
-ES24 = Text Analyzer could not be created for locale {0}. An analyzer that extends org.eclipse.help.luceneAnalyzer extension point needs to be plugged in for locale {0}, or Java Virtual Machine needs to be upgraded to version with proper support for locale {0}.
-ES25 = Help document {0} cannot be opened. The document will not be indexed.
-search_index_update_error=Problem occurred during indexing of documentation.
-
-# Browser
-WE001 = Exception occurred reading from web browser.
-
-no_browsers = There is no browser adapter configured to display {0}. Ensure that you have a required browser and adapter installed, and that the browser program is available on the system path.
-CustomBrowser.errorLaunching = Launching URL "{0}" using browser program "{1}" has failed. Specify another browser in help preferences.
-MozillaFactory.dataMissing = Initialization data required by Mozilla adapter is missing.
-MozillaBrowserAdapter.executeFailed = Launching {0} has failed. Ensure that the executable program is available on your system path.
-DefaultBrowserAdapter.executeFailed = Launching "osascript" has failed.
-
-# Warning Messages
-# ----------------
-WW001 = Documentation is not installed. \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
deleted file mode 100644
index 5ceb1fb39..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
+++ /dev/null
@@ -1,239 +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.base;
-import java.io.*;
-import java.net.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.internal.context.*;
-
-/**
- * This class provides methods to display help.
- * It is independent of platform UI.
- */
-public class HelpDisplay {
-
- /**
- * Constructor.
- */
- public HelpDisplay() {
- super();
- }
-
- /**
- * Displays help.
- */
- public void displayHelp(boolean forceExternal) {
- // Do not start help view if documentaton is not available, display error
- if (HelpSystem.getTocs().length == 0) {
- // There is no documentation
- BaseHelpSystem.getDefaultErrorUtil().displayError(
- HelpBaseResources.getString("WW001"));
- //Documentation is not installed.
- return;
- }
-
- displayHelpURL(null, forceExternal);
- }
-
- /**
- * 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, boolean forceExternal) {
- // check if this is a toc
- IToc toc = HelpPlugin.getTocManager().getToc(href, Platform.getNL());
- if (toc != null)
- try {
- displayHelpURL(
- "toc=" + URLEncoder.encode(toc.getHref(), "UTF-8"), forceExternal);
- } catch (UnsupportedEncodingException uee) {
- } else if (
- href != null
- && (href.startsWith("tab=")
- || href.startsWith("toc=")
- || href.startsWith("topic=")
- || href.startsWith(
- "contextId="))) { // assume it is a query string
- displayHelpURL(href, forceExternal);
- } else { // assume this is a topic
- if (getNoframesURL(href) == null) {
- try {
- displayHelpURL("topic=" + URLEncoder.encode(href, "UTF-8"), forceExternal);
- } catch (UnsupportedEncodingException uee) {
- }
- } else if (href.startsWith("jar:file:")) {
- // topic from a jar to display without frames
- displayHelpURL(
- getBaseURL() + "nftopic/" + getNoframesURL(href), forceExternal);
- } else {
- displayHelpURL(getNoframesURL(href), forceExternal);
- }
- }
- }
-
- /**
- * 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, boolean forceExternal) {
- if (context == null || topic == null || topic.getHref() == null)
- return;
- String topicURL = getTopicURL(topic.getHref());
- if (getNoframesURL(topicURL) == null) {
- try {
- String url =
- "tab=links"
- + "&contextId="
- + URLEncoder.encode(getContextID(context), "UTF-8")
- + "&topic="
- + URLEncoder.encode(topicURL, "UTF-8");
- displayHelpURL(url, forceExternal);
- } catch (UnsupportedEncodingException uee) {
- }
-
- } else if (topicURL.startsWith("jar:file:")) {
- // topic from a jar to display without frames
- displayHelpURL(
- getBaseURL() + "nftopic/" + getNoframesURL(topicURL), forceExternal);
- } else {
- displayHelpURL(getNoframesURL(topicURL), forceExternal);
- }
- }
- /**
- * 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, boolean forceExternal) {
- if (searchQuery == null || topic == null)
- return;
- if (getNoframesURL(topic) == null) {
- try {
- String url =
- "tab=search&"
- + searchQuery
- + "&topic="
- + URLEncoder.encode(getTopicURL(topic), "UTF-8");
- displayHelpURL(url, forceExternal);
- } catch (UnsupportedEncodingException uee) {
- }
-
- } else {
- displayHelpURL(getNoframesURL(topic), forceExternal);
- }
- }
- /**
- * Displays the specified url.
- * The url can contain query parameters to identify how help displays the document
- */
- private void displayHelpURL(String helpURL, boolean forceExternal) {
- if (!BaseHelpSystem.ensureWebappRunning()) {
- return;
- }
-
- try {
- if (helpURL == null || helpURL.length() == 0) {
- BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(getFramesetURL());
- } else if (
- helpURL.startsWith("tab=")
- || helpURL.startsWith("toc=")
- || helpURL.startsWith("topic=")
- || helpURL.startsWith("contextId=")) {
- BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(
- getFramesetURL() + "?" + helpURL);
- } else {
- BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(helpURL);
- }
- } catch (Exception e) {
- BaseHelpSystem.getDefaultErrorUtil().displayError(
- HelpBaseResources.getString(
- "HelpDisplay.exceptionMessage"));
- HelpBasePlugin.logError(
- HelpBaseResources.getString(
- "HelpDisplay.exception",
- e.getMessage()),
- e);
- }
- }
- private String getContextID(IContext context) {
- if (context instanceof Context)
- return ((Context) context).getID();
- return HelpPlugin.getContextManager().addContext(context);
- }
-
- private String getBaseURL() {
- return "http://"
- + WebappManager.getHost()
- + ":"
- + WebappManager.getPort()
- + "/help/";
- }
-
- private String getFramesetURL() {
- return getBaseURL() + "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.base/src/org/eclipse/help/internal/base/IHelpActivitySupport.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpActivitySupport.java
deleted file mode 100644
index 961b04e50..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpActivitySupport.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.base;
-
-/**
- * @since 3.0
- */
-public interface IHelpActivitySupport {
-
- /**
- * Checks if href is matches an enabled activity.
- * If it does not match any defined activites, it is assumed to be enabled.
- *
- * @param href
- * @return
- */
- public boolean isEnabled(String href);
- /**
- * Checks whether topic belongs to a TOC that mathes
- * enabled activity. Enabled children TOCs are searched if linked by
- * also enabled TOCs.
- * Additionally topic may match description topic of a root TOC.
- * @return true if topic belongs to an enabled TOC
- * @param href
- * @param locale locale for which TOCs are checked
- */
- public boolean isEnabledTopic(String href, String locale);
-
- /**
- * Enables activities with patterns matching the href
- *
- * @param href
- */
- public void enableActivities(String href);
- public boolean isFilteringEnabled();
- public void setFilteringEnabled(boolean enabled);
- public boolean isUserCanToggleFiltering();
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java
deleted file mode 100644
index 861e4be1e..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IndexToolApplication.java
+++ /dev/null
@@ -1,156 +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.base;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-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();
- HelpBasePlugin.logError("Preindexing failed", e);
- }
- return EXIT_OK;
- }
-
- private void preindex(String outputDir, Locale locale) throws Exception {
- File indexPath = new File(HelpBasePlugin.getConfigurationDirectory(), "index/"+locale);
-
- // clean
- if (indexPath.exists()) {
- delete(indexPath);
- }
- // index
- BaseHelpSystem.getSearchManager().ensureIndexUpdated(
- new NullProgressMonitor(),
- BaseHelpSystem.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.base/src/org/eclipse/help/internal/base/util/HelpProperties.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
deleted file mode 100644
index 1bc8d4053..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.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.base.util;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.base.*;
-
-/**
- * Properties stored in file.
- */
-public class HelpProperties extends Properties {
- private File file = null;
- protected String name = null;
- /**
- * Creates empty Properties for the specified plugin
- * @param name name of the file;
- * @param plugin the plugin
- */
- public HelpProperties(String name, Plugin plugin) {
- this(name, plugin.getStateLocation().toFile());
- }
- /**
- * Creates empty Properties persisted in the specified directory
- * @param name name of the file;
- * @param dir directory to persist file in
- */
- public HelpProperties(String name, File dir) {
- super();
- this.name = name;
- file = new File(dir, 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(
- HelpBaseResources.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(
- HelpBaseResources.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.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IErrorUtil.java
deleted file mode 100644
index 40da8721d..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/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.base.util;
-
-
-/**
- * Utility interface for displaying an error message.
- * Implementation may output messages in different ways
- * (log, console, pop up window).
- */
-public interface IErrorUtil {
- public void displayError(String msg);
- public void displayError(String msg, Thread uiThread);
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java
deleted file mode 100644
index 1d9b3b96f..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/TString.java
+++ /dev/null
@@ -1,338 +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.base.util;
-import java.util.*;
-
-import org.eclipse.help.internal.base.*;
-/**
- * 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(HelpBaseResources.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(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.base/src/org/eclipse/help/internal/browser/BrowserDescriptor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserDescriptor.java
deleted file mode 100644
index 4cf7ad9cc..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserDescriptor.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.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;
- }
- public boolean isExternal(){
- return !BrowserManager.BROWSER_ID_EMBEDDED.equals(getID());
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserLog.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserLog.java
deleted file mode 100644
index 599bc4973..000000000
--- a/org.eclipse.help.base/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.base.HelpBasePlugin;
-
-/**
- * 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 =
- HelpBasePlugin
- .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.base/src/org/eclipse/help/internal/browser/BrowserManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java
deleted file mode 100644
index b02bf566e..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/BrowserManager.java
+++ /dev/null
@@ -1,350 +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.base.*;
-import org.eclipse.osgi.service.environment.*;
-/**
- * Creates browser by delegating to appropriate browser adapter
- */
-public class BrowserManager {
- public static final String ALWAYS_EXTERNAL_BROWSER_KEY = "always_external_browser";
- public static final String DEFAULT_BROWSER_ID_KEY = "default_browser";
- public static final String BROWSER_ID_CUSTOM = HelpBasePlugin.PLUGIN_ID
- + ".custombrowser";
- public static final String BROWSER_ID_MOZILLA = HelpBasePlugin.PLUGIN_ID
- + ".mozilla";
- public static final String BROWSER_ID_NETSCAPE = HelpBasePlugin.PLUGIN_ID
- + ".netscape";
- public static final String BROWSER_ID_MAC_SYSTEM = HelpBasePlugin.PLUGIN_ID
- + ".defaultBrowserMacOSX";
- public static final String BROWSER_ID_EMBEDDED = "org.eclipse.help.ui.embeddedbrowser";
- public static final String BROWSER_ID_SYSTEM = "org.eclipse.help.ui.systembrowser";
- private static BrowserManager instance;
- private boolean initialized = false;
- private BrowserDescriptor currentBrowserDesc;
- private BrowserDescriptor defaultBrowserDesc;
- private BrowserDescriptor[] browsersDescriptors;
- private BrowserDescriptor internalBrowserDesc;
- private Collection browsers = new ArrayList();
- private boolean alwaysUseExternal = false;
- /**
- * Private Constructor
- */
- private BrowserManager() {
- }
- /**
- * Initialize
- */
- private void init() {
- initialized = true;
- // Find all available browsers
- browsersDescriptors = createBrowserDescriptors();
- // 1. set default browser from preferences
- String defBrowserID = HelpBasePlugin.getDefault()
- .getPluginPreferences()
- .getDefaultString(DEFAULT_BROWSER_ID_KEY);
- if (defBrowserID != null && (!"".equals(defBrowserID))) {
- setDefaultBrowserID(defBrowserID);
- }
- // 2. set default browser to embedded
- // if (defaultBrowserDesc == null) {
- // setDefaultBrowserID(BROWSER_ID_EMBEDDED);
- // }
- // 3. set default browser to help implementation of system specific
- // browser
- String os = Platform.getOS();
- if (defaultBrowserDesc == null) {
- if (Constants.WS_WIN32.equalsIgnoreCase(os)) {
- setDefaultBrowserID(BROWSER_ID_SYSTEM);
- } else if (Constants.OS_AIX.equalsIgnoreCase(os)
- || (Constants.OS_HPUX.equalsIgnoreCase(os))
- || (Constants.OS_LINUX.equalsIgnoreCase(os))
- || (Constants.OS_SOLARIS.equalsIgnoreCase(os))) {
- setDefaultBrowserID(BROWSER_ID_MOZILLA);
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID(BROWSER_ID_NETSCAPE);
- }
- } else if (Constants.OS_MACOSX.equalsIgnoreCase(os)) {
- setDefaultBrowserID(BROWSER_ID_MAC_SYSTEM);
- }
- }
- // 4. set browser to one of externally contributed
- if (defaultBrowserDesc == null) {
- for (int i = 0; i < browsersDescriptors.length; i++) {
- if (BROWSER_ID_CUSTOM.equals(browsersDescriptors[i].getID())) {
- defaultBrowserDesc = browsersDescriptors[i];
- }
- }
- }
- // 5. let user specify program
- if (defaultBrowserDesc == null) {
- setDefaultBrowserID(BROWSER_ID_CUSTOM);
- }
- // 6. use null browser
- 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 = HelpBaseResources.getString(
- "no_browsers", url);
- HelpBasePlugin.logError(msg, null);
- BaseHelpSystem.getDefaultErrorUtil()
- .displayError(msg);
- }
- public boolean isCloseSupported() {
- return false;
- }
- public boolean isSetLocationSupported() {
- return false;
- }
- public boolean isSetSizeSupported() {
- return false;
- }
- public void setLocation(int width, int height) {
- }
- public void setSize(int x, int y) {
- }
- };
- }
- });
- }
- // initialize current browser
- String curBrowserID = HelpBasePlugin.getDefault()
- .getPluginPreferences().getString(DEFAULT_BROWSER_ID_KEY);
- if (curBrowserID != null && (!"".equals(curBrowserID))) {
- setCurrentBrowserID(curBrowserID);
- // may fail if such browser does not exist
- }
- if (currentBrowserDesc == null) {
- setCurrentBrowserID(getDefaultBrowserID());
- }
- setAlwaysUseExternal(HelpBasePlugin.getDefault().getPluginPreferences()
- .getBoolean(ALWAYS_EXTERNAL_BROWSER_KEY));
- }
- /**
- * 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.getExtensionRegistry()
- .getConfigurationElementsFor(HelpBasePlugin.PLUGIN_ID,
- "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()) {
- BrowserDescriptor descriptor = new BrowserDescriptor(id,
- label, (IBrowserFactory) adapter);
- if (descriptor.isExternal()) {
- bDescriptors.add(descriptor);
- } else {
- internalBrowserDesc = descriptor;
- }
- }
- } 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 getCurrentInternalBrowserID() {
- if (!initialized) {
- init();
- }
- if (isEmbeddedBrowserPresent() && !alwaysUseExternal) {
- return internalBrowserDesc.getID();
- } else {
- return getCurrentBrowserID();
- }
- }
- /**
- * 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
- * If preferences specify to always use external,
- * the parameter will not be honored
- */
- public IBrowser createBrowser(boolean external) {
- if (!initialized) {
- init();
- }
- //external = external || alwaysUseExternal;
- //return createBrowserAdapter(forceExternal);
- if(external){
- return new CurrentBrowser(createBrowserAdapter(true),getCurrentBrowserID(), true);
- }else{
- return new CurrentBrowser(createBrowserAdapter(alwaysUseExternal),getCurrentInternalBrowserID(), false);
-
- }
- }
- /**
- * Creates web browser
- */
- public IBrowser createBrowser() {
- return createBrowser(true);
- }
- /**
- * Creates web browser
- * for external == false, if no internal browsers are present it will create external one
- */
- private IBrowser createBrowserAdapter(boolean external) {
- if (!initialized) {
- init();
- }
- IBrowser browser = null;
- if (!external && isEmbeddedBrowserPresent()) {
- browser = internalBrowserDesc.getFactory().createBrowser();
- } else {
- 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();
- }
- }
- public boolean isEmbeddedBrowserPresent() {
- if (!initialized) {
- init();
- }
- return internalBrowserDesc != null;
- }
- public void setAlwaysUseExternal(boolean alwaysExternal) {
- if (!initialized) {
- init();
- }
- alwaysUseExternal = alwaysExternal || !isEmbeddedBrowserPresent();
- }
- private boolean isAlwaysUseExternal() {
- if (!isEmbeddedBrowserPresent()) {
- return true;
- }
- return alwaysUseExternal;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CurrentBrowser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CurrentBrowser.java
deleted file mode 100644
index 9f266dcf1..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CurrentBrowser.java
+++ /dev/null
@@ -1,136 +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.*;
-/**
- * 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;
- boolean external;
- public CurrentBrowser(IBrowser browserImpl, String browserAdapterId,
- boolean externalBrowser) {
- this.browserAdapter = browserImpl;
- this.browserAdapterId = browserAdapterId;
- this.external = externalBrowser;
- }
- /**
- * @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
- * newBrowserAdapterId field
- */
- private void checkDefaultAdapter() {
- if (external) {
- if (browserAdapterId != BrowserManager.getInstance()
- .getCurrentBrowserID()) {
- newBrowserAdapter = BrowserManager.getInstance().createBrowser(
- true);
- newBrowserAdapterId = BrowserManager.getInstance()
- .getCurrentBrowserID();
- }
- } else {
- if (browserAdapterId != BrowserManager.getInstance()
- .getCurrentInternalBrowserID()) {
- newBrowserAdapter = BrowserManager.getInstance().createBrowser(
- false);
- newBrowserAdapterId = BrowserManager.getInstance()
- .getCurrentInternalBrowserID();
- }
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java
deleted file mode 100644
index 1c7221ad4..000000000
--- a/org.eclipse.help.base/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.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.base.*;
-import org.eclipse.osgi.service.environment.*;
-
-/**
- *
- */
-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 =
- HelpBasePlugin.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) {
- HelpBasePlugin.logError(
- HelpBaseResources.getString("CustomBrowser.errorLaunching", url, path),
- e);
- throw new Exception(
- HelpBaseResources.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 (Constants
- .OS_WIN32
- .equalsIgnoreCase(Platform.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.base/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowserFactory.java
deleted file mode 100644
index 5d61967bc..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java
deleted file mode 100644
index 1473afcbe..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaBrowserAdapter.java
+++ /dev/null
@@ -1,231 +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.base.*;
-
-/**
- * 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
- protected static final int DELAY = 5000;
- protected long browserFullyOpenedAt = 0;
- private BrowserThread lastBrowserThread = null;
- private int x, y;
- private int width, height;
- private boolean setLocationPending = false;
- private boolean setSizePending = false;
- protected String executable;
- protected String executableName;
- protected Thread uiThread;
- /**
- * Constructor
- * @executable executable filename to launch
- * @executableName name of the program to display when error occurs
- */
- 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 = HelpBasePlugin.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 =
- HelpBaseResources.getString(
- "MozillaBrowserAdapter.executeFailed",
- executableName);
- HelpBasePlugin.logError(msg, e);
- BaseHelpSystem.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.base/src/org/eclipse/help/internal/browser/MozillaFactory.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.java
deleted file mode 100644
index b9e57c3f4..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/MozillaFactory.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.browser;
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.help.internal.base.*;
-public class MozillaFactory implements IBrowserFactory, IExecutableExtension {
- private String executable;
- private String executableName;
- private String osList;
- private MozillaBrowserAdapter browserInstance = null;
- /**
- * Constructor.
- */
- public MozillaFactory() {
- super();
- }
- /*
- * @see IBrowserFactory#isAvailable()
- */
- public boolean isAvailable() {
- if (!isSupportedOS(System.getProperty("os.name"))) {
- 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");
- osList = (String) params.get("os");
- } catch (Exception e) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- HelpBasePlugin.PLUGIN_ID,
- IStatus.OK,
- HelpBaseResources.getString("MozillaFactory.dataMissing"),
- e));
- }
- }
- private boolean isSupportedOS(String os) {
- if (osList == null || osList.length() <= 0) {
- // parameter missing
- return false;
- }
- String[] OSes = osList.split(",\\s*");
- for (int i = 0; i < OSes.length; i++) {
- if (os.toLowerCase().startsWith(OSes[i].toLowerCase())) {
- return true;
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java
deleted file mode 100644
index ae6f2884d..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/StreamConsumer.java
+++ /dev/null
@@ -1,46 +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.base.*;
-
-/**
- * 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) {
- HelpBasePlugin.logError(HelpBaseResources.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.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java
deleted file mode 100644
index c5c6165f8..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserAdapter.java
+++ /dev/null
@@ -1,87 +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;
-import org.eclipse.help.internal.base.*;
-
-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 ioe) {
- HelpBasePlugin.logError(
- HelpBaseResources.getString(
- "DefaultBrowserAdapter.executeFailed"),
- ioe);
- }
- }
-
- /**
- * @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.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.java
deleted file mode 100644
index d6aeb4724..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/macosx/DefaultBrowserFactory.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.internal.browser.macosx;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.browser.*;
-import org.eclipse.osgi.service.environment.*;
-
-
-public class DefaultBrowserFactory implements IBrowserFactory {
-
- public DefaultBrowserFactory() {
- super();
- }
-
- /*
- * @see IBrowserFactory#isAvailable()
- */
- public boolean isAvailable() {
- return Constants.OS_MACOSX.equalsIgnoreCase(Platform.getOS());
- /*
- * 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.base/src/org/eclipse/help/internal/search/ASCIIReader.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/ASCIIReader.java
deleted file mode 100644
index 2cec12f93..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java
deleted file mode 100644
index bc28d1a2d..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/AnalyzerDescriptor.java
+++ /dev/null
@@ -1,162 +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.base.*;
-import org.osgi.framework.*;
-
-/**
- * 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 =
- HelpBasePlugin.PLUGIN_ID
- + "#"
- + HelpBasePlugin
- .getDefault()
- .getBundle()
- .getHeaders()
- .get(Constants.BUNDLE_VERSION);
- 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.getExtensionRegistry().getConfigurationElementsFor(
- HelpBasePlugin.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()
- .getNamespace();
- String pluginVersion = (String)
- Platform.getBundle(pluginId)
- .getHeaders().get(Constants.BUNDLE_VERSION);
- this.luceneAnalyzer = (Analyzer) analyzer;
- this.id = pluginId + "#" + pluginVersion;
- this.lang = locale;
- if (HelpBasePlugin.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) {
- HelpBasePlugin.logError(
- HelpBaseResources.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 some versions of org.eclipse.help plugin
- // are compatible (logic unchanged), index can be preserved between
- // them
- // in 3.0 index has been moved so cannot be reused
- // if (analyzerId.compareTo(HelpBasePlugin.PLUGIN_ID + "#2.0.1") >= 0
- // && analyzerId.compareTo(HelpBasePlugin.PLUGIN_ID + "#3.0.0") <= 0
- // && id.compareTo(HelpBasePlugin.PLUGIN_ID + "#2.0.1") >= 0
- // && id.compareTo(HelpBasePlugin.PLUGIN_ID + "#3.0.0") <= 0) {
- // return true;
- // }
- return false;
- }
-
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
deleted file mode 100644
index b15681516..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.java
deleted file mode 100644
index e2c0dee90..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/DefaultAnalyzer.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.search;
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import org.apache.lucene.analysis.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.base.*;
-/**
- * Lucene Analyzer.
- * LowerCaseTokenizer->WordTokenStream (uses word breaking in java.text)
- */
-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
- HelpBasePlugin.logError(
- HelpBaseResources.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 = Platform.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.base/src/org/eclipse/help/internal/search/HTMLDocParser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/HTMLDocParser.java
deleted file mode 100644
index 751065cdc..000000000
--- a/org.eclipse.help.base/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.base.*;
-
-/**
- * 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 (HelpBasePlugin.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 (HelpBasePlugin.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.base/src/org/eclipse/help/internal/search/ISearchHitCollector.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/ISearchHitCollector.java
deleted file mode 100644
index 10ee4cebf..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/ISearchQuery.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/ISearchQuery.java
deleted file mode 100644
index e30b1e894..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/IndexingOperation.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java
deleted file mode 100644
index da7b57d06..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/IndexingOperation.java
+++ /dev/null
@@ -1,300 +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.base.*;
-import org.eclipse.help.internal.base.util.*;
-import org.eclipse.help.internal.protocols.*;
-import org.eclipse.help.internal.toc.*;
-
-/**
- * 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(HelpBaseResources.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(HelpBaseResources.getString("Undoing_document_adds"));
- // if (!index.abortUpdate())
- // throw new Exception();
- throw oce;
- }
- pm.subTask(HelpBaseResources.getString("Writing_index"));
- if (!index.endAddBatch())
- throw new IndexingException();
- }
-
- private void removeDocuments(IProgressMonitor pm, Collection removedDocs)
- throws IndexingException {
-
- pm.subTask(HelpBaseResources.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(HelpBaseResources.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(HelpBaseResources.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 = index.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());
- return new URL(
- "help",
- null,
- -1,
- url + "?lang=" + index.getLocale(),
- HelpURLStreamHandler.getDefault());
-
- } catch (MalformedURLException mue) {
- return null;
- }
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LazyProgressMonitor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LazyProgressMonitor.java
deleted file mode 100644
index 8e277db13..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/ParsedDocument.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/ParsedDocument.java
deleted file mode 100644
index 36c0391e3..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java
deleted file mode 100644
index 13bbb21c2..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/PluginVersionInfo.java
+++ /dev/null
@@ -1,188 +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.eclipse.core.runtime.*;
-import org.eclipse.help.internal.base.util.*;
-import org.osgi.framework.*;
-/**
- * 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";
- File dir;
- 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 docBundleIds Collection of String
- * @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,
- Collection docBundleIds,
- File dir,
- boolean ignoreSavedVersions) {
- super(name, dir);
- this.dir=dir;
- this.ignoreSavedVersions = ignoreSavedVersions;
- // create table of current contributions
- for (Iterator it = docBundleIds.iterator(); it.hasNext();) {
- String bundleId = (String) it.next();
- Bundle pluginBundle = Platform.getBundle(bundleId);
- if(pluginBundle == null){
- continue;
- }
- StringBuffer pluginVersionAndFragments = new StringBuffer();
- pluginVersionAndFragments.append(bundleId);
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(pluginBundle.getHeaders().get(Constants.BUNDLE_VERSION));
- Bundle[] fragmentBundles = Platform.getFragments(pluginBundle);
- if (fragmentBundles != null) {
- for (int f = 0; f < fragmentBundles.length; f++) {
- if (fragmentBundles[f].getState() == Bundle.INSTALLED || fragmentBundles[f].getState() == Bundle.UNINSTALLED)
- continue;
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(fragmentBundles[f]
- .getSymbolicName());
- pluginVersionAndFragments.append(SEPARATOR);
- pluginVersionAndFragments.append(fragmentBundles[f]
- .getHeaders().get(Constants.BUNDLE_VERSION));
- }
- }
- this.put(bundleId, 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, dir);
- 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.base/src/org/eclipse/help/internal/search/ProgressDistributor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/ProgressDistributor.java
deleted file mode 100644
index c15e53e3c..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/QueryBuilder.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java
deleted file mode 100644
index f22c1e538..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java
+++ /dev/null
@@ -1,437 +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.base.*;
-/**
- * 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 (BaseHelpSystem.getMode() == BaseHelpSystem.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 (BaseHelpSystem.getMode() == BaseHelpSystem.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 (BaseHelpSystem.getMode() == BaseHelpSystem.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 (BaseHelpSystem.getMode() == BaseHelpSystem.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(
- HelpBasePlugin.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();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryTooComplexException.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryTooComplexException.java
deleted file mode 100644
index a36ec3e33..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsExactPhrase.java
deleted file mode 100644
index a9ac202f1..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsPhrase.java
deleted file mode 100644
index 476ca5eb1..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/QueryWordsToken.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java
deleted file mode 100644
index 0ef082f76..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryWordsToken.java
+++ /dev/null
@@ -1,81 +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;
- int questionPos = value.indexOf('?');
- int starPos = value.indexOf('*');
- if (questionPos >= 0 || starPos >= 0) {
- if (questionPos == -1 && starPos == value.length() - 1) {
- Term t = new Term("exact_" + field, value.substring(0, starPos));
- q = new PrefixQuery(t);
- ((PrefixQuery) q).setBoost(boost);
- } else {
- 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.base/src/org/eclipse/help/internal/search/SearchHit.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchHit.java
deleted file mode 100644
index be59f8dd0..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
deleted file mode 100644
index 838ed2b68..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
+++ /dev/null
@@ -1,521 +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.base.*;
-import org.eclipse.help.internal.base.util.*;
-import org.eclipse.help.internal.toc.*;
-import org.eclipse.help.internal.util.*;
-import org.osgi.framework.*;
-/**
- * Text search index. Documents added to this index can than be searched against
- * a search query.
- */
-public class SearchIndex {
- private IndexReader ir;
- private IndexWriter iw;
- private File indexDir;
- private String locale;
- private TocManager tocManager;
- private AnalyzerDescriptor analyzerDescriptor;
- private PluginVersionInfo docPlugins;
- // table of all document names, used during indexing batches
- private HelpProperties indexedDocs;
- private static final String INDEXED_CONTRIBUTION_INFO_FILE = "indexed_contributions";
- 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 File inconsistencyFile;
- private HTMLDocParser parser;
- private IndexSearcher searcher;
- private Object searcherCreateLock = new Object();
- private HelpProperties dependencies;
- private boolean closed = false;
- // Collection of searches occuring now
- private Collection searches = new ArrayList();
- /**
- * Constructor.
- *
- * @param locale
- * the locale this index uses
- * @param analyzerDesc
- * the analyzer used to index
- */
- public SearchIndex(String locale, AnalyzerDescriptor analyzerDesc,
- TocManager tocManager) {
- this.locale = locale;
- this.analyzerDescriptor = analyzerDesc;
- this.tocManager = tocManager;
- indexDir = new File(HelpBasePlugin.getConfigurationDirectory(),
- "index/" + locale);
- inconsistencyFile = new File(indexDir.getParentFile(), locale
- + ".inconsistent");
- 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 (HelpBasePlugin.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) {
- HelpBasePlugin.logError(HelpBaseResources.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) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES16", name,
- indexDir.getAbsolutePath()), e);
- return false;
- }
- }
- /**
- * Starts additions. To be called before adding documents.
- */
- public synchronized 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(INDEXED_DOCS_FILE, indexDir);
- indexedDocs.restore();
- setInconsistent(true);
- iw = new IndexWriter(indexDir, analyzerDescriptor.getAnalyzer(),
- create);
- iw.mergeFactor = 20;
- iw.maxFieldLength = 1000000;
- return true;
- } catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES17"), e);
- return false;
- }
- }
- /**
- * Starts deletions. To be called before deleting documents.
- */
- public synchronized boolean beginDeleteBatch() {
- try {
- if (ir != null) {
- ir.close();
- }
- indexedDocs = new HelpProperties(INDEXED_DOCS_FILE, indexDir);
- indexedDocs.restore();
- setInconsistent(true);
- ir = IndexReader.open(indexDir);
- return true;
- } catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.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 (HelpBasePlugin.DEBUG_SEARCH) {
- System.out.println("SearchIndex.removeDocument(" + name + ")");
- }
- Term term = new Term("name", name);
- try {
- ir.delete(term);
- indexedDocs.remove(name);
- } catch (IOException e) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES22", name,
- indexDir.getAbsolutePath()), e);
- return false;
- }
- return true;
- }
- /**
- * Finish additions. To be called after adding documents.
- */
- public synchronized 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) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES19"), e);
- return false;
- }
- }
- /**
- * Finish deletions. To be called after deleting documents.
- */
- public synchronized 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) {
- HelpBasePlugin.logError(HelpBaseResources.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 {
- if (closed)
- return;
- registerSearch(Thread.currentThread());
- if (closed)
- return;
- 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) {
- HelpBasePlugin.logError(HelpBaseResources.getString("ES21",
- searchQuery.getSearchWord()), e);
- } finally {
- unregisterSearch(Thread.currentThread());
- }
- }
- public String getLocale() {
- return locale;
- }
- /**
- * Returns the list of all the plugins in this session that have declared a
- * help contribution.
- */
- public PluginVersionInfo getDocPlugins() {
- if (docPlugins == null) {
- Collection docPluginsIds = tocManager.getContributingPlugins();
- docPlugins = new PluginVersionInfo(INDEXED_CONTRIBUTION_INFO_FILE,
- docPluginsIds, indexDir, !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(INDEXED_DOCS_FILE,
- indexDir);
- 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(DEPENDENCIES_VERSION_FILENAME,
- indexDir);
- 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 = "";
- Bundle lucenePluginDescriptor = Platform.getBundle(LUCENE_PLUGIN_ID);
- if (lucenePluginDescriptor != null) {
- currentLuceneVersion += (String) lucenePluginDescriptor
- .getHeaders().get(Constants.BUNDLE_VERSION);
- }
- // 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());
- Bundle luceneBundle = Platform.getBundle(LUCENE_PLUGIN_ID);
- if (luceneBundle != null) {
- String luceneBundleVersion = ""
- + luceneBundle.getHeaders().get(Constants.BUNDLE_VERSION);
- getDependencies().put("lucene", luceneBundleVersion);
- } 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 void openSearcher() throws IOException {
- synchronized (searcherCreateLock) {
- if (searcher == null) {
- searcher = new IndexSearcher(indexDir.getAbsolutePath());
- }
- }
- }
- /**
- * Closes IndexReader used by Searcher. Should be called on platform
- * shutdown, or when TOCs have changed when no more reading from this index
- * is to be performed.
- */
- public void close() {
- closed = true;
- // wait for all sarches to finish
- synchronized (searches) {
- while (searches.size() > 0) {
- try {
- Thread.sleep(50);
- } catch (InterruptedException ie) {
- }
- }
- //
- if (searcher != null) {
- try {
- searcher.close();
- } catch (IOException ioe) {
- }
- }
- }
- }
- /**
- * Finds and unzips prebuild index specified in preferences
- */
- private void unzipProductIndex() {
- String indexPluginId = HelpBasePlugin.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 = indexDir;
- 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 (HelpBasePlugin.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) {
- }
- }
- }
- /**
- * Returns true when the index must be updated.
- */
- public synchronized boolean needsUpdating() {
- if (!exists()) {
- return true;
- }
- return getDocPlugins().detectChange();
- }
- /**
- * @return Returns the tocManager.
- */
- public TocManager getTocManager() {
- return tocManager;
- }
- private void registerSearch(Thread t) {
- synchronized (searches) {
- searches.add(t);
- }
- }
- private void unregisterSearch(Thread t) {
- synchronized (searches) {
- searches.remove(t);
- }
- }
- /**
- * @return Returns the closed.
- */
- public boolean isClosed() {
- return closed;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndexWithIndexingProgress.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndexWithIndexingProgress.java
deleted file mode 100644
index 954f49b7c..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndexWithIndexingProgress.java
+++ /dev/null
@@ -1,33 +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.internal.toc.*;
-
-public class SearchIndexWithIndexingProgress extends SearchIndex {
- private ProgressDistributor progressDistributor;
- /**
- * @param locale
- * @param analyzerDesc
- * @param tocManager
- */
- public SearchIndexWithIndexingProgress(String locale,
- AnalyzerDescriptor analyzerDesc, TocManager tocManager) {
- super(locale, analyzerDesc, tocManager);
- progressDistributor = new ProgressDistributor();
- }
- /**
- * @return Returns the progressDistributor.
- */
- public ProgressDistributor getProgressDistributor() {
- return progressDistributor;
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java
deleted file mode 100644
index 64cd5904b..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchManager.java
+++ /dev/null
@@ -1,195 +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.base.*;
-import org.eclipse.help.internal.search.IndexingOperation.*;
-
-/**
- * Manages indexing and search for all infosets
- */
-public class SearchManager implements ITocsChangedListener{
- /** Search indexes, by locale */
- private Map indexes = new HashMap();
- /** Caches analyzer descriptors for each locale */
- private Map analyzerDescriptors = new HashMap();
- /**
- * Constructs a Search manager.
- */
- public SearchManager() {
- super();
- HelpPlugin.getDefault().addTocsChangedListener(this);
- }
- /**
- * Public for use by indexing tool
- */
- public SearchIndexWithIndexingProgress getIndex(String locale) {
- synchronized (indexes) {
- Object index = indexes.get(locale);
- if (index == null) {
- index = new SearchIndexWithIndexingProgress(locale, getAnalyzer(locale), HelpPlugin.getTocManager());
- indexes.put(locale, index);
- }
- return (SearchIndexWithIndexingProgress) index;
- }
- }
- /**
- * 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 {
-
- SearchIndexWithIndexingProgress index = getIndex(searchQuery.getLocale());
- try {
- ensureIndexUpdated(pm, index);
- if (!index.exists()) {
- //no indexable documents, hence no index
- //or index is corrupted
- return;
- }
- } catch (IndexingOperation.IndexingException ie) {
- if (HelpBasePlugin.DEBUG_SEARCH) {
- System.out.println(
- this.getClass().getName()
- + " IndexUpdateException occured.");
- }
- }
- index.search(searchQuery, collector);
- }
-
- /**
- * Updates index. Checks if all contributions were indexed.
- * If not, it indexes them.
- * @throws OperationCanceledException if indexing was cancelled
- * @throws Exception if error occured
- */
- public void ensureIndexUpdated(IProgressMonitor pm, SearchIndexWithIndexingProgress index)
- throws OperationCanceledException, IndexingOperation.IndexingException {
-
- ProgressDistributor progressDistrib = index.getProgressDistributor();
- progressDistrib.addMonitor(pm);
- try {
- // Only one index update occurs in VM at a time,
- // but progress SearchProgressMonitor for other locales
- // are waiting until we know if indexing is needed
- // to prevent showing progress on first search after launch
- // if no indexing is needed
- if (index.isClosed() || !index.needsUpdating()) {
- pm.beginTask("", 1);
- pm.worked(1);
- pm.done();
- return;
- }else{
- if(pm instanceof SearchProgressMonitor){
- ((SearchProgressMonitor)pm).started();
- }
- }
- //
- updateIndex(pm, index, progressDistrib);
- } finally {
- progressDistrib.removeMonitor(pm);
- }
- }
- /**
- * @param pm
- * @param index
- * @param progressDistrib
- * @throws IndexingException
- */
- private synchronized void updateIndex(IProgressMonitor pm, SearchIndex index, ProgressDistributor progressDistrib) throws IndexingException {
- if (index.isClosed() || !index.needsUpdating()) {
- pm.beginTask("", 1);
- pm.worked(1);
- pm.done();
- return;
- }
- if (HelpBasePlugin.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();
- return;
- }
- IndexingOperation indexer = new IndexingOperation(index);
- indexer.execute(progressDistrib);
- return;
- } catch (OperationCanceledException oce) {
- progressDistrib.operationCanceled();
- HelpBasePlugin.logWarning(HelpBaseResources
- .getString("Search_cancelled"));
- throw oce;
- }
- }
- /**
- * Closes all indexes.
- */
- public void close() {
- synchronized (indexes) {
- for (Iterator it = indexes.values().iterator(); it.hasNext();) {
- ((SearchIndex) it.next()).close();
- }
- }
- }
- public synchronized void tocsChanged(){
- Collection activeIndexes = new ArrayList();
- synchronized (indexes){
- activeIndexes.addAll(indexes.values());
- }
- for(Iterator it = activeIndexes.iterator(); it.hasNext();){
- SearchIndexWithIndexingProgress ix = (SearchIndexWithIndexingProgress)it.next();
- ix.close();
- synchronized(indexes){
- indexes.remove(ix.getLocale());
- ProgressDistributor pm = ix.getProgressDistributor();
- pm.beginTask("", 1);
- pm.worked(1);
- pm.done();
- SearchProgressMonitor.reinit(ix.getLocale());
- }
- }
-
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
deleted file mode 100644
index 87f22e1c2..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
+++ /dev/null
@@ -1,219 +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.runtime.*;
-import org.eclipse.help.internal.base.*;
-
-/**
- * Progress monitor for search
- * @since 2.0
- */
-public class SearchProgressMonitor implements IProgressMonitor {
-
- // Progress monitors, indexed by locale
- protected static Map progressMonitors = new HashMap();
-
- // Dummy collector for triggering a progress monitor
- protected 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 (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;
- }
-
- /**
- * Sets the isStarted.
- * @return Returns a boolean
- */
- public void started() {
- this.started = true;
- }
-
- /**
- * 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 {
- BaseHelpSystem.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 (HelpBasePlugin.getDefault() != null) {
- HelpBasePlugin.logError(HelpBaseResources
- .getString("search_index_update_error"), e);
- } else {
- // Plugin has been 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;
- }
- }
- public synchronized static void reinit(String locale){
- progressMonitors.remove(locale);
- }
-
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchQuery.java
deleted file mode 100644
index 9263edc9e..000000000
--- a/org.eclipse.help.base/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.runtime.*;
-
-/**
- * An implementation of ISearchQuery.
- */
-public class SearchQuery implements ISearchQuery {
- Collection fieldNames;
- boolean fieldSearch;
- String locale;
- String searchWord;
- public SearchQuery() {
- this("", false, new ArrayList(), Platform.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.base/src/org/eclipse/help/internal/search/SearchResults.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java
deleted file mode 100644
index 25eb20b44..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java
+++ /dev/null
@@ -1,166 +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 AdaptableHelpResource[]
- 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;
- 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){
- // topic outside of scope
- 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) {
- scoreScale = 0.99f / score;
- score = 1;
- }
- scoreScaleSet = true;
- } else {
- score = score * scoreScale + 0.01f;
- }
-
- // Set the document label
- String label = doc.get("raw_title");
- if ("".equals(label) && toc != null) {
- ITopic t;
- if (scope != null) {
- t = scope.getTopic(href);
- } else{
- t = toc.getTopic(href);
- }
- if(t!=null){
- label=t.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 = HelpPlugin.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.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SmartAnalyzer.java
deleted file mode 100644
index be8b555b7..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/search/WordTokenStream.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/WordTokenStream.java
deleted file mode 100644
index 68d58c486..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/standalone/Eclipse.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Eclipse.java
deleted file mode 100644
index bf0da8795..000000000
--- a/org.eclipse.help.base/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(" " + cmdarray[i]);
- }
-
- }
- /**
- * Forcibly kill Eclipse process.
- */
- public void killProcess() {
- if (pr != null) {
- pr.destroy();
- }
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseConnection.java
deleted file mode 100644
index 5427660a3..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/standalone/EclipseController.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java
deleted file mode 100644
index c6d85249a..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseController.java
+++ /dev/null
@@ -1,275 +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.base/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/EclipseLifeCycleListener.java
deleted file mode 100644
index cb91e1f5e..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/standalone/Options.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/Options.java
deleted file mode 100644
index 6cd9cf234..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneHelp.java
deleted file mode 100644
index e574666f7..000000000
--- a/org.eclipse.help.base/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.*;
-
-import org.eclipse.help.internal.base.*;
-
-/**
- * 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 =
- HelpBasePlugin.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.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/standalone/StandaloneInfocenter.java
deleted file mode 100644
index e430abde5..000000000
--- a/org.eclipse.help.base/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.*;
-
-import org.eclipse.help.internal.base.*;
-
-/**
- * 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 =
- HelpBasePlugin.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.base/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableHelpResource.java
deleted file mode 100644
index dcee80007..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableToc.java
deleted file mode 100644
index fb1627714..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTocsArray.java
deleted file mode 100644
index 2e47d9e23..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/AdaptableTopic.java
deleted file mode 100644
index a3c9ba4d5..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/IHelpWorkingSetManager.java
deleted file mode 100644
index b95f74953..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/PropertyChange.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/PropertyChange.java
deleted file mode 100644
index 3575b9f9f..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/WorkingSet.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSet.java
deleted file mode 100644
index 57fe978b3..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetComparator.java
deleted file mode 100644
index 5c92986a9..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
deleted file mode 100644
index a4433478a..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
+++ /dev/null
@@ -1,507 +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.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.base.*;
-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, ITocsChangedListener{
-
- // 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 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() {
- restoreState();
- HelpPlugin.getDefault().addTocsChangedListener(this);
- }
-
- public AdaptableTocsArray getRoot() {
- if (root == null)
- root =
- new AdaptableTocsArray(
- HelpPlugin.getTocManager().getTocs(Platform.getNL()));
- 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 = HelpBasePlugin.getDefault().getStateLocation();
- 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 = HelpBaseResources.getString("WorkingSetManager.PCE");
- HelpPlugin.logError(msg, pce);
- HelpPlugin.logError(HelpBaseResources.getString("E041"), pce);
- return false;
- } catch (SAXException se) {
- String msg = HelpBaseResources.getString("E018", stateFile.toString());
- HelpBasePlugin.logError(msg, se);
- HelpBasePlugin.logError(HelpBaseResources.getString("E041"), se);
- return false;
- } catch (IOException ioe) {
- String msg = HelpBaseResources.getString("E018", stateFile.toString());
- HelpBasePlugin.logError(msg, ioe);
- HelpBasePlugin.logError(HelpBaseResources.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() != Node.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 = HelpBaseResources.getString("WorkingSetManager.PCE");
- HelpPlugin.logError(msg, pce);
- return false;
- }catch (TransformerException e){
- String message = HelpBaseResources.getString("WorkingSetManager.transformer");
- HelpPlugin.logError(message, null);
- return false;
- } catch (IOException e) {
- stateFile.delete();
- String message = HelpBaseResources.getString("E40");
- HelpBasePlugin.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.
- */
- 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 HelpBasePlugin.getDefault().getPluginPreferences().getString(
- BaseHelpSystem.WORKING_SET);
- }
-
- public void setCurrentWorkingSet(String workingSet) {
- HelpBasePlugin.getDefault().getPluginPreferences().setValue(
- BaseHelpSystem.WORKING_SET,
- workingSet);
- HelpBasePlugin.getDefault().savePluginPreferences();
- }
- public void tocsChanged() {
- saveState();
- List oldWorkingSets = new ArrayList(workingSets);
- root = null;
- workingSets = new TreeSet(new WorkingSetComparator());
- restoreState();
- List newWorkingSets = new ArrayList(workingSets);
- for (Iterator it = oldWorkingSets.iterator(); it.hasNext();) {
- WorkingSet ws = (WorkingSet) it.next();
- firePropertyChange(CHANGE_WORKING_SET_REMOVE, ws, null);
- }
- for (Iterator it = newWorkingSets.iterator(); it.hasNext();) {
- WorkingSet ws = (WorkingSet) it.next();
- firePropertyChange(CHANGE_WORKING_SET_ADD, null, ws);
- }
- }
-
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java b/org.eclipse.help.base/src/org/eclipse/help/standalone/Help.java
deleted file mode 100644
index 04043958b..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/standalone/Infocenter.java b/org.eclipse.help.base/src/org/eclipse/help/standalone/Infocenter.java
deleted file mode 100644
index 3b3a74b9f..000000000
--- a/org.eclipse.help.base/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.base/src/org/eclipse/help/standalone/package.html b/org.eclipse.help.base/src/org/eclipse/help/standalone/package.html
deleted file mode 100644
index ded158b98..000000000
--- a/org.eclipse.help.base/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>
diff --git a/org.eclipse.help/.classpath b/org.eclipse.help/.classpath
deleted file mode 100644
index 065ac06e1..000000000
--- a/org.eclipse.help/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.help/.cvsignore b/org.eclipse.help/.cvsignore
deleted file mode 100644
index a05a9c026..000000000
--- a/org.eclipse.help/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-build.xml
-help.jar
-help.jar.bin.log
-org.eclipse.help_* \ No newline at end of file
diff --git a/org.eclipse.help/.options b/org.eclipse.help/.options
deleted file mode 100644
index adc49bf89..000000000
--- a/org.eclipse.help/.options
+++ /dev/null
@@ -1,3 +0,0 @@
-org.eclipse.help/debug = true
-org.eclipse.help/debug/context = false
-org.eclipse.help/debug/protocols = false
diff --git a/org.eclipse.help/.project b/org.eclipse.help/.project
deleted file mode 100644
index 6718fa07e..000000000
--- a/org.eclipse.help/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.help</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.help/about.html b/org.eclipse.help/about.html
deleted file mode 100644
index 9db411aab..000000000
--- a/org.eclipse.help/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 (&quot;CPL&quot;). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, &quot;Program&quot; will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL (&quot;Other License&quot;), any modifications, enhancements and/or
-other code and/or documentation (&quot;Modifications&quot;) uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/org.eclipse.help/build.properties b/org.eclipse.help/build.properties
deleted file mode 100644
index 7ba1a6267..000000000
--- a/org.eclipse.help/build.properties
+++ /dev/null
@@ -1,14 +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
-###############################################################################
-source.help.jar=src/
-src.includes=schema/,about.html
-bin.includes=dtd/,livehelp.js,plugin.xml,preferences.ini,*.jar,plugin.properties,about.html,.options
-
diff --git a/org.eclipse.help/dtd/contexts.dtd b/org.eclipse.help/dtd/contexts.dtd
deleted file mode 100644
index e1897422f..000000000
--- a/org.eclipse.help/dtd/contexts.dtd
+++ /dev/null
@@ -1,13 +0,0 @@
-
-<!ELEMENT contexts (context)* >
-
-<!ELEMENT context (description, topic*) >
-<!ATTLIST context id ID #REQUIRED >
-
-<!ELEMENT description (#PCDATA|b)* >
-
-<!ELEMENT b (#PCDATA)* >
-
-<!ELEMENT topic EMPTY >
-<!ATTLIST topic label CDATA #REQUIRED >
-<!ATTLIST topic href CDATA #IMPLIED >
diff --git a/org.eclipse.help/dtd/toc.dtd b/org.eclipse.help/dtd/toc.dtd
deleted file mode 100644
index bb251085e..000000000
--- a/org.eclipse.help/dtd/toc.dtd
+++ /dev/null
@@ -1,14 +0,0 @@
-<!ELEMENT toc (topic | anchor | link)* >
-<!ATTLIST toc link_to CDATA #IMPLIED >
-<!ATTLIST toc label CDATA #REQUIRED >
-<!ATTLIST toc topic CDATA #IMPLIED >
-
-<!ELEMENT topic (topic | anchor | link )* >
-<!ATTLIST topic label CDATA #REQUIRED >
-<!ATTLIST topic href CDATA #IMPLIED >
-
-<!ELEMENT anchor EMPTY >
-<!ATTLIST anchor id ID #REQUIRED >
-
-<!ELEMENT link EMPTY >
-<!ATTLIST link toc CDATA #REQUIRED >
diff --git a/org.eclipse.help/livehelp.js b/org.eclipse.help/livehelp.js
deleted file mode 100644
index 835c217df..000000000
--- a/org.eclipse.help/livehelp.js
+++ /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
- *******************************************************************************/
-
-/**
- * Private helper function for use by other (public) functions.
- */
-function findHelpTop() {
- var helpTop;
- for (helpTop=self; helpTop; helpTop = helpTop.parent){
- if (helpTop.liveActionInternal){
- break;
- }
- if (helpTop==helpTop.parent){
- break;
- }
- }
- return helpTop;
-}
-
-/**
- * Call this Javascript method to trigger a specified live help action
- * in the workbench.
- * The parameters for liveAction are:
- * - the id of the plug-in that contains the action
- * - the name of the class that implements the action
- * - the String that will be passed to the live help action using setInitializationString
- */
-
-function liveAction(pluginId, className, argument)
-{
- // find top help frameset
- var helpTop=findHelpTop();
- if (helpTop != null && helpTop.liveActionInternal){
- return helpTop.liveActionInternal(helpTop, pluginId, className, argument);
- }
-}
-
-/**
- * Show specified topic in the Contents tree.
- * The topic must be passed as a URL string.
- * Example:
- * // include the script first
- * <script src="../org.eclipse.help/livehelp.js"></script>
- * ......
- * // show specified topic in the tree
- * showTopicInContents(window.location.href);
- */
-function showTopicInContents(topic) {
- var helpTop=findHelpTop();
- if (helpTop != null && helpTop.showTopicInContentsInternal){
- return helpTop.showTopicInContentsInternal(helpTop, topic);
- }
-}
diff --git a/org.eclipse.help/plugin.properties b/org.eclipse.help/plugin.properties
deleted file mode 100644
index 6181f1f30..000000000
--- a/org.eclipse.help/plugin.properties
+++ /dev/null
@@ -1,15 +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
-###############################################################################
-help_plugin_name = Help System Core
-providerName=Eclipse.org
-toc_extension_point_name = Help Table of Contents Contributions
-contexts_extension_point_name = Context Help
-content_producer_extension_point_name = Help Content Producer
diff --git a/org.eclipse.help/plugin.xml b/org.eclipse.help/plugin.xml
deleted file mode 100644
index eaec99e42..000000000
--- a/org.eclipse.help/plugin.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.help"
- name="%help_plugin_name"
- version="3.0.0"
- provider-name="%providerName"
- class="org.eclipse.help.internal.HelpPlugin">
-
- <runtime>
- <library name="help.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.help"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- </requires>
-
-
-<!-- Extension points -->
- <extension-point id="contexts" name="%contexts_extension_point_name" schema="schema/contexts.exsd"/>
- <extension-point id="toc" name="%toc_extension_point_name" schema="schema/toc.exsd"/>
- <extension-point id="contentProducer" name="%content_producer_extension_point_name" schema="schema/contentProducer.exsd"/>
-
-</plugin>
diff --git a/org.eclipse.help/preferences.ini b/org.eclipse.help/preferences.ini
deleted file mode 100644
index 2c57c6b49..000000000
--- a/org.eclipse.help/preferences.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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
diff --git a/org.eclipse.help/schema/contentProducer.exsd b/org.eclipse.help/schema/contentProducer.exsd
deleted file mode 100644
index a3201938c..000000000
--- a/org.eclipse.help/schema/contentProducer.exsd
+++ /dev/null
@@ -1,156 +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="contentProducer" name="Help Content Producer"/>
- </appInfo>
- <documentation>
- For providing dynamic, generated at run time, help content.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="contentProducer" 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="contentProducer">
- <complexType>
- <sequence>
- <element ref="producer"/>
- </sequence>
- <attribute name="producer" type="string">
- <annotation>
- <documentation>
- the implementation class for the help content producer. This class must implement the &lt;samp&gt;org.eclipse.help.IHelpContentProducer&lt;/samp&gt; interface. This attribute may be omitted, and the nested &lt;samp&gt;producer&lt;/samp&gt; element may be provided instead.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.IHelpContentProducer"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="producer">
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- the implementation class for the help content producer. This class must implement the &lt;samp&gt;org.eclipse.help.IHelpContentProducer&lt;/samp&gt; interface.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.IHelpContentProducer"/>
- </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="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <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.contentProducer&quot;
- id=&quot;org.eclipse.myPlugin.myDynamicHelpProducer&quot;
- name=&quot;My Dynamic Help Content&quot;&gt;
- &lt;contentProducer producer=&quot;org.eclipse.myPlugin.myPackage.Myproducer&quot; /&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The supplied content producer class must implement the &lt;samp&gt;org.eclipse.help.IHelpContentProducer&lt;/samp&gt; interface.
-The producer is responsible for providing content for dynamic help resources from a plug-in. The method of content producer is called by help for every help resource obtained from the plug-in.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- None. If a documentation plug-in does not provide help content producer or a call to it results in null, help system searches doc.zip and file system in the plug-in install location for a static document and displays its content.
- </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/contexts.exsd b/org.eclipse.help/schema/contexts.exsd
deleted file mode 100644
index b96a1e3b5..000000000
--- a/org.eclipse.help/schema/contexts.exsd
+++ /dev/null
@@ -1,170 +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="contexts" name="Contexts"/>
- </appInfo>
- <documentation>
- For defining context-sensitive help for an
-individual plug-in.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="contexts" 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="contexts">
- <complexType>
- <attribute name="file" type="string" use="required">
- <annotation>
- <documentation>
- the name of the manifest file which contains the context-sensitive help documentation for this plug-in.
-&lt;p&gt;
-&lt;i&gt;&lt;b&gt;Configuration Markup for what goes into the
-contexts manifest file:&lt;/b&gt;&lt;/i&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT contexts (context)* ) &gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT context (description?,topic*) &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST context id ID #REQUIRED &gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT description (#PCDATA)&gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT topic EMPTY &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST topic label CDATA #REQUIRED &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST topic href CDATA #IMPLIED &gt;&lt;/tt&gt;
-&lt;p&gt;The contexts manifest files provide all the information needed when
-context-sensitive help is requested by the user. The id is passed by the
-platform to identify the currently active context. The context definitions
-with matching IDs are then retrieved. The IContext object is then created
-by help system that contains descriptions and topics from all context definitions
-for a given ID.&amp;nbsp; The description is to be displayed to the user, and
-related topics might be useful to the user for understanding the current
-context.&amp;nbsp; The related topic are html files packaged in doc.zip, together
-with topics that are part of on line help.
-&lt;/p&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="plugin" type="string">
- <annotation>
- <documentation>
- Plugin to which its context definitions are extended with extra information.
-&lt;p&gt;If a plugin defines some context id&apos;s, one can extend the description or related links of a context by declaring another context with the same id.&lt;/p&gt;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of using the contexts
-extension point:
-&lt;br&gt;
-(in file &lt;tt&gt;plugin.xml&lt;/tt&gt;)
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.help.contexts&quot;&gt;
- &lt;contexts file=&quot;xyzContexts.xml&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-&lt;p&gt;(in file &lt;tt&gt;xyzContexts.xml&lt;/tt&gt;)
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;contexts&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;context&amp;nbsp; id=&quot;generalContextId&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;description&gt; This
-is a sample F1 help string.&amp;lt;/description&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;topic href=&quot;contexts/RelatedContext1.html&quot;&amp;nbsp;
-label=&quot;Help Related Topic 1&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;topic href=&quot;contexts/RelatedContext2.html&quot;&amp;nbsp;
-label=&quot;Help Related Topic 2&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/context&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/contexts&gt;&lt;/tt&gt;
-&lt;br&gt;&amp;nbsp;
-&lt;/p&gt;
-
-&lt;b&gt;&lt;em&gt;Externalizing Strings&lt;/em&gt;&lt;/b&gt;
-The Context XML files can be translated and the resulting copy (with translated
-descriptions labels) should be placed in nl/&amp;lt;language&gt;/&amp;lt;country&gt;
-or nl/&amp;lt;language&gt; directory.&amp;nbsp; The &amp;lt;language&gt; and &amp;lt;country&gt;
-stand for two letter language and country codes as used in locale codes.&amp;nbsp;
-For example, Traditional Chinese translations should be placed in the nl/zh/TW
-directory.&amp;nbsp; The nl/&amp;lt;language&gt;/&amp;lt;country&gt; directory has a higher
-priority than nl/&amp;lt;language&gt;.&amp;nbsp; Only if no file is found in the nl/&amp;lt;language&gt;/&amp;lt;country&gt;,
-the file residing in nl/&amp;lt;language&gt; will be used.&amp;nbsp; The the root
-directory of a plugin will be searched last.
-&lt;p&gt;The related topics contained in doc.zip can be localized by creating
-a doc.zip file with translated version of documents, and placing doc.zip
-in
-&lt;br&gt;nl/&amp;lt;language&gt;/&amp;lt;country&gt; or nl/&amp;lt;language&gt; directory. The help
-system will look for the files under this directories before defaulting
-to plugin directory.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- No code is required to use this extension point. All
-that is needed is to supply the appropriate manifest
-file(s) mentioned in the plugin.xml file.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The optional default implementation of the help
-system UI supplied with the Eclipse platform
-fully supports the &lt;samp&gt;contexts&lt;/samp&gt; extension point.
- </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/toc.exsd b/org.eclipse.help/schema/toc.exsd
deleted file mode 100644
index b165f65bf..000000000
--- a/org.eclipse.help/schema/toc.exsd
+++ /dev/null
@@ -1,294 +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="toc" name="Table of Contents (TOC)"/>
- </appInfo>
- <documentation>
- For registering an online help contribution for an individual plug-in.
-
-&lt;p&gt;Each plug-in that contributes help files should in general do the following:
-&lt;ul&gt;
-&lt;ul&gt;
-&lt;li&gt;
-author the html files, zip html files into doc.zip, and store the zip file
-in the plug-in directory.&lt;/li&gt;
-
-&lt;li&gt;
-create TOC files that describe Table of Contents for the help and the necessary
-topic interleaving. See the syntax below.&lt;/li&gt;
-
-&lt;li&gt;
-the plugin.xml file should extend the &lt;tt&gt;org.eclipse.help.toc&lt;/tt&gt; extension
-point and specify TOC file(s).&lt;/li&gt;
-&lt;/ul&gt;
-&lt;/ul&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="toc" 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="toc">
- <complexType>
- <attribute name="file" type="string" use="required">
- <annotation>
- <documentation>
- the name of the TOC file which contains the table of contents or section for this plug-in&apos;s online help.
-&lt;p&gt;
-&lt;i&gt;&lt;b&gt;Configuration Markup for toc file:&lt;/b&gt;&lt;/i&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT toc (topic | anchor | link)* &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST toc link_to CDATA #IMPLIED &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST toc label CDATA #REQUIRED &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST toc topic CDATA #IMPLIED &gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT topic (topic | anchor | link )*
-&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST topic label CDATA #REQUIRED &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST topic href CDATA #IMPLIED &gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT anchor EMPTY &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST anchor id ID&amp;nbsp; #REQUIRED &gt;&lt;/tt&gt;
-&lt;p&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ELEMENT link EMPTY &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!ATTLIST link toc CDATA #REQUIRED &gt;&lt;/tt&gt;
-&lt;p&gt;In general, a plug-in that needs to provide online help will define
-its own TOC files. In the end, the help system is configured to be launched
-as some actions, and the path of the TOC file can be used to do so.
-&lt;p&gt;&lt;b&gt;The topic element&lt;/b&gt;
-&lt;p&gt;All help topic element are contributed as part of the toc container
-element. They can have a hierarchical structure, or can be listed as a
-flat list.
-&lt;p&gt;The topic element is the workhorse of structure of Table of Contents.
-There are two typical uses for the topic element:
-&lt;p&gt;1.&amp;nbsp; To provide a link to a documentation file - usually an HTML
-file.
-&lt;br&gt;2.&amp;nbsp; To act as a container for other toc, either in the same manifest
-or another.
-&lt;p&gt;&lt;b&gt;&lt;i&gt;1.&amp;nbsp; Topics as links&lt;/i&gt;&lt;/b&gt;
-&lt;br&gt;The simplest use of a topic is as a link to a documentation file.
-&lt;p&gt;&lt;tt&gt;&amp;lt;topic label=&quot;Some concept file&quot; href=&quot;concepts/some_file.html&quot;
-/&gt;&lt;/tt&gt;
-&lt;p&gt;The href attribute is relative to the plug-in that the manifest file
-belongs to.&amp;nbsp; If you need to access a file in another plug-in, you
-can use the syntax
-&lt;p&gt;&lt;tt&gt;&amp;lt;topic label=&quot;topic in another plug-in&quot; href=&quot;../other.plugin.id/concepts/some_other_file.html&quot;
-/&gt;&lt;/tt&gt;
-&lt;p&gt;&lt;b&gt;&lt;i&gt;2.&amp;nbsp; Topics as containers&lt;/i&gt;&lt;/b&gt;
-&lt;br&gt;The next most common use of a topic is to use it as a container for
-other toc.&amp;nbsp; The container topic itself can always refer to a particular
-file as well.
-&lt;p&gt;&lt;tt&gt;&amp;lt;topic label=&quot;Integrated Development Environment&quot; href=&quot;concepts/ciover.htm&quot;
-&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Starting the IDE&quot; href=&quot;concepts/blah.htm&quot;
-/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; ...&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;p&gt;&lt;b&gt;The link element&lt;/b&gt;
-&lt;p&gt;The link element allows to link Table of Contents defined in another
-toc file.&amp;nbsp; All the topics from the toc file specified in the toc attribute
-will appear in the table of contents as if they were defined directly in
-place of the link element.&amp;nbsp; To include toc from api.xml file you could
-write
-&lt;p&gt;&lt;tt&gt;&amp;lt;topic label=&quot;References&quot; &gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; ...&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;link toc=&quot;api.xml&quot; /&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; ...&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;p&gt;&lt;b&gt;The anchor element&lt;/b&gt;
-&lt;p&gt;The anchor element defines a point that will allow linking other toc
-files to this navigation, and extending it, without using the link element
-and referencing other toc files from here.&amp;nbsp; To allow inserting Table
-of Contents with more topics after the &quot;ZZZ&quot; document you would define
-an anchor as follows:
-&lt;p&gt;&lt;tt&gt;...&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;topic label=&quot;zzz&quot; href=&quot;zzz.html&quot; /&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;anchor id=&quot;moreapi&quot; /&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;...&lt;/tt&gt;
-&lt;p&gt;&lt;b&gt;The toc element&lt;/b&gt;
-&lt;p&gt;The toc element is a Table of Contents that groups topics and other
-elements defined in this file.&amp;nbsp; The label identifies the table of
-contents to the user, when it is displayed to the user.&amp;nbsp; The optional topic
-attribute is the path to a topic file describing the TOC.&amp;nbsp; The optional
-link_to attribute allows for linking toc from this file into another toc
-file being higher in the navigation hierarchy.&amp;nbsp; The value of the link_to
-attribute must specify an anchor in another toc file. To link toc from
-myapi.xml to api.xml file, specified in another plugin you would use
-the syntax
-&lt;p&gt;&lt;tt&gt;&amp;lt;toc link_to=&quot;../anotherPlugin/api.xml#moreapi&quot; label=&quot;My Tool
-API&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;...&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;toc /&gt;&lt;/tt&gt;
-&lt;p&gt;where # character separates toc file name from the anchor identifier.
-&lt;/p&gt;
-&lt;br&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="primary" type="boolean" use="default" value="false">
- <annotation>
- <documentation>
- specifies whether the TOC file is a primary table of contents and is meant to be the master table of contents,
-or not primary and intended to be integrated into another table of contents.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="extradir" type="string">
- <annotation>
- <documentation>
- specifies relative directory name of containing additional documents that are associated with the table of contents.
-All help documents in this directory, and all subdirectories, will be indexed, and accessible through
-the documentation search, even if &lt;samp&gt;topic&lt;/samp&gt; elements in the TOC file do not refer to these documents.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of using the &lt;samp&gt;toc&lt;/samp&gt; extension point.
-
-&lt;p&gt;(in file &lt;tt&gt;plugin.xml&lt;/tt&gt;)
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.help.toc&quot;&gt;
- &lt;toc file=&quot;maindocs.html&quot; primary=&quot;true&quot;/&gt;
- &lt;toc file=&quot;task.xml&quot;/&gt;
- &lt;toc file=&quot;sample.xml&quot; extradir=&quot;samples&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-&lt;p&gt;(in file &lt;tt&gt;maindocs.xml&lt;/tt&gt;)
-&lt;blockquote&gt;&lt;tt&gt;&amp;lt;toc label=&quot;Help System Example&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;topic label=&quot;Introduction&quot; href=&quot;intro.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;topic label=&quot;Tasks&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Creating a Project&quot; href=&quot;tasks/task1.html&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp; &amp;lt;topic label=&quot;Creating a Web Project&quot; href=&quot;tasks/task11.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp; &amp;lt;topic label=&quot;Creating a Java Project&quot; href=&quot;tasks/task12.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;link toc=&quot;task.xml&quot; /&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Testing a Project&quot; href=&quot;tasks/taskn.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;topic label=&quot;Samples&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Creating Java Project&quot; href=&quot;samples/sample1.html&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp; &amp;lt;topic label=&quot;Launch a Wizard&quot; href=&quot;samples/sample11.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp; &amp;lt;topic label=&quot;Set Options&quot; href=&quot;samples/sample12.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;nbsp; &amp;lt;topic label=&quot;Finish Creating Project&quot; href=&quot;samples/sample13.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;anchor id=&quot;samples&quot; /&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;/toc&gt;&lt;/tt&gt;&lt;/blockquote&gt;
-
-&lt;p&gt;&lt;br&gt;(in file &lt;tt&gt;tasks.xml&lt;/tt&gt;)
-&lt;blockquote&gt;&lt;tt&gt;&amp;lt;toc label=&quot;Building a Project&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;topic label=&quot;Building a Project&quot; href=&quot;build/building.html&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Building a Web Project&quot; href=&quot;build/web.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Building a Java Project&quot; href=&quot;build/java.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;/toc&gt;&lt;/tt&gt;&lt;/blockquote&gt;
-
-&lt;p&gt;&lt;br&gt;(in file &lt;tt&gt;samples.xml&lt;/tt&gt;)
-&lt;blockquote&gt;&lt;tt&gt;&amp;lt;toc link_to=&quot;maindocs.xml#samples&quot; label=&quot;Using The
-Compile Tool&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;topic label=&quot;The Compile Tool Sample&quot; href=&quot;compilesample/example.html&quot;&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Step 1&quot; href=&quot;compilesample/step1.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Step 2&quot; href=&quot;compilesample/step2.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Step 3&quot; href=&quot;compilesample/step3.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp; &amp;lt;topic label=&quot;Step 4&quot; href=&quot;compilesample/step4.html&quot;/&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;nbsp;&amp;lt;/topic&gt;&lt;/tt&gt;
-&lt;br&gt;&lt;tt&gt;&amp;lt;/toc&gt;&lt;/tt&gt;&lt;/blockquote&gt;
-
-
-&lt;p&gt;Assuming more documents exists with the path starting with &quot;samples&quot;,
-they will not be displayed in the navigation tree, but be accessible using
-search.&amp;nbsp; It is due to the presence of &quot;extradir&quot; attribute in the
-element &lt;tt&gt;&amp;lt;toc file=&quot;sample.xml&quot; extradir=&quot;samples&quot; /&gt; &lt;/tt&gt;inside&lt;tt&gt;
-plugin.xml &lt;/tt&gt;file. For example searching for &quot;Creating Java Project&quot;
-could return a document &quot;Other Ways of Creating Java Project&quot;, which path
-is &lt;tt&gt;samples/sample2.html.&lt;/tt&gt;
-
-&lt;p&gt;
-&lt;b&gt;&lt;em&gt;Internationalization&lt;/em&gt;&lt;/b&gt;
-The TOC XML files can be translated and the resulting copy (with translated
-labels) should be placed in nl/&amp;lt;language&gt;/&amp;lt;country&gt; or nl/&amp;lt;language&gt;
-directory.&amp;nbsp; The &amp;lt;language&gt; and &amp;lt;country&gt; stand for two letter
-language and country codes as used in locale codes.&amp;nbsp; For example,
-Traditional Chinese translations should be placed in the nl/zh/TW directory.&amp;nbsp;
-The nl/&amp;lt;language&gt;/&amp;lt;country&gt; directory has a higher priority than
-nl/&amp;lt;language&gt;.&amp;nbsp; Only if no file is found in the nl/&amp;lt;language&gt;/&amp;lt;country&gt;,
-the file residing in nl/&amp;lt;language&gt; will be used.&amp;nbsp; The the root
-directory of a plugin will be searched last.
-&lt;p&gt;The documentation contained in doc.zip can be localized by creating
-a doc.zip file with translated version of documents, and placing doc.zip
-in
-&lt;br&gt;nl/&amp;lt;language&gt;/&amp;lt;country&gt; or nl/&amp;lt;language&gt; directory. The help
-system will look for the files under this directories before defaulting
-to plugin directory.
-&lt;br&gt;&amp;nbsp;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- No code is required to use this extension point. All that is needed is to supply the appropriate manifest
-files mentioned in the plugin.xml file.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The default implementation of the help system UI supplied with the Eclipse platform fully supports the &lt;samp&gt;toc&lt;/samp&gt; extension point.
- </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/org/eclipse/help/HelpSystem.java b/org.eclipse.help/src/org/eclipse/help/HelpSystem.java
deleted file mode 100644
index 7ee63e9ad..000000000
--- a/org.eclipse.help/src/org/eclipse/help/HelpSystem.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * 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.runtime.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.protocols.*;
-
-/**
- * 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(Platform.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);
- URL helpURL =
- new URL(
- "help",
- null,
- -1,
- href,
- HelpURLStreamHandler.getDefault());
-
- return helpURL.openStream();
- } catch (IOException ioe) {
- return null;
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/IContext.java b/org.eclipse.help/src/org/eclipse/help/IContext.java
deleted file mode 100644
index a54ad575c..000000000
--- a/org.eclipse.help/src/org/eclipse/help/IContext.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;
-/**
- * A context registered for context-sensitive help.
- * <p>
- * This interface models the context-sensitive help that can be associated with
- * SWT menus, menu items, and controls, and with JFace actions. A help context
- * provides the text description of the object with which it is associated with,
- * as well as topic links that contain more related information. This information
- * would be displayed to the user when context sensitive help (F1) is requested.
- * </p>
- * <p>
- * In the current implementation of the Help system, valid contexts can be
- * contributed through the <code>contexts</code> element of the
- * <code>"org.eclipse.help.contexts"</code> extension point. The
- * <code>IHelp.findContext(String)</code> method is used at runtime to create
- * or fetch IContext objects using there fully qualified contextIds. If there
- * is a need to override this behavior, then this IContext interface could be
- * implemented by a client and registered with the SWT control or JFace action.
- * </p>
- */
-public interface IContext {
- /**
- * Returns a list of related topics for this help context.
- *
- * @return a list of related help topics
- * @since 2.0
- */
- public IHelpResource[] getRelatedTopics();
- /**
- * Returns the text description for this context.
- *
- * @return the text description
- */
- public String getText();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/IHelp.java b/org.eclipse.help/src/org/eclipse/help/IHelp.java
deleted file mode 100644
index 19c12347d..000000000
--- a/org.eclipse.help/src/org/eclipse/help/IHelp.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;
-/**
- * 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 {
-
- /**
- * Displays the entire help bookshelf.
- * <p>
- * 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();
-
- /**
- * Displays context-sensitive help for the given context.
- * <p>
- * (x,y) coordinates specify the location where the context sensitive
- * help UI will be presented. These coordinates are screen-relative
- * (ie: (0,0) is the top left-most screen corner).
- * The platform is responsible for calling this method and supplying the
- * appropriate location.
- * </p>
- *
- *
- * @param context the context to display
- * @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);
-
- /**
- * Displays context-sensitive help for context with the given context id.
- * <p>
- * (x,y) coordinates specify the location where the context sensitive
- * help UI will be presented. These coordinates are screen-relative
- * (ie: (0,0) is the top left-most screen corner).
- * The platform is responsible for calling this method and supplying the
- * appropriate location.
- * </p>
- *
- * @param contextId the help context identifier;
- * the parameter needs to have a form pluginID.pluginContextId,
- * where pluginID is ID of plug-in contributing a context,
- * and pluginContextID is ID of context contributed in a plug-in.
- * @param x horizontal position
- * @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);
-
- /**
- * Displays help content for the help resource with the given URL.
- * <p>
- * This method is called by the platform to launch the help system UI, displaying
- * the documentation identified by the <code>href</code> parameter.
- * </p>
- * <p>
- * The help system makes no guarantee that all the help resources can be displayed or how they are displayed.
- * </p>
- * @param href the URL of the help resource.
- * <p>Valid href are as described in
- * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()}
- * </p>
- * @since 2.0
- * @deprecated Use WorkbenchHelp.displayHelpResource(href) instead.
- */
- public void displayHelpResource(String href);
-
- /**
- * Displays help content for the help resource.
- * <p>
- * This method is called by the platform to launch the help system UI, displaying
- * the documentation identified by the <code>helpResource</code> parameter.
- * <p>
- * The help system makes no guarantee that all the help resources can be displayed or how they are displayed.
- * </p>
- * @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>
- * This method is called by the platform to launch the help system UI, displaying
- * the documentation identified by the <code>toc</code> parameter.
- * </p>
- * <p>
- * Valid toc are
- * contributed through the <code>toc</code> element of the
- * <code>"org.eclipse.help.toc"</code> extension point.
- * </p>
- *
- * @param toc the URL of the toc as specified in
- * the <code>"org.eclipse.help.toc"</code> extenstion
- * point
- * @deprecated Use WorkbenchHelp.displayHelpResource(toc) instead.
- */
- public void displayHelp(String toc);
-
- /**
- * This method is an extension to the
- * <a href="#displayHelp(java.lang.String)">displayHelp(String toc)</a>
- * method, providing the ability to open the specified help topic.
- * <p>
- * <code>selectedTopic</code> should be a valid help topic url contained in
- * the specified <code>toc</code> and have the following format:
- * <em>/pluginID/path_to_document</em>
- * <br>where
- * <dl>
- * <dt> <em>pluginID</em> is the unique identifier of the plugin containing the help topic,
- * </dt>
- * <dt> <em>path_to_document</em> is the help topic path, relative to the plugin directory
- * </dt>
- * </dl>
- * </p>
- * @param toc the URL of the toc
- * @param selectedTopic the help topic url.
- * @see #displayHelp(java.lang.String)
- * @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>
- * (x,y) coordinates specify the location where the context sensitive
- * help UI will be presented. These coordinates are screen-relative
- * (ie: (0,0) is the top left-most screen corner).
- * The platform is responsible for calling this method and supplying the
- * appropriate location.
- * </p>
- *
- * @param contextId the help context identifier
- * @param x horizontal position
- * @param y verifical position
- * @see #getContext(String)
- * @deprecated Use WorkbenchHelp.displayContext(HelpSystem.getContext(contextId),x,y) instead.
- */
- public void displayHelp(String contextId, int x, int y);
-
- /**
- * Displays context-sensitive help for the given context.
- * <p>
- * (x,y) coordinates specify the location where the context sensitive
- * help UI will be presented. These coordinates are screen-relative
- * (ie: (0,0) is the top left-most screen corner).
- * The platform is responsible for calling this method and supplying the
- * appropriate location.
- * </p>
- *
- *
- * @param context the context to display
- * @param x horizontal position
- * @param y verifical position
- * @deprecated Use WorkbenchHelp.displayContext(context,x,y) instead.
- */
- public void displayHelp(IContext context, int x, int y);
-
- /**
- * Computes and returns context information for the given context id.
- *
- * @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);
-
- /**
- * 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/IHelpContentProducer.java b/org.eclipse.help/src/org/eclipse/help/IHelpContentProducer.java
deleted file mode 100644
index cbba37a9e..000000000
--- a/org.eclipse.help/src/org/eclipse/help/IHelpContentProducer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.util.*;
-
-/**
- * Producer capable of generating or otherwise obtaining
- * contents for help resources. A plug-in can contribute instance
- * of IHelpContentProducer to <code>"org.eclipse.help.contentProducer"</code>
- * extension point. When content for a resource is needed from a plug-in
- * is needed, help tries to obtain content from instance of this class
- * contributed by the plugin. If IHelpContentProvider does not return
- * the content, help system searches doc.zip and plug-in install location
- * for the file and reads its content.
- * @since 3.0
- */
-public interface IHelpContentProducer {
- /**
- * Obtains content of a specified help resource.
- * If resource for a given path does not exist, a null should be returned.
- * If topic content is static, and corresponding file exist in a plug-in
- * directory or doc.zip file, null might be return as help system can
- * read the file content itself.
- * @param pluginID unique identifier of a plug-in containing the resource
- * @param href path of the resource in a plug-in.
- * <p>
- * An href has a format <em>path/to/resource</em> or
- * <em>path/to/resource?parameter=value1&parameter2=value2...</em>
- * For example, <em>references/myclass.html</em> may be passed.
- * </p>
- * @param locale used by the client. In most cases, content
- * in a user language should be produced.
- * @return InputStream or null if specified resource is not dynamic
- * and should be read from doc.zip or plug-in install location.
- */
- public InputStream getInputStream(String pluginID, String href, Locale locale);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/IHelpResource.java b/org.eclipse.help/src/org/eclipse/help/IHelpResource.java
deleted file mode 100644
index a4658d919..000000000
--- a/org.eclipse.help/src/org/eclipse/help/IHelpResource.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;
-/**
-* A help resource, usually a help topic.
- * <p>
- * This interface models a help resource. In general, help resources are either
- * html help files, or table of contents XML files.
- * </p>
- * @since 2.0
- */
-public interface IHelpResource {
-
- /**
- * This is attribute name used for href in XML files.
- */
- public final static String HREF = "href";
- /**
- * This is attribute name used for label in XML files.
- */
- public final static String LABEL = "label";
-
- /**
- * Returns the URL (as a string) associated with this help resource.
- * @return the URL (as a string) associated with the resource
- * <p>
- * Valid URL of a help resource is:
- * <ul>
- * <li>a <em>/pluginID/path/to/resource</em>, where
- * <ul>
- * <li><em>pluginID</em> is the unique identifier
- * of the plugin containing the help resource,
- * <li><em>path/to/document</em> is the help resource path,
- * relative to the plugin directory.
- * </ul>
- * For example. <em>/myplugin/mytoc.xml</em>
- * or <em>/myplugin/references/myclass.html</em>
- * are vaild.
- * <li>string representation of URI to an external document.
- * In this case, all special characters have to be enoded
- * such that the URI is appropriate to be opened with a web browser.
- * <em>http://eclipse.org/documents/my%20file.html</em> and
- * <em>jar:file:/c:/my%20sources/src.zip!/mypackage/MyClass.html</em>
- * are examples of valid URIs.
- * </ul>
- * </p>
- */
- public String getHref();
- /**
- * Returns the label of this help resource.
- *
- * @return the label
- */
- public String getLabel();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java b/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java
deleted file mode 100644
index 486c0c09e..000000000
--- a/org.eclipse.help/src/org/eclipse/help/ILiveHelpAction.java
+++ /dev/null
@@ -1,27 +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;
-/**
- * Live Help Extension. Classes that implement this interface
- * can be used as live help extensions.
- * When user clicks a live help link in a help document,
- * the class will be loaded and run.
- * @since 2.0
- */
-public interface ILiveHelpAction extends Runnable {
- /**
- * This method will be called upon instantiation of the
- * live help extension. The data will be passed as specified
- * in the help document live help link.
- * @param data - initialization data as a String
- */
- public void setInitializationString(String data);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/IToc.java b/org.eclipse.help/src/org/eclipse/help/IToc.java
deleted file mode 100644
index 794274899..000000000
--- a/org.eclipse.help/src/org/eclipse/help/IToc.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;
-
-
-/**
- * IToc is the table of contents. It contains help topics.
- * @since 2.0
- */
-public interface IToc extends IHelpResource {
- /**
- * This is element name used for TOC in XML files.
- */
- public final static String TOC = "toc";
- /**
- * This is the attribute used for description topic in XML files.
- */
- public final static String TOPIC = "topic";
-
- /**
- * Obtains the topics directly contained by a toc.
- * @return Array of ITopic
- */
- public ITopic[] getTopics();
-
- /**
- * Returns a topic with the specified href defined by this TOC.
- * <br> If the TOC contains multiple
- * topics with the same href only of them (arbitrarily chosen) will
- * be returned.
- * <p> If no topic is specified, then the TOC description topic is
- * returned, or null if there is no description topic for the TOC.
- * </p>
- * @param href the topic's URL or null
- * @return ITopic or null
- */
- public ITopic getTopic(String href);
-}
-
diff --git a/org.eclipse.help/src/org/eclipse/help/ITopic.java b/org.eclipse.help/src/org/eclipse/help/ITopic.java
deleted file mode 100644
index a43b1b1c1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/ITopic.java
+++ /dev/null
@@ -1,30 +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;
-
-
-/**
- * ITopic is one topic in a hierarchy of topics.
- * @since 2.0
- */
-public interface ITopic extends IHelpResource {
- /**
- * This is element name used for topic in XML files.
- */
- public final static String TOPIC = "topic";
-
- /**
- * Obtains the topics contained in this node.
- * @return Array of ITopic
- */
- public ITopic[] getSubtopics();
-}
-
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
deleted file mode 100644
index a08091a05..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.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;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.context.*;
-import org.eclipse.help.internal.toc.*;
-import org.eclipse.help.internal.util.*;
-import org.osgi.framework.*;
-/**
- * Help System Core plug-in
- */
-public class HelpPlugin extends Plugin implements IRegistryChangeListener, BundleListener{
- public final static String PLUGIN_ID = "org.eclipse.help";
- // debug options
- public static boolean DEBUG = false;
- public static boolean DEBUG_CONTEXT = false;
- public static boolean DEBUG_PROTOCOLS = false;
- protected static HelpPlugin plugin;
- private static BundleContext bundleContext;
- private List tocsChangedListeners = new Vector();
-
- public final static String BASE_TOCS_KEY = "baseTOCS";
-
- protected TocManager tocManager;
- protected static Object tocManagerCreateLock = new Object();
- protected ContextManager contextManager;
-
- /**
- * 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)
- message = "";
- Status errorStatus =
- 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
- */
- public static synchronized void logWarning(String message) {
- if (HelpPlugin.DEBUG) {
- if (message == null)
- message = "";
- Status warningStatus =
- new Status(
- IStatus.WARNING,
- PLUGIN_ID,
- IStatus.OK,
- message,
- null);
- HelpPlugin.getDefault().getLog().log(warningStatus);
- }
- }
-
- /**
- * @return the singleton instance of the plugin
- */
- public static HelpPlugin getDefault() {
- return plugin;
- }
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- Platform.getExtensionRegistry().removeRegistryChangeListener(this);
- context.removeBundleListener(this);
- plugin = null;
- bundleContext = null;
- super.stop(context);
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- bundleContext = context;
- context.addBundleListener(this);
- Platform.getExtensionRegistry().addRegistryChangeListener(this,
- HelpPlugin.PLUGIN_ID);
- // Setup debugging options
- DEBUG = isDebugging();
- if (DEBUG) {
- 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$
- }
- }
- /**
- * 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;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(
- HelpPlugin.PLUGIN_ID, TocManager.TOC_XP_NAME);
- if (deltas.length > 0) {
- tocManager = null;
- }
- // notifiy listeners
- if (deltas.length > 0) {
- for (Iterator it = tocsChangedListeners.iterator(); it.hasNext();) {
- ((ITocsChangedListener) it.next()).tocsChanged();
- }
- }
- }
- public void addTocsChangedListener(ITocsChangedListener listener) {
- if (!tocsChangedListeners.contains(listener)){
- tocsChangedListeners.add(listener);
- }
- }
- public void removeTocsChangedListener(ITocsChangedListener listener) {
- tocsChangedListeners.remove(listener);
- }
-
- public void bundleChanged(BundleEvent event) {
- int type = event.getType();
- if (type == BundleEvent.RESOLVED || type == BundleEvent.UNRESOLVED) {
- ResourceLocator.clearZipCache();
- }
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java
deleted file mode 100644
index e2932ff95..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.java
+++ /dev/null
@@ -1,96 +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.text.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-
-/**
- * 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;
- }
- }
-
- /**
- * 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;
- }
- }
-
- private static Locale getDefaultLocale() {
- String nl = Platform.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
deleted file mode 100644
index 7e8a26c77..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpResources.properties
+++ /dev/null
@@ -1,36 +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 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}.
-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.
-ContextManager.FileAttribute = "context" element in extension of {0}, contributed in plug-in {1}, is missing required "file" attribute.
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/ITocsChangedListener.java b/org.eclipse.help/src/org/eclipse/help/internal/ITocsChangedListener.java
deleted file mode 100644
index ff34cad3a..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/ITocsChangedListener.java
+++ /dev/null
@@ -1,15 +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;
-
-public interface ITocsChangedListener {
- public void tocsChanged();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java b/org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java
deleted file mode 100644
index 12bbac1d2..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/RuntimeHelpStatus.java
+++ /dev/null
@@ -1,131 +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.runtime.*;
-import org.xml.sax.*;
-
-/**
- * This class is intended to capture all runtime exception happening during
- * the execution of the Help System.
- */
-
-public class RuntimeHelpStatus {
- private static RuntimeHelpStatus inst = null;
-
- // contains Status objects of errors occurred
- private ArrayList errorList = new ArrayList();
-
- // contains File names (Strings) of invalid contribution files.
- private ArrayList badFilesList = new ArrayList();
-
- // contains the error messages (Strings) from the parser
- private ArrayList parserErrorMessagesList = new ArrayList();
-
- /**
- * RuntimeHelpStatus constructor comment.
- */
- public RuntimeHelpStatus() {
- super();
- }
- public synchronized void addError(Status status) {
- errorList.add(status);
-
- }
- public synchronized void addParseError(
- String message,
- String invalidFileName) {
- // add the Exception to the files list only once. These exceptions will be used to
- // produce the list of files with errors.
- if (!badFilesList.contains(invalidFileName))
- badFilesList.add(invalidFileName);
-
- // now add the message. All parser messages are added
- parserErrorMessagesList.add(message);
-
- }
- public synchronized void addParseError(
- String message,
- SAXParseException parseException) {
- // add the Exception to the files list only once. These exceptions will be used to
- // produce the list of files with errors.
- if (!badFilesList.contains(parseException))
- badFilesList.add(parseException);
-
- // now add the message. All parser messages are added
- parserErrorMessagesList.add(message);
-
- }
- public boolean errorsExist() {
- if (errorList.isEmpty()
- && parserErrorMessagesList.isEmpty()
- && badFilesList.isEmpty())
- return false;
- else
- return true;
- }
- public static synchronized RuntimeHelpStatus getInstance() {
- if (inst == null) // create instance
- inst = new RuntimeHelpStatus();
- return inst;
- }
- /**
- * clears RuntimeHelpStatus object.
- */
- public void reset() {
- errorList.clear();
- badFilesList.clear();
- parserErrorMessagesList.clear();
- }
- public synchronized String toString() {
- StringBuffer fullText = new StringBuffer();
- if (!errorList.isEmpty()) {
- fullText.append(HelpResources.getString("E006"));
- fullText.append("******************** \n");
- for (int i = 0; i < errorList.size(); i++) {
- fullText.append(((Status) (errorList.get(i))).getMessage());
- fullText.append("\n");
- }
- }
-
- if (fullText.length() > 0)
- fullText.append("\n");
-
- if (!parserErrorMessagesList.isEmpty()) {
- // display the files that failed to parse
- fullText.append(HelpResources.getString("E007"));
- fullText.append("******************** \n");
- for (int i = 0; i < badFilesList.size(); i++) {
- fullText.append(((String) (badFilesList.get(i))));
- fullText.append("\n");
- }
-
- fullText.append("\n");
-
- // and the parse error message
- fullText.append(HelpResources.getString("E008"));
- fullText.append("******************** \n");
- for (int i = 0; i < parserErrorMessagesList.size(); i++) {
- fullText.append(((String) (parserErrorMessagesList.get(i))));
- fullText.append("\n");
- }
- }
-
- if (fullText.length() > 0)
- return fullText.toString();
- else
- return "null status object";
-
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java b/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java
deleted file mode 100644
index 3893d3a56..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.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.internal.context;
-import java.util.List;
-
-import org.eclipse.help.*;
-import org.xml.sax.Attributes;
-/**
- * Context object, as defined in the map.xml
- */
-public class Context extends ContextsNode implements IStyledContext {
- private String text;
- protected String pluginID;
- protected String shortID;
- /**
- * Context constructor.
- */
- public Context(Attributes attrs) {
- super(attrs);
- if (attrs == null)
- return;
- shortID = attrs.getValue("id");
- }
- /**
- * @return plain text (without <@#$b>or </@#$b> bug 59541)
- */
- public String getText() {
- return text
- // if there are spaces on any or both side of bold they need to be
- // collapsed to one
- .replaceAll("(\\s+</?@#\\$b>\\s*)|(\\s*</?@#\\$b>\\s+)", " ")
- .replaceAll("</?@#\\$b>", "");
- }
- /**
- * @return styled text with <@#$b> and </@#$b> to mark bold range
- */
- public String getStyledText() {
- return text;
- }
- public IHelpResource[] getRelatedTopics() {
- if (children.size() > 0) {
- IHelpResource[] related = new IHelpResource[children.size()];
- children.toArray(related);
- return related;
- } else {
- // signal empty toc. handled by calling class.
- return null;
- }
- }
- public void setStyledText(String s) {
- text = s;
- }
- /**
- * Obtains short id (without plugin)
- */
- public String getShortId() {
- return shortID;
- }
- public String getID() {
- return pluginID + "." + shortID;
- }
- /**
- * Sets the pluginID.
- * @param pluginID The pluginID to set
- */
- public void setPluginID(String pluginID) {
- this.pluginID = pluginID;
- }
- /**
- * @see ContextsNode#build(ContextsBuilder)
- */
- public void build(ContextsBuilder builder) {
- builder.build(this);
- }
- /**
- * Replaces children list
- */
- public void setChildren(List children) {
- this.children = children;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java
deleted file mode 100644
index 197116a46..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java
+++ /dev/null
@@ -1,183 +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 java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-/**
- * Maintains the list of contexts and performs look-ups.
- */
-public class ContextManager implements IRegistryChangeListener {
- public static final String CONTEXTS_XP_NAME = "contexts";
- public static final String CONTEXTS_XP_FULLNAME = HelpPlugin.PLUGIN_ID
- + "." + CONTEXTS_XP_NAME;
- PluginsContexts pluginsContexts = new PluginsContexts();
- /**
- * Context contributions
- */
- Map contextsFiles = new HashMap(/*
- * of List ContextsFile indexed by plugin ID
- * the context apply to
- */
- );
- // Dynamic context IDs (generated by help)
- // indexed by dynamic context objects (not read from files)
- Map dynamicContextIDs = new HashMap();
- private int idCounter = 0;
- /**
- * HelpContextManager constructor.
- */
- public ContextManager() {
- super();
- createContextsFiles();
- Platform.getExtensionRegistry().addRegistryChangeListener(this,
- HelpPlugin.PLUGIN_ID);
- }
- /**
- * Finds the context, given context ID.
- */
- public IContext getContext(String contextId) {
- if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("ContextManager.getContext(" + contextId + ")");
- }
- if (contextId == null)
- return null;
- String plugin = contextId;
- String id = contextId;
- int dot = contextId.lastIndexOf('.');
- if (dot <= 0 || dot >= contextId.length() - 1) {
- // no dot in the middle of context ID
- return null;
- }
- plugin = contextId.substring(0, dot);
- id = contextId.substring(dot + 1);
- PluginContexts contexts = pluginsContexts.get(plugin);
- if (contexts == null) {
- contexts = loadPluginContexts(plugin);
- }
- return contexts.get(id);
- }
- /**
- * Loads context.xml with context for a specified plugin, creates context
- * nodes and adds to pluginContext map.
- */
- private synchronized PluginContexts loadPluginContexts(String plugin) {
- PluginContexts contexts = (PluginContexts) pluginsContexts.get(plugin);
- if (contexts == null) {
- contexts = new PluginContexts();
- // read the context info from the XML contributions
- List pluginContextsFiles = (List) contextsFiles.get(plugin);
- if (pluginContextsFiles == null) {
- pluginContextsFiles = new ArrayList();
- }
- ContextsBuilder builder = new ContextsBuilder(contexts);
- builder.build(pluginContextsFiles);
- pluginsContexts.put(plugin, contexts);
- }
- return contexts;
- }
- /**
- * Creates a list of context files.
- */
- private void createContextsFiles() {
- // read extension point and retrieve all context contributions
- IExtensionPoint xpt = Platform.getExtensionRegistry()
- .getExtensionPoint(CONTEXTS_XP_FULLNAME);
- if (xpt == null)
- return; // no contributions...
- IExtension[] extensions = xpt.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- createContextFile(extensions[i]);
- }
- }
- /**
- * @param extension
- * @return Collection of String (plugin IDs that have new contexts
- * contributed)
- */
- private Collection createContextFile(IExtension extension) {
- Collection plugins = new HashSet();
- String definingPlugin = extension.getNamespace();
- IConfigurationElement[] contextContributions = extension
- .getConfigurationElements();
- for (int j = 0; j < contextContributions.length; j++) {
- if ("contexts".equals(contextContributions[j].getName())) {
- String plugin = contextContributions[j].getAttribute("plugin");
- if (plugin == null || "".equals(plugin))
- plugin = definingPlugin;
- String fileName = contextContributions[j].getAttribute("file");
- // in v1 file attribute was called name
- if (fileName == null)
- fileName = contextContributions[j].getAttribute("name");
- if (fileName == null) {
- String msg = HelpResources.getString(
- "ContextManager.FileAttribute",
- CONTEXTS_XP_FULLNAME, definingPlugin);
- HelpPlugin.logError(msg, null);
- continue;
- }
- List pluginContextsFiles = (List) contextsFiles.get(plugin);
- if (pluginContextsFiles == null) {
- pluginContextsFiles = new ArrayList();
- contextsFiles.put(plugin, pluginContextsFiles);
- }
- pluginContextsFiles.add(new ContextsFile(definingPlugin,
- fileName, plugin));
- plugins.add(plugin);
- }
- }
- return plugins;
- }
- /**
- * Registers context in the manager.
- *
- * @return context ID assigned to the context
- */
- public String addContext(IContext context) {
- String plugin = HelpPlugin.PLUGIN_ID;
- String id = (String) dynamicContextIDs.get(context);
- if (id != null) {
- // context already registered
- } else {
- // generate ID and register the context
- id = "ID" + idCounter++;
- dynamicContextIDs.put(context, id);
- PluginContexts contexts = pluginsContexts.get(plugin);
- if (contexts == null) {
- contexts = loadPluginContexts(plugin);
- }
- contexts.put(id, context);
- }
- return plugin + "." + id;
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- public synchronized void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(
- HelpPlugin.PLUGIN_ID, CONTEXTS_XP_NAME);
- for (int i = 0; i < deltas.length; i++) {
- if (deltas[i].getKind() == IExtensionDelta.ADDED) {
- IExtension extension = deltas[i].getExtension();
- Collection affectedPlugins = createContextFile(extension);
- // reset contexts for affected plugins,
- // they will be recreated on demand
- for (Iterator it = affectedPlugins.iterator(); it.hasNext();) {
- String pluginId = (String) it.next();
- pluginsContexts.remove(pluginId);
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/Contexts.java b/org.eclipse.help/src/org/eclipse/help/internal/context/Contexts.java
deleted file mode 100644
index 566cecda2..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/Contexts.java
+++ /dev/null
@@ -1,25 +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.xml.sax.Attributes;
-/**
- * Context
- */
-public class Contexts extends ContextsNode {
- /**
- * Contexts constructor.
- */
- public Contexts(Attributes attrs) {
- super(attrs);
- }
- public void build(ContextsBuilder builder) {
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsBuilder.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsBuilder.java
deleted file mode 100644
index 9315d8fa1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsBuilder.java
+++ /dev/null
@@ -1,121 +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 java.util.*;
-import org.eclipse.help.*;
-public class ContextsBuilder {
- protected PluginContexts contexts;
- private String definingPluginID;
- private String pluginID;
- /**
- * Contexts Builder Constructor.
- */
- public ContextsBuilder(PluginContexts pluginContexts) {
- this.contexts = pluginContexts;
- }
- public void build(RelatedTopic relatedTopic) {
- // set the href on the related topic
- String href = relatedTopic.getHref();
- if (href == null)
- relatedTopic.setHref("");
- else {
- if (!href.equals("") // no empty link
- && !href.startsWith("/") // no help url
- && href.indexOf(':') == -1) // no other protocols
- {
- relatedTopic.setHref("/" + definingPluginID + "/" + href);
- }
- }
- }
- public void build(Context context) {
- context.setPluginID(pluginID);
- // if context with same Id exists, merge them
- Context existingContext = (Context) contexts.get(context.getShortId());
- if (existingContext != null) {
- mergeContexts(existingContext, context);
- } else {
- contexts.put(context.getShortId(), context);
- }
- }
- public void build(ContextsFile contextsFile) {
- this.pluginID = contextsFile.getPluginID();
- this.definingPluginID = contextsFile.getDefiningPluginID();
- ContextsFileParser parser = new ContextsFileParser(this);
- parser.parse(contextsFile);
- }
- public void build(List pluginContextsFiles) {
- for (Iterator contextFilesIt = pluginContextsFiles.iterator(); contextFilesIt
- .hasNext();) {
- ContextsFile contextsFile = (ContextsFile) contextFilesIt.next();
- contextsFile.build(this);
- }
- }
- /**
- * Merges Text and Links from new Context into an existing Context
- */
- private void mergeContexts(Context existingContext, Context newContext) {
- // Merge Text
- if (newContext.getStyledText() != null) {
- if (existingContext.getStyledText() != null) {
- existingContext.setStyledText(existingContext.getStyledText() + "\n"
- + newContext.getStyledText());
- } else {
- existingContext.setStyledText(newContext.getStyledText());
- }
- }
- // Merge Related Links
- existingContext.getChildren().addAll(newContext.getChildren());
- removeDuplicateLinks(existingContext);
- }
- /**
- * Filters out the duplicate related topics in a Context
- */
- private void removeDuplicateLinks(Context context) {
- List links = context.getChildren();
- if (links == null || links.size() <= 0)
- return;
- List filtered = new ArrayList();
- for (Iterator it = links.iterator(); it.hasNext();) {
- IHelpResource topic1 = (IHelpResource) it.next();
- if (!isValidTopic(topic1))
- continue;
- boolean dup = false;
- for (int j = 0; j < filtered.size(); j++) {
- IHelpResource topic2 = (IHelpResource) filtered.get(j);
- if (!isValidTopic(topic2))
- continue;
- if (equalTopics(topic1, topic2)) {
- dup = true;
- break;
- }
- }
- if (!dup)
- filtered.add(topic1);
- }
- context.setChildren(filtered);
- }
- /**
- * Checks if topic labels and href are not null and not empty strings
- */
- private boolean isValidTopic(IHelpResource topic) {
- return topic != null && topic.getHref() != null
- && !"".equals(topic.getHref()) && topic.getLabel() != null
- && !"".equals(topic.getLabel());
- }
- /**
- * Check if two context topic are the same. They are considered the same if
- * both labels and href are equal
- */
- private boolean equalTopics(IHelpResource topic1, IHelpResource topic2) {
- return topic1.getHref().equals(topic2.getHref())
- && topic1.getLabel().equals(topic2.getLabel());
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java
deleted file mode 100644
index 839184ca1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java
+++ /dev/null
@@ -1,64 +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 java.io.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.util.ResourceLocator;
-
-public class ContextsFile {
- protected String href;
- protected String definingPluginID;
- protected String pluginID;
- /**
- * Contexts File Constructor
- */
- protected ContextsFile(String definingPlugin, String href, String plugin) {
- this.href = href;
- this.definingPluginID = definingPlugin;
- this.pluginID = plugin;
- }
- /**
- * Gets the href
- * @return Returns a String
- */
- protected String getHref() {
- return href;
- }
- protected InputStream getInputStream() {
- InputStream stream = null;
- try {
- if (definingPluginID != null)
- stream = ResourceLocator.openFromPlugin(definingPluginID, href, Platform.getNL());
- else
- stream = new FileInputStream(href);
- } catch (IOException e) {
- }
- return stream;
- }
- /**
- * Gets the definingPluginID.
- * @return Returns a String
- */
- public String getDefiningPluginID() {
- return definingPluginID;
- }
- /**
- * Gets the plugin ID.
- * @return Returns a String
- */
- public String getPluginID() {
- return pluginID;
- }
- public void build(ContextsBuilder builder) {
- builder.build(this);
- }
-}
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
deleted file mode 100644
index df0ca1641..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
+++ /dev/null
@@ -1,179 +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 java.io.*;
-import java.text.*;
-import javax.xml.parsers.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.util.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-/**
- * Parser for xml file
- */
-public class ContextsFileParser extends DefaultHandler {
- protected FastStack stack = new FastStack();
- StringBuffer buffer = new StringBuffer();
- boolean seenDescription = false;
- ContextsFile contextsFile;
- private ContextsBuilder builder;
- private final static SAXParserFactory factory = SAXParserFactory
- .newInstance();
- public ContextsFileParser(ContextsBuilder builder) {
- super();
- this.builder = builder;
- }
- /**
- * Receive notification of character data.
- */
- public void characters(char ch[], int start, int length)
- throws SAXException {
- if (seenDescription)
- buffer.append(ch, start, length);
- if (HelpPlugin.DEBUG_CONTEXT) {
- System.out
- .println("ContextsFileParser.characters(): got char from parser= "
- + new StringBuffer().append(ch, start, length)
- .toString());
- }
- }
- /**
- * 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.
- if (qName.equals(ContextsNode.DESC_ELEM)) {
- seenDescription = false;
- ((Context) stack.peek()).setStyledText(buffer.toString());
- buffer.setLength(0);
- } else if (qName.equals(ContextsNode.DESC_TXT_BOLD)) {
- // pop the starting bold tag
- stack.pop();
- if (!(stack.peek()).equals(ContextsNode.BOLD_TAG))
- buffer.append(ContextsNode.BOLD_CLOSE_TAG);
- } else {
- ContextsNode node = (ContextsNode) stack.pop();
- node.build(builder);
- }
- }
- /**
- * @see ErrorHandler#error(SAXParseException)
- */
- public void error(SAXParseException ex) {
- String message = getMessage("E001", ex);
- HelpPlugin.logError(message, null);
- RuntimeHelpStatus.getInstance()
- .addParseError(message, ex.getSystemId());
- }
- /**
- * @see ErrorHandler#fatalError(SAXParseException)
- */
- public void fatalError(SAXParseException ex) throws SAXException {
- String message = getMessage("E002", ex);
- HelpPlugin.logError(message, ex);
- RuntimeHelpStatus.getInstance()
- .addParseError(message, ex.getSystemId());
- }
- public String getMessage(String messageID, SAXParseException ex) {
- String param0 = ex.getSystemId();
- Integer param1 = new Integer(ex.getLineNumber());
- Integer param2 = new Integer(ex.getColumnNumber());
- String param3 = ex.getMessage();
- String message = MessageFormat.format(HelpResources
- .getString(messageID), new Object[]{param0, param1, param2,
- param3});
- return message;
- }
- /**
- * Receive notification of the beginning of an element.
- */
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts) throws SAXException {
- // We don't create a description element
- if (qName.equals(ContextsNode.DESC_ELEM))
- seenDescription = true;
- else if (qName.equals(ContextsNode.DESC_TXT_BOLD)) {
- // peek into stack to findout if a bold tag element already
- // exists. If we find one, then we do not add the bold tag to
- // 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
- // in all of the sentence being bold.
- if (!(stack.peek()).equals(ContextsNode.BOLD_TAG))
- buffer.append(ContextsNode.BOLD_TAG);
- stack.push(ContextsNode.BOLD_TAG);
- } else {
- ContextsNode e = null;
- // NOTE: we don't create an element for the description
- if (qName.equals(ContextsNode.CONTEXTS_ELEM)) {
- e = new Contexts(atts);
- } else if (qName.equals(ContextsNode.CONTEXT_ELEM)) {
- e = new Context(atts);
- } else if (qName.equals(ContextsNode.RELATED_ELEM)) {
- e = new RelatedTopic(atts);
- } else
- return;
- if (!stack.empty())
- ((ContextsNode) stack.peek()).addChild(e);
- stack.push(e);
- }
- }
- public void warning(SAXParseException ex) {
- String message = getMessage("E003", ex);
- HelpPlugin.logWarning(message);
- }
- public void parse(ContextsFile contextsFile) {
- this.contextsFile = contextsFile;
- InputStream is = contextsFile.getInputStream();
- if (is == null)
- return;
- InputSource inputSource = new InputSource(is);
- String file = "/" + contextsFile.getDefiningPluginID() + "/"
- + contextsFile.getHref();
- inputSource.setSystemId(file);
- try {
- SAXParser parser = factory.newSAXParser();
- parser.parse(inputSource, this);
- } catch (ParserConfigurationException pce) {
- HelpPlugin.logError(HelpResources
- .getString("ContextsFileParser.PCE"), pce);
- } catch (SAXException se) {
- HelpPlugin.logError("", se);
- } catch (IOException ioe) {
- String msg = HelpResources.getString("E009", file);
- HelpPlugin.logError(msg, ioe);
- // 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);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- }
- }
- /**
- * @see EntityResolver This method implementation prevents loading external
- * entities instead of calling
- * org.apache.xerces.parsers.SaxParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
- */
- public InputSource resolveEntity(String publicId, String systemId) {
- InputSource source = new InputSource(new ByteArrayInputStream(
- new byte[0]));
- source.setPublicId(publicId);
- source.setSystemId(systemId);
- return source;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java
deleted file mode 100644
index aad5ee4ef..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java
+++ /dev/null
@@ -1,59 +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 java.util.*;
-
-import org.xml.sax.*;
-/**
- * Object in hierarchy of context contributions
- */
-public abstract class ContextsNode {
- public static final String CONTEXTS_ELEM = "contexts";
- public static final String CONTEXT_ELEM = "context";
- public static final String DESC_ELEM = "description";
- public static final String RELATED_ELEM = "topic";
- public static final String RELATED_HREF = "href";
- public static final String RELATED_LABEL = "label";
- /**
- * Internal representation of &lt;b&gt; - unlikely to occur in a text
- */
- public static final String BOLD_CLOSE_TAG = "</@#$b>";
- /**
- * Internal representation of &lt;b&gt; - unlikely to occur in a text
- */
- public static final String BOLD_TAG = "<@#$b>";
- public static final String DESC_TXT_BOLD = "b";
- protected List children = new ArrayList();
- /**
- * When a builder builds the contexts, each node
- * must "accomodate" the builder by responding to the build()
- * command.
- */
- public abstract void build(ContextsBuilder builder);
- /**
- * ContextsNode constructor.
- */
- public ContextsNode(Attributes attrs) {
- }
- /**
- * Adds a child
- * @param child IContextsNode
- */
- public void addChild(ContextsNode child) {
- children.add(children.size(), child);
- }
- /**
- * Obtains children
- */
- public List getChildren() {
- return children;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/IStyledContext.java b/org.eclipse.help/src/org/eclipse/help/internal/context/IStyledContext.java
deleted file mode 100644
index 9b74e7ea3..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/IStyledContext.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.internal.context;
-import org.eclipse.help.*;
-/**
- * <p>
- * An enhanced version of <code>org.eclipse.help.IContext</code> interface
- * allowing obtaining a styled text. Used by Intro plug-ing and
- * org.eclipse.help.ui.internal.ContextHelpDialog TODO Create interface that
- * will return description as XML and make it public
- * </p>
- *
- * @since 3.0
- */
-public interface IStyledContext extends IContext {
- /**
- * Returns the text description for this context with bold markers
- *
- * @return String with <@#$b>and </@#$b> to mark bold range (as
- * IContext.getText() used to in 2.x)
- */
- public String getStyledText();
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java b/org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java
deleted file mode 100644
index 73dcf097d..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java
+++ /dev/null
@@ -1,25 +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 java.util.*;
-import org.eclipse.help.*;
-/**
- * Holds mapping of short contextId to IContext
- */
-class PluginContexts {
- private Map map = new HashMap();
- public void put(String shortId, IContext context) {
- map.put(shortId, context);
- }
- public IContext get(String shortId) {
- return (IContext) map.get(shortId);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/PluginsContexts.java b/org.eclipse.help/src/org/eclipse/help/internal/context/PluginsContexts.java
deleted file mode 100644
index f8e842bee..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/PluginsContexts.java
+++ /dev/null
@@ -1,27 +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 java.util.*;
-/**
- * Holds mapping of short plugin Id to PluginContext
- */
-class PluginsContexts {
- private Map map = new HashMap();
- public void put(String pluginId, PluginContexts contexts) {
- map.put(pluginId, contexts);
- }
- public PluginContexts get(String pluginId) {
- return (PluginContexts) map.get(pluginId);
- }
- public void remove(String pluginId) {
- map.remove(pluginId);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/RelatedTopic.java b/org.eclipse.help/src/org/eclipse/help/internal/context/RelatedTopic.java
deleted file mode 100644
index a2ddce416..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/RelatedTopic.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.context;
-import org.eclipse.help.IHelpResource;
-import org.xml.sax.Attributes;
-/**
- * Default implementation for a topic contribution
- */
-public class RelatedTopic extends ContextsNode implements IHelpResource {
- protected String href;
- protected String label;
- public RelatedTopic(Attributes attrs) {
- super(attrs);
- if (attrs == null)
- return;
- href = attrs.getValue(ContextsNode.RELATED_HREF);
- this.label = attrs.getValue(ContextsNode.RELATED_LABEL);
- if (this.label == null)
- this.label = "undefined";
- }
- public String getHref() {
- return href;
- }
- public void setHref(String href) {
- this.href = href;
- }
- /**
- * Returns the label
- */
- public String getLabel() {
- return label;
- }
- /**
- * @see ContextsNode#build(ContextsBuilder)
- */
- public void build(ContextsBuilder builder) {
- builder.build(this);
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/model/IAnchorElement.java b/org.eclipse.help/src/org/eclipse/help/internal/model/IAnchorElement.java
deleted file mode 100644
index 098ff9626..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/model/IAnchorElement.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.internal.model;
-
-/**
- * Part of help navigation model corresponding to ANCHOR element.
- * It may contain TOC elements.
- * @since 3.0
- */
-public interface IAnchorElement extends INavigationElement{
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/model/ILinkElement.java b/org.eclipse.help/src/org/eclipse/help/internal/model/ILinkElement.java
deleted file mode 100644
index c36fab937..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/model/ILinkElement.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.internal.model;
-
-/**
- * Part of help navigation model corresponding to LINK element.
- * It may contain TOC elements.
- * @since 3.0
- */
-public interface ILinkElement extends INavigationElement{
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/model/INavigationElement.java b/org.eclipse.help/src/org/eclipse/help/internal/model/INavigationElement.java
deleted file mode 100644
index ed26cfec0..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/model/INavigationElement.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.internal.model;
-
-import java.util.*;
-
-/**
- * Part of help navigation model corresponding to any of: TOC, TOPIC, ANCHOR, or LINK element.
- * After navigation is built, this may contain TOC, TOPIC, LINK, or ANCHOR elements.
- * @since 3.0
- */
-public interface INavigationElement {
- /**
- * Returns child elements
- * @return List of INavigationElement
- */
- List getChildren();
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/model/ITocElement.java b/org.eclipse.help/src/org/eclipse/help/internal/model/ITocElement.java
deleted file mode 100644
index daf4996e4..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/model/ITocElement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.internal.model;
-
-import java.util.*;
-
-import org.eclipse.help.*;
-
-/**
- * Part of help navigation model corresponding to TOC element.
- * It may contain TOPIC, LINK, or ANCHOR elements.
- * @since 3.0
- */
-public interface ITocElement extends IToc, INavigationElement{
- /**
- * @return the URL (as a string) of description topic.
- */
- public String getTocTopicHref();
- /**
- * Returns a topic with the specified href defined by this TOC,
- * without looking in children TOCs
- * <br> If the TOC contains multiple
- * topics with the same href only of them (arbitrarily chosen) will
- * be returned. TOC Descritpion topic is ignored.
- * @param href the topic's URL.
- * @return ITopic or null
- */
- public ITopic getOwnedTopic(String href);
- /**
- * Returns a topic with the specified href found in extra dir defined by this TOC,
- * without looking in children TOCs
- * @param href the topic's URL.
- * @return ITopic or null
- */
- public ITopic getOwnedExtraTopic(String href);
- /**
- * Gets the childrenTocs.
- * @return Returns a List of ITocElement
- */
- public List getChildrenTocs();
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/model/ITopicElement.java b/org.eclipse.help/src/org/eclipse/help/internal/model/ITopicElement.java
deleted file mode 100644
index 3f5ca229f..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/model/ITopicElement.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.internal.model;
-
-import org.eclipse.help.*;
-
-/**
- * Part of help navigation model corresponding to TOPIC element.
- * It may contain TOPIC, LINK, or ANCHOR elements.
- * @since 3.0
- */
-public interface ITopicElement extends ITopic, INavigationElement{
-
-}
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
deleted file mode 100644
index 992849f87..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
+++ /dev/null
@@ -1,311 +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.protocols;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.*;
-//import org.eclipse.help.internal.appserver.*;
-import org.eclipse.help.internal.util.*;
-import org.osgi.framework.Bundle;
-/**
- * URLConnection to help documents in plug-ins
- */
-public class HelpURLConnection extends URLConnection {
- private final static String LANG = "lang";
- // document caching - disabled if running in dev mode
- protected static boolean cachingEnabled = true;
- static {
- String[] args = Platform.getCommandLineArgs();
- for (int i = 0; i < args.length; i++) {
- if ("-dev".equals(args[i])) {
- cachingEnabled = false;
- break;
- }
- }
- }
-
- protected String pluginAndFile; // plugin/file
- protected String query; // after ?
- protected HashMap arguments;
- protected Bundle plugin;
- // file in a plug-in
- protected String file;
- protected String locale;
- private static String appserverImplPluginId;
- /**
- * Constructor for HelpURLConnection
- */
- public HelpURLConnection(URL url) {
- super(url);
-
- String urlFile = url.getFile();
-
- // Strip off the leading "/" and the query
- if (urlFile.startsWith("/"))
- urlFile = urlFile.substring(1);
-
- int indx = urlFile.indexOf("?");
- if (indx != -1) {
- query = urlFile.substring(indx + 1);
- urlFile = urlFile.substring(0, indx);
- }
- this.pluginAndFile = urlFile;
- parseQuery();
-
- setDefaultUseCaches(isCacheable());
- if (HelpPlugin.DEBUG_PROTOCOLS) {
- System.out.println("HelpURLConnection: url=" + url);
- }
- }
-
- /**
- * @see URLConnection#connect()
- */
- public void connect() throws IOException {
- }
- /**
- * see URLConnection#getInputStream();
- *Note: this method can throw IOException, but should never return null
- */
- public InputStream getInputStream() throws IOException {
- // must override parent implementation, since it does nothing.
- Bundle plugin = getPlugin();
- if (plugin == null) {
- throw new IOException("Resource not found.");
- }
-
- if (plugin.getSymbolicName().equals(getAppserverImplPluginId())) {
- // 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.");
- }
-
- // first try using content provider
- // then find the file inside nl tree in doc.zip,
- // and then, in the file system
- InputStream inputStream=ResourceLocator.openFromProducer(
- plugin,
- query == null ? getFile() : getFile() + "?" + query,
- getLocale());
-
- if (inputStream == null) {
- inputStream =
- ResourceLocator.openFromZip(
- plugin,
- "doc.zip",
- getFile(),
- getLocale());
- }
- if (inputStream == null) {
- inputStream =
- ResourceLocator.openFromPlugin(plugin, getFile(), getLocale());
- }
- if (inputStream == null) {
- throw new IOException("Resource not found.");
- }
- return inputStream;
- }
-
- public long getExpiration() {
- return isCacheable() ? new Date().getTime() + 10000 : 0;
- }
- /**
- * NOTE: need to add support for multi-valued parameters (like filtering)
- * Multiple values are added as vectors
- */
- protected void parseQuery() {
- if (query != null && !"".equals(query)) {
- if (arguments == null) {
- arguments = new HashMap(5);
- }
-
- StringTokenizer stok = new StringTokenizer(query, "&");
- while (stok.hasMoreTokens()) {
- String aQuery = stok.nextToken();
- int equalsPosition = aQuery.indexOf("=");
- if (equalsPosition > -1) { // well formed name/value pair
- String arg = aQuery.substring(0, equalsPosition);
- String val = aQuery.substring(equalsPosition + 1);
- Object existing = arguments.get(arg);
- if (existing == null)
- arguments.put(arg, val);
- else if (existing instanceof Vector) {
- ((Vector) existing).add(val);
- arguments.put(arg, existing);
- } else {
- Vector v = new Vector(2);
- v.add(existing);
- v.add(val);
- arguments.put(arg, v);
- }
- }
- }
- }
- }
-
- public String getContentType() {
- // Check if the file is hypertext or plain text
- String file = pluginAndFile.toLowerCase(Locale.US);
- if (file.endsWith(".html") || file.endsWith(".htm"))
- return "text/html";
- else if (file.endsWith(".css"))
- return "text/css";
- else if (file.endsWith(".gif"))
- return "image/gif";
- else if (file.endsWith(".jpg"))
- return "image/jpeg";
- else if (file.endsWith(".pdf"))
- return "application/pdf";
- else if (file.endsWith(".xml"))
- return "application/xml";
- else if (file.endsWith(".xsl"))
- return "application/xsl";
- return "text/plain";
- }
- /**
- *
- */
- public Vector getMultiValue(String name) {
- if (arguments != null) {
- Object value = arguments.get(name);
- if (value instanceof Vector)
- return (Vector) value;
- else
- return null;
- }
- return null;
- }
- /**
- *
- */
- public String getValue(String name) {
- if (arguments == null)
- return null;
- Object value = arguments.get(name);
- String stringValue = null;
- if (value instanceof String)
- stringValue = (String) value;
- else if (value instanceof Vector)
- stringValue = (String) ((Vector) value).firstElement();
- else
- return null;
- try {
- return URLCoder.decode(stringValue);
- } catch (Exception e) {
- return null;
- }
-
- }
-
- /**
- * Returns the locale specified by client.
- */
- protected String getLocale() {
- if (locale == null) {
- locale = getValue(LANG);
- if (locale == null) {
- locale = Platform.getNL();
- }
- }
- return locale;
- }
-
- protected String getFile() {
- if (file == null) {
- // Strip the plugin id
- int start = pluginAndFile.indexOf("/") + 1;
- // Strip query string or anchor bookmark
- int end = pluginAndFile.indexOf("?");
- if (end == -1)
- end = pluginAndFile.indexOf("#");
- if (end == -1)
- end = pluginAndFile.length();
- file = pluginAndFile.substring(start, end);
- file = URLCoder.decode(file);
- }
- return file;
- }
- protected Bundle getPlugin() {
- if (plugin == null) {
- // Assume the url is pluginID/path_to_topic.html
- int i = pluginAndFile.indexOf('/');
- String pluginId = i == -1 ? "" : pluginAndFile.substring(0, i);
- pluginId = URLCoder.decode(pluginId);
- plugin = Platform.getBundle(pluginId);
- }
- return plugin;
- }
- public boolean isCacheable() {
- if (getValue("resultof") != null)
- return false;
- else
- return cachingEnabled;
- }
- public String toString() {
- return pluginAndFile;
- }
-
- /**
- * Obtains ID of plugin that contributes appserver implementation. *
- * @return plug-in ID or null
- */
- private static String getAppserverImplPluginId() {
- if (appserverImplPluginId == null) {
-
- // This part mimics AppserverPlugin.createWebappServer()
-
- // get the app server extension from the system plugin registry
- IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
- IExtensionPoint point =
- pluginRegistry.getExtensionPoint(
- "org.eclipse.help.appserver.server");
- 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();
- if (elements.length == 0)
- return null;
- IConfigurationElement serverElement = null;
- for (int i = 0; i < elements.length; i++) {
- String defaultValue =
- elements[i].getAttribute("default");
- if (defaultValue == null
- || defaultValue.equals("false")) {
- serverElement = elements[i];
- break;
- }
- }
- // if all the servers are default, then pick the first one
- if (serverElement == null) {
- serverElement = elements[0];
- }
- //
-
- appserverImplPluginId =
- serverElement
- .getDeclaringExtension()
- .getNamespace();
-
- }
- }
- }
- return appserverImplPluginId;
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLStreamHandler.java b/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLStreamHandler.java
deleted file mode 100644
index 8969f39a6..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/protocols/HelpURLStreamHandler.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.protocols;
-import java.io.*;
-import java.net.*;
-public class HelpURLStreamHandler extends URLStreamHandler {
- private static HelpURLStreamHandler instance;
- /**
- * Constructor for URLHandler
- */
- public HelpURLStreamHandler() {
- super();
- }
- /**
- * @see java.net.URLStreamHandler#openConnection(java.net.URL)
- */
- protected URLConnection openConnection(URL url) throws IOException {
- String protocol = url.getProtocol();
- if (protocol.equals("help")) {
- return new HelpURLConnection(url);
- } else {
- return null;
- }
- }
- public static URLStreamHandler getDefault() {
- if (instance == null) {
- instance = new HelpURLStreamHandler();
- }
- return instance;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/Anchor.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/Anchor.java
deleted file mode 100644
index 2280749fe..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Anchor.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.toc;
-import java.util.*;
-
-import org.eclipse.help.internal.model.*;
-import org.xml.sax.*;
-/**
- * Anchor. Place holder that Toc objects can atatch to.
- */
-class Anchor extends TocNode implements IAnchorElement{
- protected Toc parentToc;
- protected String id;
- protected TocFile tocFile;
- /**
- * Constructor.
- */
- protected Anchor(TocFile tocFile, Attributes attrs) {
- this.tocFile = tocFile;
- if (attrs == null)
- return;
- id = attrs.getValue("id");
- id =
- HrefUtil.normalizeHref(tocFile.getPluginID(), tocFile.getHref() + "#" + id);
- parentToc = tocFile.getToc();
- }
- /**
- * Implements abstract method.
- */
- public void build(TocBuilder builder) {
- builder.buildAnchor(this);
- }
- /**
- * Obtains the ID
- */
- protected String getID() {
- return id;
- }
- /**
- * Returns the toc file
- */
- public TocFile getTocFile() {
- return tocFile;
- }
- /**
- * Adds another element as child of this element
- * Modifies parents of a child as well
- */
- public void addChild(ITocNode child) {
- super.addChild(child);
- if (child instanceof Toc && parentToc != null) {
- parentToc.getChildrenTocs().add(child);
- }
- }
-
- /**
- * @return ITopic list
- */
- public List getChildTopics() {
- // after build, release TocFile
- tocFile=null;
- return super.getChildTopics();
- }
-
-}
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
deleted file mode 100644
index 14a4b6860..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java
+++ /dev/null
@@ -1,241 +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.toc;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.zip.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.osgi.framework.Bundle;
-/**
- * Toc created from files in a extra directory in a plugin.
- */
-public class DirectoryToc {
- private String dir;
- /**
- * Map of ITopic by href String;
- */
- private Map extraTopics;
- private String locale;
- /**
- * Constructor.
- */
- protected DirectoryToc(TocFile tocFile) {
- this(tocFile.getPluginID(), tocFile.getLocale(), tocFile.getExtraDir());
- }
- private DirectoryToc(String pluginID, String locale, String directory) {
- this.locale = locale;
- // Obtain extra search directory if provided
- this.dir = HrefUtil.normalizeDirectoryHref(pluginID, directory);
-
- }
- /**
- * This public method is to be used after the build of TOCs
- * is finished.
- * With assumption that TOC model is not modifiable
- * after the build, this method caches topics in an array
- * and releases objects used only during build.
- * @return Map of ITopic
- */
- public Map getExtraTopics() {
- if (extraTopics == null) {
- extraTopics = createExtraTopics();
- // for memory foot print, release TocFile and dir
- dir = null;
- }
-
- return extraTopics;
- }
- /**
- * Obtains URLs of all documents inside given directory.
- * @param extraDir directory for the topics in the form
- * <em>/pluginID/directory/containing/docs<em>
- * or
- * <em>/pluginID<em> for all documents in a given plugin
- * @return Map of ITopic by href
- */
- private Map createExtraTopics() {
- Map ret = new HashMap();
- String pluginID = HrefUtil.getPluginIDFromHref(dir);
- if (pluginID == null) {
- return ret;
- }
- Bundle pluginDesc = Platform.getBundle(pluginID);
- if (pluginDesc == null || pluginDesc.getState() == Bundle.INSTALLED || pluginDesc.getState() == Bundle.UNINSTALLED)
- return ret;
- String directory = HrefUtil.getResourcePathFromHref(dir);
- if (directory == null) {
- // the root - all files in a zip should be indexed
- directory = "";
- }
- // Find doc.zip file
- IPath iPath = new Path("$nl$/doc.zip");
- Map override = new HashMap(1);
- override.put("$nl$", locale);
- URL url = Platform.find(pluginDesc, iPath, override);
- if (url == null) {
- url = Platform.find(pluginDesc, new Path("doc.zip"));
- }
- if (url != null) {
- // collect topics from doc.zip file
- ret.putAll(createExtraTopicsFromZip(pluginID, directory, url));
- }
- // Find directory on the filesystem
- iPath = new Path("$nl$/" + directory);
- url = null;
- url = Platform.find(pluginDesc, iPath, override);
- if (url == null) {
- url = Platform.find(pluginDesc, new Path(directory));
- }
- if (url != null) {
- // collect topics from directory
- ret.putAll(
- createExtraTopicsFromDirectory(pluginID, directory, url));
- }
- return ret;
-
- }
- /**
- * @param directory path in the form "segment1/segment2...",
- * "" will return names of all files in a zip
- * @return Map of ITopic by href String
- */
- private Map createExtraTopicsFromZip(
- String pluginID,
- String directory,
- URL url) {
- Map ret = new HashMap(0);
- URL realZipURL;
- try {
- realZipURL = Platform.asLocalURL(Platform.resolve(url));
- } catch (IOException ioe) {
- HelpPlugin.logError(
- HelpResources.getString("E036", url.toString()),
- ioe);
- return new HashMap(0);
- }
- ZipFile zipFile;
- try {
- zipFile = new ZipFile(realZipURL.getFile());
- ret = createExtraTopicsFromZipFile(pluginID, zipFile, directory);
- zipFile.close();
- } catch (IOException ioe) {
- HelpPlugin.logError(
- HelpResources.getString("E037", realZipURL.getFile()),
- ioe);
- return new HashMap(0);
- }
-
- return ret;
-
- }
-
- /**
- * Obtains names of files in a zip file that given directory in their path.
- * Files in subdirectories are included as well.
- * @param directory path in the form "segment1/segment2...",
- * "" will return names of all files in a zip
- * @return Map of ITopic by href String
- */
- private Map createExtraTopicsFromZipFile(
- String pluginID,
- ZipFile zipFile,
- String directory) {
- String constantHrefSegment = "/" + pluginID + "/";
- Map ret = new HashMap();
- for (Enumeration enum = zipFile.entries(); enum.hasMoreElements();) {
- ZipEntry zEntry = (ZipEntry) enum.nextElement();
- if (zEntry.isDirectory()) {
- continue;
- }
- String docName = zEntry.getName();
- int l = directory.length();
- if (l == 0
- || docName.length() > l
- && docName.charAt(l) == '/'
- && directory.equals(docName.substring(0, l))) {
- String href=constantHrefSegment + docName;
- ret.put(href, new ExtraTopic(href));
- }
- }
- return ret;
- }
- /**
- * @param directory path in the form "segment1/segment2...",
- * "" will return names of all files in a directory
- * @return Map of ITopic by href String
- */
- private Map createExtraTopicsFromDirectory(
- String pluginID,
- String directory,
- URL url) {
- Map m = new HashMap();
- URL realURL;
- try {
- realURL = Platform.asLocalURL(Platform.resolve(url));
- } catch (IOException ioe) {
- HelpPlugin.logError(
- HelpResources.getString("E038", url.toString()),
- ioe);
- return m;
- }
- File dirFile = new File(realURL.getFile());
- if (dirFile.exists() && dirFile.isDirectory()) {
- String prefix;
- if (directory.length() > 0) {
- prefix = "/" + pluginID + "/" + directory;
- } else {
- prefix = "/" + pluginID;
- }
- createExtraTopicsFromDirectoryFile(prefix, dirFile, m);
- }
- return m;
-
- }
- /**
- * @prefix /pluginID/segment1/segment2
- * @return Map of ITopic by href String
- */
- private Map createExtraTopicsFromDirectoryFile(
- String prefix,
- File dir,
- Map m) {
- File[] files = dir.listFiles();
- for (int i = 0; i < files.length; i++) {
- String href = prefix + "/" + files[i].getName();
- if (files[i].isDirectory()) {
- createExtraTopicsFromDirectoryFile(href, files[i], m);
- } else {
- m.put(href, new ExtraTopic(href));
- }
- }
- return m;
- }
- class ExtraTopic implements ITopic {
- private String topicHref;
- public ExtraTopic(String href) {
- this.topicHref = href;
- }
-
- public String getHref() {
- return topicHref;
- }
- public String getLabel() {
- return topicHref;
- }
- public ITopic[] getSubtopics() {
- return new ITopic[0];
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/HrefUtil.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/HrefUtil.java
deleted file mode 100644
index ba7be64eb..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/HrefUtil.java
+++ /dev/null
@@ -1,99 +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.toc;
-
-public class HrefUtil {
- /**
- * Creates /pluginid/directory from directory name
- */
- public static String normalizeDirectoryHref(String pluginID, String dir) {
- // "" is treated as if extra directory was not provided
- if (dir == null || dir.length() <= 0)
- return null;
- // "." means all the files in the plugin
- if (".".equals(dir))
- dir = "";
- // remove not needed trailing separator
- if (dir.length() > 0 && dir.lastIndexOf('/') == dir.length() - 1) {
- dir = dir.substring(0, dir.length() - 1);
- }
- return normalizeHref(pluginID, dir);
- }
-
- /**
- * Creates /pluginid/href from href
- * relative to the current plugin
- * @param pluginID id of a plugin to which href is relative
- * @param href relative href
- * ex: path[#anchorID]
- * ex: ../pluginID/path[#anchorID]
- * @return String representation of href,
- * formatted as /pluginID/path[#anchorID]
- */
- public final static String normalizeHref(String pluginID, String href) {
- if (href == null)
- return null;
- if (href.startsWith("/"))
- // already normalized
- return href;
- if (href.startsWith("http:")
- || href.startsWith("file:")
- || href.startsWith("jar:"))
- // external doc
- return href;
- if (href.startsWith("../")) {
- return href.substring(2);
- } else {
- if (href.length() > 0)
- return "/" + pluginID + "/" + href;
- else
- return "/" + pluginID;
- }
- }
- /**
- * Parses href and obtains plugin id
- * @param href String in format /string1[/string2]
- * @return plugin ID, or null
- */
- public static String getPluginIDFromHref(String href) {
- if (href == null || href.length() < 2 || href.charAt(0) != '/')
- return null;
- int secondSlashIx = href.indexOf("/", 1);
- if (secondSlashIx < 0) // href is /pluginID
- return href.substring(1);
- // href is /pluginID/path[#anchorID]
- return href.substring(1, secondSlashIx);
- }
-
- /**
- * Parses href and obtains resource path relative to the plugin
- * @param href String in format /string1[/[string2]][#string3]
- * @return relative resource path, or null
- */
- public static String getResourcePathFromHref(String href) {
- if (href == null)
- return null;
- // drop anchor id
- int anchorIx = href.lastIndexOf("#");
- if (anchorIx >= 0) //anchor exists, drop it
- href = href.substring(0, anchorIx);
- if (href.length() < 2 || href.charAt(0) != '/')
- return null;
- int secondSlashIx = href.indexOf("/", 1);
- if (secondSlashIx < 0) // href is /pluginID
- return null;
- if (secondSlashIx + 1 < href.length()) // href is /pluginID/path
- return href.substring(secondSlashIx + 1);
- else // href is /pluginID/
- return "";
- }
-
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/ITocNode.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/ITocNode.java
deleted file mode 100644
index dafd6eaca..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/ITocNode.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.toc;
-
-import org.eclipse.help.internal.model.*;
-/**
- * ITocNode interface.
- */
-interface ITocNode extends INavigationElement{
-
- /**
- * Adds another element as child of this element
- * Modifies parents of a child as well
- * @param child node to add as child
- */
- void addChild(ITocNode child);
-
- /**
- * When a builder builds the navigation, each node
- * must "accomodate" the builder by responding to the build()
- * command.
- */
- void build(TocBuilder builder);
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/Link.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/Link.java
deleted file mode 100644
index 68dcdee64..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Link.java
+++ /dev/null
@@ -1,52 +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.toc;
-import org.eclipse.help.internal.model.*;
-import org.xml.sax.*;
-/**
- * Include. Place holder to link to other Toc objects.
- */
-class Link extends TocNode implements ILinkElement{
- protected Toc parentToc;
- protected String toc;
- /**
- * Contstructor. Used when parsing help contributions.
- */
- protected Link(TocFile tocFile, Attributes attrs) {
- if (attrs == null)
- return;
- toc = attrs.getValue("toc");
- toc = HrefUtil.normalizeHref(tocFile.getPluginID(), toc);
- parentToc = tocFile.getToc();
- }
- /**
- * Implements abstract method.
- */
- public void build(TocBuilder builder) {
- builder.buildLink(this);
- }
- /**
- * Obtains URL of linked TOC
- */
- protected String getToc() {
- return toc;
- }
- /**
- * Adds another element as child of this element
- * Modifies parents of a child as well
- */
- public void addChild(ITocNode child) {
- super.addChild(child);
- if (child instanceof Toc && parentToc != null) {
- parentToc.getChildrenTocs().add(child);
- }
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.java
deleted file mode 100644
index f2e9eb815..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.java
+++ /dev/null
@@ -1,255 +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.toc;
-import java.util.*;
-
-import org.eclipse.help.*;
-import org.eclipse.help.internal.model.*;
-import org.xml.sax.*;
-/**
- * Root of navigation TocFile
- * Can be linked with other Toc objects.
- */
-public class Toc extends TocNode implements IToc, ITocElement{
- private static final int SIZE_UNINITIALIZED = -1;
- private String link_to;
- private String href;
- private String label;
- private TocFile tocFile;
- private ITopic[] topicArray;
- private Topic descriptionTopic;
- /**
- * Collection of Toc
- */
- private List childrenTocs;
- private DirectoryToc directoryToc;
- /** Map of all topics contained by this TOC by href.
- * Description topic is not in the map.
- */
- private Map topicMap = new HashMap();
- private int size=SIZE_UNINITIALIZED;
- /**
- * Constructor. Used when parsing help contributions.
- */
- protected Toc(TocFile tocFile, Attributes attrs) {
- if (attrs == null)
- return;
- this.tocFile = tocFile;
- this.label = attrs.getValue("label");
- if(label==null){
- throw new RuntimeException("toc label==null");
- }
- this.link_to = attrs.getValue("link_to");
- this.link_to = HrefUtil.normalizeHref(tocFile.getPluginID(), link_to);
- this.href =
- HrefUtil.normalizeHref(tocFile.getPluginID(), tocFile.getHref());
-
- try {
- // create the description topic
- this.descriptionTopic = new Topic(tocFile, null);
- this.descriptionTopic.setLabel(this.label);
- String topic = attrs.getValue("topic");
- if (topic != null && topic.trim().length() > 0)
- this.descriptionTopic.setHref(
- HrefUtil.normalizeHref(tocFile.getPluginID(), topic));
- else
- this.descriptionTopic.setHref("");
- } catch (Exception e) {
- }
-
- childrenTocs = new ArrayList();
- directoryToc = new DirectoryToc(tocFile);
- }
- /**
- * Implements abstract method.
- */
- public void build(TocBuilder builder) {
- builder.buildToc(this);
- }
- /**
- * Returns the toc file.
- * Returns null when the topic is read from a temp file.
- */
- public TocFile getTocFile() {
- return tocFile;
- }
- /**
- * Gets the link_to
- * @return Returns a String
- */
- protected String getLink_to() {
- return link_to;
- }
- /**
- * Gets the href
- * @return Returns a String
- */
- public String getHref() {
- return href;
- }
- public String getLabel() {
- return label;
- }
- /**
- * Returns a topic with the specified href defined by this TOC.
- * <br> If the TOC contains multiple
- * topics with the same href only of them (arbitrarily chosen) will
- * be returned.
- * <p> If no topic is specified, then the TOC description topic is
- * returned, or null if there is no description topic for the TOC.
- * </p>
- * @param href the topic's URL or null
- * @return ITopic or null
- */
- public ITopic getTopic(String href) {
- if (href == null || href.equals(descriptionTopic.getHref())){
- return descriptionTopic;
- }
- return getTopicNoDescr(href);
- }
- /**
- * Similar to ITopic getTopic(String) but does not match and
- * return description Topic
- * @param href the topic's URL
- * @return ITopic or null
- */
- private ITopic getTopicNoDescr(String href) {
- ITopic result=getOwnedTopic(href);
- if(result!=null){
- return result;
- }
-
- // check inside children TOCs
- for(Iterator it=getChildrenTocs().iterator(); it.hasNext();){
- Toc childToc=(Toc)it.next();
- // must not return description topic from children TOCs
- result=childToc.getTopicNoDescr(href);
- if(result!=null){
- break;
- }
- }
- return result;
- }
- /**
- * This public method is to be used after the build of TOCs
- * is finished.
- * With assumption that TOC model is not modifiable
- * after the build, this method caches subtopics in an array
- * and releases objects used only during build.
- * @return ITopic[]
- */
- public ITopic[] getTopics() {
- if (topicArray == null) {
- List topics = getChildTopics();
- // create and cache array of children (Topics only)
- topicArray = new ITopic[topics.size()];
- topics.toArray(topicArray);
- // after TOC is build, TocFile no longer needed
- tocFile = null;
- }
- return topicArray;
- }
- /**
- * @return ITopic or null;
- */
- public String getTocTopicHref(){
- if(descriptionTopic!=null){
- return descriptionTopic.getHref();
- }
- return null;
- }
- /**
- * Returns a topic with the specified href defined by this TOC,
- * without looking in children TOCs
- * <br> If the TOC contains multiple
- * topics with the same href only of them (arbitrarily chosen) will
- * be returned. TOC Descritpion topic is ignored.
- * @param href the topic's URL.
- * @return ITopic or null
- */
- public ITopic getOwnedTopic(String href) {
- return(ITopic)topicMap.get(href);
- }
- /**
- * @return ITopic[]
- */
- public ITopic[] getExtraTopics() {
- Collection dirTopicCollection = directoryToc.getExtraTopics().values();
- ITopic[] dirTopics = (ITopic[]) dirTopicCollection.toArray(new ITopic[dirTopicCollection.size()]);
-
-
- // add extra topics from children TOCs.
- for (Iterator it = childrenTocs.iterator(); it.hasNext();) {
- IToc toc = (IToc) it.next();
- if (toc instanceof Toc) {
- ITopic[] moreDirTopics = ((Toc) toc).getExtraTopics();
- if (moreDirTopics.length > 0) {
- ITopic[] newDirTopics =
- new ITopic[dirTopics.length + moreDirTopics.length];
- System.arraycopy(
- dirTopics,
- 0,
- newDirTopics,
- 0,
- dirTopics.length);
- System.arraycopy(
- moreDirTopics,
- 0,
- newDirTopics,
- dirTopics.length,
- moreDirTopics.length);
- dirTopics = newDirTopics;
- }
- }
- }
-
- return dirTopics;
- }
- /**
- * Returns a topic with the specified href found in extra dir defined by this TOC,
- * without looking in children TOCs
- * @param href the topic's URL.
- * @return ITopic or null
- */
- public ITopic getOwnedExtraTopic(String href) {
- return(ITopic)directoryToc.getExtraTopics().get(href);
-
- }
- /**
- * Used by debugger
- */
- public String toString() {
- return href != null ? href : super.toString();
- }
-
- /**
- * Gets the childrenTocs.
- * @return Returns a Collection of Toc
- */
- public List getChildrenTocs() {
- return childrenTocs;
- }
- public int size(){
- if(size==SIZE_UNINITIALIZED){
- size=topicMap.size();
- for(Iterator it=childrenTocs.iterator(); it.hasNext();){
- size+=((Toc)it.next()).size();
- }
- }
- return size;
- }
- void registerTopic(ITopic topic){
- String topicHref = topic.getHref();
- if (topicHref != null) {
- topicMap.put(topicHref, topic);
- }
- }
-}
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
deleted file mode 100644
index c698a65e1..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocBuilder.java
+++ /dev/null
@@ -1,151 +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.toc;
-
-import java.util.*;
-
-import org.eclipse.help.internal.*;
-
-public class TocBuilder {
- // list of all toc files
- protected Collection contributedTocFiles;
- // list of unprocessed toc files
- protected Collection unprocessedTocFiles;
- // list of unprocessed toc (the target of attach_to was not available at the time)
- protected List unprocessedTocs;
- /**
- * Constructor.
- */
- public TocBuilder() {
- unprocessedTocFiles = new ArrayList();
- unprocessedTocs = new ArrayList();
- }
- public Collection getBuiltTocs() {
- // returns the list of root Toc trees
- Collection tocCol = new ArrayList(contributedTocFiles.size());
- for (Iterator it = contributedTocFiles.iterator(); it.hasNext();) {
- TocFile tocFile = (TocFile) it.next();
- Toc toc = tocFile.getToc();
- if (toc != null
- && toc.getTocFile().isPrimary()
- && !isIntegrated(toc))
- tocCol.add((toc));
- }
- return tocCol;
- }
- /**
- */
- public void build(Collection contributedTocFiles) {
- this.contributedTocFiles = contributedTocFiles;
- unprocessedTocFiles.addAll(contributedTocFiles);
- // process all the toc files.
- // A side-effect is that linked files are also processed
- while (!unprocessedTocFiles.isEmpty()) {
- TocFile tocFile = (TocFile) unprocessedTocFiles.iterator().next();
- tocFile.build(this);
- }
- // At the end, unprocessedTocs may contain TOCs that need be build.
- // All these toc could not be attached because the
- // target node was not parsed at that time
-
- // try processing as many toc (link_to) as possible now
- int remaining = unprocessedTocs.size();
- for (int i = 0; i < remaining; i++) {
- Toc toc = (Toc) unprocessedTocs.get(i);
- buildToc(toc);
- }
- }
- public void buildTocFile(TocFile tocFile) {
- try {
- unprocessedTocFiles.remove(tocFile);
- TocFileParser parser = new TocFileParser(this);
- parser.parse(tocFile);
- } catch (Exception e) {
- String msg = HelpResources.getString("E033", tocFile.getHref());
- HelpPlugin.logError(msg, e);
- }
- }
- public void buildAnchor(Anchor anchor) {
- // cache the anchor in the toc file
- anchor.getTocFile().addAnchor(anchor);
- }
- public void buildLink(Link link) {
- // parse the linked file
- String linkedToc = link.getToc();
- TocFile includedTocFile = getTocFile(linkedToc);
- if (includedTocFile == null)
- return;
- Toc toc = includedTocFile.getToc();
- if (toc == null)
- return;
- // link the two Toc objects
- link.addChild(toc);
- }
- public void buildTopic(Topic topic) {
- // nothing to do
- }
- public void buildToc(Toc toc) {
- // link toc if so specified
- String href = toc.getLink_to();
- if (href == null || href.equals(""))
- return;
- TocFile targetTocFile = getTocFile(href);
- if (targetTocFile == null)
- return;
- Anchor anchor = targetTocFile.getAnchor(href);
- if (anchor == null) {
- unprocessedTocs.add(toc);
- return;
- }
- // link the two toc objects
- anchor.addChild(toc);
- }
- private TocFile getTocFile(String href) {
- String plugin = HrefUtil.getPluginIDFromHref(href);
- if (plugin == null)
- return null;
- String path = HrefUtil.getResourcePathFromHref(href);
- if (path == null)
- return null;
- TocFile tocFile = null;
- for (Iterator it = contributedTocFiles.iterator(); it.hasNext();) {
- tocFile = (TocFile) it.next();
- if (tocFile.getPluginID().equals(plugin)
- && tocFile.getHref().equals(path))
- break;
- else
- tocFile = null;
- }
- if (tocFile == null)
- return null;
- if (unprocessedTocFiles.contains(tocFile))
- buildTocFile(tocFile);
- return tocFile;
- }
- /**
- * Checks if navigation element has been integrated
- * into another TOC.
- */
- private boolean isIntegrated(TocNode element) {
- // check if there if there is TOC in ancestor hierarchy (depth first)
- for (Iterator it = element.getParents().iterator(); it.hasNext();) {
- TocNode parent = (TocNode) it.next();
- if (parent instanceof Toc
- && ((Toc) parent).getTocFile().isPrimary()) {
- return true;
- } else if (isIntegrated(parent)) {
- return true;
- }
- }
- // no ancestor is a TOC
- return false;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.java
deleted file mode 100644
index 98806092a..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.java
+++ /dev/null
@@ -1,144 +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.toc;
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.help.internal.util.ResourceLocator;
-
-public class TocFile {
-
- protected Toc toc;
-
- protected String plugin;
- protected String href;
- protected boolean primary;
- protected String locale;
- protected String extraDir;
-
- // used for fast access to anchors
- protected Map anchors;
-
- /**
- * Toc File Constructor
- */
- protected TocFile(
- String plugin,
- String href,
- boolean primary,
- String locale,
- String extraDir) {
- this.plugin = plugin;
- this.href = href;
- this.primary = primary;
- this.locale = locale;
- this.extraDir = extraDir;
- }
-
- /**
- * Gets the href
- * @return Returns a String
- */
- protected String getHref() {
- return href;
- }
-
- /**
- * Gets the pluginID
- * @return Returns a String
- */
- public final String getPluginID() {
- return plugin;
- }
-
- protected InputStream getInputStream() {
- InputStream stream = null;
- try {
- if (plugin != null)
- stream = ResourceLocator.openFromPlugin(plugin, href, locale);
- else
- stream = new FileInputStream(href);
- } catch (IOException e) {
- }
- return stream;
- }
-
- /**
- * Parses file and gets the toc
- * @return Returns a Toc
- */
- public Toc getToc() {
- return toc;
- }
-
- /**
- * Sets the toc on this file. It should happen during parsing
- */
- public void setToc(Toc toc) {
- this.toc = toc;
- }
-
- /**
- * Registers a new anchor.
- */
- public void addAnchor(Anchor a) {
- if (anchors == null)
- anchors = new HashMap();
-
- anchors.put(a.getID(), a);
- }
-
- /**
- * Returns anchor by id
- */
- public Anchor getAnchor(String id) {
- if (anchors == null || anchors.get(id) == null)
- return null;
- else
- return (Anchor) anchors.get(id);
- }
-
- /**
- * Builds the toc file if needed
- */
- public void build(TocBuilder builder) {
- builder.buildTocFile(this);
- }
-
- /**
- * Used by debugger
- */
- public String toString() {
- return plugin + "/" + href;
- }
- /**
- * Checks if this file specifies a TOC.
- * @return Returns a boolean
- */
- public boolean isPrimary() {
- return primary;
- }
-
- /**
- * Gets the extraDir.
- * @return Returns a String
- */
- public String getExtraDir() {
- return extraDir;
- }
- /**
- * Gets the locale.
- * @return Returns a String
- */
- public String getLocale() {
- return locale;
- }
-}
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
deleted file mode 100644
index 8183e9b71..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
+++ /dev/null
@@ -1,182 +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.toc;
-import java.io.*;
-import java.text.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.eclipse.help.internal.*;
-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.
- */
-class TocFileParser extends DefaultHandler {
- protected TocBuilder builder;
- protected FastStack elementStack;
- protected TocFile tocFile;
- static SAXParserFactory factory = SAXParserFactory.newInstance();
- private static XMLParserPool parserPool = new XMLParserPool();
- /**
- * Constructor
- */
- public TocFileParser(TocBuilder builder) {
- super();
- this.builder = builder;
- }
- /**
- * @see ErrorHandler#error(SAXParseException)
- */
- 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
- HelpPlugin.logError(message, null);
- RuntimeHelpStatus.getInstance().addParseError(
- message,
- ex.getSystemId());
- }
- /**
- * @see ErrorHandler#fatalError(SAXParseException)
- */
- 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
- HelpPlugin.logError(message, ex);
- RuntimeHelpStatus.getInstance().addParseError(
- message,
- ex.getSystemId());
- }
- protected String getMessage(String messageID, SAXParseException ex) {
- String param0 = ex.getSystemId();
- Integer param1 = new Integer(ex.getLineNumber());
- Integer param2 = new Integer(ex.getColumnNumber());
- String param3 = ex.getMessage();
- String message =
- MessageFormat.format(
- HelpResources.getString(messageID),
- new Object[] { param0, param1, param2, param3 });
- return message;
- }
- /**
- * Gets the toc
- */
- public void parse(TocFile tocFile) {
- this.tocFile = tocFile;
- elementStack = new FastStack();
- InputStream is = tocFile.getInputStream();
- if (is == null)
- return;
- InputSource inputSource = new InputSource(is);
- String file = "/" + tocFile.getPluginID() + "/" + tocFile.getHref();
- inputSource.setSystemId(file);
- try {
- SAXParser parser = parserPool.obtainParser();
- try {
- parser.parse(inputSource, this);
- is.close();
- } finally {
- parserPool.releaseParser(parser);
- }
- } catch (ParserConfigurationException pce) {
- String msg = HelpResources.getString("TocFileParser.PCE");
- //SAXParser implementation could not be loaded.
- HelpPlugin.logError(msg, pce);
- } catch (SAXException se) {
- String msg = HelpResources.getString("E026", file);
- //Error loading Table of Contents file %1.
- HelpPlugin.logError(msg, se);
- } catch (IOException ioe) {
- 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
- // still need to display errors even if Logging is turned off.
- RuntimeHelpStatus.getInstance().addParseError(msg, file);
- }
- }
- /**
- * @see ContentHandler#startElement(String, String, String, Attributes)
- */
- public final void startElement(
- String namespaceURI,
- String localName,
- String qName,
- Attributes atts)
- throws SAXException {
- TocNode node = null;
- if (qName.equals("toc")) {
- node = new Toc(tocFile, atts);
- tocFile.setToc((Toc) node);
- } else if (qName.equals("topic")) {
- node = new Topic(tocFile, atts);
- } else if (qName.equals("link")) {
- node = new Link(tocFile, atts);
- } else if (qName.equals("anchor")) {
- node = new Anchor(tocFile, atts);
- } else
- return; // perhaps throw some exception
- if (!elementStack.empty())
- ((TocNode) elementStack.peek()).addChild(node);
- elementStack.push(node);
- // do any builder specific actions in the node
- node.build(builder);
- }
- /**
- * @see ContentHandler#endElement(String, String, String)
- */
- public final void endElement(
- String namespaceURI,
- String localName,
- String qName)
- throws SAXException {
- elementStack.pop();
- }
-
- /**
- * @see EntityResolver This method implementation prevents loading external
- * entities instead of calling
- * org.apache.xerces.parsers.SaxParser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
- */
- public InputSource resolveEntity(String publicId, String systemId) {
- InputSource source =
- new InputSource(new ByteArrayInputStream(new byte[0]));
- source.setPublicId(publicId);
- source.setSystemId(systemId);
- return source;
- }
-
- /**
- * This class maintain pool of parsers that can be used for parsing TOC
- * files. The parsers should be returned to the pool for reuse.
- */
- static class XMLParserPool {
- private ArrayList pool = new ArrayList();
- SAXParser obtainParser()
- throws ParserConfigurationException, SAXException {
- SAXParser p;
- int free = pool.size();
- if (free > 0) {
- p = (SAXParser) pool.remove(free - 1);
- } else {
- p = factory.newSAXParser();
- }
- return p;
- }
- void releaseParser(SAXParser parser) {
- pool.add(parser);
- }
- }
-}
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
deleted file mode 100644
index e07d01cbc..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
+++ /dev/null
@@ -1,225 +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.toc;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.eclipse.help.internal.model.*;
-
-/**
- * Manages the navigation model. It keeps track of all the tables of contents.
- */
-public class TocManager {
- public static final String TOC_XP_NAME = "toc";
-
- /**
- * Map of ITocNavNode[] by String
- */
- private Map tocsByLang;
- private Collection contributingPlugins;
-
- /**
- * HelpNavigationManager constructor.
- */
- public TocManager() {
- super();
- try {
- tocsByLang = new HashMap();
- // build TOCs for machine locale at startup
- // Note: this can be removed, and build on first invocation...
- build(Platform.getNL());
- } catch (Exception e) {
- HelpPlugin.logError("", e);
- }
- }
-
- /**
- * Returns the list of TOC's available in the help system
- */
- public ITocElement[] getTocs(String locale) {
-
- if (locale == null)
- return new ITocElement[0];
-
- ITocElement[] tocs = (ITocElement[]) tocsByLang.get(locale);
- if (tocs == null) {
- synchronized (this) {
- if (tocs == null) {
- build(locale);
- }
- }
- tocs = (ITocElement[]) tocsByLang.get(locale);
- // one more sanity test...
- if (tocs == null)
- tocs = new ITocElement[0];
- }
- return tocs;
- }
-
- /**
- * Returns the navigation model for specified toc
- */
- public ITocElement getToc(String href, String locale) {
- if (href == null || href.equals(""))
- return null;
- ITocElement[] tocs = getTocs(locale);
-
- for (int i = 0; i < tocs.length; i++) {
- if (tocs[i].getHref().equals(href))
- return tocs[i];
- }
- return null;
- }
-
- /**
- * Returns the list of contributing Bundle IDs
- */
- public Collection getContributingPlugins() {
- if(contributingPlugins == null){
- getContributedTocFiles(Locale.getDefault().toString());
- }
- return contributingPlugins;
- }
-
- /**
- * Builds the toc from the contribution files
- */
- private void build(String locale) {
- IToc[] tocs;
- try {
- Collection contributedTocFiles = getContributedTocFiles(locale);
- TocBuilder builder = new TocBuilder();
- builder.build(contributedTocFiles);
- Collection builtTocs = builder.getBuiltTocs();
- tocs = new ITocElement[builtTocs.size()];
- int i = 0;
- for (Iterator it = builtTocs.iterator(); it.hasNext();) {
- tocs[i++] = (ITocElement) it.next();
- }
- Collection orderedTocs = orderTocs(builtTocs);
- tocs = new ITocElement[orderedTocs.size()];
- orderedTocs.toArray(tocs);
- } catch (Exception e) {
- tocs = new IToc[0];
- HelpPlugin.logError("", e);
- }
- tocsByLang.put(locale, tocs);
- }
-
- /**
- * Orders the TOCs according to a product wide preference.
- */
- private Collection orderTocs(Collection unorderedTocs) {
- ArrayList orderedHrefs = getPreferredTocOrder();
- ArrayList orderedTocs = new ArrayList(unorderedTocs.size());
-
- // add the tocs from the preferred order...
- for (Iterator it = orderedHrefs.iterator(); it.hasNext();) {
- String href = (String) it.next();
- ITocElement toc = getToc(unorderedTocs, href);
- if (toc != null)
- orderedTocs.add(toc);
- }
- // add the remaining tocs
- for (Iterator it = unorderedTocs.iterator(); it.hasNext();) {
- ITocElement toc = (ITocElement) it.next();
- if (!orderedTocs.contains(toc))
- orderedTocs.add(toc);
- }
- return orderedTocs;
- }
-
- /**
- * Reads product.ini to determine toc ordering. It works in current
- * drivers, but will not if location/name of product.ini change. Return the
- * list of href's.
- */
- private ArrayList getPreferredTocOrder() {
- ArrayList orderedTocs = new ArrayList();
- try {
- Preferences pref = HelpPlugin.getDefault().getPluginPreferences();
- String preferredTocs = pref.getString(HelpPlugin.BASE_TOCS_KEY);
- if (preferredTocs != null) {
- StringTokenizer suggestdOrderedInfosets =
- new StringTokenizer(preferredTocs, " ;,");
-
- while (suggestdOrderedInfosets.hasMoreElements()) {
- orderedTocs.add(suggestdOrderedInfosets.nextElement());
- }
- }
- } catch (Exception e) {
- HelpPlugin.logError(HelpResources.getString("E039"), e);
- }
- return orderedTocs;
- }
-
- /**
- * Returns the toc from a list of IToc by identifying it with its (unique)
- * href.
- */
- private ITocElement getToc(Collection list, String href) {
- for (Iterator it = list.iterator(); it.hasNext();) {
- ITocElement toc = (ITocElement) it.next();
- if (toc.getHref().equals(href))
- return toc;
- }
- return null;
- }
-
- /**
- * Returns a collection of TocFile that were not processed.
- */
- protected Collection getContributedTocFiles(String locale) {
- contributingPlugins = new HashSet();
- Collection contributedTocFiles = new ArrayList();
- // find extension point
- IExtensionPoint xpt =
- Platform.getExtensionRegistry().getExtensionPoint(
- HelpPlugin.PLUGIN_ID,
- TOC_XP_NAME);
- if (xpt == null)
- return contributedTocFiles;
- // get all extensions
- IExtension[] extensions = xpt.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- contributingPlugins.add(
- extensions[i].getNamespace());
- // add to TopicFiles declared in this extension
- IConfigurationElement[] configElements =
- extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++)
- if (configElements[j].getName().equals(TOC_XP_NAME)) {
- String pluginId =
- configElements[j]
- .getDeclaringExtension()
- .getNamespace();
- String href = configElements[j].getAttribute("file");
- boolean isPrimary =
- "true".equals(
- configElements[j].getAttribute("primary"));
- String extraDir =
- configElements[j].getAttribute("extradir");
- if (href != null) {
- contributedTocFiles.add(
- new TocFile(
- pluginId,
- href,
- isPrimary,
- locale,
- extraDir));
- }
- }
- }
- return contributedTocFiles;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.java
deleted file mode 100644
index c596ec5ea..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.java
+++ /dev/null
@@ -1,83 +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.toc;
-
-import java.util.*;
-
-/**
- * Navigation Element.
- * Common for all objects definable in toc.xml
- */
-abstract class TocNode implements ITocNode {
- protected List children;
- protected List parents;
-
-
- /**
- * Adds another element as child of this element
- * Modifies parents of a child as well
- */
- public void addChild(ITocNode child) {
- if (children == null)
- children = new ArrayList();
- children.add(child);
- if (child instanceof TocNode)
- ((TocNode)child).addParent(this);
- }
- /**
- * Adds parent parents of this element
- * called by addChild method
- */
- protected void addParent(ITocNode parent) {
- if (parents == null)
- parents = new ArrayList();
- parents.add(parent);
- }
-
- /**
- * Obtains children
- * @return ITocNode List
- */
- public List getChildren() {
- if (children == null)
- return Collections.EMPTY_LIST;
- return children;
- }
- /**
- * Obtains parents
- * @return ITocNode List
- */
- protected List getParents() {
- if (parents == null)
- return Collections.EMPTY_LIST;
- return parents;
- }
-
- /**
- * @return ITopic list
- */
- public List getChildTopics() {
- if (children == null)
- return Collections.EMPTY_LIST;
- List childTopics = new ArrayList(children.size());
- for (Iterator childrenIt = children.iterator(); childrenIt.hasNext();) {
- TocNode c = (TocNode) childrenIt.next();
- if ((c instanceof Topic)) {
- childTopics.add(c);
- } else {
- // it is a Toc, Anchor or Link,
- // which may have children attached to it.
- childTopics.addAll(c.getChildTopics());
- }
- }
- return childTopics;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.java
deleted file mode 100644
index 2ca6d3782..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.java
+++ /dev/null
@@ -1,133 +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.toc;
-import java.util.*;
-
-import org.eclipse.help.*;
-import org.eclipse.help.internal.model.*;
-import org.xml.sax.*;
-/**
- * Topic. Visible navigation element.
- * Labeled, contains linik to a document.
- * Can also act as a container for other documents.
- */
-public class Topic extends TocNode implements ITopic, ITopicElement{
- private String href;
- private String label;
- private ITopic[] topicArray;
- /**
- * Constructor.
- */
- protected Topic(TocFile tocFile, Attributes attrs) throws SAXException {
- if (attrs == null)
- return;
- href = attrs.getValue("href");
- if (href != null && href.length() > 0)
- href = HrefUtil.normalizeHref(tocFile.getPluginID(), href);
- label = attrs.getValue("label");
- if(label==null){
- throw new RuntimeException("topic label==null");
- }
- tocFile.getToc().registerTopic(this);
- }
- /**
- * Implements abstract method.
- */
- public final void build(TocBuilder builder) {
- builder.buildTopic(this);
- }
- public String getHref() {
- return href;
- }
- public String getLabel() {
- return label;
- }
- /**
- * This public method is to be used after the build of TOCs
- * is finished.
- * With assumption that TOC model is not modifiable
- * after the build, this method caches subtopics in an array
- * and releases objects used only during build.
- * @return ITopic list
- */
- public ITopic[] getSubtopics() {
- if (topicArray == null) {
- List topics = getChildTopics();
- // create and cache array of children (Topics only)
- topicArray = new ITopic[topics.size()];
- topics.toArray(topicArray);
- }
- return topicArray;
- }
-
- void setLabel(String label) {
- this.label = label;
- }
-
- void setHref(String href) {
- this.href = href;
- }
- /**
- * Obtains shortest path leading to this topic in a given TOC
- * @param toc
- * @return ITopic[] or null, path excludes TOC and includes this topic
- */
- public ITopic[] getPathInToc(IToc toc){
- List /* of TocNode */ ancestors=getTopicPathInToc(toc, this);
- if(ancestors==null){
- return null;
- }
- return (ITopic[]) ancestors.toArray(new ITopic[ancestors.size()]);
- }
-
- /**
- * Obtains List of ancestors (TocNodes) leading to specific topic or null
- * @param toc
- * @param topic
- * @return List with TocElements: topic1, topic2, topic
- */
- static List getTopicPathInToc(IToc toc, Topic topic){
- List topicParents=new ArrayList(topic.getParents());
- for(ListIterator it=topicParents.listIterator(); it.hasNext(); ){
- TocNode tocNode=(TocNode)it.next();
- if(!(tocNode instanceof Topic)){
- // Check if any parent is the needed TOC
- if(tocNode==toc){
- // success, found the correct TOC
- List ancestors=new ArrayList();
- ancestors.add(topic);
- return ancestors;
- }else{
- // substitute real topics for toc, link, and anchor parent nodes, because we are looking for the shortest path
- List grandParents=tocNode.getParents();
- it.remove();
- for(Iterator it2=grandParents.iterator(); it2.hasNext();){
- it.add(it2.next());
- it.previous();
- }
- }
-
- }
- }
-
- for(Iterator it=topicParents.iterator(); it.hasNext();){
- // delegate to ancestors first
- List a =getTopicPathInToc(toc, (Topic)it.next());
- if(a!=null){
- // then add this topic to the path
- a.add(topic);
- return a;
- }
- }
-
- return null;
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/FastStack.java b/org.eclipse.help/src/org/eclipse/help/internal/util/FastStack.java
deleted file mode 100644
index 5d7e492d8..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/FastStack.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.util;
-
-import java.util.*;
-
-/**
- * Fast Stack is similar to java.uiti.Stack,
- * but simplified for speed. It uses ArrayList
- * as an underlying collection. The methods
- * in this class are not thread safe.
- */
-public class FastStack extends ArrayList {
- private int last = -1;
-
- public FastStack() {
- super();
- }
-
- public final Object push(Object item) {
- super.add(item);
- last++;
- return item;
- }
-
- public final Object pop() {
- return super.remove(last--);
- }
-
- public final Object peek() {
- return super.get(last);
- }
-
- public final boolean empty() {
- return last < 0;
- }
-}
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
deleted file mode 100644
index c07d6585c..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
+++ /dev/null
@@ -1,252 +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.net.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.help.internal.*;
-import org.osgi.framework.*;
-public class ResourceLocator {
- public static final String CONTENTPRODUCER_XP_NAME = "contentProducer";
- public static final String CONTENTPRODUCER_XP_FULLNAME = HelpPlugin.PLUGIN_ID
- + "." + CONTENTPRODUCER_XP_NAME;
- private static Hashtable zipCache = new Hashtable();
- private static final Object ZIP_NOT_FOUND = new Object();
- // Indicates there is no dynamic content provider for a particular plugin
- private static final Object STATIC_DOCS_ONLY = ZIP_NOT_FOUND;
- // Map of document content providers by plug-in ID;
- private static Map contentProducers = new HashMap(2, 0.5f);
- static {
- Platform.getExtensionRegistry().addRegistryChangeListener(
- new IRegistryChangeListener() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(
- HelpPlugin.PLUGIN_ID, CONTENTPRODUCER_XP_NAME);
- for (int i = 0; i < deltas.length; i++) {
- IExtension extension = deltas[i].getExtension();
- String affectedPlugin = extension.getNamespace();
- // reset producer for the affected plugin,
- // it will be recreated on demand
- synchronized (contentProducers) {
- contentProducers.remove(affectedPlugin);
- }
- }
- }
- });
- }
- /**
- * Obtains content proivider for a documentation plug-in, creates one if
- * necessary.
- *
- * @param pluginId
- * @return ITopicContentProvider or null
- */
- private static IHelpContentProducer getContentProducer(String pluginId) {
- synchronized (contentProducers) {
- Object producer = contentProducers.get(pluginId);
- if (producer == null) {
- // first time for the plug-in, so attempt to
- // find and instantiate provider
- producer = createContentProducer(pluginId);
- if (producer == null) {
- producer = STATIC_DOCS_ONLY;
- }
- contentProducers.put(pluginId, producer);
- }
- if (producer == STATIC_DOCS_ONLY) {
- return null;
- } else {
- return (IHelpContentProducer) producer;
- }
- }
- }
- /**
- * Creates content proivider for a documentation plug-in
- *
- * @param pluginId
- * @return ITopicContentProvider or null
- */
- private static IHelpContentProducer createContentProducer(String pluginId) {
- IExtensionPoint xp = Platform.getExtensionRegistry().getExtensionPoint(
- CONTENTPRODUCER_XP_FULLNAME);
- if (xp == null) {
- return null;
- }
- IExtension[] extensions = xp.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- if (!extensions[i].getNamespace().equals(pluginId)) {
- continue;
- }
- IConfigurationElement[] elements = extensions[i]
- .getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- if (!CONTENTPRODUCER_XP_NAME.equals(elements[j].getName())) {
- continue;
- }
- try {
- Object o = elements[j]
- .createExecutableExtension("producer");
- if (o instanceof IHelpContentProducer) {
- return (IHelpContentProducer) o;
- }
- } catch (CoreException ce) {
- HelpPlugin.logError(HelpResources.getString("E044", pluginId), ce);
- }
- }
- }
- return null;
- }
- /**
- * Opens an input stream to a file contained in a plugin. This includes NL
- * lookup.
- */
- public static InputStream openFromProducer(Bundle pluginDesc, String file,
- String locale) {
- IHelpContentProducer producer = getContentProducer(pluginDesc.getSymbolicName());
- if (producer == null) {
- return null;
- }
- if (locale == null || locale.length() <= 0) {
- locale = Platform.getNL();
- }
- Locale l;
- if (locale.length() >= 5) {
- l = new Locale(locale.substring(0, 2), locale.substring(3, 5));
- } else if (locale.length() >= 2) {
- l = new Locale(locale.substring(0, 2), "");
- } else {
- l = Locale.getDefault();
- }
- return producer.getInputStream(pluginDesc.getSymbolicName(), file, l);
- }
- /**
- * Opens an input stream to a file contained in a plugin. This includes NL
- * lookup.
- */
- public static InputStream openFromPlugin(String pluginId, String file,
- String locale) {
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle != null)
- return openFromPlugin(Platform.getBundle(pluginId), file, locale);
- else
- return null;
- }
- /**
- * Opens an input stream to a file contained in a zip in a plugin. This
- * includes NL lookup.
- */
- public static InputStream openFromZip(Bundle pluginDesc, String zip,
- String file, String locale) {
- // First try the NL lookup
- InputStream is = doOpenFromZip(pluginDesc, "$nl$/" + zip, file, locale);
- if (is == null)
- // Default location <plugin>/doc.zip
- is = doOpenFromZip(pluginDesc, zip, file, locale);
- return is;
- }
- /**
- * Opens an input stream to a file contained in a plugin. This includes NL
- * lookup.
- */
- public static InputStream openFromPlugin(Bundle pluginDesc, String file,
- String locale) {
- InputStream is = doOpenFromPlugin(pluginDesc, "$nl$/" + file, locale);
- if (is == null)
- // Default location
- is = doOpenFromPlugin(pluginDesc, file, locale);
- return is;
- }
- /**
- * Opens an input stream to a file contained in doc.zip in a plugin
- */
- private static InputStream doOpenFromZip(Bundle pluginDesc, String zip,
- String file, String locale) {
- String realZipURL = findZip(pluginDesc, zip, locale);
- if (realZipURL == null) {
- return null;
- }
- try {
- URL jurl = new URL("jar", "", realZipURL + "!/" + file);
- URLConnection jconnection = jurl.openConnection();
- jconnection.setDefaultUseCaches(false);
- jconnection.setUseCaches(false);
- return jconnection.getInputStream();
- } catch (IOException ioe) {
- return null;
- }
- }
- /**
- * Opens an input stream to a file contained in a plugin
- */
- private static InputStream doOpenFromPlugin(Bundle pluginDesc, String file,
- String locale) {
- IPath flatFilePath = new Path(file);
- Map override = new HashMap(1);
- override.put("$nl$", locale);
- URL flatFileURL = Platform.find(pluginDesc, flatFilePath, override);
- if (flatFileURL != null)
- try {
- return flatFileURL.openStream();
- } catch (IOException e) {
- return null;
- }
- return null;
- }
- /**
- * @param pluginDesc
- * @param zip
- * zip file path as required by Plugin.find()
- * @param locale
- * @return String form of resolved URL of a zip or null
- */
- private static String findZip(Bundle pluginDesc, String zip, String locale) {
- String pluginID = pluginDesc.getSymbolicName();
- // check cache
- Map cache = zipCache;
- Object cached = cache.get(pluginID + '/' + zip + '/' + locale);
- if (cached == null) {
- // not in cache find on filesystem
- IPath zipFilePath = new Path(zip);
- Map override = new HashMap(1);
- override.put("$nl$", locale);
- try {
- URL zipFileURL = Platform.find(pluginDesc, zipFilePath,
- override); //PASCAL This will not activate the plugin
- if (zipFileURL != null) {
- URL realZipURL = Platform.asLocalURL(Platform
- .resolve(zipFileURL));
- cached = realZipURL.toExternalForm();
- } else {
- cached = ZIP_NOT_FOUND;
- }
- } catch (IOException ioe) {
- cached = ZIP_NOT_FOUND;
- }
- // cache it
- cache.put(pluginID + '/' + zip + '/' + locale, cached);
- }
- if (cached == ZIP_NOT_FOUND) {
- return null;
- }
- return (String) cached;
- }
- public static void clearZipCache() {
- zipCache = new Hashtable();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java b/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java
deleted file mode 100644
index 2363a1b90..000000000
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.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.util;
-import java.io.*;
-
-public class URLCoder {
- public static String encode(String s) {
- try {
- return urlEncode(s.getBytes("UTF8"));
- } catch (UnsupportedEncodingException uee) {
- return null;
- }
- }
- public static String decode(String s) {
- try {
- return new String(urlDecode(s), "UTF8");
- } catch (UnsupportedEncodingException uee) {
- return null;
- }
- }
- private static String urlEncode(byte[] data) {
- StringBuffer buf = new StringBuffer(data.length);
- for (int i = 0; i < data.length; i++) {
- buf.append('%');
- buf.append(Character.forDigit((data[i] & 240) >>> 4, 16));
- buf.append(Character.forDigit(data[i] & 15, 16));
- }
- return buf.toString();
- }
- private static byte[] urlDecode(String encodedURL) {
- int len = encodedURL.length();
- ByteArrayOutputStream os = new ByteArrayOutputStream(len);
- for (int i = 0; i < len;) {
- switch (encodedURL.charAt(i)) {
- case '%' :
- if (len >= i + 3) {
- os.write(Integer.parseInt(encodedURL.substring(i + 1, i + 3), 16));
- }
- i += 3;
- break;
- case '+' : //exception from standard
- os.write(' ');
- i++;
- break;
- default :
- os.write(encodedURL.charAt(i++));
- break;
- }
-
- }
- return os.toByteArray();
- }
-}
diff --git a/org.eclipse.help/src/org/eclipse/help/package.html b/org.eclipse.help/src/org/eclipse/help/package.html
deleted file mode 100644
index 8ab6f51be..000000000
--- a/org.eclipse.help/src/org/eclipse/help/package.html
+++ /dev/null
@@ -1,20 +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.51 [en] (WinNT; U) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-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.
-
-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.ui.intro/empty_swt.properties b/org.eclipse.ui.intro/empty_swt.properties
index 086632523..2b9f66c33 100644
--- a/org.eclipse.ui.intro/empty_swt.properties
+++ b/org.eclipse.ui.intro/empty_swt.properties
@@ -41,34 +41,51 @@ title.image.repeat = true/false
+
+
+
+
+
+
+
+
+
! Sub Title:
! ----------
-! The style id of the direct child Text element that will be used as subtitle of any page.
-! It would be used if a specific id has not been specified at the page.
+! The style id of the child Text element that will be used as description of any page or any group.
+! It would be used if a specific id has not been specified at the page or group level.
! (Can only be a child Text element)
subtitle-style-id = <style id of child subtitle Text element>
-! The path of the child Text element that will be used as subtitle of this page.
+! The id of the child Text element that will be used as subtitle.
! (Can only be a child Text element)
<pageId>.subtitle-id = <path to subtitle child>
+! The id of the child Text element that will be used as subtitle of this page.
+! (Can only be a child Text element)
+<pageId>.subtitle-id = <id of child subtitle Text element>
+
+! The id of the child Text element that will be used as subtitle of this group.
+! (Can only be a child Text element)
+!!!<pageId>.<path_to_group>.subtitle-id = <id of child subtitle Text element>
+
! Description:
! ------------
-! The style id of the direct child Text element that will be used as description of any page or any group.
+! The style id of the child Text element that will be used as description of any page or any group.
! It would be used if a specific id has not been specified at the page or group level.
! (Can only be a child Text element)
description-style-id = <style id of child description Text element>
-! The pathof the child Text element that will be used as description of this page.
+! The id of the child Text element that will be used as description of this page.
! (Can only be a child Text element)
<pageId>.description-id = <id of child description Text element>
-! The path of the child Text element that will be used as description of this group.
+! The id of the child Text element that will be used as description of this group.
! (Can only be a child Text element)
<pageId>.<path_to_group>.description-id = <id of child description Text element>
-!
+
<pageId>.layout.link-vspacing = <integer>
! default icon used for all links in the page.

Back to the top