diff options
Diffstat (limited to 'org.eclipse.help')
8 files changed, 86 insertions, 26 deletions
diff --git a/org.eclipse.help/META-INF/MANIFEST.MF b/org.eclipse.help/META-INF/MANIFEST.MF index 48678ac17..b8201ee9a 100644 --- a/org.eclipse.help/META-INF/MANIFEST.MF +++ b/org.eclipse.help/META-INF/MANIFEST.MF @@ -7,13 +7,13 @@ Bundle-Activator: org.eclipse.help.internal.HelpPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.help, - org.eclipse.help.internal;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ui.intro", - org.eclipse.help.internal.context;x-friends:="org.eclipse.help.base,org.eclipse.help.ui", - org.eclipse.help.internal.index;x-friends:="org.eclipse.help.webapp", - org.eclipse.help.internal.model;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp", - org.eclipse.help.internal.protocols;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp", - org.eclipse.help.internal.toc;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp", - org.eclipse.help.internal.util;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp", - org.eclipse.help.internal.xhtml;x-friends:="org.eclipse.help.ui,org.eclipse.ui.intro" + org.eclipse.help.internal;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ui.intro,org.eclipse.ua.tests", + org.eclipse.help.internal.context;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.ua.tests", + org.eclipse.help.internal.index;x-friends:="org.eclipse.help.webapp,org.eclipse.ua.tests", + org.eclipse.help.internal.model;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests", + org.eclipse.help.internal.protocols;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests", + org.eclipse.help.internal.toc;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests", + org.eclipse.help.internal.util;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests", + org.eclipse.help.internal.xhtml;x-friends:="org.eclipse.help.ui,org.eclipse.ui.intro,org.eclipse.ua.tests" Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)" Eclipse-LazyStart: true diff --git a/org.eclipse.help/src/org/eclipse/help/internal/FilterableHelpElement.java b/org.eclipse.help/src/org/eclipse/help/internal/FilterableHelpElement.java new file mode 100644 index 000000000..1b39ccc80 --- /dev/null +++ b/org.eclipse.help/src/org/eclipse/help/internal/FilterableHelpElement.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.help.internal; + +/** + * Any model element or node in a help component that is filterable. This is + * used to tag help elements, as they can be treated differently in some + * situations. e.g. to allow the option of showing all content + */ +public abstract class FilterableHelpElement extends FilterableUAElement { +} diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java index 6e9fa4a79..cce033187 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/DirectoryToc.java @@ -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 @@ -183,6 +183,11 @@ public class DirectoryToc { this.topicHref = href; } + public Map getFilters() { + // extra topics can't have filters + return null; + } + public String getHref() { return topicHref; } 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 index deb159131..a9f54de51 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/Toc.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 @@ -9,11 +9,19 @@ * 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.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.help.IToc; +import org.eclipse.help.ITopic; +import org.eclipse.help.internal.model.ITocElement; +import org.xml.sax.Attributes; + /** * Root of navigation TocFile Can be linked with other Toc objects. */ @@ -67,6 +75,7 @@ public class Toc extends TocNode implements IToc, ITocElement { childrenTocs = new ArrayList(); directoryToc = new DirectoryToc(tocFile); + addFilters(attrs); } /** * Implements abstract method. 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 index f2e3547ca..19178da15 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFile.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 @@ -44,7 +44,7 @@ public class TocFile { * * @return Returns a String */ - protected String getHref() { + public String getHref() { return href; } diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java index accaa90b8..55b73dbd0 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java @@ -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 @@ -118,6 +118,19 @@ class TocFileParser extends DefaultHandler { node = new Link(tocFile, atts); } else if (qName.equals("anchor")) { //$NON-NLS-1$ node = new Anchor(tocFile, atts); + } else if (qName.equals("filter")) { //$NON-NLS-1$ + if (!elementStack.empty()) { + Object parent = elementStack.peek(); + if (parent instanceof FilterableUAElement && atts != null) { + FilterableUAElement filterableNode = (FilterableUAElement)parent; + String name = atts.getValue("name"); + String value = atts.getValue("value"); + if (name != null && value != null) { + filterableNode.addFilter(name, value); + } + } + } + return; } else return; // perhaps throw some exception if (!elementStack.empty()) @@ -132,7 +145,9 @@ class TocFileParser extends DefaultHandler { */ public final void endElement(String namespaceURI, String localName, String qName) throws SAXException { - elementStack.pop(); + if (!qName.equals("filter")) { //$NON-NLS-1$ + elementStack.pop(); + } } /** 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 index f2c011d3c..b1b50753f 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocNode.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 @@ -10,12 +10,17 @@ *******************************************************************************/ package org.eclipse.help.internal.toc; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.help.internal.FilterableHelpElement; /** * Navigation Element. Common for all objects definable in toc.xml */ -abstract class TocNode implements ITocNode { +abstract class TocNode extends FilterableHelpElement implements ITocNode { protected List children; protected List parents; 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 index ba384f14a..5c8a61a08 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/Topic.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 @@ -9,11 +9,17 @@ * 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.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.help.IToc; +import org.eclipse.help.ITopic; +import org.eclipse.help.internal.model.ITopicElement; +import org.xml.sax.Attributes; + /** * Topic. Visible navigation element. Labeled, contains linik to a document. Can * also act as a container for other documents. @@ -36,6 +42,7 @@ public class Topic extends TocNode implements ITopic, ITopicElement { throw new RuntimeException("topic label==null"); //$NON-NLS-1$ } tocFile.getToc().registerTopic(this); + addFilters(attrs); } /** * Implements abstract method. |