mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-119640 Problem with goto declaration of XML attribute defined in XSD
This commit is contained in:
@@ -1437,7 +1437,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
ExternalResourceManagerExImpl.registerResourceTemporarily(url, location, getTestRootDisposable());
|
||||
configureByFiles(null, getVirtualFile(getFullRelativeTestName()), getVirtualFile(BASE_PATH + location));
|
||||
|
||||
doDoTest(true,false);
|
||||
doDoTest(true, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -1528,7 +1528,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
public void testEncoding() throws Exception { doTest(true); }
|
||||
|
||||
public void testSchemaImportHighlightingAndResolve() throws Exception {
|
||||
doTestWithLocations(new String[][] { {"http://www.springframework.org/schema/beans", "ComplexSchemaValidation11.xsd"} },"xsd");
|
||||
doTestWithLocations(new String[][]{{"http://www.springframework.org/schema/beans", "ComplexSchemaValidation11.xsd"}}, "xsd");
|
||||
}
|
||||
|
||||
public void testDocBookV5() throws Exception {
|
||||
@@ -1731,7 +1731,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
{"http://extended", testName + ".xsd"},
|
||||
{"http://simple", testName + "_2.xsd"}
|
||||
};
|
||||
doTestWithLocations(urls,"xml");
|
||||
doTestWithLocations(urls, "xml");
|
||||
}
|
||||
|
||||
public void testComplexRedefine6() throws Exception {
|
||||
@@ -1839,7 +1839,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
Collection<HighlightInfo> infos = doDoTest(true, false);
|
||||
|
||||
findAndInvokeIntentionAction(infos, "Change Root Tag Name to xxx", myEditor, myFile);
|
||||
checkResultByFile(BASE_PATH + testName+"_after.xml");
|
||||
checkResultByFile(BASE_PATH + testName + "_after.xml");
|
||||
}
|
||||
|
||||
public void testUnqualifiedAttributePsi() throws Exception {
|
||||
@@ -1847,7 +1847,8 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final List<XmlAttribute> attrs = new ArrayList<XmlAttribute>(2);
|
||||
|
||||
myFile.acceptChildren(new XmlRecursiveElementVisitor() {
|
||||
@Override public void visitXmlAttribute(final XmlAttribute attribute) {
|
||||
@Override
|
||||
public void visitXmlAttribute(final XmlAttribute attribute) {
|
||||
if (!attribute.isNamespaceDeclaration()) attrs.add(attribute);
|
||||
}
|
||||
});
|
||||
@@ -1876,7 +1877,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final String testName = getTestName(false);
|
||||
|
||||
doTest(
|
||||
new VirtualFile[] {
|
||||
new VirtualFile[]{
|
||||
getVirtualFile(BASE_PATH + testName + ".xml"),
|
||||
getVirtualFile(BASE_PATH + testName + ".xsd")
|
||||
},
|
||||
@@ -1921,7 +1922,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
}
|
||||
|
||||
public void testProblemWithImportedNsReference() throws Exception {
|
||||
doTestWithLocations(null,"xsd");
|
||||
doTestWithLocations(null, "xsd");
|
||||
}
|
||||
|
||||
public void testBadXmlns() throws Exception {
|
||||
@@ -1930,7 +1931,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
}
|
||||
|
||||
public void testProblemWithMemberTypes() throws Exception {
|
||||
doTestWithLocations(null,"xsd");
|
||||
doTestWithLocations(null, "xsd");
|
||||
}
|
||||
|
||||
public void testDtdHighlighting() throws Exception {
|
||||
@@ -1948,7 +1949,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
final String testName = getTestName(false);
|
||||
|
||||
doTest(
|
||||
new VirtualFile[] {
|
||||
new VirtualFile[]{
|
||||
getVirtualFile(BASE_PATH + testName + ".xml"),
|
||||
getVirtualFile(BASE_PATH + testName + ".xsd")
|
||||
},
|
||||
@@ -1978,13 +1979,13 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
public void testMappedSchemaLocation() throws Exception {
|
||||
doTestWithLocations(new String[][]{
|
||||
{ "schemas/Forms.xsd", "Forms.xsd"}
|
||||
{"schemas/Forms.xsd", "Forms.xsd"}
|
||||
}, "xml");
|
||||
}
|
||||
|
||||
public void testMuleConfigValidation() throws Exception {
|
||||
doSchemaTestWithManyFilesFromSeparateDir(
|
||||
new String[][] {
|
||||
new String[][]{
|
||||
{"http://www.springframework.org/schema/tool", "spring-tool-2.5.xsd"},
|
||||
{"http://www.springframework.org/schema/beans/spring-beans-2.5.xsd", "spring-beans-2.5.xsd"},
|
||||
{"http://www.mulesource.org/schema/mule/core/2.2/mule.xsd", "mule.xsd"},
|
||||
@@ -2034,6 +2035,21 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
public void testAnyAttributeNavigation() throws Exception {
|
||||
doTest(
|
||||
new VirtualFile[] {
|
||||
getVirtualFile(BASE_PATH + "AnyAttributeNavigation/test.xml"),
|
||||
getVirtualFile(BASE_PATH + "AnyAttributeNavigation/test.xsd"),
|
||||
getVirtualFile(BASE_PATH + "AnyAttributeNavigation/library.xsd")
|
||||
},
|
||||
true,
|
||||
false
|
||||
);
|
||||
PsiReference at = getFile().findReferenceAt(getEditor().getCaretModel().getOffset());
|
||||
PsiElement resolve = at.resolve();
|
||||
assertTrue(resolve instanceof XmlTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema attributeFormDefault="unqualified"
|
||||
elementFormDefault="qualified"
|
||||
targetNamespace="http://library"
|
||||
xmlns:library="http://library"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="bar" type='library:barType'/>
|
||||
<xs:complexType name="barType">
|
||||
<xs:attribute type='xs:string' name="baz"/>
|
||||
<xs:anyAttribute namespace="http://untyped http://untyped"/>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<test:foo xmlns:test="http://test"
|
||||
xmlns:library="http://library"
|
||||
ba<caret>z="baz"/>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema attributeFormDefault="unqualified"
|
||||
elementFormDefault="qualified"
|
||||
targetNamespace="http://test"
|
||||
xmlns:local="http://test"
|
||||
xmlns:library="http://library"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:import namespace="http://library"/>
|
||||
<xs:element name="foo" type='local:fooType'/>
|
||||
<xs:complexType name="fooType">
|
||||
<xs:complexContent>
|
||||
<xs:extension base='library:barType'/>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
@@ -377,6 +377,11 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor<XmlTag>
|
||||
final ComplexTypeDescriptor.CanContainAttributeType containAttributeType = descriptor.canContainAttribute(namespace, qName);
|
||||
|
||||
if (containAttributeType != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain) {
|
||||
for (XmlAttributeDescriptor attributeDescriptor : descriptors) {
|
||||
if (attributeDescriptor.getName().equals(attributeName)) {
|
||||
return attributeDescriptor;
|
||||
}
|
||||
}
|
||||
return new AnyXmlAttributeDescriptor(attributeName, containAttributeType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user