Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2012-06-26 17:28:20 +0000
committerJohn Arthorne2012-07-24 17:19:07 +0000
commit669fa15cc859773492bf292b70ec998e921293aa (patch)
treea62029c3141170a2271da13b620a1d413c2672be
parent6e3a775e71e0862084e1664b8fd3e4913b85f33d (diff)
downloadeclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.tar.gz
eclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.tar.xz
eclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.zip
Bug 350103 - [Help] Remove extension point luceneSearchParticipants
-rw-r--r--org.eclipse.help.base/plugin.xml1
-rw-r--r--org.eclipse.help.base/schema/luceneSearchParticipants.exsd245
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java49
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/LuceneSearchParticipantAdapter.java71
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java3
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/search/ISearchIndex.java58
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/search/LuceneSearchParticipant.java202
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/search/XMLSearchParticipant.java396
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java70
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java56
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java65
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java20
13 files changed, 10 insertions, 1229 deletions
diff --git a/org.eclipse.help.base/plugin.xml b/org.eclipse.help.base/plugin.xml
index 229fd7bec..1f508fd64 100644
--- a/org.eclipse.help.base/plugin.xml
+++ b/org.eclipse.help.base/plugin.xml
@@ -17,7 +17,6 @@
<extension-point id="luceneAnalyzer" name="%lucene_analyzer" schema="schema/luceneAnalyzer.exsd"/>
<extension-point id="browser" name="%browser_extension_point_name" schema="schema/browser.exsd"/>
<extension-point id="activitySupport" name="%activity_extension_point_name" schema="schema/activitySupport.exsd"/>
- <extension-point id="luceneSearchParticipants" name="%search_participant_extension_point_name" schema="schema/luceneSearchParticipants.exsd"/>
<extension-point id="server" name="%server_extension_point_name" schema="schema/server.exsd"/>
<extension-point id="searchParticipant" name="%help_search_participant_extension_point_name" schema="schema/searchParticipant.exsd"/>
<extension-point id="scope" name="%help_scope_extension_point_name" schema="schema/scope.exsd"/>
diff --git a/org.eclipse.help.base/schema/luceneSearchParticipants.exsd b/org.eclipse.help.base/schema/luceneSearchParticipants.exsd
deleted file mode 100644
index 1a7f56e28..000000000
--- a/org.eclipse.help.base/schema/luceneSearchParticipants.exsd
+++ /dev/null
@@ -1,245 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.help.base" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.help.base" id="luceneSearchParticipants" name="Lucene Search Participants"/>
- </appInfo>
- <documentation>
- &lt;p&gt;&lt;strong&gt;In Eclipse 3.6 the announcement was made that this API is deprecated and will be removed in a future release. Use org.eclipse.help.base.searchParticipant as a replacement.
-&lt;/strong&gt;&lt;/p&gt;
-
-This extension point should be used to add document content to the Lucene search index. There are two cases were you would want to add a search participant:
-&lt;ol&gt;
-&lt;li&gt;
-To index documents registered with the help system&apos;s TOC that are not of the HTML format (e.g. XML). In this case, the participant must declare file extensions it can handle. It will be called to index each matching document. In this case, the participant has the plug-in scope.
-&lt;/li&gt;
-&lt;li&gt;
-To index documents outside of the help system&apos;s TOC. In this case, the participant will be given a chance to index all the documents it knows about at once. In addition, the participant will be delegated the task of opening the search result because the help system will not know how to open the documents outside the TOC. In this case, the participant has global scope.
-&lt;/li&gt;
-&lt;/ol&gt;
-&lt;p&gt;
-Search participants are associated with the plug-in the extension appears in. In order to reuse the participant in other plug-ins, &lt;code&gt;binding&lt;/code&gt; should be used to reference them. This strategy prevents a plug-in from imposing its participant on the entire product for the file extensions it was registered with. By adding an explicit reference, the plug-in declares that it allows the referenced search participant to handle indexing of documents with those extensions. For documents that are not part of the TOC, there is no such danger. For this reason, they are global and &lt;code&gt;binding&lt;/code&gt; should not be used.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element deprecated="true" replacement="org.eclipse.help.base.searchParticipant" />
- </appInfo>
- <documentation>
- This extension point is deprecated because it depends on API classes which expose Lucene classes, which are not binary compatible between major release. The extension point org.eclipse.help.base.searchParticipant should be used instead.
- </documentation>
- </annotation>
- <complexType>
- <choice minOccurs="1" maxOccurs="unbounded">
- <element ref="searchParticipant"/>
- <element ref="binding"/>
- </choice>
- <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>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="searchParticipant">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="id" icon="icon"/>
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="participant" minOccurs="0" maxOccurs="1"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier of this search participant
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional translatable name that will be used to represent the participant as a category of documents that can be included in the search. The name is not required when the participant is used for documents in the TOC (i.e. when &lt;code&gt;extensions&lt;/code&gt; attribute is set).
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- an optional icon to be used to render search hits from the documents indexed by this participant. The icon will be used for the documents outside of the help&apos;s TOC to indicate that opening the search hit may result in an action different from showing the regular help document. Consequently, icon is not required when the participant is used for documents in the TOC (i.e. when &lt;code&gt;extensions&lt;/code&gt; attribute is set).
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="participant" type="string">
- <annotation>
- <documentation>
- (&lt;strong&gt;new in 3.2&lt;/strong&gt;) the implementation class for the help search participant. This class must implement the &lt;samp&gt;org.eclipse.help.search.ILuceneSearchParticipant&lt;/samp&gt; interface. This attribute may be omitted, and the nested &lt;samp&gt;participant&lt;/samp&gt; element may be provided instead.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.help.IHelpSerchParticipant"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="extensions" type="string">
- <annotation>
- <documentation>
- an optional field containing the list of file types handled by the search participant. This is a string containing comma separate file extensions (e.g. &quot;abc, xyz&quot;). This attribute should be used when files are made explicitly known to the help system in the &lt;code&gt;org.eclipse.help.toc&lt;/code&gt; extension point. The absence of this attribute is an indication that the participant will index all the documents it is responsible for by itself.
-&lt;p&gt;Note also that participants that are registered for known documents have plug-in scope. If you want a participant to apply to documents in another plug-in, you must use the &lt;code&gt;binding&lt;/code&gt; element to extend the scope. In contrast, participants that do not specify this attribute have global scope.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="headless" type="boolean" use="default" value="false">
- <annotation>
- <documentation>
- specifies whether or not this search participant should be used when running the help system outside an eclipse workbench, i.e. it is running in either standalone or information center mode. The default value is &lt;code&gt;false&lt;/code&gt;.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="participant">
- <complexType>
- <sequence>
- <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- the implementation class for the help search participant. This class must implement the &lt;samp&gt;org.eclipse.help.search.ILuceneSearchParticipant&lt;/samp&gt; interface.
- </documentation>
- </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>
-
- <element name="binding">
- <complexType>
- <attribute name="participantId" type="string">
- <annotation>
- <documentation>
- a reference to the search participant declared elsewhere using &lt;code&gt;searchParticipant&lt;/code&gt; element. Binding can be used to reuse search participants in plug-ins without violating the top-down policy. Binding is only needed for indexing documents that are part of the TOC. Otherwise, participant has global scope.
- </documentation>
- <appInfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.help.base.luceneSearchParticipants/searchParticipant/@id"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.2
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is a sample usage of the extension point:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.help.base.luceneSearchParticipant&quot;&gt;
- &lt;searchParticipant id=&quot;org.eclipse.myGlobalParticipant&quot;
- name=&quot;Global Participant&quot;
- icon=&quot;icons/mydoc.gif&quot;
- participant=&quot;org.eclipse.myPlugin.myPackage.MyGlobalParticipant&quot;
- headless=&quot;true&quot;/&gt;
- &lt;searchParticipant id=&quot;org.eclipse.myXYZParticipant&quot;
- extensions=&quot;xyz&quot;
- participant=&quot;org.eclipse.myPlugin.myPackage.MyXYZParticipant&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- The supplied search participant class must extend the &lt;samp&gt;org.eclipse.help.search.LuceneSearchParticipant&lt;/samp&gt; abstract class.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- Help system provides search participant for XHTML files (xhtml extension). Plug-ins that have dynamic XHTML documents as part of TOC must bind to this participant using &lt;code&gt;binding&lt;/code&gt; element and &lt;code&gt;org.eclipse.help.base.xhtml&lt;/code&gt; as the target participant id.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005, 2010 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
index c3b4989d2..d5578e7bb 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,7 +40,6 @@ import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.search.IndexingOperation.IndexingException;
import org.eclipse.help.internal.util.URLCoder;
-import org.eclipse.help.search.LuceneSearchParticipant;
import org.eclipse.help.search.SearchParticipant;
import org.osgi.framework.Bundle;
@@ -49,7 +48,6 @@ import org.osgi.framework.Bundle;
*/
public class LocalSearchManager {
- private static final String LUCENE_SEARCH_PARTICIPANT_XP_FULLNAME = "org.eclipse.help.base.luceneSearchParticipants"; //$NON-NLS-1$
private static final String SEARCH_PARTICIPANT_XP_FULLNAME = "org.eclipse.help.base.searchParticipant"; //$NON-NLS-1$
private static final String SEARCH_PARTICIPANT_XP_NAME = "searchParticipant"; //$NON-NLS-1$
private static final String BINDING_XP_NAME = "binding"; //$NON-NLS-1$
@@ -97,10 +95,6 @@ public class LocalSearchManager {
if (obj instanceof SearchParticipant) {
participant = (SearchParticipant)obj;
participant.init(getId());
- } else if (obj instanceof LuceneSearchParticipant) {
- LuceneSearchParticipant luceneParticipant = (LuceneSearchParticipant) obj;
- participant = new LuceneSearchParticipantAdapter(luceneParticipant);
- participant.init(getId());
}
} catch (Throwable t) {
HelpPlugin.logError("Exception occurred creating Lucene search participant.", t); //$NON-NLS-1$
@@ -318,9 +312,8 @@ public class LocalSearchManager {
*
* @param pluginId
* @param fileName
- * @return
+ * @return The matching participant, or <code>null</code>
*/
-
public SearchParticipant getParticipant(String pluginId, String fileName) {
ArrayList<ParticipantDescriptor> list = getParticipantDescriptors(pluginId);
if (list == null)
@@ -366,7 +359,6 @@ public class LocalSearchManager {
public Set<String> getPluginsWithSearchParticipants() {
HashSet<String> set = new HashSet<String>();
addSearchBindings(set);
- addLuceneSearchBindings(set);
// must ask global search participants directly
SearchParticipant[] gps = getGlobalParticipants();
for (int i = 0; i < gps.length; i++) {
@@ -394,17 +386,6 @@ public class LocalSearchManager {
}
}
- private void addLuceneSearchBindings(HashSet<String> set) {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- LUCENE_SEARCH_PARTICIPANT_XP_FULLNAME);
-
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- if (element.getName().equals("binding") || element.getName().equals("searchParticipant")) //$NON-NLS-1$//$NON-NLS-2$
- set.add(element.getContributor().getName());
- }
- }
-
/**
* Loops through all the loaded search participants and notifies them that they can drop the
* cached data to reduce runtime memory footprint.
@@ -417,13 +398,6 @@ public class LocalSearchManager {
}
}
- private ArrayList<ParticipantDescriptor> createSearchParticipants(String pluginId) {
- ArrayList<ParticipantDescriptor> list = null;
- list = getBindingsForPlugin(pluginId, list, SEARCH_PARTICIPANT_XP_FULLNAME);
- list = getBindingsForPlugin(pluginId, list, LUCENE_SEARCH_PARTICIPANT_XP_FULLNAME);
- return list;
- }
-
private ArrayList<ParticipantDescriptor> getBindingsForPlugin(String pluginId, ArrayList<ParticipantDescriptor> list, String extensionPointName) {
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
extensionPointName);
@@ -536,7 +510,6 @@ public class LocalSearchManager {
private void createGlobalSearchParticipants() {
globalSearchParticipants = new ArrayList<ParticipantDescriptor>();
addSearchParticipants();
- addLuceneSearchParticipants();
}
private void addSearchParticipants() {
@@ -555,26 +528,10 @@ public class LocalSearchManager {
}
}
- private void addLuceneSearchParticipants() {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(
- LUCENE_SEARCH_PARTICIPANT_XP_FULLNAME);
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- if (!element.getName().equals(SEARCH_PARTICIPANT_XP_NAME))
- continue;
- if (element.getAttribute("extensions") != null) //$NON-NLS-1$
- continue;
- if (!isParticipantEnabled(String.valueOf(true).equals(element.getAttribute("headless")))) //$NON-NLS-1$
- continue;
- ParticipantDescriptor desc = new ParticipantDescriptor(element);
- globalSearchParticipants.add(desc);
- }
- }
-
private ArrayList<ParticipantDescriptor> getParticipantDescriptors(String pluginId) {
ArrayList<ParticipantDescriptor> result = searchParticipantsByPlugin.get(pluginId);
if (result == null) {
- result = createSearchParticipants(pluginId);
+ result = getBindingsForPlugin(pluginId, null, SEARCH_PARTICIPANT_XP_FULLNAME);
if (result == null)
result = PARTICIPANTS_NOT_FOUND;
searchParticipantsByPlugin.put(pluginId, result);
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LuceneSearchParticipantAdapter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LuceneSearchParticipantAdapter.java
deleted file mode 100644
index 89bec5428..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LuceneSearchParticipantAdapter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.help.internal.search;
-
-/**
- * Adapts a LuceneSearchParticipant to SearchParticipant. This allows
- * the deprecated extension point org.eclipse.help.base.luceneSearchParticipants
- * to continue to function even though the rest of the help system has
- * switched to use the class SearchParticipant instead of LuceneSearchParticipant
- */
-
-import java.net.URL;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.help.search.IHelpSearchIndex;
-import org.eclipse.help.search.ISearchDocument;
-import org.eclipse.help.search.LuceneSearchParticipant;
-import org.eclipse.help.search.SearchParticipant;
-
-public class LuceneSearchParticipantAdapter extends SearchParticipant {
-
- private LuceneSearchParticipant searchParticipant;
-
- public LuceneSearchParticipantAdapter(LuceneSearchParticipant participant) {
- this.searchParticipant = participant;
- }
-
- public IStatus addDocument(IHelpSearchIndex index, String pluginId, String name, URL url, String id,
- ISearchDocument doc) {
- // In the help system the only class that implements ISearchDocument is LuceneSearchDocument
- // and the only class that implements IHelpSearchIndex is SearchIndex
- LuceneSearchDocument luceneDoc = (LuceneSearchDocument)doc;
- SearchIndex searchIndex = (SearchIndex) index;
- return searchParticipant.addDocument(searchIndex, pluginId, name, url, id, luceneDoc.getDocument());
- }
-
- public Set<String> getAllDocuments(String locale) {
- return searchParticipant.getAllDocuments(locale);
- }
-
- public void clear() {
- searchParticipant.clear();
- }
-
- public boolean equals(Object obj) {
- return searchParticipant.equals(obj);
- }
-
- public Set<String> getContributingPlugins() {
- return searchParticipant.getContributingPlugins();
- }
-
- public int hashCode() {
- return searchParticipant.hashCode();
- }
-
- public boolean open(String id) {
- return searchParticipant.open(id);
- }
-
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
index b583ba253..7514c8309 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
@@ -64,7 +64,6 @@ import org.eclipse.help.internal.toc.TocManager;
import org.eclipse.help.internal.util.ResourceLocator;
import org.eclipse.help.search.IHelpSearchIndex;
import org.eclipse.help.search.ISearchDocument;
-import org.eclipse.help.search.ISearchIndex;
import org.eclipse.help.search.SearchParticipant;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
@@ -73,7 +72,7 @@ import org.osgi.framework.Version;
/**
* Text search index. Documents added to this index can than be searched against a search query.
*/
-public class SearchIndex implements ISearchIndex, IHelpSearchIndex {
+public class SearchIndex implements IHelpSearchIndex {
private IndexReader ir;
diff --git a/org.eclipse.help.base/src/org/eclipse/help/search/ISearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/search/ISearchIndex.java
deleted file mode 100644
index c45b58a97..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/search/ISearchIndex.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.search;
-
-import java.net.URL;
-
-import org.apache.lucene.document.Document;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Represents a Lucene index for one locale. The interface is used
- * to allow participants to delegate indexing of documents outside
- * of the TOC using the same algorithms as those in TOC.
- * @deprecated
- * This interface is deprecated because it exposes Lucene classes,
- * which are not binary compatible between major release. This
- * interface was used by clients which implemented the extension
- * point org.eclipse.help.bace.luceneSearchParticipants. The
- * extension point org.eclipse.help.base.searchParticipant
- * and the interface IHelpSearchIndex should be used instead.
- */
-
-public interface ISearchIndex {
-
- /**
- * Adds a document to the search index by parsing it using one of the file-based search
- * participants, or the default HTML search participant. Use this method when encountering
- * documents outside of TOC that are nevertheless of the known format and help system knows how
- * to handle.
- *
- * @param pluginId
- * the id of the contributing plug-in
- * @param name
- * the name of the document
- * @param url
- * the URL of the document using format '/pluginId/href'
- * @param id
- * the unique id of this document as defined in the participant
- * @param doc
- * the Lucene document
- * @return the status of the operation
- */
- IStatus addDocument(String pluginId, String name, URL url, String id, Document doc);
-
- /**
- * A search index is created for each locale.
- * @return the locale associated with this index.
- */
- String getLocale();
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/search/LuceneSearchParticipant.java b/org.eclipse.help.base/src/org/eclipse/help/search/LuceneSearchParticipant.java
deleted file mode 100644
index ee3c34df9..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/search/LuceneSearchParticipant.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.search;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.internal.util.ResourceLocator;
-import org.osgi.framework.Bundle;
-
-/**
- * Participant in the help search. A plug-in can contribute instance of LuceneSearchParticipant to
- * <code>"org.eclipse.help.search.luceneSearchParticipant"</code> extension point. Search
- * participant is responsible for adding the content of documents it is responsible for into the
- * help system's search index. Once in the index, the document becomes searchable and can produce
- * search hits. There are two ways of using the participant:
- * <ol>
- * <li> For adding documents that are part of the help's TOC that have content formats not known to
- * the default indexer (which are essentially all documents that are not of HTML format). In this
- * case, the help system knows about the documents because they are in TOC but does not know how to
- * index them. Because of the non-HTML format, help search participants are normally accompanied by
- * the help content producers that are responsible for transforming the unknown format into HTML on
- * the fly. <br>
- * <br>
- * When used in this mode, search participants must be registered with file extensions they handle.
- * Based on the file extension mapping, they will be the first to get a chance at indexing the
- * document with the matching extension.<br>
- * <br>
- * </li>
- * <li> For adding documents that are outside of the help's TOC. In this case, the documents are
- * completely unknown to the help system. Search participants are responsible for providing a set of
- * documents they know about and are not supposed to declare file extensions they can handle. They
- * are also responsible for opening these documents when asked because the help system will not be
- * able to open them in any meaningful way. </li>
- * </ol>
- *
- * @since 3.2
- * @deprecated
- * This class is deprecated because it exposes Lucene classes,
- * which are not binary compatible between major release. The
- * extension point org.eclipse.help.base.searchParticipant
- * and the class SearchParticipant should be used instead.
- *
- * In Eclipse 3.6 the announcement was made that this API class will be removed
- * in a future release.
- */
-public abstract class LuceneSearchParticipant {
-
- private static final HashSet<String> EMPTY_SET = new HashSet<String>();
-
- private String id;
-
- /**
- * Initializes the participant with the unique identifier from the registry. The method is
- * called by the help system - subclasses are not supposed to call it.
- *
- * @param id
- * the unique identifier of this participant
- */
-
- public final void init(String id) {
- this.id = id;
- }
-
- /**
- * Returns the unique identifier of this participant.
- *
- * @return the unique id
- */
- public String getId() {
- return id;
- }
-
- /**
- * Adds the document to the search index.
- *
- * @param index
- * the abstract representation of the help index that is currently running. Indexing
- * known file types in participants that manage documents outside the TOC can be
- * delegated to the index.
- * @param pluginId
- * the plug-in that owns the document
- * @param name
- * the name of the document to index
- * @param url
- * the url of the document to index
- * @param id
- * the unique id associated with this document
- * @param doc
- * the Lucene document to add searchable content to
- * @return the status of the indexing operation. A successful operation should return
- * <code>Status.OK</code>.
- */
- public abstract IStatus addDocument(ISearchIndex index, String pluginId, String name, URL url, String id,
- Document doc);
-
- /**
- * Returns all the documents that this participant knows about. This method is only used for
- * participants that handle documents outside of the help system's TOC.
- *
- * @param locale
- * the index locale
- *
- * @return a set of hrefs for documents managed by this participant.
- */
- public Set<String> getAllDocuments(String locale) {
- return EMPTY_SET;
- }
-
- /**
- * Returns a set of identifiers of plug-ins that contribute indexable documents. This method is
- * only used for participants that handle documents outside of the help system's TOC.
- *
- * @return a set of contributing plug-in ids
- */
-
- public Set<String> getContributingPlugins() {
- return EMPTY_SET;
- }
-
- /**
- * A utility method that resolves a file name that contains '$'-based substitution variables.
- *
- * @param pluginId
- * the identifier of the originating plug-in
- * @param fileName
- * the source file name
- * @param locale
- * the locale to use when resolving nl variable
- * @return the plug-in relative file name with resolved variables
- */
-
- protected static String resolveVariables(String pluginId, String fileName, String locale) {
- if (fileName.indexOf('$') == -1)
- return fileName;
- ArrayList<String> prefix = ResourceLocator.getPathPrefix(locale);
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle == null)
- return fileName;
- URL url = ResourceLocator.find(bundle, new Path(fileName), prefix);
- URL root = FileLocator.find(bundle, new Path(""), null); //$NON-NLS-1$
- return url.toString().substring(root.toString().length());
- }
-
- /**
- * A utility method that adds a document title to the Lucene document.
- *
- * @param title
- * the title string
- * @param doc
- * the Lucene document
- */
-
- protected void addTitle(String title, Document doc) {
- doc.add(new Field("title", title, Field.Store.NO, Field.Index.ANALYZED)); //$NON-NLS-1$
- doc.add(new Field("exact_title", title, Field.Store.NO, Field.Index.ANALYZED)); //$NON-NLS-1$
- doc.add(new Field("raw_title", title, Field.Store.YES, Field.Index.NO)); //$NON-NLS-1$
- }
-
- /**
- * Help system does not know how to open documents outside of the system's TOC. Global search
- * participants that bring additional documents into the index when
- * <code>getAllDocuments(String)</code> have a chance to open the document when it is part of
- * the search results. The default implementation returns <code>false</code> indicating that
- * the help system should open the document. In most cases this is wrong for most of XML files
- * that are in some interesting way.
- *
- * @param id
- * a participant-specific identifier that completely represents a search result
- *
- * @return <code>true</code> if the file has been opened correctly or <code>false</code> to
- * allow the help system to try to open the document.
- */
-
- public boolean open(String id) {
- return false;
- }
-
- /**
- * Signals to the participant that the indexing operation has finished and that cached resources
- * can be disposed to free up memory. The participant itself is still kept around (hence this is
- * semantically different from <code>dispose</code>).
- */
- public void clear() {
- }
-}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/search/XMLSearchParticipant.java b/org.eclipse.help.base/src/org/eclipse/help/search/XMLSearchParticipant.java
deleted file mode 100644
index e3b9494b6..000000000
--- a/org.eclipse.help.base/src/org/eclipse/help/search/XMLSearchParticipant.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.help.search;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.net.URL;
-import java.util.Stack;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.help.internal.base.HelpBasePlugin;
-import org.eclipse.help.internal.dynamic.DocumentReader;
-import org.eclipse.help.internal.dynamic.ExtensionHandler;
-import org.eclipse.help.internal.dynamic.IncludeHandler;
-import org.eclipse.help.internal.dynamic.ProcessorHandler;
-import org.eclipse.help.internal.dynamic.XMLProcessor;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * An abstract search participants for adding XML documents to the Lucene search index. Subclass it
- * and implement or override protected methods to handle parsing of the document.
- *
- * @since 3.2
- * * @deprecated
- * This class is deprecated because it exposes Lucene classes,
- * which are not binary compatible between major release. The
- * extension point org.eclipse.help.base.searchParticipant
- * and the class SearchParticipantXML should be used instead.
- */
-public abstract class XMLSearchParticipant extends LuceneSearchParticipant {
- private Stack<String> stack = new Stack<String>();
- private SAXParser parser;
- private XMLProcessor processor;
- private boolean hasFilters;
-
- /**
- * Class that implements this interface is used to store data obtained during the parsing phase.
- */
- protected interface IParsedXMLContent {
-
- /**
- * Returns the locale of the index.
- *
- * @return the locale string
- */
- String getLocale();
-
- /**
- * Sets the title of the parsed document for indexing.
- *
- * @param title
- * the document title
- */
- void setTitle(String title);
-
- /**
- * Sets the optional summary of the parsed document that can be later rendered for the
- * search hits.
- *
- * @param summary
- * the short document summary
- */
- void addToSummary(String summary);
-
- /**
- * Adds the text to the content buffer for indexing.
- *
- * @param text
- * the text to add to the document content buffer
- */
- void addText(String text);
- }
-
- private static class ParsedXMLContent implements IParsedXMLContent {
- private StringBuffer buffer = new StringBuffer();
- private StringBuffer summary = new StringBuffer();
- private String title;
- private String locale;
- private static int SUMMARY_LENGTH = 200;
-
- public ParsedXMLContent(String locale) {
- this.locale = locale;
- }
-
- public String getLocale() {
- return locale;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public void addToSummary(String text) {
- if (summary.length() >= SUMMARY_LENGTH)
- return;
- if (summary.length() > 0)
- summary.append(" "); //$NON-NLS-1$
- summary.append(text);
- if (summary.length() > SUMMARY_LENGTH)
- summary.delete(SUMMARY_LENGTH, summary.length());
- }
-
- public void addText(String text) {
- if (buffer.length() > 0)
- buffer.append(" "); //$NON-NLS-1$
- buffer.append(text);
- }
-
- public Reader newContentReader() {
- return new StringReader(buffer.toString());
- }
-
- public String getSummary() {
- // if the summary starts with the title, trim that part off.
- String summaryStr = summary.toString();
- if (title != null && summaryStr.length() >= title.length()) {
- String header = summaryStr.substring(0, title.length());
- if (header.equalsIgnoreCase(title)) {
- return summaryStr.substring(title.length()).trim();
- }
- }
- return summaryStr;
- }
-
- public String getTitle() {
- return title;
- }
- }
-
- private class XMLHandler extends DefaultHandler {
-
- public ParsedXMLContent data;
-
- public XMLHandler(ParsedXMLContent data) {
- this.data = data;
- }
-
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException {
- stack.push(qName);
- handleStartElement(qName, attributes, data);
- if (attributes.getValue("filter") != null || qName.equalsIgnoreCase("filter")) { //$NON-NLS-1$ //$NON-NLS-2$
- hasFilters = true;
- }
- }
-
- public void endElement(String uri, String localName, String qName) throws SAXException {
- handleEndElement(qName, data);
- String top = stack.peek();
- if (top != null && top.equals(qName))
- stack.pop();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#startDocument()
- */
- public void startDocument() throws SAXException {
- XMLSearchParticipant.this.handleStartDocument(data);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#endDocument()
- */
- public void endDocument() throws SAXException {
- XMLSearchParticipant.this.handleEndDocument(data);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#processingInstruction(java.lang.String,
- * java.lang.String)
- */
- public void processingInstruction(String target, String pidata) throws SAXException {
- handleProcessingInstruction(target, data);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
- */
- public void characters(char[] characters, int start, int length) throws SAXException {
- if (length == 0)
- return;
- StringBuffer buff = new StringBuffer();
- for (int i = 0; i < length; i++) {
- buff.append(characters[start + i]);
- }
- String text = buff.toString();
- if (text.trim().length() > 0)
- handleText(text, data);
- }
-
- /*
- * Note: throws clause does not declare IOException due to a bug in
- * sun jdk: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6327149
- *
- * @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String, java.lang.String)
- */
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
- return new InputSource(new StringReader("")); //$NON-NLS-1$
- }
- }
-
- /**
- * Called when the element has been started.
- *
- * @param name
- * the element name
- * @param attributes
- * the element attributes
- * @param data
- * data the parser content data to update
- */
- protected abstract void handleStartElement(String name, Attributes attributes, IParsedXMLContent data);
-
- /**
- * Called when the element has been ended.
- *
- * @param name
- * the name of the XML element
- * @param data
- * data the parser content data to update
- */
- protected abstract void handleEndElement(String name, IParsedXMLContent data);
-
- /**
- * Called when the XML document has been started.
- *
- * @param data
- * data the parser content data to update
- */
- protected void handleStartDocument(IParsedXMLContent data) {
- }
-
- /**
- * Called when the XML document has been ended.
- *
- * @param data
- * data the parser content data to update
- */
- protected void handleEndDocument(IParsedXMLContent data) {
- }
-
- /**
- * Called when a processing instruction has been encountered.
- *
- * @param type
- * the instruction data
- * @param data
- * the parser content data to update
- */
- protected void handleProcessingInstruction(String type, IParsedXMLContent data) {
- }
-
- /**
- * Called when element body text has been encountered. Use 'getElementStackPath()' to determine
- * the element in question.
- *
- * @param text
- * the body text
- * @param data
- * the parser content data to update
- */
- protected abstract void handleText(String text, IParsedXMLContent data);
-
- /*
- * @see LuceneSearchParticipant#addDocument(String, String, URL, String, Document)
- */
- public IStatus addDocument(ISearchIndex index, String pluginId, String name, URL url, String id,
- Document doc) {
- InputStream stream = null;
- try {
- if (parser == null) {
- parser = SAXParserFactory.newInstance().newSAXParser();
- }
- stack.clear();
- hasFilters = false;
- ParsedXMLContent parsed = new ParsedXMLContent(index.getLocale());
- XMLHandler handler = new XMLHandler(parsed);
- stream = url.openStream();
- stream = preprocess(stream, name, index.getLocale());
- parser.parse(stream, handler);
- doc.add(new Field("contents", parsed.newContentReader())); //$NON-NLS-1$
- doc.add(new Field("exact_contents", parsed.newContentReader())); //$NON-NLS-1$
- String title = parsed.getTitle();
- if (title != null)
- addTitle(title, doc);
- String summary = parsed.getSummary();
- if (summary != null)
- doc.add(new Field("summary", summary, Field.Store.YES, Field.Index.NO)); //$NON-NLS-1$
- if (hasFilters) {
- doc.add(new Field("filters", "true", Field.Store.YES, Field.Index.NO)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return Status.OK_STATUS;
- } catch (Exception e) {
- return new Status(IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, IStatus.ERROR,
- "Exception occurred while adding document " + name //$NON-NLS-1$
- + " to index.", //$NON-NLS-1$
- e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- }
- stream = null;
- }
- }
- }
-
- /**
- * Returns the name of the element that is currently at the top of the element stack.
- *
- * @return the name of the element that is currently at the top of the element stack
- */
-
- protected String getTopElement() {
- return stack.peek();
- }
-
- /**
- * Returns the full path of the current element in the stack separated by the '/' character.
- *
- * @return the path to the current element in the stack.
- */
- protected String getElementStackPath() {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < stack.size(); i++) {
- if (i > 0)
- buf.append("/"); //$NON-NLS-1$
- buf.append(stack.get(i));
- }
- return buf.toString();
- }
-
- /**
- * <p>
- * Pre-processes the given document input stream for the given document name and locale.
- * This implementation will resolve dynamic content that is applicable to searching,
- * e.g. includes and extensions, but not filters. Subclasses may override to do their
- * own pre-processing.
- * </p>
- * <p>
- * For performance, implementations that handle documents that do not support dynamic
- * content should subclass and return the original stream.
- * </p>
- *
- * @param in the input stream for the document content
- * @param name the name of the document as it appears in the index
- * @param locale the locale code, e.g. "en_US"
- * @return the processed content
- * @since 3.3
- */
- protected InputStream preprocess(InputStream in, String name, String locale) {
- if (processor == null) {
- DocumentReader reader = new DocumentReader();
- processor = new XMLProcessor(new ProcessorHandler[] {
- new IncludeHandler(reader, locale),
- new ExtensionHandler(reader, locale)
- });
- }
- try {
- return processor.process(in, name, null);
- }
- catch (Throwable t) {
- String msg = "An error occured while pre-processing user assistance document \"" + name + "\" for search indexing"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpBasePlugin.logError(msg, t);
- return in;
- }
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java
index 4216e92ee..ed620f7d7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,7 +42,6 @@ public class AllSearchTests extends TestSuite {
addTest(SearchParticipantXMLTest.suite());
addTest(SearchRanking.suite());
addTest(LuceneParticipantTest.suite());
- addTest(LuceneXMLParticipantTest.suite());
addTestSuite(WorkingSetManagerTest.class);
addTestSuite(InfocenterWorkingSetManagerTest.class);
addTestSuite(PrebuiltIndexCompatibility.class);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java
deleted file mode 100644
index 794b10b92..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.search;
-
-
-import org.eclipse.help.internal.search.SearchHit;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-
-public class LuceneXMLParticipantTest extends TestCase {
-
- /*
- * Returns an instance of this Test.
- */
- public static Test suite() {
- return new TestSuite(LuceneXMLParticipantTest.class);
- }
-
- public void testSearchFirstWordInFirstDoc() {
- SearchTestUtils.searchAllLocales("hujnjujnh", new String[] { MockLuceneXMLParticipant.DOC_1 });
- }
-
- public void testSearchLastWordInFirstDoc() {
- SearchTestUtils.searchAllLocales("dusudusud", new String[] { MockLuceneXMLParticipant.DOC_1 });
- }
-
- public void testSearchWordFromOuterElement() {
- SearchTestUtils.searchAllLocales("kfkkfjeeej", new String[] { MockLuceneXMLParticipant.DOC_2 });
- }
-
- public void testSearchWordFromNestedElement() {
- SearchTestUtils.searchAllLocales("syueuduehj", new String[] { MockLuceneXMLParticipant.DOC_2 });
- }
-
- public void testReturnedTitle() {
- SearchHit[] hits = SearchTestUtils.getSearchHits("hujnjujnh", "en");
- assertEquals(hits.length,1);
- assertEquals("Lucene XML 1", hits[0].getLabel());
- }
-
- public void testReturnedSummary() {
- SearchHit[] hits = SearchTestUtils.getSearchHits("hujnjujnh", "en");
- assertEquals(hits.length,1);
- assertEquals("Summary for file Lucene XML1", hits[0].getSummary());
- }
-
- public void testReturnedTitleNestedCase() {
- SearchHit[] hits = SearchTestUtils.getSearchHits("kfkkfjeeej", "en");
- assertEquals(hits.length,1);
- assertEquals("Lucene XML 2 - tests nesting", hits[0].getLabel());
- }
-
- public void testReturnedSummaryNestedCase() {
- SearchHit[] hits = SearchTestUtils.getSearchHits("kfkkfjeeej", "en");
- assertEquals(hits.length,1);
- assertEquals("Summary for file Lucene XML2", hits[0].getSummary());
- }
-
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java
deleted file mode 100644
index f72c3d426..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ua.tests.help.search;
-
-import java.io.StringReader;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.help.search.ISearchIndex;
-import org.eclipse.help.search.LuceneSearchParticipant;
-
-@SuppressWarnings("deprecation")
-public class MockLuceneParticipant extends LuceneSearchParticipant {
-
- private static final String DOC_1 = "/org.eclipse.help.base/lucene1.xml";
- private static final String DOC_2 = "/org.eclipse.help.base/lucene2.xml";
-
- public IStatus addDocument(ISearchIndex index, String pluginId,
- String name, URL url, String id, Document doc) {
- boolean isDoc1 = url.getPath().equals(DOC_1) ;
- String title = isDoc1 ? "Title1" : "Title2";
- String summary = isDoc1? "Summary1" : "Summary2";
- String contents = isDoc1? "sehdtegd jduehdye" : "nhduehrf ldoekfij";
- addTitle(title, doc);
- doc.add(new Field("summary", summary, Field.Store.YES, Field.Index.NO)); //$NON-NLS-1$
- doc.add(new Field("contents", new StringReader(contents))); //$NON-NLS-1$
- doc.add(new Field("exact_contents", new StringReader(contents))); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
-
- public Set<String> getAllDocuments(String locale) {
- HashSet<String> set = new HashSet<String>();
- set.add(DOC_1);
- set.add(DOC_2);
- return set;
- }
-
- public String getId() {
- return super.getId();
- }
-
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java
deleted file mode 100644
index 7537681d7..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ua.tests.help.search;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.help.search.XMLSearchParticipant;
-import org.xml.sax.Attributes;
-
-@SuppressWarnings("deprecation")
-public class MockLuceneXMLParticipant extends XMLSearchParticipant {
-
- public static final String DOC_1 = "/org.eclipse.ua.tests/data/help/search/lucene_xml_1.xml";
- public static final String DOC_2 = "/org.eclipse.ua.tests/data/help/search/lucene_xml_2.xml";
-
- public Set<String> getAllDocuments(String locale) {
- HashSet<String> set = new HashSet<String>();
- set.add(DOC_1 + "?id=xml1" + "?id=xml2");
- set.add(DOC_2);
- return set;
- }
-
- public Set<String> getContributingPlugins() {
- Set<String> result = new HashSet<String>();
- result.add("org.eclipse.ua.tests");
- return result;
- }
-
- protected void handleStartElement(String name, Attributes attributes,
- IParsedXMLContent data) {
- if ("searchable".equalsIgnoreCase(name)) {
- data.setTitle(attributes.getValue("title"));
- }
- String summary = attributes.getValue("summary");
- if (summary != null) {
- data.addToSummary(summary);
- }
- }
-
- protected void handleEndElement(String name, IParsedXMLContent data) {
- }
-
- protected void handleText(String text, IParsedXMLContent data) {
- String top = getTopElement();
- if ("text".equalsIgnoreCase(top)) {
- data.addText(text);
- }
- }
-
- public boolean open(String id) {
- System.out.println("Open " + id);
- return true;
- }
-
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
index 9cd5d8b45..08ec1e290 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,24 +15,14 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import junit.framework.*;
import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.NIOFSDirectory;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.*;
import org.eclipse.help.internal.base.BaseHelpSystem;
-import org.eclipse.help.internal.search.AnalyzerDescriptor;
-import org.eclipse.help.internal.search.PluginIndex;
-import org.eclipse.help.internal.search.QueryBuilder;
-import org.eclipse.help.internal.search.SearchIndexWithIndexingProgress;
+import org.eclipse.help.internal.search.*;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
import org.osgi.framework.Bundle;

Back to the top