Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDejan Gloszic2006-02-09 18:19:41 -0500
committerDejan Gloszic2006-02-09 18:19:41 -0500
commit045f60cde766d1b467d923ea03db0ecf31c18723 (patch)
treee9298b22706b6cad4cf893ef3263618a42d15cbb /org.eclipse.help
parent58eb0b1860f4e1a18a276ffbe39120026e02cb27 (diff)
downloadeclipse.platform.ua-045f60cde766d1b467d923ea03db0ecf31c18723.tar.gz
eclipse.platform.ua-045f60cde766d1b467d923ea03db0ecf31c18723.tar.xz
eclipse.platform.ua-045f60cde766d1b467d923ea03db0ecf31c18723.zip
127104[Help] Ability to filter out context help topics
Diffstat (limited to 'org.eclipse.help')
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java6
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java17
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java6
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java11
5 files changed, 33 insertions, 11 deletions
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
index b51d81064..62001413b 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -71,7 +71,7 @@ public class ContextManager implements IRegistryChangeListener {
* Loads context.xml with context for a specified plugin, creates context
* nodes and adds to pluginContext map.
*/
- private synchronized PluginContexts loadPluginContexts(String plugin) {
+ public synchronized PluginContexts loadPluginContexts(String plugin) {
PluginContexts contexts = pluginsContexts.get(plugin);
if (contexts == null) {
contexts = new PluginContexts();
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
index dd157b78e..3858b0f4f 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -21,7 +21,7 @@ public class ContextsFile {
/**
* Contexts File Constructor
*/
- protected ContextsFile(String definingPlugin, String href, String plugin) {
+ public ContextsFile(String definingPlugin, String href, String plugin) {
this.href = href;
this.definingPluginID = definingPlugin;
this.pluginID = plugin;
@@ -31,7 +31,7 @@ public class ContextsFile {
*
* @return Returns a String
*/
- protected String getHref() {
+ public String getHref() {
return href;
}
protected InputStream getInputStream() {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
index 65cf75414..593589b9c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsFileParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -72,7 +72,7 @@ public class ContextsFileParser extends DefaultHandler {
stack.pop();
if (!(stack.peek()).equals(ContextsNode.BOLD_TAG))
buffer.append(ContextsNode.BOLD_CLOSE_TAG);
- } else {
+ } else if (!qName.equals("filter")) { //$NON-NLS-1$
ContextsNode node = (ContextsNode) stack.pop();
node.build(builder);
}
@@ -132,6 +132,19 @@ public class ContextsFileParser extends DefaultHandler {
e = new Context(atts);
} else if (qName.equals(ContextsNode.RELATED_ELEM)) {
e = new RelatedTopic(atts);
+ } else if (qName.equals("filter")) { //$NON-NLS-1$
+ if (!stack.empty()) {
+ Object parent = stack.peek();
+ if (parent instanceof FilterableUAElement && atts != null) {
+ FilterableUAElement filterableNode = (FilterableUAElement)parent;
+ String name = atts.getValue("name"); //$NON-NLS-1$
+ String value = atts.getValue("value"); //$NON-NLS-1$
+ if (name != null && value != null) {
+ filterableNode.addFilter(name, value);
+ }
+ }
+ }
+ return;
} else
return;
if (!stack.empty())
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
index 53ec72905..1667fd9ca 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextsNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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
@@ -11,11 +11,12 @@
package org.eclipse.help.internal.context;
import java.util.*;
+import org.eclipse.help.internal.FilterableUAElement;
import org.xml.sax.*;
/**
* Object in hierarchy of context contributions
*/
-public abstract class ContextsNode {
+public abstract class ContextsNode extends FilterableUAElement {
public static final String CONTEXTS_ELEM = "contexts"; //$NON-NLS-1$
public static final String CONTEXT_ELEM = "context"; //$NON-NLS-1$
public static final String DESC_ELEM = "description"; //$NON-NLS-1$
@@ -41,6 +42,7 @@ public abstract class ContextsNode {
* ContextsNode constructor.
*/
public ContextsNode(Attributes attrs) {
+ addFilters(attrs);
}
/**
* Adds a child
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
index 2698c29e8..108959061 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/PluginContexts.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2006 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,7 +15,7 @@ import org.eclipse.help.*;
/**
* Holds mapping of short contextId to IContext
*/
-class PluginContexts {
+public class PluginContexts {
private Map map = new HashMap();
public void put(String shortId, IContext context) {
map.put(shortId, context);
@@ -23,4 +23,11 @@ class PluginContexts {
public IContext get(String shortId) {
return (IContext) map.get(shortId);
}
+
+ /**
+ * For unit testing purposes.
+ */
+ public Map getMap() {
+ return map;
+ }
}

Back to the top