[devkit] EP tag property: support boolean

GitOrigin-RevId: 90d4f01a354b47915382d9abbe93e22af679170e
This commit is contained in:
Yann Cébron
2023-06-15 18:42:32 +00:00
committed by intellij-monorepo-bot
parent 03c4e119b0
commit 59018c357f
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.dom.impl;
import com.google.common.base.CaseFormat;
@@ -105,11 +105,17 @@ public class ExtensionDomExtender extends DomExtender<Extension> {
@Override
public void visitTagOrProperty(@NotNull PsiField field, @NotNull String tagName, RequiredFlag required) {
boolean isBoolean = PsiTypes.booleanType().equals(field.getType());
final DomExtension extension =
registrar.registerFixedNumberChildExtension(new XmlName(tagName), SimpleTagValue.class)
registrar.registerFixedNumberChildExtension(new XmlName(tagName), isBoolean ? SimpleBooleanTagValue.class : SimpleTagValue.class)
.setDeclaringElement(field);
markAsRequired(extension, required);
if (isBoolean) {
return;
}
final With withElement = findWithElement(elements, field);
markAsClass(extension, Extension.isClassField(field.getName()), withElement);
@@ -263,6 +269,9 @@ public class ExtensionDomExtender extends DomExtender<Extension> {
public interface SimpleTagValue extends GenericDomValue<String> {
}
public interface SimpleBooleanTagValue extends GenericDomValue<Boolean> {
}
@SuppressWarnings("ClassExplicitlyAnnotation")
private static class MyNoSpellchecking implements NoSpellchecking {