DevKit: refine DOM stubs + test

This commit is contained in:
Yann Cébron
2013-12-04 17:43:16 +01:00
parent b2f3b78680
commit 84d8e52d93
6 changed files with 83 additions and 5 deletions
+1
View File
@@ -39,6 +39,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="spellchecker" />
<orderEntry type="module" module-name="dom-tests" scope="TEST" />
</component>
</module>
+4 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,10 +19,7 @@
package org.jetbrains.idea.devkit.dom;
import com.intellij.util.xml.Attribute;
import com.intellij.util.xml.Convert;
import com.intellij.util.xml.DomElement;
import com.intellij.util.xml.GenericAttributeValue;
import com.intellij.util.xml.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.dom.impl.ExtensionNsConverter;
@@ -32,10 +29,12 @@ public interface Extensions extends DomElement {
@NotNull
@Attribute("defaultExtensionNs")
@Convert(value=ExtensionNsConverter.class, soft=true)
@Stubbed
GenericAttributeValue<IdeaPlugin> getDefaultExtensionNs();
@NotNull
@Convert(value=ExtensionNsConverter.class, soft=true)
@Stubbed
GenericAttributeValue<IdeaPlugin> getXmlns();
List<Extension> getExtensions();
+1
View File
@@ -105,6 +105,7 @@ public interface IdeaPlugin extends DomElement {
@NotNull
@SubTagList("extensions")
@Stubbed
List<Extensions> getExtensions();
Extensions addExtensions();
@@ -103,4 +103,9 @@ public class PluginXmlDomFileDescription extends DomFileDescription<IdeaPlugin>
public boolean hasStubs() {
return true;
}
@Override
public int getStubVersion() {
return 2;
}
}
@@ -0,0 +1,20 @@
<idea-plugin>
<id>com.intellij.myPlugin</id>
<name>pluginName</name>
<depends>anotherPlugin</depends>
<module value="myModule"/>
<extensions xmlns="someNS" defaultExtensionNs="com.intellij">
<actionPromoter implementation="someImpl"/>
</extensions>
<extensionPoints>
<extensionPoint name="myEP" interface="SomeInterface">
<with attribute="attributeName" implements="SomeImplements"/>
</extensionPoint>
<extensionPoint qualifiedName="qualifiedName" beanClass="BeanClass"/>
</extensionPoints>
</idea-plugin>
@@ -0,0 +1,52 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.devkit.codeInsight;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.util.xml.stubs.DomStubTest;
public class PluginXmlDomStubsTest extends DomStubTest {
public void testStubs() {
doBuilderTest("pluginXmlStubs.xml",
"File:idea-plugin\n" +
" Element:idea-plugin\n" +
" Element:id\n" +
" Element:name\n" +
" Element:depends\n" +
" Element:module\n" +
" Attribute:value:myModule\n" +
" Element:extensions\n" +
" Attribute:xmlns:someNS\n" +
" Attribute:defaultExtensionNs:com.intellij\n" +
" Element:extensionPoints\n" +
" Element:extensionPoint\n" +
" Attribute:name:myEP\n" +
" Attribute:interface:SomeInterface\n" +
" Element:with\n" +
" Attribute:attribute:attributeName\n" +
" Attribute:implements:SomeImplements\n" +
" Element:extensionPoint\n" +
" Attribute:qualifiedName:qualifiedName\n" +
" Attribute:beanClass:BeanClass\n"
);
}
@Override
protected String getBasePath() {
return PluginPathManager.getPluginHomePathRelative("devkit") + "/testData/codeInsight";
}
}