Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java3
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java7
-rw-r--r--org.eclipse.help/schema/contexts.exsd2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/TocContribution.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java25
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java111
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextManager.java59
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/dynamic/ValidationHandler.java80
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtension.java11
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java51
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java24
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java43
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java16
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java46
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java29
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java62
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java28
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java28
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java16
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java62
-rw-r--r--org.eclipse.ua.tests/data/help/dynamic/extension/extension.xml52
-rw-r--r--org.eclipse.ua.tests/data/help/dynamic/include/extension.xml4
-rw-r--r--org.eclipse.ua.tests/data/help/dynamic/shared/extension.xml16
-rw-r--r--org.eclipse.ua.tests/data/help/index/assembler/result_a_b_c.xml18
-rw-r--r--org.eclipse.ua.tests/data/help/index/tocIgnored.xml11
-rw-r--r--org.eclipse.ua.tests/data/help/search/extension.xml2
-rw-r--r--org.eclipse.ua.tests/data/help/search/extension2.xml2
-rw-r--r--org.eclipse.ua.tests/plugin.xml1
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java6
30 files changed, 434 insertions, 389 deletions
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
index 8eebe11e2..731f4a176 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/HelpProperties.java
@@ -72,8 +72,7 @@ public class HelpProperties extends Properties {
super.load(in);
loaded = true;
} catch (IOException ioe00) {
- HelpPlugin.logError("File " + file.getName() + " cannot be read.", //$NON-NLS-1$ //$NON-NLS-2$
- null);
+ HelpPlugin.logError("File " + file.getName() + " cannot be read."); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
if (in != null)
try {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
index c03f2a437..41e37bb67 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/workingset/WorkingSetManager.java
@@ -319,13 +319,12 @@ public class WorkingSetManager implements IHelpWorkingSetManager {
"DocumentBuilder implementation could not be loaded.", pce); //$NON-NLS-1$
return false;
} catch (TransformerException e) {
- HelpPlugin.logError("Problems occurred while saving working sets.", //$NON-NLS-1$
- null);
+ HelpPlugin.logError("Problems occurred while saving working sets."); //$NON-NLS-1$
return false;
} catch (IOException e) {
stateFile.delete();
- HelpBasePlugin.logError(
- "Problems occurred while saving working set file.", null); //$NON-NLS-1$
+ HelpPlugin.logError(
+ "Problems occurred while saving working set file."); //$NON-NLS-1$
return false;
}
}
diff --git a/org.eclipse.help/schema/contexts.exsd b/org.eclipse.help/schema/contexts.exsd
index 245d7313f..ec35f4587 100644
--- a/org.eclipse.help/schema/contexts.exsd
+++ b/org.eclipse.help/schema/contexts.exsd
@@ -63,7 +63,7 @@ contexts manifest file:</b></i>
<p><tt>    <!ELEMENT description (#PCDATA)></tt>
<p><tt>    <!ELEMENT topic EMPTY ></tt>
<br><tt>    <!ATTLIST topic label CDATA #REQUIRED ></tt>
-<br><tt>    <!ATTLIST topic href CDATA #IMPLIED ></tt>
+<br><tt>    <!ATTLIST topic href CDATA #REQUIRED ></tt>
<p>The contexts manifest files provide all the information needed when
context-sensitive help is requested by the user. The id is passed by the
platform to the help system to identify the currently active context.The context definitions with matching IDs are then retrieved. The IDs in the manifest file, must not contain the period character, since the IDs are uniquely identified by pluginID.contextID string when in memory. The IContext object is then created by help system that contains descriptions and topics from all context definitions for a given ID in a plug-in.  The description is to be displayed to the user, and
diff --git a/org.eclipse.help/src/org/eclipse/help/TocContribution.java b/org.eclipse.help/src/org/eclipse/help/TocContribution.java
index 10d7e2f2b..3a85eff8c 100644
--- a/org.eclipse.help/src/org/eclipse/help/TocContribution.java
+++ b/org.eclipse.help/src/org/eclipse/help/TocContribution.java
@@ -104,7 +104,7 @@ public class TocContribution extends Node {
*/
public Node getToc() {
Node[] children = getChildNodes();
- if (children.length > 0 && Toc.NAME.equals(children[0].getNodeName())) {
+ if (children.length > 0) {
return children[0];
}
return null;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
index 1973295a5..4b6595b7b 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java
@@ -39,21 +39,26 @@ public class HelpPlugin extends Plugin {
private ContentExtensionManager contentExtensionManager;
private IndexManager indexManager;
private IHelpProvider helpProvider;
-
- /**
- * Logs an Error message with an exception.
- */
- public static synchronized void logError(String message, Throwable ex) {
- if (message == null)
+
+ public static void logWarning(String message) {
+ Status errorStatus = new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null);
+ logStatus(errorStatus);
+ }
+
+ public static void logError(String message) {
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, null);
+ logStatus(errorStatus);
+ }
+
+ public static void logError(String message, Throwable ex) {
+ if (message == null) {
message = ""; //$NON-NLS-1$
+ }
Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, ex);
logStatus(errorStatus);
}
- /**
- * Logs an IStatus
- */
- private static void logStatus(IStatus errorStatus) {
+ private static synchronized void logStatus(IStatus errorStatus) {
HelpPlugin.getDefault().getLog().log(errorStatus);
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
index a81ab0c10..76e73b35f 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.help.internal.context;
+import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
@@ -28,6 +29,7 @@ import org.eclipse.help.internal.dynamic.NodeHandler;
import org.eclipse.help.internal.dynamic.NodeProcessor;
import org.eclipse.help.internal.dynamic.NodeReader;
import org.eclipse.help.internal.dynamic.NodeWriter;
+import org.eclipse.help.internal.dynamic.ValidationHandler;
import org.eclipse.help.internal.toc.HrefUtil;
import org.eclipse.help.internal.util.ResourceLocator;
@@ -55,6 +57,7 @@ public class ContextFileProvider extends AbstractContextProvider {
private NodeProcessor processor;
private NodeReader reader;
private NodeWriter writer;
+ private Map requiredAttributes;
/* (non-Javadoc)
* @see org.eclipse.help.AbstractContextProvider#getContext(java.lang.String, java.lang.String)
@@ -106,26 +109,20 @@ public class ContextFileProvider extends AbstractContextProvider {
if (ELEMENT_CONTEXTS.equals(elements[i].getName())) {
String declaringPluginId = elements[i].getDeclaringExtension().getContributor().getName();
String file = elements[i].getAttribute(ATTRIBUTE_FILE);
- if (file != null) {
- String plugin = elements[i].getAttribute(ATTRIBUTE_PLUGIN);
- String targetPluginId = (plugin == null ? declaringPluginId : plugin);
- ContextFile descriptor = new ContextFile(declaringPluginId, file);
- ContextFile[] descriptors = (ContextFile[])descriptorsByPluginId.get(targetPluginId);
- if (descriptors == null) {
- descriptors = new ContextFile[] { descriptor };
- }
- else {
- ContextFile[] temp = new ContextFile[descriptors.length + 1];
- System.arraycopy(descriptors, 0, temp, 0, descriptors.length);
- temp[descriptors.length] = descriptor;
- descriptors = temp;
- }
- descriptorsByPluginId.put(targetPluginId, descriptors);
+ String plugin = elements[i].getAttribute(ATTRIBUTE_PLUGIN);
+ String targetPluginId = (plugin == null ? declaringPluginId : plugin);
+ ContextFile descriptor = new ContextFile(declaringPluginId, file);
+ ContextFile[] descriptors = (ContextFile[])descriptorsByPluginId.get(targetPluginId);
+ if (descriptors == null) {
+ descriptors = new ContextFile[] { descriptor };
}
else {
- String msg = "Required attribute \"" + ATTRIBUTE_FILE + "\" missing from element \"" + ELEMENT_CONTEXTS + "\" of extension for extension point \"" + EXTENSION_POINT_CONTEXTS + "\" in plug-in \"" + declaringPluginId + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- HelpPlugin.logError(msg, null);
+ ContextFile[] temp = new ContextFile[descriptors.length + 1];
+ System.arraycopy(descriptors, 0, temp, 0, descriptors.length);
+ temp[descriptors.length] = descriptor;
+ descriptors = temp;
}
+ descriptorsByPluginId.put(targetPluginId, descriptors);
}
}
}
@@ -181,41 +178,63 @@ public class ContextFileProvider extends AbstractContextProvider {
try {
// load the file
InputStream in = ResourceLocator.openFromPlugin(descriptor.getBundleId(), descriptor.getFile(), locale);
- if (reader == null) {
- reader = new NodeReader();
- reader.setIgnoreWhitespaceNodes(true);
- }
- Node root = reader.read(in);
-
- // process dynamic content
- if (processor == null) {
- processor = new NodeProcessor(new NodeHandler[] {
- new NormalizeHandler(),
- new IncludeHandler(reader, locale),
- new ExtensionHandler(reader, locale)
- });
- }
- processor.process(root, '/' + descriptor.getBundleId() + '/' + descriptor.getFile());
-
- // build map
- Node[] children = root.getChildNodes();
- Map contexts = new HashMap();
- for (int i=0;i<children.length;++i) {
- if (ELEMENT_CONTEXT.equals(children[i].getNodeName())) {
- Context context = children[i] instanceof Context ? (Context)children[i] : new Context(children[i]);
- String id = context.getId();
- if (id != null) {
- contexts.put(id, context);
+ if (in != null) {
+ if (reader == null) {
+ reader = new NodeReader();
+ reader.setIgnoreWhitespaceNodes(true);
+ }
+ Node root = reader.read(in);
+ if ("contexts".equals(root.getNodeName())) { //$NON-NLS-1$
+ // process dynamic content
+ if (processor == null) {
+ processor = new NodeProcessor(new NodeHandler[] {
+ new ValidationHandler(getRequiredAttributes()),
+ new NormalizeHandler(),
+ new IncludeHandler(reader, locale),
+ new ExtensionHandler(reader, locale)
+ });
+ }
+ processor.process(root, '/' + descriptor.getBundleId() + '/' + descriptor.getFile());
+
+ // build map
+ Node[] children = root.getChildNodes();
+ Map contexts = new HashMap();
+ for (int i=0;i<children.length;++i) {
+ if (ELEMENT_CONTEXT.equals(children[i].getNodeName())) {
+ Context context = children[i] instanceof Context ? (Context)children[i] : new Context(children[i]);
+ String id = context.getId();
+ if (id != null) {
+ contexts.put(id, context);
+ }
+ }
}
+ return contexts;
}
- }
- return contexts;
+ else {
+ String msg = "Required root element \"contexts\" missing from context-sensitive help file \"/" + descriptor.getBundleId() + '/' + descriptor.getFile() + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg);
+ }
+ }
+ else {
+ throw new FileNotFoundException();
+ }
}
catch (Throwable t) {
- String msg = "Error loading context-sensitive help file \"" + descriptor.getFile() + "\" in plug-in \"" + descriptor.getBundleId() + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String msg = "Error reading context-sensitive help file /\"" + descriptor.getBundleId() + '/' + descriptor.getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
- return null;
}
+ return null;
+ }
+
+ private Map getRequiredAttributes() {
+ if (requiredAttributes == null) {
+ requiredAttributes = new HashMap();
+ requiredAttributes.put(Context.NAME, new String[] { Context.ATTRIBUTE_ID });
+ requiredAttributes.put(Topic.NAME, new String[] { Topic.ATTRIBUTE_LABEL, Topic.ATTRIBUTE_HREF });
+ requiredAttributes.put("anchor", new String[] { "id" }); //$NON-NLS-1$ //$NON-NLS-2$
+ requiredAttributes.put("include", new String[] { "path" }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return requiredAttributes;
}
/*
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 91abef21e..40ece8a6d 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
@@ -19,7 +19,6 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.AbstractContextProvider;
import org.eclipse.help.IContext;
@@ -121,53 +120,29 @@ public class ContextManager {
IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_CONTEXT);
for (int i=0;i<elements.length;++i) {
IConfigurationElement elem = elements[i];
- try {
- if (elem.getName().equals(ELEMENT_NAME_CONTEXT_PROVIDER)) {
- String className = elem.getAttribute(ATTRIBUTE_NAME_CLASS);
- if (className != null) {
- try {
- AbstractContextProvider provider = (AbstractContextProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
- String[] plugins = provider.getPlugins();
- if (plugins != null) {
- for (int j=0;j<plugins.length;++j) {
- List list = (List)providersByPluginId.get(plugins[j]);
- if (list == null) {
- list = new ArrayList();
- providersByPluginId.put(plugins[j], list);
- }
- list.add(provider);
- }
- }
- else {
- globalProviders.add(provider);
+ if (elem.getName().equals(ELEMENT_NAME_CONTEXT_PROVIDER)) {
+ try {
+ AbstractContextProvider provider = (AbstractContextProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
+ String[] plugins = provider.getPlugins();
+ if (plugins != null) {
+ for (int j=0;j<plugins.length;++j) {
+ List list = (List)providersByPluginId.get(plugins[j]);
+ if (list == null) {
+ list = new ArrayList();
+ providersByPluginId.put(plugins[j], list);
}
- }
- catch (CoreException e) {
- // log and skip
- String msg = "Error instantiating " + ELEMENT_NAME_CONTEXT_PROVIDER + " class"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, e);
- }
- catch (ClassCastException e) {
- // log and skip
- String msg = ELEMENT_NAME_CONTEXT_PROVIDER + " class must implement " + AbstractContextProvider.class.getName(); //$NON-NLS-1$
- HelpPlugin.logError(msg, e);
+ list.add(provider);
}
}
else {
- // log the missing class attribute and skip
- String msg = ELEMENT_NAME_CONTEXT_PROVIDER + " element of extension point " + EXTENSION_POINT_ID_CONTEXT + " must specify a " + ATTRIBUTE_NAME_CLASS + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
+ globalProviders.add(provider);
}
}
- }
- catch (InvalidRegistryObjectException e) {
- // no longer valid; skip it
+ catch (CoreException e) {
+ // log and skip
+ String msg = "Error instantiating context-sensitive help provider class \"" + elem.getAttribute(ATTRIBUTE_NAME_CLASS) + '"'; //$NON-NLS-1$
+ HelpPlugin.logError(msg, e);
+ }
}
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ValidationHandler.java b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ValidationHandler.java
new file mode 100644
index 000000000..235ede286
--- /dev/null
+++ b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/ValidationHandler.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.dynamic;
+
+import java.util.Map;
+
+import org.eclipse.help.Node;
+import org.eclipse.help.TocContribution;
+import org.eclipse.help.internal.HelpPlugin;
+
+/*
+ * A handler that ensures that specified attributes are there for certain nodes,
+ * or removes the node and logs an error. Also logs warnings for deprecated elements.
+ */
+public class ValidationHandler extends NodeHandler {
+
+ private Map requiredAttributes;
+ private Map deprecatedElements;
+
+ /*
+ * Creates a new validator that looks for the given mapping of
+ * element names to required attribute names.
+ */
+ public ValidationHandler(Map requiredAttributes) {
+ this(requiredAttributes, null);
+ }
+
+ /*
+ * Creates a new validator that looks for the given mapping of
+ * element names to required attribute names, as well as a mapping
+ * of deprecated element names to suggested new element names.
+ */
+ public ValidationHandler(Map requiredAttributes, Map deprecatedElements) {
+ this.requiredAttributes = requiredAttributes;
+ this.deprecatedElements = deprecatedElements;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.help.internal.dynamic.NodeHandler#handle(org.eclipse.help.Node, java.lang.String)
+ */
+ public short handle(Node node, String id) {
+ if (deprecatedElements != null) {
+ String suggestion = (String)deprecatedElements.get(node.getNodeName());
+ if (suggestion != null) {
+ String msg = "The \"" + node.getNodeName() + "\" element is deprecated in \"" + id + "\"; use \"" + suggestion + "\" instead."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ HelpPlugin.logWarning(msg);
+ }
+ }
+ String[] attributes = (String[])requiredAttributes.get(node.getNodeName());
+ if (attributes != null) {
+ for (int i=0;i<attributes.length;++i) {
+ if (node.getAttribute(attributes[i]) == null) {
+ String msg = "Required attribute \"" + attributes[i] + "\" missing from \"" + node.getNodeName() + "\" element"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (id != null) {
+ msg += " in \"" + id + '"'; //$NON-NLS-1$
+ }
+ Node parent = node.getParentNode();
+ if (parent != null && !(parent instanceof TocContribution)) {
+ msg += " (skipping element)"; //$NON-NLS-1$
+ parent.removeChild(node);
+ HelpPlugin.logError(msg);
+ return HANDLED_SKIP;
+ }
+ else {
+ throw new IllegalArgumentException(msg);
+ }
+ }
+ }
+ }
+ return UNHANDLED;
+ }
+}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtension.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtension.java
index 39309e792..160a1e4b3 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtension.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtension.java
@@ -19,11 +19,12 @@ import org.eclipse.help.internal.NodeAdapter;
*/
public class ContentExtension extends NodeAdapter {
- private static final String NAME_CONTRIBUTION = "contribution"; //$NON-NLS-1$
- private static final String NAME_REPLACEMENT = "replacement"; //$NON-NLS-1$
- private static final String NAME_CONTRIBUTION_LEGACY = "topicExtension"; //$NON-NLS-1$
- private static final String ATTRIBUTE_CONTENT = "content"; //$NON-NLS-1$
- private static final String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
+ public static final String NAME_CONTRIBUTION = "contribution"; //$NON-NLS-1$
+ public static final String NAME_CONTRIBUTION_LEGACY = "topicExtension"; //$NON-NLS-1$
+ public static final String NAME_REPLACEMENT = "replacement"; //$NON-NLS-1$
+ public static final String NAME_REPLACEMENT_LEGACY = "topicReplace"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_CONTENT = "content"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
// type for contribution into anchor
public static final int CONTRIBUTION = 0;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
index 1d8bd4dcc..a08b6ca8e 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
@@ -10,14 +10,21 @@
*******************************************************************************/
package org.eclipse.help.internal.extension;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.help.Node;
+import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.help.internal.dynamic.NodeHandler;
+import org.eclipse.help.internal.dynamic.NodeProcessor;
import org.eclipse.help.internal.dynamic.NodeReader;
+import org.eclipse.help.internal.dynamic.ValidationHandler;
import org.osgi.framework.Bundle;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -28,7 +35,10 @@ import org.xml.sax.helpers.DefaultHandler;
public class ContentExtensionFileParser extends DefaultHandler {
private NodeReader reader;
-
+ private NodeProcessor processor;
+ private Map requiredAttributes;
+ private Map deprecatedElements;
+
/*
* Parses the specified content extension XML file into model elements.
*/
@@ -41,8 +51,43 @@ public class ContentExtensionFileParser extends DefaultHandler {
if (url != null) {
InputStream in = url.openStream();
Node node = reader.read(in);
- return node.getChildNodes();
+ if ("contentExtension".equals(node.getNodeName())) { //$NON-NLS-1$
+ if (processor == null) {
+ processor = new NodeProcessor(new NodeHandler[] {
+ new ValidationHandler(getRequiredAttributes(), getDeprecatedElements())
+ });
+ }
+ processor.process(node, '/' + bundle.getSymbolicName() + '/' + path);
+ return node.getChildNodes();
+ }
+ else {
+ String msg = "Required root element \"contentExtension\" missing from user assistance content extension file \"/" + bundle.getSymbolicName() + '/' + path + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg);
+ return new Node[0];
+ }
+ }
+ else {
+ throw new FileNotFoundException();
}
- return new Node[0];
}
+
+ private Map getRequiredAttributes() {
+ if (requiredAttributes == null) {
+ requiredAttributes = new HashMap();
+ requiredAttributes.put(ContentExtension.NAME_CONTRIBUTION, new String[] { ContentExtension.ATTRIBUTE_CONTENT, ContentExtension.ATTRIBUTE_PATH });
+ requiredAttributes.put(ContentExtension.NAME_CONTRIBUTION_LEGACY, new String[] { ContentExtension.ATTRIBUTE_CONTENT, ContentExtension.ATTRIBUTE_PATH });
+ requiredAttributes.put(ContentExtension.NAME_REPLACEMENT, new String[] { ContentExtension.ATTRIBUTE_CONTENT, ContentExtension.ATTRIBUTE_PATH });
+ requiredAttributes.put(ContentExtension.NAME_REPLACEMENT_LEGACY, new String[] { ContentExtension.ATTRIBUTE_CONTENT, ContentExtension.ATTRIBUTE_PATH });
+ }
+ return requiredAttributes;
+ }
+
+ private Map getDeprecatedElements() {
+ if (deprecatedElements == null) {
+ deprecatedElements = new HashMap();
+ deprecatedElements.put(ContentExtension.NAME_CONTRIBUTION_LEGACY, ContentExtension.NAME_CONTRIBUTION);
+ deprecatedElements.put(ContentExtension.NAME_REPLACEMENT_LEGACY, ContentExtension.NAME_REPLACEMENT);
+ }
+ return deprecatedElements;
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java
index 89038d194..7f41394f4 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileProvider.java
@@ -45,21 +45,19 @@ public class ContentExtensionFileProvider extends AbstractContentExtensionProvid
String file = elements[i].getAttribute(ATTRIBUTE_FILE);
String bundleId = elements[i].getContributor().getName();
Bundle bundle = Platform.getBundle(bundleId);
- if (bundle != null) {
- try {
- Node[] ext = parser.parse(bundle, file);
- for (int j=0;j<ext.length;++j) {
- String content = ext[j].getAttribute(ATTRIBUTE_CONTENT);
- if (content != null) {
- ext[j].setAttribute(ATTRIBUTE_CONTENT, '/' + bundleId + '/' + content);
- }
- extensions.add(ext[j]);
+ try {
+ Node[] ext = parser.parse(bundle, file);
+ for (int j=0;j<ext.length;++j) {
+ String content = ext[j].getAttribute(ATTRIBUTE_CONTENT);
+ if (content != null) {
+ ext[j].setAttribute(ATTRIBUTE_CONTENT, '/' + bundleId + '/' + content);
}
+ extensions.add(ext[j]);
}
- catch (Throwable t) {
- String msg = "Unable to load user assistance content extension " + file + " from plug-in " + bundleId; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, t);
- }
+ }
+ catch (Throwable t) {
+ String msg = "Error reading user assistance content extension file /\"" + bundleId + '/' + file + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg, t);
}
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java
index 4c3962d49..57a39c09d 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionManager.java
@@ -20,7 +20,6 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.AbstractContentExtensionProvider;
import org.eclipse.help.Node;
@@ -145,40 +144,16 @@ public class ContentExtensionManager {
IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_CONTENT_EXTENSION);
for (int i=0;i<elements.length;++i) {
IConfigurationElement elem = elements[i];
- try {
- if (elem.getName().equals(ELEMENT_NAME_CONTENT_EXTENSION_PROVIDER)) {
- String className = elem.getAttribute(ATTRIBUTE_NAME_CLASS);
- if (className != null) {
- try {
- AbstractContentExtensionProvider provider = (AbstractContentExtensionProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
- providers.add(provider);
- }
- catch (CoreException e) {
- // log and skip
- String msg = "Error instantiating " + ELEMENT_NAME_CONTENT_EXTENSION_PROVIDER + " class"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, e);
- }
- catch (ClassCastException e) {
- // log and skip
- String msg = ELEMENT_NAME_CONTENT_EXTENSION_PROVIDER + " class must implement " + AbstractContentExtensionProvider.class.getName(); //$NON-NLS-1$
- HelpPlugin.logError(msg, e);
- }
- }
- else {
- // log the missing class attribute and skip
- String msg = ELEMENT_NAME_CONTENT_EXTENSION_PROVIDER + " element of extension point " + EXTENSION_POINT_ID_CONTENT_EXTENSION + " must specify a " + ATTRIBUTE_NAME_CLASS + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
- }
+ if (elem.getName().equals(ELEMENT_NAME_CONTENT_EXTENSION_PROVIDER)) {
+ try {
+ AbstractContentExtensionProvider provider = (AbstractContentExtensionProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
+ providers.add(provider);
+ }
+ catch (CoreException e) {
+ // log and skip
+ String msg = "Error instantiating user assistance content extension provider class \"" + elem.getAttribute(ATTRIBUTE_NAME_CLASS) + '"'; //$NON-NLS-1$
+ HelpPlugin.logError(msg, e);
}
- }
- catch (InvalidRegistryObjectException e) {
- // no longer valid; skip it
}
}
contentExtensionProviders = (AbstractContentExtensionProvider[])providers.toArray(new AbstractContentExtensionProvider[providers.size()]);
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 e6f940082..98dced092 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
@@ -30,6 +30,7 @@ import org.eclipse.help.internal.dynamic.IncludeHandler;
import org.eclipse.help.internal.dynamic.NodeHandler;
import org.eclipse.help.internal.dynamic.NodeProcessor;
import org.eclipse.help.internal.dynamic.NodeReader;
+import org.eclipse.help.internal.dynamic.ValidationHandler;
import org.eclipse.help.internal.toc.HrefUtil;
/*
@@ -41,6 +42,7 @@ public class IndexAssembler {
private NodeProcessor processor;
private Comparator comparator;
private String locale;
+ private Map requiredAttributes;
/*
* Assembles the given index contributions into a complete, sorted index.
@@ -120,8 +122,9 @@ public class IndexAssembler {
NodeReader reader = new NodeReader();
reader.setIgnoreWhitespaceNodes(true);
processor = new NodeProcessor(new NodeHandler[] {
- new LabelHandler(),
+ new ValidationHandler(getRequiredAttributes()),
new NormalizeHandler(),
+ new LabelHandler(),
new IncludeHandler(reader, locale),
new ExtensionHandler(reader, locale),
});
@@ -163,6 +166,17 @@ public class IndexAssembler {
}
}
+ private Map getRequiredAttributes() {
+ if (requiredAttributes == null) {
+ requiredAttributes = new HashMap();
+ requiredAttributes.put(IndexEntry.NAME, new String[] { IndexEntry.ATTRIBUTE_KEYWORD });
+ requiredAttributes.put(Topic.NAME, new String[] { Topic.ATTRIBUTE_HREF });
+ requiredAttributes.put("anchor", new String[] { "id" }); //$NON-NLS-1$ //$NON-NLS-2$
+ requiredAttributes.put("include", new String[] { "path" }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return requiredAttributes;
+ }
+
/*
* Normalizes topic hrefs, by prepending the plug-in id to form an href.
* e.g. "path/myfile.html" -> "/my.plugin/path/myfile.html"
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
index 850debe0a..fe5fd6d0c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
@@ -11,58 +11,38 @@
*******************************************************************************/
package org.eclipse.help.internal.index;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.help.IndexContribution;
import org.eclipse.help.Node;
-import org.eclipse.help.internal.Topic;
-import org.eclipse.help.internal.dynamic.NodeHandler;
-import org.eclipse.help.internal.dynamic.NodeProcessor;
import org.eclipse.help.internal.dynamic.NodeReader;
-import org.eclipse.help.internal.toc.HrefUtil;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class IndexFileParser extends DefaultHandler {
private NodeReader reader;
- private NodeProcessor processor;
public IndexContribution parse(IndexFile indexFile) throws IOException, SAXException, ParserConfigurationException {
if (reader == null) {
reader = new NodeReader();
reader.setIgnoreWhitespaceNodes(true);
}
- Node node = reader.read(indexFile.getInputStream());
- if (processor == null) {
- processor = new NodeProcessor(new NodeHandler[] {
- new NormalizeHandler()
- });
+ InputStream in = indexFile.getInputStream();
+ if (in != null) {
+ Node node = reader.read(indexFile.getInputStream());
+ IndexContribution contribution = new IndexContribution();
+ contribution.setId('/' + indexFile.getPluginId() + '/' + indexFile.getFile());
+ contribution.setIndex(node);
+ contribution.setLocale(indexFile.getLocale());
+ return contribution;
+ }
+ else {
+ throw new FileNotFoundException();
}
- processor.process(node, indexFile.getPluginId());
- IndexContribution contribution = new IndexContribution();
- contribution.setId('/' + indexFile.getPluginId() + '/' + indexFile.getFile());
- contribution.setIndex(node);
- contribution.setLocale(indexFile.getLocale());
- return contribution;
}
-
- /*
- * Normalizes topic hrefs, by prepending the plug-in id to form an href.
- * e.g. "path/myfile.html" -> "/my.plugin/path/myfile.html"
- */
- private class NormalizeHandler extends NodeHandler {
- public short handle(Node node, String id) {
- if (Topic.NAME.equals(node.getNodeName())) {
- String href = node.getAttribute(Topic.ATTRIBUTE_HREF);
- if (href != null) {
- node.setAttribute(Topic.ATTRIBUTE_HREF, HrefUtil.normalizeHref(id, href));
- }
- return HANDLED_CONTINUE;
- }
- return UNHANDLED;
- }
- }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
index 443a732e7..8f1f5cb80 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
@@ -15,7 +15,6 @@ import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.AbstractIndexProvider;
import org.eclipse.help.IndexContribution;
@@ -43,8 +42,8 @@ public class IndexFileProvider extends AbstractIndexProvider {
contributions.add(toc);
}
catch (Throwable t) {
- String msg = "Error reading index file \"" + indexFiles[i].getFile() + "\" in extension specified in plug-in: " + indexFiles[i].getPluginId(); //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, null);
+ String msg = "Error reading help keyword index file /\"" + indexFiles[i].getPluginId() + '/' + indexFiles[i].getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg, t);
}
}
return (IndexContribution[])contributions.toArray(new IndexContribution[contributions.size()]);
@@ -59,31 +58,9 @@ public class IndexFileProvider extends AbstractIndexProvider {
IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_INDEX);
for (int i=0;i<elements.length;++i) {
IConfigurationElement elem = elements[i];
- String pluginId;
- try {
- pluginId = elem.getNamespaceIdentifier();
- }
- catch (InvalidRegistryObjectException e) {
- // no longer valid; skip it
- continue;
- }
-
+ String pluginId = elem.getContributor().getName();
if (elem.getName().equals(ELEMENT_NAME_INDEX)) {
String file = elem.getAttribute(ATTRIBUTE_NAME_FILE);
-
- if (file == null) {
- // log and skip
- String msg = ELEMENT_NAME_INDEX + " element for extension point " + EXTENSION_POINT_ID_INDEX + " must specify a " + ATTRIBUTE_NAME_FILE + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
- continue;
- }
-
IndexFile indexFile = new IndexFile(pluginId, file, locale);
indexFiles.add(indexFile);
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
index bc337cea2..ac713ec7d 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
@@ -25,7 +25,6 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.help.AbstractIndexProvider;
@@ -71,15 +70,26 @@ public class IndexManager {
}
catch (Throwable t) {
// log, and skip the offending provider
- String msg = "Error getting " + IndexContribution.class.getName() + " from " + AbstractIndexProvider.class.getName() + ": " + providers[i].getClass().getName(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String msg = "Error getting help keyword index data from provider: " + providers[i].getClass().getName() + " (skipping provider)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
continue;
}
- // check for nulls
+ // check for nulls and root element
for (int j=0;j<contrib.length;++j) {
- // null means no contribution
- if (contrib[j] != null) {
+ if (contrib[j] == null) {
+ String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a null contribution (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg);
+ }
+ else if (contrib[j].getIndex() == null) {
+ String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a contribution with a null root element (expected a \"" + Index.NAME + "\" element; skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ HelpPlugin.logError(msg);
+ }
+ else if (!Index.NAME.equals(contrib[j].getIndex().getNodeName())) {
+ String msg = "Required root element \"" + Index.NAME + "\" missing from help keyword index \"" + contrib[j].getId() + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ HelpPlugin.logError(msg);
+ }
+ else {
contributions.add(contrib[j]);
}
}
@@ -109,40 +119,16 @@ public class IndexManager {
IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_INDEX);
for (int i=0;i<elements.length;++i) {
IConfigurationElement elem = elements[i];
- try {
- if (elem.getName().equals(ELEMENT_NAME_INDEX_PROVIDER)) {
- String className = elem.getAttribute(ATTRIBUTE_NAME_CLASS);
- if (className != null) {
- try {
- AbstractIndexProvider provider = (AbstractIndexProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
- providers.add(provider);
- }
- catch (CoreException e) {
- // log and skip
- String msg = "Error instantiating " + ELEMENT_NAME_INDEX_PROVIDER + " class"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, e);
- }
- catch (ClassCastException e) {
- // log and skip
- String msg = ELEMENT_NAME_INDEX_PROVIDER + " class must implement " + AbstractIndexProvider.class.getName(); //$NON-NLS-1$
- HelpPlugin.logError(msg, e);
- }
- }
- else {
- // log the missing class attribute and skip
- String msg = ELEMENT_NAME_INDEX_PROVIDER + " element of extension point " + EXTENSION_POINT_ID_INDEX + " must specify a " + ATTRIBUTE_NAME_CLASS + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
- }
+ if (elem.getName().equals(ELEMENT_NAME_INDEX_PROVIDER)) {
+ try {
+ AbstractIndexProvider provider = (AbstractIndexProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
+ providers.add(provider);
+ }
+ catch (CoreException e) {
+ // log and skip
+ String msg = "Error instantiating help keyword index provider class \"" + elem.getAttribute(ATTRIBUTE_NAME_CLASS) + '"'; //$NON-NLS-1$
+ HelpPlugin.logError(msg, e);
}
- }
- catch (InvalidRegistryObjectException e) {
- // no longer valid; skip it
}
}
indexProviders = (AbstractIndexProvider[])providers.toArray(new AbstractIndexProvider[providers.size()]);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
index 6348a6429..26f08199c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
@@ -16,17 +16,20 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.help.Node;
import org.eclipse.help.TocContribution;
+import org.eclipse.help.internal.HelpPlugin;
import org.eclipse.help.internal.Topic;
import org.eclipse.help.internal.dynamic.ExtensionHandler;
import org.eclipse.help.internal.dynamic.IncludeHandler;
import org.eclipse.help.internal.dynamic.NodeHandler;
import org.eclipse.help.internal.dynamic.NodeProcessor;
import org.eclipse.help.internal.dynamic.NodeReader;
+import org.eclipse.help.internal.dynamic.ValidationHandler;
/*
* Assembles toc contributions (toc fragments) into complete, linked, and
@@ -47,6 +50,7 @@ public class TocAssembler {
private Map contributionsById;
private Map contributionsByLinkTo;
private Set processedContributions;
+ private Map requiredAttributes;
/*
* Assembles the given toc contributions into complete, linked
@@ -137,6 +141,7 @@ public class TocAssembler {
}
final Set linkedContributionIds = new HashSet();
NodeHandler[] linkFinder = new NodeHandler[] {
+ new ValidationHandler(getRequiredAttributes()),
new NodeHandler() {
public short handle(Node node, String id) {
if (ELEMENT_LINK.equals(node.getNodeName())) {
@@ -151,10 +156,17 @@ public class TocAssembler {
}
};
processor.setHandlers(linkFinder);
- Iterator iter = contributions.iterator();
+ ListIterator iter = contributions.listIterator();
while (iter.hasNext()) {
TocContribution contrib = (TocContribution)iter.next();
- processor.process(contrib.getToc(), contrib.getId());
+ try {
+ processor.process(contrib.getToc(), contrib.getId());
+ }
+ catch (Throwable t) {
+ iter.remove();
+ String msg = "Error processing help table of contents: " + contrib.getId() + " (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg, t);
+ }
}
return linkedContributionIds;
}
@@ -246,6 +258,18 @@ public class TocAssembler {
return contributions;
}
+ private Map getRequiredAttributes() {
+ if (requiredAttributes == null) {
+ requiredAttributes = new HashMap();
+ requiredAttributes.put(Toc.NAME, new String[] { Toc.ATTRIBUTE_LABEL });
+ requiredAttributes.put(Topic.NAME, new String[] { Topic.ATTRIBUTE_LABEL });
+ requiredAttributes.put("anchor", new String[] { "id" }); //$NON-NLS-1$ //$NON-NLS-2$
+ requiredAttributes.put("include", new String[] { "path" }); //$NON-NLS-1$ //$NON-NLS-2$
+ requiredAttributes.put("link", new String[] { "toc" }); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return requiredAttributes;
+ }
+
/*
* Adds the given extra documents to the contribution.
*/
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 2619750c6..8f3ffbd5f 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
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.help.internal.toc;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import javax.xml.parsers.ParserConfigurationException;
@@ -32,15 +34,21 @@ public class TocFileParser extends DefaultHandler {
reader = new NodeReader();
reader.setIgnoreWhitespaceNodes(true);
}
- Node node = reader.read(tocFile.getInputStream());
- TocContribution contribution = new TocContribution();
- contribution.setCategoryId(tocFile.getCategory());
- contribution.setContributorId(tocFile.getPluginId());
- contribution.setExtraDocuments(DocumentFinder.collectExtraDocuments(tocFile));
- contribution.setId(HrefUtil.normalizeHref(tocFile.getPluginId(), tocFile.getFile()));
- contribution.setLocale(tocFile.getLocale());
- contribution.setPrimary(tocFile.isPrimary());
- contribution.setToc(node);
- return contribution;
+ InputStream in = tocFile.getInputStream();
+ if (in != null) {
+ Node node = reader.read(in);
+ TocContribution contribution = new TocContribution();
+ contribution.setCategoryId(tocFile.getCategory());
+ contribution.setContributorId(tocFile.getPluginId());
+ contribution.setExtraDocuments(DocumentFinder.collectExtraDocuments(tocFile));
+ contribution.setId(HrefUtil.normalizeHref(tocFile.getPluginId(), tocFile.getFile()));
+ contribution.setLocale(tocFile.getLocale());
+ contribution.setPrimary(tocFile.isPrimary());
+ contribution.setToc(node);
+ return contribution;
+ }
+ else {
+ throw new FileNotFoundException();
+ }
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
index 79e11afe5..b0b33e353 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
@@ -46,7 +46,7 @@ public class TocFileProvider extends AbstractTocProvider {
contributions.add(toc);
}
catch (Throwable t) {
- String msg = "Error reading toc file \"" + tocFiles[i].getFile() + "\" in extension specified in plug-in: " + tocFiles[i].getPluginId(); //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = "Error reading help table of contents file /\"" + tocFiles[i].getPluginId() + '/' + tocFiles[i].getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
}
}
@@ -76,20 +76,6 @@ public class TocFileProvider extends AbstractTocProvider {
boolean primary = Boolean.toString(true).equals(elem.getAttribute(ATTRIBUTE_NAME_PRIMARY));
String extradir = elem.getAttribute(ATTRIBUTE_NAME_EXTRADIR);
String category = elem.getAttribute(ATTRIBUTE_NAME_CATEGORY);
-
- if (file == null) {
- // log and skip
- String msg = ELEMENT_NAME_TOC + " element for extension point " + EXTENSION_POINT_ID_TOC + " must specify a " + ATTRIBUTE_NAME_FILE + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
- continue;
- }
-
TocFile tocFile = new TocFile(pluginId, file, primary, locale, extradir, category);
tocFiles.add(tocFile);
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
index 37c487c0b..7a00f73e9 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
@@ -23,7 +23,6 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.help.AbstractTocProvider;
@@ -115,15 +114,26 @@ public class TocManager {
}
catch (Throwable t) {
// log, and skip the offending provider
- String msg = "Error getting " + TocContribution.class.getName() + " from " + AbstractTocProvider.class.getName() + ": " + providers[i].getClass().getName(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String msg = "Error getting help table of contents data from provider: " + providers[i].getClass().getName() + " (skipping provider)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
continue;
}
- // check for nulls
+ // check for nulls and root element
for (int j=0;j<contrib.length;++j) {
- // null means no contribution
- if (contrib[j] != null) {
+ if (contrib[j] == null) {
+ String msg = "Help table of contents provider \"" + providers[i].getClass().getName() + "\" returned a null contribution (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg);
+ }
+ else if (contrib[j].getToc() == null) {
+ String msg = "Help table of contents provider \"" + providers[i].getClass().getName() + "\" returned a contribution with a null root element (expected a \"" + Toc.NAME + "\" element; skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ HelpPlugin.logError(msg);
+ }
+ else if (!Toc.NAME.equals(contrib[j].getToc().getNodeName())) {
+ String msg = "Required root element \"" + Toc.NAME + "\" missing from help table of contents \"" + contrib[j].getId() + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ HelpPlugin.logError(msg);
+ }
+ else {
contributions.add(contrib[j]);
}
}
@@ -201,40 +211,16 @@ public class TocManager {
IConfigurationElement[] elements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID_TOC);
for (int i=0;i<elements.length;++i) {
IConfigurationElement elem = elements[i];
- try {
- if (elem.getName().equals(ELEMENT_NAME_TOC_PROVIDER)) {
- String className = elem.getAttribute(ATTRIBUTE_NAME_CLASS);
- if (className != null) {
- try {
- AbstractTocProvider provider = (AbstractTocProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
- providers.add(provider);
- }
- catch (CoreException e) {
- // log and skip
- String msg = "Error instantiating " + ELEMENT_NAME_TOC_PROVIDER + " class"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, e);
- }
- catch (ClassCastException e) {
- // log and skip
- String msg = ELEMENT_NAME_TOC_PROVIDER + " class must implement " + AbstractTocProvider.class.getName(); //$NON-NLS-1$
- HelpPlugin.logError(msg, e);
- }
- }
- else {
- // log the missing class attribute and skip
- String msg = ELEMENT_NAME_TOC_PROVIDER + " element of extension point " + EXTENSION_POINT_ID_TOC + " must specify a " + ATTRIBUTE_NAME_CLASS + " attribute"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- msg += " (declared from plug-in " + elem.getNamespaceIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InvalidRegistryObjectException e) {
- // skip the declaring plugin part
- }
- HelpPlugin.logError(msg, null);
- }
+ if (elem.getName().equals(ELEMENT_NAME_TOC_PROVIDER)) {
+ try {
+ AbstractTocProvider provider = (AbstractTocProvider)elem.createExecutableExtension(ATTRIBUTE_NAME_CLASS);
+ providers.add(provider);
+ }
+ catch (CoreException e) {
+ // log and skip
+ String msg = "Error instantiating help table of contents provider class \"" + elem.getAttribute(ATTRIBUTE_NAME_CLASS) + '"'; //$NON-NLS-1$
+ HelpPlugin.logError(msg, e);
}
- }
- catch (InvalidRegistryObjectException e) {
- // no longer valid; skip it
}
}
tocProviders = (AbstractTocProvider[])providers.toArray(new AbstractTocProvider[providers.size()]);
diff --git a/org.eclipse.ua.tests/data/help/dynamic/extension/extension.xml b/org.eclipse.ua.tests/data/help/dynamic/extension/extension.xml
index 0247a51e6..126148c02 100644
--- a/org.eclipse.ua.tests/data/help/dynamic/extension/extension.xml
+++ b/org.eclipse.ua.tests/data/help/dynamic/extension/extension.xml
@@ -3,71 +3,71 @@
<!-- valid contributions -->
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/content.xml#content"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#anchor.1">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/content.xml#content2"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#anchor.2">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/content.xml#content3"
path="org.eclipse.ua.tests/data/help/dynamic/extension.xml/anchor.2">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/shared/doc1.xml#doc.1"
path="org.eclipse.ua.tests/data/help/dynamic/extension.xml/anchor.3">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/extension.xml/element.1"
path="org.eclipse.ua.tests/data/help/dynamic/extension.xml/anchor.4">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/doc.xhtml"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#anchor.xhtml">
- </topicExtension>
+ </contribution>
- <topicReplace
+ <replacement
content="data/help/dynamic/extension/content.xml#content"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#replace.2">
- </topicReplace>
+ </replacement>
- <topicReplace
+ <replacement
content="data/help/dynamic/shared/doc1.xml#doc.1"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#replace.3">
- </topicReplace>
+ </replacement>
- <topicReplace
+ <replacement
content="data/help/dynamic/extension.xml#element.1"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#replace.4">
- </topicReplace>
+ </replacement>
<!-- invalid contributions -->
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/nonExistentFile.xml"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#anchor.invalidcontribution">
- </topicExtension>
+ </contribution>
- <topicExtension
+ <contribution
content="data/help/dynamic/extension/content.xml#nonExistentId"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#anchor.invalidcontribution">
- </topicExtension>
+ </contribution>
- <topicReplace
+ <replacement
content="data/help/dynamic/extension/nonExistentFile.xml"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#replace.invalid">
- </topicReplace>
+ </replacement>
- <topicReplace
+ <replacement
content="data/help/dynamic/extension/content.xml#nonExistentId"
path="/org.eclipse.ua.tests/data/help/dynamic/extension.xml#replace.invalid">
- </topicReplace>
+ </replacement>
</contentExtension>
diff --git a/org.eclipse.ua.tests/data/help/dynamic/include/extension.xml b/org.eclipse.ua.tests/data/help/dynamic/include/extension.xml
index 1685f6753..3694395af 100644
--- a/org.eclipse.ua.tests/data/help/dynamic/include/extension.xml
+++ b/org.eclipse.ua.tests/data/help/dynamic/include/extension.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<contentExtension>
- <topicExtension
+ <contribution
content="data/help/dynamic/include/doc1.xml#paragraph.1"
path="/org.eclipse.ua.tests/data/help/dynamic/include/doc2.xml#anchor">
- </topicExtension>
+ </contribution>
</contentExtension>
diff --git a/org.eclipse.ua.tests/data/help/dynamic/shared/extension.xml b/org.eclipse.ua.tests/data/help/dynamic/shared/extension.xml
index cb089735a..e7df41d06 100644
--- a/org.eclipse.ua.tests/data/help/dynamic/shared/extension.xml
+++ b/org.eclipse.ua.tests/data/help/dynamic/shared/extension.xml
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<contentExtension>
- <topicExtension
+ <contribution
content="data/help/dynamic/shared/doc2.xml#element.1"
path="/org.eclipse.ua.tests/data/help/dynamic/shared/doc1.xml#anchor.2">
- </topicExtension>
- <topicExtension
+ </contribution>
+ <contribution
content="data/help/dynamic/shared/doc2.xml#element.2"
path="/org.eclipse.ua.tests/data/help/dynamic/shared/doc1.xml#anchor.3">
- </topicExtension>
- <topicExtension
+ </contribution>
+ <contribution
content="data/help/dynamic/shared/doc2.xml#element.3"
path="/org.eclipse.ua.tests/data/help/dynamic/shared/doc1.xml#anchor.3">
- </topicExtension>
- <topicReplace
+ </contribution>
+ <replacement
content="data/help/dynamic/shared/doc2.xml#element.1"
path="/org.eclipse.ua.tests/data/help/dynamic/shared/doc1.xml#element.2">
- </topicReplace>
+ </replacement>
</contentExtension>
diff --git a/org.eclipse.ua.tests/data/help/index/assembler/result_a_b_c.xml b/org.eclipse.ua.tests/data/help/index/assembler/result_a_b_c.xml
index 4f3e8ad3d..2f9c7b205 100644
--- a/org.eclipse.ua.tests/data/help/index/assembler/result_a_b_c.xml
+++ b/org.eclipse.ua.tests/data/help/index/assembler/result_a_b_c.xml
@@ -2,29 +2,29 @@
<index>
<entry keyword="keyword1">
<entry keyword="keyword2">
- <topic href="topic2.html" label="topic2"/>
+ <topic href="/org.eclipse.ua.tests/topic2.html" label="topic2"/>
</entry>
</entry>
<entry keyword="keyword3">
- <topic href="topic3.html" label="topic3"/>
- <topic href="topic3b.html" label="topic3b"/>
+ <topic href="/org.eclipse.ua.tests/topic3.html" label="topic3"/>
+ <topic href="/org.eclipse.ua.tests/topic3b.html" label="topic3b"/>
<entry keyword="keyword9">
- <topic href="topic9.html" label="topic9"/>
+ <topic href="/org.eclipse.ua.tests/topic9.html" label="topic9"/>
</entry>
</entry>
<entry keyword="keyword4">
- <topic href="topic4.html" label="topic4"/>
+ <topic href="/org.eclipse.ua.tests/topic4.html" label="topic4"/>
</entry>
<entry keyword="keyword5">
- <topic href="topic5.html" label="topic5"/>
+ <topic href="/org.eclipse.ua.tests/topic5.html" label="topic5"/>
</entry>
<entry keyword="keyword6">
<entry keyword="keyword7">
- <topic href="topic7.html" label="topic7"/>
+ <topic href="/org.eclipse.ua.tests/topic7.html" label="topic7"/>
</entry>
<entry keyword="keyword8">
- <topic href="topic8a.html" label="topic8a"/>
- <topic href="topic8b.html" label="topic8b"/>
+ <topic href="/org.eclipse.ua.tests/topic8a.html" label="topic8a"/>
+ <topic href="/org.eclipse.ua.tests/topic8b.html" label="topic8b"/>
</entry>
</entry>
</index>
diff --git a/org.eclipse.ua.tests/data/help/index/tocIgnored.xml b/org.eclipse.ua.tests/data/help/index/tocIgnored.xml
deleted file mode 100644
index f97a2821a..000000000
--- a/org.eclipse.ua.tests/data/help/index/tocIgnored.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.toc"?>
-
-<toc label="index2" link_to="data/help/toc/root.xml#content">
- <topic label="index2">
- <topic label="topic2.html" href="data/help/index/topic2.html">
- <topic label="topic3.html" href="data/help/index/topic3.html"/>
- </topic>
- <topic label="topic4.html" href="data/help/index/topic4.html"/>
- </topic>
-</toc>
diff --git a/org.eclipse.ua.tests/data/help/search/extension.xml b/org.eclipse.ua.tests/data/help/search/extension.xml
index db66ffd16..07d8e43ca 100644
--- a/org.eclipse.ua.tests/data/help/search/extension.xml
+++ b/org.eclipse.ua.tests/data/help/search/extension.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<contentExtension>
- <topicExtension
+ <contribution
content="data/help/search/test3.xhtml"
path="org.eclipse.ua.tests/data/help/search/test5.xhtml/test5_anchor"/>
</contentExtension>
diff --git a/org.eclipse.ua.tests/data/help/search/extension2.xml b/org.eclipse.ua.tests/data/help/search/extension2.xml
index e5206dd6b..8623b15a3 100644
--- a/org.eclipse.ua.tests/data/help/search/extension2.xml
+++ b/org.eclipse.ua.tests/data/help/search/extension2.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<contentExtension>
- <topicReplace
+ <replacement
content="data/help/search/test3.xhtml"
path="org.eclipse.ua.tests/data/help/search/test6.xhtml/test6_paragraph_to_replace"/>
</contentExtension>
diff --git a/org.eclipse.ua.tests/plugin.xml b/org.eclipse.ua.tests/plugin.xml
index b71a1556b..9b9d17205 100644
--- a/org.eclipse.ua.tests/plugin.xml
+++ b/org.eclipse.ua.tests/plugin.xml
@@ -248,7 +248,6 @@
<toc file="data/help/search/toc3.xml" extradir="data/help/search/extraDir2"/>
<toc file="data/help/search/toc4.xml" extradir="data/help/search/extraDir3"/>
<toc file="data/help/index/toc.xml"/>
- <toc file="data/help/index/tocIgnored.xml"/>
</extension>
<extension point= "org.eclipse.help.contentExtension">
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
index 707b1c1ac..ca8e4016f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
@@ -37,10 +37,10 @@ import org.w3c.dom.NodeList;
public class IntroExtensionContent extends AbstractIntroElement {
protected static final String TAG_CONTAINER_EXTENSION = "extensionContent"; //$NON-NLS-1$
- protected static final String TAG_CONTAINER_REPLACE = "replaceContent"; //$NON-NLS-1$
+ protected static final String TAG_CONTAINER_REPLACE = "replacementContent"; //$NON-NLS-1$
public static final int TYPE_CONTRIBUTION = 0;
- public static final int TYPE_REPLACE = 1;
+ public static final int TYPE_REPLACEMENT = 1;
protected static final String ATT_PATH = "path"; //$NON-NLS-1$
protected static final String ATT_ID = "id"; //$NON-NLS-1$
@@ -153,7 +153,7 @@ public class IntroExtensionContent extends AbstractIntroElement {
* of an element.
*/
public int getExtensionType() {
- return TAG_CONTAINER_REPLACE.equals(element.getNodeName()) ? TYPE_REPLACE : TYPE_CONTRIBUTION;
+ return TAG_CONTAINER_REPLACE.equals(element.getNodeName()) ? TYPE_REPLACEMENT : TYPE_CONTRIBUTION;
}
/**
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
index 92288e2d0..40ea8d6cb 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
@@ -538,7 +538,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
targetElement.getParentNode().insertBefore(targetNode, targetElement);
}
- if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACE) {
+ if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
targetElement.getParentNode().removeChild(targetElement);
}
@@ -570,7 +570,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
// insert all children of this extension before the target element/anchor.
insertExtensionChildren(target, extensionContent, extensionContent.getBundle(), extensionContent.getBase());
// anchors need to stay around to receive other contributions
- if (type == IntroExtensionContent.TYPE_REPLACE) {
+ if (type == IntroExtensionContent.TYPE_REPLACEMENT) {
AbstractIntroContainer parent = (AbstractIntroContainer)target.getParent();
parent.removeChild(target);
}
@@ -603,7 +603,7 @@ public class IntroModelRoot extends AbstractIntroContainer {
return null;
String extensionId = extensionContent.getId();
// if this is a replace, take the mixin style as what is being replaced
- if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACE) {
+ if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
IPath ipath = new Path(extensionContent.getPath());
String s2 = ipath.segment(1);
if (s2 != null && s2.startsWith("@") && s2.length() > 1) { //$NON-NLS-1$

Back to the top