Author: scabanovich
Date: 2007-07-24 07:24:59 -0400 (Tue, 24 Jul 2007)
New Revision: 2618
Modified:
trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolver.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java
Log:
EXIN-26 org.eclipse.jst.standard.schemas schema storage accessed from DtdResolver
Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2007-07-24 11:06:29
UTC (rev 2617)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2007-07-24 11:24:59
UTC (rev 2618)
@@ -134,6 +134,7 @@
org.eclipse.jface,
org.eclipse.core.resources,
org.eclipse.ui,
+ org.eclipse.wst.common.uriresolver,
org.eclipse.core.net
Bundle-Version: 2.0.0
Eclipse-LazyStart: true
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java 2007-07-24
11:06:29 UTC (rev 2617)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/DtdResolver.java 2007-07-24
11:24:59 UTC (rev 2618)
@@ -18,6 +18,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -25,6 +27,7 @@
import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.util.HttpUtil;
+import org.osgi.framework.Bundle;
/**
* @author igels
@@ -44,6 +47,20 @@
}
}
+ if((location == null || location.startsWith("http:")) &&
systemId != null) {
+ Bundle b = Platform.getBundle("org.eclipse.jst.standard.schemas");
+ if(b != null) {
+ int q = systemId.lastIndexOf("/");
+ String s = systemId.substring(q + 1);
+ URL u = b.getEntry("/dtdsAndSchemas/" + s);
+ try {
+ if(u != null) u = FileLocator.resolve(u);
+ } catch (IOException ee) {
+ u = null;
+ }
+ if(u != null) location = u.toString();
+ }
+ }
if(location == null) {
if(systemId != null && !unfound.contains(systemId)) {
unfound.add(systemId);
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolver.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolver.java 2007-07-24
11:06:29 UTC (rev 2617)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolver.java 2007-07-24
11:24:59 UTC (rev 2618)
@@ -54,6 +54,21 @@
public void setDeactivate(boolean b) {
deactivate = b;
}
+
+ public boolean isResolved(String publicId, String systemId) {
+ if (publicId != null) {
+ String url = publicEntities.getProperty(publicId);
+ if (url != null) {
+ return true;
+ }
+ } else if (systemId != null) {
+ String url = systemEntities.getProperty(systemId);
+ if (url != null) {
+ return true;
+ }
+ }
+ return false;
+ }
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, java.io.IOException {
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java 2007-07-24
11:06:29 UTC (rev 2617)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLEntityResolverImpl.java 2007-07-24
11:24:59 UTC (rev 2618)
@@ -45,8 +45,8 @@
publicId = rid.getPublicId();
if(systemId != null && systemId.indexOf("www.ibm.com") >=
0) {
- CommonPlugin.getPluginLog().logError( "ignore");
- return null;
+// CommonPlugin.getPluginLog().logError( "ignore");
+// return null;
}
InputStream is = resolver.getInputStream(rid.getPublicId(), systemId);