mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-92949: xml mapping for dynamic child.
nested children supported
This commit is contained in:
@@ -68,6 +68,13 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
@Attribute("childrenEPName")
|
||||
public String childrenEPName;
|
||||
|
||||
/**
|
||||
* Indicates that configurable has dynamically calculated children.
|
||||
* {@link com.intellij.openapi.options.Configurable.Composite#getConfigurables()} will be called for such configurables.
|
||||
*/
|
||||
@Attribute("dynamic")
|
||||
public boolean dynamic;
|
||||
|
||||
@Attribute("parentId")
|
||||
public String parentId;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ConfigurableWrapper implements SearchableConfigurable {
|
||||
@Nullable
|
||||
public static <T extends UnnamedConfigurable> T wrapConfigurable(ConfigurableEP<T> ep) {
|
||||
if (ep.displayName != null || ep.key != null) {
|
||||
return (T)(ep.children != null || ep.childrenEPName != null ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
|
||||
return (T)(ep.children != null || ep.childrenEPName != null || ep.dynamic ? new CompositeWrapper(ep) : new ConfigurableWrapper(ep));
|
||||
}
|
||||
else {
|
||||
return ep.createConfigurable();
|
||||
@@ -162,15 +162,15 @@ public class ConfigurableWrapper implements SearchableConfigurable {
|
||||
|
||||
public CompositeWrapper(ConfigurableEP ep, Configurable... kids) {
|
||||
super(ep);
|
||||
if (ep.children == null) {
|
||||
kids = EMPTY_ARRAY;
|
||||
if (ep.dynamic) {
|
||||
kids = ((Composite)getConfigurable()).getConfigurables();
|
||||
}
|
||||
else {
|
||||
else if (ep.children != null) {
|
||||
kids = ContainerUtil.mapNotNull(ep.getChildren(),
|
||||
new NullableFunction<ConfigurableEP, ConfigurableWrapper>() {
|
||||
@Override
|
||||
public ConfigurableWrapper fun(ConfigurableEP ep) {
|
||||
return ep.isAvailable() ? new ConfigurableWrapper(ep) : null;
|
||||
return ep.isAvailable() ? (ConfigurableWrapper)wrapConfigurable(ep) : null;
|
||||
}
|
||||
}, EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,12 @@
|
||||
<depends optional="true" config-file="java.xml">com.intellij.modules.java</depends>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<projectConfigurable instance="com.maddyhome.idea.copyright.ui.CopyrightProjectConfigurable"/>
|
||||
<projectConfigurable instance="com.maddyhome.idea.copyright.ui.CopyrightProjectConfigurable" id="copyright" displayName="Copyright">
|
||||
<configurable instance="com.maddyhome.idea.copyright.ui.CopyrightProfilesPanel" id="copyright.profiles"
|
||||
displayName="Copyright Profiles"/>
|
||||
<configurable instance="com.maddyhome.idea.copyright.ui.CopyrightFormattingConfigurable" id="template.copyright.formatting"
|
||||
displayName="Formatting" dynamic="true"/>
|
||||
</projectConfigurable>
|
||||
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
|
||||
<checkinHandlerFactory implementation="com.maddyhome.idea.copyright.actions.UpdateCopyrightCheckinHandlerFactory"/>
|
||||
<applicationService serviceInterface="com.maddyhome.idea.copyright.util.FileTypeUtil"
|
||||
|
||||
Reference in New Issue
Block a user