use of org.jetbrains.android.dom.AndroidAnyAttributeDescriptor in project android by JetBrains.
the class NlProperties method getPropertiesWithReadLock.
@NotNull
private Table<String, String, NlPropertyItem> getPropertiesWithReadLock(@NotNull AndroidFacet facet, @NotNull List<NlComponent> components, @NotNull GradleDependencyManager dependencyManager) {
ResourceManager localResourceManager = facet.getLocalResourceManager();
ResourceManager systemResourceManager = facet.getSystemResourceManager();
if (systemResourceManager == null) {
Logger.getInstance(NlProperties.class).error("No system resource manager for module: " + facet.getModule().getName());
return ImmutableTable.of();
}
AttributeDefinitions localAttrDefs = localResourceManager.getAttributeDefinitions();
AttributeDefinitions systemAttrDefs = systemResourceManager.getAttributeDefinitions();
Table<String, String, NlPropertyItem> combinedProperties = null;
for (NlComponent component : components) {
XmlTag tag = component.getTag();
if (!tag.isValid()) {
return ImmutableTable.of();
}
XmlElementDescriptor elementDescriptor = myDescriptorProvider.getDescriptor(tag);
if (elementDescriptor == null) {
return ImmutableTable.of();
}
XmlAttributeDescriptor[] descriptors = elementDescriptor.getAttributesDescriptors(tag);
Table<String, String, NlPropertyItem> properties = HashBasedTable.create(3, descriptors.length);
for (XmlAttributeDescriptor desc : descriptors) {
String namespace = getNamespace(desc, tag);
AttributeDefinitions attrDefs = NS_RESOURCES.equals(namespace) ? systemAttrDefs : localAttrDefs;
AttributeDefinition attrDef = attrDefs == null ? null : attrDefs.getAttrDefByName(desc.getName());
NlPropertyItem property = NlPropertyItem.create(components, desc, namespace, attrDef);
properties.put(StringUtil.notNullize(namespace), property.getName(), property);
}
// Exceptions:
switch(tag.getName()) {
case AUTO_COMPLETE_TEXT_VIEW:
// An AutoCompleteTextView has a popup that is created at runtime.
// Properties for this popup can be added to the AutoCompleteTextView tag.
properties.put(ANDROID_URI, ATTR_POPUP_BACKGROUND, NlPropertyItem.create(components, new AndroidAnyAttributeDescriptor(ATTR_POPUP_BACKGROUND), ANDROID_URI, systemAttrDefs != null ? systemAttrDefs.getAttrDefByName(ATTR_POPUP_BACKGROUND) : null));
break;
}
combinedProperties = combine(properties, combinedProperties);
}
// The following properties are deprecated in the support library and can be ignored by tools:
assert combinedProperties != null;
combinedProperties.remove(AUTO_URI, ATTR_PADDING_START);
combinedProperties.remove(AUTO_URI, ATTR_PADDING_END);
combinedProperties.remove(AUTO_URI, ATTR_THEME);
setUpDesignProperties(combinedProperties);
setUpSrcCompat(combinedProperties, facet, components, dependencyManager);
initStarState(combinedProperties);
//noinspection ConstantConditions
return combinedProperties;
}
Aggregations