resolve namespaces declared as import in wsdl:types

This commit is contained in:
Konstantin Bulenkov
2010-09-14 16:38:56 +04:00
parent f86fbe588a
commit 186cd8a282
2 changed files with 20 additions and 6 deletions
@@ -553,4 +553,11 @@ public class ArrayUtil {
public static <T> T getLastElement(T[] array) {
return array.length > 0 ? array[array.length -1] : null;
}
public static <T> T[] join(T[] array1, T[] array2) {
final T[] newArray = (T[])Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length);
System.arraycopy(array1, 0, newArray, 0, array1.length);
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
return newArray;
}
}
@@ -132,6 +132,14 @@ public class URLReference implements PsiReference, QuickFixProvider, EmptyResolv
result[0] = t;
return false;
}
for (XmlTag anImport : t.findSubTags("import", t.getNamespace())) {
if (canonicalText.equals(anImport.getAttributeValue("namespace"))) {
final XmlAttribute location = anImport.getAttribute("schemaLocation");
if (location != null) {
result[0] = FileReferenceUtil.findFile(location.getValueElement());
}
}
}
return true;
}
});
@@ -233,12 +241,11 @@ public class URLReference implements PsiReference, QuickFixProvider, EmptyResolv
final XmlTag subTag = rootTag.findFirstSubTag(types);
if (subTag != null) {
XmlTag[] tags = subTag.findSubTags("xsd:schema");
if (tags.length == 0) {
tags = subTag.findSubTags("schema");
}
for(XmlTag t:tags) {
if (!processor.process(t)) return;
for (int i = 0; i < XmlUtil.SCHEMA_URIS.length; i++) {
final XmlTag[] tags = subTag.findSubTags("schema", XmlUtil.SCHEMA_URIS[i]);
for (XmlTag t : tags) {
if (!processor.process(t)) return;
}
}
}
}