[devkit] plugin.xml Structure View: render PluginModule node text

GitOrigin-RevId: d209b925ca4858a51d57b41a536c815d22fe3920
This commit is contained in:
Yann Cébron
2019-11-21 19:11:00 +00:00
committed by intellij-monorepo-bot
parent b4ad34874d
commit 8a87f310ae
3 changed files with 15 additions and 7 deletions
@@ -112,6 +112,9 @@ public class PluginDescriptorStructureUtil {
return null;
}
if (element instanceof PluginModule) {
return getPluginModuleLocation((PluginModule)element);
}
if (element instanceof IdeaVersion) {
return getIdeaVersionLocation((IdeaVersion)element);
}
@@ -152,6 +155,9 @@ public class PluginDescriptorStructureUtil {
return guessTagLocation(element);
}
private static String getPluginModuleLocation(PluginModule pluginModule) {
return pluginModule.getValue().getStringValue();
}
@Nullable
private static String getIdeaVersionLocation(IdeaVersion element) {
@@ -19,6 +19,8 @@
<depends optional="true">com.intellij.javaee</depends>
<idea-version until-build="130.0" since-build="125.5"/>
<module value="myModule"/>
<extensions defaultExtensionNs="plugin.id">
<toolWindow id="someToolWindow" factoryClass="com.jetbrains.test.SomeToolWindowFactory"/>
<projectConfigurable id="someConfigurable" instance="com.jetbrains.test.SomeConfigurable"/>
@@ -50,23 +50,23 @@ public class PluginDescriptorStructureTest extends JavaCodeInsightFixtureTestCas
myFixture.testStructureView(component -> {
TreeElementWrapper root = (TreeElementWrapper)TreeUtil.getUserObject(component.getTree().getModel().getRoot());
TreeElement[] topLevelNodes = root.getValue().getChildren();
assertSize(13, topLevelNodes);
assertSize(14, topLevelNodes);
String[] expectedTopLevelNames = new String[] {"ID", "Name", "Version", "Vendor", "Description", "Change Notes",
"Depends", "Depends", "IDEA Version", "Extensions", "Extension Points", "Application Components", "Actions"};
"Depends", "Depends", "IDEA Version", "Module", "Extensions", "Extension Points", "Application Components", "Actions"};
String[] actualTopLevelNames = Stream.of(topLevelNodes)
.map(treeElement -> treeElement.getPresentation().getPresentableText())
.toArray(String[]::new);
assertArrayEquals(expectedTopLevelNames, actualTopLevelNames);
String[] expectedTopLevelLocations = new String[] {"plugin.id", "MyPlugin", "1.0", "YourCompany", null, null,
"com.intellij.java-i18n", "com.intellij.javaee [optional]", "125.5 - 130.0", "plugin.id", "plugin.id", null, null};
"com.intellij.java-i18n", "com.intellij.javaee [optional]", "125.5 - 130.0", "myModule", "plugin.id", "plugin.id", null, null};
String[] actualTopLevelLocations = Stream.of(topLevelNodes)
.map(treeElement -> treeElement.getPresentation().getLocationString())
.toArray(String[]::new);
assertArrayEquals(expectedTopLevelLocations, actualTopLevelLocations);
TreeElement[] extensionNodes = topLevelNodes[9].getChildren();
TreeElement[] extensionNodes = topLevelNodes[10].getChildren();
assertSize(5, extensionNodes);
String[] expectedExtensionNames = new String[] {"Tool Window", "Project Configurable", "File Editor Provider",
"Mock Application Service", "DOM | Extender"};
@@ -82,7 +82,7 @@ public class PluginDescriptorStructureTest extends JavaCodeInsightFixtureTestCas
.toArray(String[]::new);
assertArrayEquals(expectedExtensionLocations, actualExtensionLocations);
TreeElement[] epNodes = topLevelNodes[10].getChildren();
TreeElement[] epNodes = topLevelNodes[11].getChildren();
assertSize(6, epNodes);
String[] expectedEpNames = new String[] {"someExtensionPoint", "toolWindow", "projectConfigurable", "fileEditorProvider",
@@ -99,7 +99,7 @@ public class PluginDescriptorStructureTest extends JavaCodeInsightFixtureTestCas
.toArray(String[]::new);
assertArrayEquals(expectedEpLocations, actualEpLocations);
TreeElement applicationComponentNode = assertOneElement(topLevelNodes[11].getChildren());
TreeElement applicationComponentNode = assertOneElement(topLevelNodes[12].getChildren());
assertEquals("Component", applicationComponentNode.getPresentation().getPresentableText());
assertEquals("SomeApplicationComponentImplementation", applicationComponentNode.getPresentation().getLocationString());
@@ -111,7 +111,7 @@ public class PluginDescriptorStructureTest extends JavaCodeInsightFixtureTestCas
assertEquals("Implementation Class", implementationClass.getPresentation().getPresentableText());
assertEquals("com.jetbrains.test.SomeApplicationComponentImplementation", implementationClass.getPresentation().getLocationString());
TreeElement[] actionNodes = topLevelNodes[12].getChildren();
TreeElement[] actionNodes = topLevelNodes[13].getChildren();
assertSize(2, actionNodes);
TreeElement groupNode = actionNodes[0];
assertEquals("Group", groupNode.getPresentation().getPresentableText());