Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.webapp/advanced/indexList.jsp1
-rw-r--r--org.eclipse.help.webapp/advanced/indexTypein.js10
-rw-r--r--org.eclipse.help.webapp/advanced/indexTypein.jsp3
-rw-r--r--org.eclipse.help.webapp/advanced/indexView.jsp2
-rw-r--r--org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/IndexData.java56
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/Index.java14
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexEntry.java5
7 files changed, 78 insertions, 13 deletions
diff --git a/org.eclipse.help.webapp/advanced/indexList.jsp b/org.eclipse.help.webapp/advanced/indexList.jsp
index 94e8fce56..03460e0d1 100644
--- a/org.eclipse.help.webapp/advanced/indexList.jsp
+++ b/org.eclipse.help.webapp/advanced/indexList.jsp
@@ -28,6 +28,7 @@
<base target="ContentViewFrame">
<script language="JavaScript">
+var ids = [<%data.generateIds(out);%>];
minus = new Image();
minus.src = "<%=prefs.getImagesDirectory()%>" + "/minus.gif";
plus = new Image();
diff --git a/org.eclipse.help.webapp/advanced/indexTypein.js b/org.eclipse.help.webapp/advanced/indexTypein.js
index 506a3464e..c72c19a3a 100644
--- a/org.eclipse.help.webapp/advanced/indexTypein.js
+++ b/org.eclipse.help.webapp/advanced/indexTypein.js
@@ -38,23 +38,25 @@ function compare(keyword, pattern) {
}
function searchPattern(pattern) {
+ if (!parent.listFrame) return null;
+
var from = 0;
- var to = ids.length;
+ var to = parent.listFrame.ids.length;
var i;
var res;
while (to > from) {
i = Math.floor((to + from) / 2);
- res = compare(ids[i], pattern);
+ res = compare(parent.listFrame.ids[i], pattern);
if (res == 0) {
while (i > 0) {
- res = compare(ids[--i], pattern);
+ res = compare(parent.listFrame.ids[--i], pattern);
if (res != 0) {
i++;
break;
}
}
- return ids[i];
+ return parent.listFrame.ids[i];
} else if (res < 0) {
from = i + 1;
} else {
diff --git a/org.eclipse.help.webapp/advanced/indexTypein.jsp b/org.eclipse.help.webapp/advanced/indexTypein.jsp
index 807ff4ceb..91493b9ea 100644
--- a/org.eclipse.help.webapp/advanced/indexTypein.jsp
+++ b/org.eclipse.help.webapp/advanced/indexTypein.jsp
@@ -11,7 +11,7 @@
<%@ include file="header.jsp"%>
<%
- IndexData data = new IndexData(application, request, response);
+ RequestData data = new RequestData(application, request, response);
WebappPreferences prefs = data.getPrefs();
%>
@@ -25,7 +25,6 @@
<%@ include file="indexTypein.css"%>
</style>
-<script language="JavaScript">var ids = [<%data.generateIds(out);%>];</script>
<script language="JavaScript" src="indexTypein.js"></script>
</head>
diff --git a/org.eclipse.help.webapp/advanced/indexView.jsp b/org.eclipse.help.webapp/advanced/indexView.jsp
index 28d7008c1..9885857c6 100644
--- a/org.eclipse.help.webapp/advanced/indexView.jsp
+++ b/org.eclipse.help.webapp/advanced/indexView.jsp
@@ -11,7 +11,7 @@
<%@ include file="fheader.jsp"%>
<%
- IndexData data = new IndexData(application, request, response);
+ RequestData data = new RequestData(application, request, response);
WebappPreferences prefs = data.getPrefs();
%>
diff --git a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/IndexData.java b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/IndexData.java
index e41230a70..6277e6370 100644
--- a/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/IndexData.java
+++ b/org.eclipse.help.webapp/src_servlets/org/eclipse/help/internal/webapp/data/IndexData.java
@@ -12,6 +12,7 @@ package org.eclipse.help.internal.webapp.data;
import java.io.IOException;
import java.io.Writer;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -21,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.index.Index;
import org.eclipse.help.internal.index.IndexEntry;
import org.eclipse.help.internal.index.IIndexTopic;
@@ -71,7 +73,7 @@ public class IndexData extends ActivitiesData {
* Loads help index
*/
private void loadIndex() {
- index = HelpPlugin.getIndexManager().getIndex(getLocale());
+ index = extractEnabled(HelpPlugin.getIndexManager().getIndex(getLocale()));
}
/*
@@ -283,4 +285,56 @@ public class IndexData extends ActivitiesData {
out.write("</ul>\n"); //$NON-NLS-1$
}
}
+
+ private Index extractEnabled(Index index) {
+ List enabledEntries = new ArrayList();
+ Iterator iter = index.getEntryMap().values().iterator();
+ while (iter.hasNext()) {
+ IndexEntry entry = extractEnabled((IndexEntry)iter.next());
+ if (entry != null)
+ enabledEntries.add(entry);
+ }
+ return new Index(enabledEntries);
+ }
+
+ private IndexEntry extractEnabled(IndexEntry entry) {
+ List enabledTopics = new ArrayList();
+ List enabledSubentries = new ArrayList();
+
+ List topics = entry.getTopicList();
+ if (topics != null) {
+ Iterator iter = topics.iterator();
+ while (iter.hasNext()) {
+ IIndexTopic topic = (IIndexTopic)iter.next();
+ if (isEnabled(topic)) {
+ enabledTopics.add(topic);
+ }
+ }
+ }
+
+ Map subentries = entry.getEntryMap();
+ if (subentries != null) {
+ Iterator iter = subentries.values().iterator();
+ while (iter.hasNext()) {
+ IndexEntry subentry = extractEnabled((IndexEntry)iter.next());
+ if (subentry != null) {
+ enabledSubentries.add(subentry);
+ }
+ }
+ }
+
+ if (enabledTopics.isEmpty() && enabledSubentries.isEmpty())
+ return null;
+
+ return new IndexEntry(entry.getKeyword(),
+ enabledTopics, enabledSubentries);
+ }
+
+ private boolean isEnabled(IIndexTopic topic) {
+ if (!isAdvancedUI()) {
+ // activities never filtered for basic browsers
+ return true;
+ }
+ return HelpBasePlugin.getActivitySupport().isEnabled(topic.getHref());
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/Index.java b/org.eclipse.help/src/org/eclipse/help/internal/index/Index.java
index cea4e52f7..4ad7e23c3 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/Index.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/Index.java
@@ -12,6 +12,8 @@ package org.eclipse.help.internal.index;
import java.util.Collection;
import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -37,11 +39,19 @@ public class Index implements IIndex {
public Index() {
entries = new TreeMap(new IgnoreCaseComparator());
}
-
+
+ public Index(List entries) {
+ this();
+ for (Iterator i = entries.iterator(); i.hasNext();) {
+ IndexEntry entry = (IndexEntry)i.next();
+ this.entries.put(entry.getKeyword(), entry);
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.help.internal.index.IIndex#addEntry(java.lang.String, java.util.Collection)
*/
- public IndexEntry addEntry(String keyword) {
+ protected IndexEntry addEntry(String keyword) {
IndexEntry oldEntry = (IndexEntry) entries.get(keyword);
if (oldEntry == null) {
oldEntry = new IndexEntry(keyword);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexEntry.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexEntry.java
index a7082fe1a..19d0e40d6 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexEntry.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexEntry.java
@@ -12,7 +12,6 @@ package org.eclipse.help.internal.index;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.eclipse.help.IHelpResource;
import org.eclipse.help.IIndexEntry;
@@ -35,10 +34,10 @@ public class IndexEntry extends Index implements IIndexEntry {
this.topics = topics;
}
- public IndexEntry(String keyword, List topics, Map subentries) {
+ public IndexEntry(String keyword, List topics, List subentries) {
+ super(subentries);
this.keyword = keyword;
this.topics = topics;
- this.entries = subentries;
}
public void addTopic(String label, String href, String location) {

Back to the top