mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-183233 Exception during offline inspections
This commit is contained in:
@@ -8,5 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.tests" />
|
||||
<orderEntry type="module" module-name="intellij.xml.psi.impl" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<xi:include href="XIncludeWithActions.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
|
||||
<actions>
|
||||
<group>
|
||||
<action class="foo" id="bar"/>
|
||||
</group>
|
||||
</actions>
|
||||
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,6 @@
|
||||
<idea-plugin>
|
||||
|
||||
<actions>
|
||||
</actions>
|
||||
|
||||
</idea-plugin>
|
||||
+32
@@ -15,9 +15,20 @@
|
||||
*/
|
||||
package org.jetbrains.idea.devkit.codeInsight;
|
||||
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.intellij.util.xml.DomFileElement;
|
||||
import com.intellij.util.xml.DomTarget;
|
||||
import com.intellij.util.xml.impl.DomInvocationHandler;
|
||||
import com.intellij.util.xml.impl.DomManagerImpl;
|
||||
import com.intellij.util.xml.stubs.DomStubTest;
|
||||
import com.intellij.xml.util.IncludedXmlTag;
|
||||
import org.jetbrains.idea.devkit.DevkitJavaTestsUtil;
|
||||
import org.jetbrains.idea.devkit.dom.Action;
|
||||
import org.jetbrains.idea.devkit.dom.Actions;
|
||||
import org.jetbrains.idea.devkit.dom.IdeaPlugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@TestDataPath("$CONTENT_ROOT/testData/pluginXmlDomStubs")
|
||||
public class PluginXmlDomStubsTest extends DomStubTest {
|
||||
@@ -74,6 +85,27 @@ public class PluginXmlDomStubsTest extends DomStubTest {
|
||||
myFixture.testHighlighting("pluginWithXInclude.xml");
|
||||
}
|
||||
|
||||
public void testIncludedActions() {
|
||||
prepareFile("XIncludeWithActions.xml");
|
||||
DomFileElement<IdeaPlugin> element = prepare("XIncludeWithActions-main.xml", IdeaPlugin.class);
|
||||
|
||||
XmlTag[] tags = element.getRootTag().getSubTags();
|
||||
assertEquals(2, tags.length);
|
||||
XmlTag included = tags[0];
|
||||
assertTrue(included instanceof IncludedXmlTag);
|
||||
assertEquals("actions", included.getName());
|
||||
|
||||
List<Actions> actions = element.getRootElement().getActions();
|
||||
assertEquals(1, actions.size());
|
||||
assertNotNull(actions.get(0).getXmlTag());
|
||||
|
||||
Action action = actions.get(0).getGroups().get(0).getActions().get(0);
|
||||
DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(action.getId());
|
||||
assertNotNull(handler.getStub());
|
||||
|
||||
assertNotNull(DomTarget.getTarget(action));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return DevkitJavaTestsUtil.TESTDATA_PATH + "pluginXmlDomStubs";
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.psi.xml.XmlElement;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.xml.impl.*;
|
||||
import com.intellij.xml.util.IncludedXmlTag;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -94,7 +95,7 @@ public class StubParentStrategy implements DomParentStrategy {
|
||||
int i = 0;
|
||||
String nameToFind = myStub.getName();
|
||||
for (XmlTag xmlTag : tags) {
|
||||
if (nameToFind.equals(xmlTag.getName()) && myStub.getIndex() == i++) {
|
||||
if (nameToFind.equals(xmlTag.getName()) && !(xmlTag instanceof IncludedXmlTag) && myStub.getIndex() == i++) {
|
||||
return xmlTag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user