mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DOM stubs: exclude some dom extenders from stub building
This commit is contained in:
@@ -105,7 +105,6 @@ public interface IdeaPlugin extends DomElement {
|
||||
|
||||
@NotNull
|
||||
@SubTagList("extensions")
|
||||
@Stubbed
|
||||
List<Extensions> getExtensions();
|
||||
Extensions addExtensions();
|
||||
|
||||
|
||||
@@ -147,6 +147,11 @@ public class ExtensionDomExtender extends DomExtender<Extensions> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsStubs() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Set<IdeaPlugin> getVisiblePlugins(IdeaPlugin ideaPlugin) {
|
||||
Set<IdeaPlugin> result = ContainerUtil.newHashSet();
|
||||
MultiMap<String, IdeaPlugin> byId = getPluginMap(ideaPlugin.getManager().getProject());
|
||||
|
||||
@@ -29,9 +29,6 @@ public class PluginXmlDomStubsTest extends DomStubTest {
|
||||
" 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" +
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.xml.impl.DomInvocationHandler;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -53,6 +54,7 @@ public class DomExtenderEP extends AbstractExtensionPointBean {
|
||||
}
|
||||
}
|
||||
if (myDomClass.isAssignableFrom(handler.getRawType())) {
|
||||
if (!myExtender.supportsStubs() && XmlUtil.isStubBuilding()) return registrar;
|
||||
if (registrar == null) {
|
||||
registrar = new DomExtensionsRegistrarImpl();
|
||||
}
|
||||
|
||||
@@ -33,4 +33,12 @@ public abstract class DomExtender<T extends DomElement> {
|
||||
* @param registrar a place to register your own DOM children descriptions
|
||||
*/
|
||||
public abstract void registerExtensions(@NotNull T t, @NotNull final DomExtensionsRegistrar registrar);
|
||||
|
||||
/**
|
||||
* Makes stub building for extensions available.
|
||||
* To be compatible with general stubs contract, extension should NOT depend on anything beyond current file's content.
|
||||
*/
|
||||
public boolean supportsStubs() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,5 +106,10 @@ public class DomStubBuilderTest extends DomStubTest {
|
||||
public void registerExtensions(@NotNull Bar bar, @NotNull DomExtensionsRegistrar registrar) {
|
||||
registrar.registerAttributeChildExtension(new XmlName("extend"), Custom.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsStubs() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user