Search in sources :

Example 1 with StaticEnumConverter

use of org.jetbrains.android.dom.converters.StaticEnumConverter in project android by JetBrains.

the class NlDesignProperties method getDefinitionByName.

private static AttributeDefinition getDefinitionByName(@NotNull String name) {
    AttributeDefinition definition = ToolsAttributeUtil.getAttrDefByName(name);
    assert definition != null;
    ResolvingConverter converter = ToolsAttributeUtil.getConverter(definition);
    // TODO: Figure out how to provide the correct reference editor depending on the converter.
    if (converter instanceof StaticEnumConverter) {
        Collection variants = converter.getVariants(null);
        for (Object variant : variants) {
            definition.addValue(variant.toString());
        }
    }
    return definition;
}
Also used : ResolvingConverter(com.intellij.util.xml.ResolvingConverter) AttributeDefinition(org.jetbrains.android.dom.attrs.AttributeDefinition) Collection(java.util.Collection) StaticEnumConverter(org.jetbrains.android.dom.converters.StaticEnumConverter)

Aggregations

ResolvingConverter (com.intellij.util.xml.ResolvingConverter)1 Collection (java.util.Collection)1 AttributeDefinition (org.jetbrains.android.dom.attrs.AttributeDefinition)1 StaticEnumConverter (org.jetbrains.android.dom.converters.StaticEnumConverter)1