Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-07-22 22:41:02 +0000
committerChris Goldthorpe2009-07-22 22:41:02 +0000
commit77fd2dca17764168d36a1a0a973f833683ecc67d (patch)
treebef29bc8d52aea389e04100cebb15780bf67d9b9
parent76f663ce9b88bf079e395d48df94fb939c9a425f (diff)
downloadeclipse.platform.ua-77fd2dca17764168d36a1a0a973f833683ecc67d.tar.gz
eclipse.platform.ua-77fd2dca17764168d36a1a0a973f833683ecc67d.tar.xz
eclipse.platform.ua-77fd2dca17764168d36a1a0a973f833683ecc67d.zip
Bug 226595 – [Help] Help index cannot handle multiple files with same ID
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java6
-rw-r--r--org.eclipse.ua.tests/data/help/index/assembler/hasTitle.xml15
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java21
3 files changed, 40 insertions, 2 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
index 93e249eba..638470bf7 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 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
@@ -181,6 +181,10 @@ public class IndexAssembler {
topic.setHref(HrefUtil.normalizeHref(pluginId, href));
}
}
+ String title = element.getAttribute("title"); //$NON-NLS-1$
+ if (title != null) {
+ topic.setLabel(title);
+ }
}
return UNHANDLED;
}
diff --git a/org.eclipse.ua.tests/data/help/index/assembler/hasTitle.xml b/org.eclipse.ua.tests/data/help/index/assembler/hasTitle.xml
new file mode 100644
index 000000000..c479d81cf
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/index/assembler/hasTitle.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?> <!--
+ Copyright (c) 2005, 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
+ -->
+
+<index>
+ <entry keyword="keyword1"> <topic href="topic1.html" title="topic0"/> <topic href="topic2.html" label="topic1"/> <topic href="topic3.html" title="topic2" label = "topic3"/>
+ </entry>
+</index>
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
index b7df7cb5b..0c19d6a6e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 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
@@ -19,6 +19,9 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.help.IIndex;
+import org.eclipse.help.IIndexEntry;
+import org.eclipse.help.ITopic;
import org.eclipse.help.internal.UAElement;
import org.eclipse.help.internal.dynamic.DocumentWriter;
import org.eclipse.help.internal.index.Index;
@@ -53,6 +56,22 @@ public class IndexAssemblerTest extends TestCase {
assertEquals(trimWhiteSpace(expected), trimWhiteSpace(actual));
}
+ public void testTitle() throws Exception{
+ IndexFileParser parser = new IndexFileParser();
+ IndexContribution contrib = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/hasTitle.xml", "en"));
+ IndexAssembler assembler = new IndexAssembler();
+ List contributions = new ArrayList(Arrays.asList(new Object[] { contrib }));
+ Index index = assembler.assemble(contributions, Platform.getNL());
+ IIndexEntry[] children = index.getEntries();
+ assertEquals(1,children.length);
+ assertEquals("keyword1", children[0].getKeyword());
+ ITopic[] topics = children[0].getTopics();
+ assertEquals(3, topics.length);
+ assertEquals("topic0", topics[0].getLabel());
+ assertEquals("topic1", topics[1].getLabel());
+ assertEquals("topic2", topics[2].getLabel());
+ }
+
// Replaces white space between ">" and "<" by a single newline
private String trimWhiteSpace(String input) {

Back to the top