bug 331462 use the WTP XML catalog to load DTDs
Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.dita/plugin.xml b/sourceediting/plugins/org.eclipse.wst.xml.vex.dita/plugin.xml
index f5192f0..09067bb 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.dita/plugin.xml
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.dita/plugin.xml
@@ -58,7 +58,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="concept.dtd"
- dtd="dita11/concept.dtd"
publicId="-//OASIS//DTD DITA 1.1 Concept//EN">
<rootElement
name="concept">
@@ -71,7 +70,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="ditabase.dtd"
- dtd="dita11/ditabase.dtd"
publicId="-//OASIS//DTD DITA Composite//EN">
</doctype>
</extension>
@@ -81,7 +79,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="reference.dtd"
- dtd="dita11/reference.dtd"
publicId="-//OASIS//DTD DITA Reference//EN">
</doctype>
</extension>
@@ -91,7 +88,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="task.dtd"
- dtd="dita11/task.dtd"
publicId="-//OASIS//DTD DITA Task//EN">
</doctype>
</extension>
@@ -101,7 +97,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="topic.dtd"
- dtd="dita11/topic.dtd"
publicId="-//OASIS//DTD DITA Topic//EN">
</doctype>
</extension>
@@ -111,7 +106,6 @@
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="map.dtd"
- dtd="dita11/map.dtd"
publicId="-//OASIS//DTD DITA Map//EN">
</doctype>
</extension>
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.docbook/plugin.xml b/sourceediting/plugins/org.eclipse.wst.xml.vex.docbook/plugin.xml
index cafb873..2538b3e 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.docbook/plugin.xml
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.docbook/plugin.xml
@@ -24,7 +24,6 @@
name="%doctype.docbook4_5"
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
- dtd="4.5/docbookx.dtd"
outlineProvider="org.eclipse.wst.xml.vex.docbook.DocBookOutlineProvider"
publicId="-//OASIS//DTD DocBook XML V4.5//EN"
systemId="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/META-INF/MANIFEST.MF b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/META-INF/MANIFEST.MF
index 3768493..c4bcbee 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/META-INF/MANIFEST.MF
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@
org.eclipse.wst.sse.ui;bundle-version="[1.1.0,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.0,2.0.0)",
org.eclipse.wst.xml.ui;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.emf.ecore;bundle-version="[2.4.1,3.0.0)"
+ org.eclipse.emf.ecore;bundle-version="[2.4.1,3.0.0)",
+ org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,2.0.0)"
Export-Package: org.eclipse.wst.xml.vex.ui.internal;x-friends:="org.eclipse.wst.xml.vex.ui.tests",
org.eclipse.wst.xml.vex.ui.internal.config;x-internal:=true,
org.eclipse.wst.xml.vex.ui.internal.editor;x-friends:="org.eclipse.wst.xml.vex.docbook",
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/schema/doctype.exsd b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/schema/doctype.exsd
index 6285162..3846319 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/schema/doctype.exsd
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/schema/doctype.exsd
@@ -1,146 +1,133 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="vex-editor">
-<annotation>
- <appInfo>
- <meta.schema plugin="vex-editor" id="doctype" name="Vex DocType"/>
- </appInfo>
- <documentation>
- Registers a new document type with Vex.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="doctype"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="doctype">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="publicId"/>
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="rootElement" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="publicId" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="systemId" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="dtd" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="outlineProvider" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="net.sf.vex.editor.IOutlineProvider"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="rootElement">
- <complexType>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="vex-editor" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="vex-editor" id="doctype" name="Vex DocType"/>
+ </appinfo>
+ <documentation>
+ Registers a new document type with Vex.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="doctype"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="doctype">
+ <annotation>
+ <appinfo>
+ <meta.element labelAttribute="publicId"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="rootElement" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="publicId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="systemId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outlineProvider" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="net.sf.vex.editor.IOutlineProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="rootElement">
+ <complexType>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
index 4dd94ae..a4364ac 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
+ * Copyright (c) 2004, 2010 John Krasnay 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
@@ -20,7 +20,10 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
import org.eclipse.wst.xml.vex.ui.internal.VexPlugin;
/**
@@ -30,7 +33,7 @@
public abstract class ConfigSource {
private static final IConfigItemFactory[] CONFIG_ITEM_FACTORIES = new IConfigItemFactory[] { new DoctypeFactory(), new StyleFactory() };
-
+
// Globally-unique identifier of this configuration == the plugin id.
private final String id;
@@ -46,7 +49,7 @@
return factory;
return null;
}
-
+
public ConfigSource(final String id) {
this.id = id;
}
@@ -170,12 +173,12 @@
* Returns the item for the resource with the given path relative to the
* plugin or project. May return null if no such item exists.
*
- * @param resourcePath
+ * @param resource
* Path of the resource.
*/
- public ConfigItem getItemForResource(final String resourcePath) {
+ public ConfigItem getItemForResource(final IResource resource) {
for (final ConfigItem item : items)
- if (item.getResourcePath().equals(resourcePath))
+ if (item.getResourcePath().equals(resource.getLocationURI().toString()))
return item;
return null;
}
@@ -243,5 +246,10 @@
}
}
}
+
+ public String resolve(final String publicId, final String systemId) {
+ URIResolver uriResolver = URIResolverPlugin.createResolver();
+ return uriResolver.resolve(getBaseUrl().toString(), publicId, systemId);
+ }
}
\ No newline at end of file
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypeFactory.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypeFactory.java
index 32fbed8..c2de3c3 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypeFactory.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
+ * Copyright (c) 2004, 2010 John Krasnay 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
@@ -25,7 +25,6 @@
private static final String ELT_DOCTYPE = "doctype"; //$NON-NLS-1$
private static final String ATTR_OUTLINE_PROVIDER = "outlineProvider"; //$NON-NLS-1$
- private static final String ATTR_DTD = "dtd"; //$NON-NLS-1$
private static final String ATTR_SYSTEM_ID = "systemId"; //$NON-NLS-1$
private static final String ATTR_PUBLIC_ID = "publicId"; //$NON-NLS-1$
@@ -37,7 +36,6 @@
final ConfigurationElement doctypeElement = new ConfigurationElement(ELT_DOCTYPE);
doctypeElement.setAttribute(ATTR_PUBLIC_ID, doctype.getPublicId());
doctypeElement.setAttribute(ATTR_SYSTEM_ID, doctype.getSystemId());
- doctypeElement.setAttribute(ATTR_DTD, doctype.getResourcePath());
doctypeElement.setAttribute(ATTR_OUTLINE_PROVIDER, doctype.getOutlineProvider());
for (final String name : doctype.getRootElements()) {
@@ -53,10 +51,12 @@
if (configElements.length < 1)
return null;
final IConfigElement configElement = configElements[0];
+ final String publicId = configElement.getAttribute(ATTR_PUBLIC_ID);
+ final String systemId = configElement.getAttribute(ATTR_SYSTEM_ID);
final DocumentType doctype = new DocumentType(config);
- doctype.setPublicId(configElement.getAttribute(ATTR_PUBLIC_ID));
- doctype.setSystemId(configElement.getAttribute(ATTR_SYSTEM_ID));
- doctype.setResourcePath(configElement.getAttribute(ATTR_DTD));
+ doctype.setPublicId(publicId);
+ doctype.setSystemId(systemId);
+ doctype.setResourcePath(config.resolve(publicId, systemId));
doctype.setOutlineProvider(configElement.getAttribute(ATTR_OUTLINE_PROVIDER));
final IConfigElement[] rootElementRefs = configElement.getChildren();
@@ -67,7 +67,7 @@
return doctype;
}
-
+
public String getExtensionPointId() {
return DocumentType.EXTENSION_POINT;
}
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypePropertyPage.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypePropertyPage.java
index b1e3c2c..13ab2d3 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypePropertyPage.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/DoctypePropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
+ * Copyright (c) 2004, 2010 John Krasnay 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
@@ -83,8 +83,7 @@
VexPlugin.getInstance().getLog().log(e.getStatus());
}
- final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
- doctype = (DocumentType) pluginProject.getItemForResource(resourcePath);
+ doctype = (DocumentType) pluginProject.getItemForResource((IFile) getElement());
populateRootElements();
}
@@ -147,12 +146,10 @@
gd.horizontalAlignment = GridData.FILL;
systemIdText.setLayoutData(gd);
- final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
-
- doctype = (DocumentType) pluginProject.getItemForResource(resourcePath);
+ doctype = (DocumentType) pluginProject.getItemForResource((IFile) getElement());
if (doctype == null) {
doctype = new DocumentType(pluginProject);
- doctype.setResourcePath(resourcePath);
+ doctype.setResourcePath(((IFile) getElement()).getLocationURI().toString());
pluginProject.addItem(doctype);
}
@@ -192,7 +189,7 @@
}
private void populateRootElements() {
- final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
+ final String resourcePath = ((IFile) getElement()).getLocationURI().toString();
final Validator validator = (Validator) pluginProject.getParsedResource(resourcePath);
if (validator != null) {
final List<String> list = Arrays.asList(doctype.getRootElements());
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StyleFactory.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StyleFactory.java
index 07dcba0..c9113f6 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StyleFactory.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StyleFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
+ * Copyright (c) 2004, 2010 John Krasnay 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 @@
final IConfigElement configElement = configElements[0];
final Style style = new Style(config);
- style.setResourcePath(configElement.getAttribute("css")); //$NON-NLS-1$
+ style.setResourcePath(config.resolve(null, configElement.getAttribute("css"))); //$NON-NLS-1$
final IConfigElement[] doctypeRefs = configElement.getChildren();
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
index 9b2b8a5..a3e385d 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
+ * Copyright (c) 2004, 2010 John Krasnay 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
@@ -70,8 +70,7 @@
} catch (CoreException e) {
VexPlugin.getInstance().getLog().log(e.getStatus());
}
- final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
- style = (Style) pluginProject.getItemForResource(resourcePath);
+ style = (Style) pluginProject.getItemForResource((IFile) getElement());
populateDoctypes();
}
@@ -117,12 +116,10 @@
gd.widthHint = NAME_WIDTH;
nameText.setLayoutData(gd);
- final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
-
- style = (Style) pluginProject.getItemForResource(resourcePath);
+ style = (Style) pluginProject.getItemForResource((IFile) getElement());
if (style == null) {
style = new Style(pluginProject);
- style.setResourcePath(resourcePath);
+ style.setResourcePath(((IFile) getElement()).getLocationURI().toString());
pluginProject.addItem(style);
}
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.properties b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.properties
index 9a3e18e..3d85c6a 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.properties
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.properties
@@ -10,3 +10,4 @@
###############################################################################
pluginName= Vex UI Tests
providerName= Eclipse.org
+contentType.name=Vex Test XML Document Type
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml
index 4528bd3..84cd689 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/plugin.xml
@@ -1,18 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension point="org.eclipse.core.contenttype.contentTypes">
+ <content-type id="org.eclipse.wst.xml.vex.ui.tests" name="%contentType.name"
+ base-type="org.eclipse.wst.xml.vex.ui.XmlDocument" file-extensions="xml">
+ </content-type>
+ </extension>
+ <extension
+ point="org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution
+ id="default">
+ <public
+ publicId="-//Vex//DTD Test//EN"
+ uri="testdata/test.dtd">
+ </public>
+ </catalogContribution>
+ </extension>
<extension
- id="test"
+ id="test-doctype"
name="test doctype"
point="org.eclipse.wst.xml.vex.ui.doctypes">
<doctype
systemId="test.dtd"
- dtd="testdata/test.dtd"
publicId="-//Vex//DTD Test//EN">
</doctype>
</extension>
<extension
- id="test"
+ id="test-style"
name="test style"
point="org.eclipse.wst.xml.vex.ui.styles">
<style
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java
index c741501..847eb0a 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigLoaderJobTest.java
@@ -18,6 +18,8 @@
import java.util.HashSet;
import java.util.List;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.wst.xml.vex.ui.internal.config.ConfigLoaderJob;
import org.eclipse.wst.xml.vex.ui.internal.config.ConfigSource;
import org.junit.Rule;
@@ -39,18 +41,18 @@
job.schedule();
job.join();
final List<ConfigSource> allConfigSources = job.getLoadedConfigSources();
- assertContainsConfiguration(allConfigSources, "org.eclipse.wst.xml.vex.ui.tests", "testdata/test.dtd", "testdata/test.css");
+ assertContainsConfiguration(allConfigSources, "org.eclipse.wst.xml.vex.ui.tests", "test-doctype", "test-style");
assertContainsEachPluginOnlyOnce(allConfigSources);
}
@Test
public void loadWorkspacePluginConfiguration() throws Exception {
- PluginProjectTest.createVexPluginProject(name.getMethodName());
+ IProject pluginProject = PluginProjectTest.createVexPluginProject(name.getMethodName());
final ConfigLoaderJob job = new ConfigLoaderJob();
job.schedule();
job.join();
final List<ConfigSource> allConfigSources = job.getLoadedConfigSources();
- assertContainsConfiguration(allConfigSources, name.getMethodName(), "plugintest.dtd", "plugintest.css");
+ assertContainsConfiguration(allConfigSources, name.getMethodName(), pluginProject.getFile("plugintest.dtd"), pluginProject.getFile("plugintest.css"));
assertContainsEachPluginOnlyOnce(allConfigSources);
}
@@ -81,10 +83,21 @@
assertTrue(runnableRun[1]);
}
- private static void assertContainsConfiguration(final List<ConfigSource> configSources, final String uniqueIdentifier, final String... configuredResources) {
+ private static void assertContainsConfiguration(final List<ConfigSource> configSources, final String uniqueIdentifier, final String... simpleIds) {
for (final ConfigSource configSource : configSources) {
if (uniqueIdentifier.equals(configSource.getUniqueIdentifer())) {
- for (final String configuredResource : configuredResources)
+ for (final String simpleId : simpleIds)
+ assertNotNull(simpleId + " is not configured", configSource.getItem(simpleId));
+ return;
+ }
+ }
+ fail("Cannot find configuration " + uniqueIdentifier);
+ }
+
+ private static void assertContainsConfiguration(final List<ConfigSource> configSources, final String uniqueIdentifier, final IResource... configuredResources) {
+ for (final ConfigSource configSource : configSources) {
+ if (uniqueIdentifier.equals(configSource.getUniqueIdentifer())) {
+ for (final IResource configuredResource : configuredResources)
assertNotNull(configuredResource + " is not configured", configSource.getItemForResource(configuredResource));
return;
}
diff --git a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigurationRegistryTest.java b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigurationRegistryTest.java
index 3224023..1f4a3c7 100644
--- a/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigurationRegistryTest.java
+++ b/sourceediting/tests/org.eclipse.wst.xml.vex.ui.tests/src/org/eclipse/wst/xml/vex/ui/internal/config/tests/ConfigurationRegistryTest.java
@@ -91,7 +91,7 @@
project.getFile(PluginProject.PLUGIN_XML).setContents(new ByteArrayInputStream(fileContent.getBytes()), true, true, null);
assertFalse(configListener.loaded);
assertTrue(configListener.changed);
- assertNotNull(registry.getPluginProject(project).getItemForResource("plugintest2.css"));
+ assertNotNull(registry.getPluginProject(project).getItemForResource(project.getFile("plugintest2.css")));
}
@Test