Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.eclipse.help.internal.UAElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Context extends UAElement implements IContext3 {
Expand All @@ -53,27 +54,37 @@ public void mergeContext(IContext src) {
if (getText() == null || getText().length() == 0) {
setText(text);
}
if (src instanceof IContext2 && getTitle() == null) {
String title = ((IContext2)src).getTitle();
if (src instanceof IContext2 icontext2 && getTitle() == null) {
String title = icontext2.getTitle();
if (title != null) {
setAttribute(ATTRIBUTE_TITLE, title);
}
}
if (src instanceof IContext3) {
ICommandLink[] commands = ((IContext3)src).getRelatedCommands();
for (int i=0;i<commands.length;++i) {
appendChild(new CommandLink(commands[i]));
if (src instanceof IContext3 icontext3) {
ICommandLink[] commands = icontext3.getRelatedCommands();
for (ICommandLink command : commands) {
appendChild(new CommandLink(command));
}
}
IHelpResource[] topics = src.getRelatedTopics();
for (int i=0;i<topics.length;++i) {
if (topics[i] instanceof ITopic) {
appendChild(new Topic((ITopic)topics[i]));
if (src instanceof UAElement uaelement) {
NamedNodeMap attributes = uaelement.getElement().getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
String attributeName = attribute.getNodeName();
String attributeValue = attribute.getNodeValue();
if (getAttribute(attributeName) == null) {
setAttribute(attributeName, attributeValue);
}
}
else {
}
IHelpResource[] relatedTopics = src.getRelatedTopics();
for (IHelpResource relatedTopic : relatedTopics) {
if (relatedTopic instanceof ITopic) {
appendChild(new Topic((ITopic) relatedTopic));
} else {
Topic topic = new Topic();
topic.setHref(topics[i].getHref());
topic.setLabel(topics[i].getLabel());
topic.setHref(relatedTopic.getHref());
topic.setLabel(relatedTopic.getLabel());
appendChild(topic);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ua/org.eclipse.ua.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: User Assistance Test
Bundle-SymbolicName: org.eclipse.ua.tests;singleton:=true
Bundle-Version: 3.7.400.qualifier
Bundle-Version: 3.7.500.qualifier
Require-Bundle: org.eclipse.help.ui,
org.eclipse.help.webapp,
org.eclipse.test.performance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public void testContextWithoutDescriptionMixedCatenation() {
assertEquals("Context Description", context3.getText());
}

/*
@Test
public void testCopyContextWithAttribute() {
final String contextSource = CONTEXT_HEAD_WITH_ATTRIBUTE +
CONTEXT_DESCRIPTION +
Expand All @@ -432,6 +432,5 @@ public void testCopyContextWithAttribute() {
assertEquals("abc", context1.getAttribute("att"));
assertEquals("abc", context2.getAttribute("att"));
}
*/

}
2 changes: 1 addition & 1 deletion ua/org.eclipse.ua.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.ua.tests</artifactId>
<version>3.7.400-SNAPSHOT</version>
<version>3.7.500-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<properties>
Expand Down
Loading