use of com.intellij.util.xml.XmlName in project intellij-community by JetBrains.
the class MavenPluginConfigurationParameterDomExtender method registerExtensions.
@Override
public void registerExtensions(@NotNull MavenDomConfigurationParameter param, @NotNull DomExtensionsRegistrar r) {
for (XmlAttribute each : param.getXmlTag().getAttributes()) {
String name = each.getName();
if (CompletionUtil.DUMMY_IDENTIFIER_TRIMMED.equals(name))
continue;
r.registerGenericAttributeValueChildExtension(new XmlName(name), String.class);
}
}
use of com.intellij.util.xml.XmlName in project intellij-community by JetBrains.
the class CustomAntElementsRegistry method getCompletionVariants.
@NotNull
public Set<XmlName> getCompletionVariants(AntDomElement parentElement) {
if (parentElement instanceof AntDomCustomElement) {
// this case is already handled in AntDomExtender when defining children
return Collections.emptySet();
}
final Set<XmlName> result = new HashSet<>();
final Pair<AntDomMacroDef, AntDomScriptDef> contextMacroOrScriptDef = getContextMacroOrScriptDef(parentElement);
final AntDomMacroDef restrictToMacroDef = contextMacroOrScriptDef != null ? contextMacroOrScriptDef.getFirst() : null;
final AntDomScriptDef restrictToScriptDef = contextMacroOrScriptDef != null ? contextMacroOrScriptDef.getSecond() : null;
final boolean parentIsDataType = parentElement.isDataType();
for (final XmlName xmlName : myCustomElements.keySet()) {
final AntDomNamedElement declaringElement = myDeclarations.get(xmlName);
if (declaringElement instanceof AntDomMacrodefElement) {
if (restrictToMacroDef == null || !restrictToMacroDef.equals(declaringElement.getParentOfType(AntDomMacroDef.class, true))) {
continue;
}
} else if (declaringElement instanceof AntDomScriptdefElement) {
if (restrictToScriptDef == null || !restrictToScriptDef.equals(declaringElement.getParentOfType(AntDomScriptDef.class, true))) {
continue;
}
}
if (declaringElement != null) {
if (declaringElement.equals(restrictToMacroDef) || declaringElement.equals(restrictToScriptDef)) {
continue;
}
}
if (parentIsDataType) {
if (declaringElement instanceof AntDomMacroDef || declaringElement instanceof AntDomScriptDef || declaringElement instanceof AntDomTaskdef) {
continue;
}
if (declaringElement instanceof AntDomTypeDef) {
final AntDomTypeDef typedef = (AntDomTypeDef) declaringElement;
final Class clazz = lookupClass(xmlName);
if (clazz != null && typedef.isTask(clazz)) {
continue;
}
}
}
result.add(xmlName);
}
return result;
}
use of com.intellij.util.xml.XmlName in project intellij-community by JetBrains.
the class CustomAntElementsRegistry method addCustomDefinition.
private void addCustomDefinition(@NotNull AntDomNamedElement declaringTag, String customTagName, String nsUri, ClassProvider classProvider) {
final XmlName xmlName = new XmlName(customTagName, nsUri == null ? "" : nsUri);
myCustomElements.put(xmlName, classProvider);
myDeclarations.put(xmlName, declaringTag);
}
use of com.intellij.util.xml.XmlName in project android by JetBrains.
the class AttributeProcessingUtil method processMenuItemAttributes.
private static void processMenuItemAttributes(@NotNull AndroidFacet facet, @NotNull DomElement element, @NotNull Collection<XmlName> skippedAttributes, @NotNull AttributeProcessor callback) {
ResourceManager manager = facet.getSystemResourceManager();
if (manager == null) {
return;
}
AttributeDefinitions styleables = manager.getAttributeDefinitions();
if (styleables == null) {
return;
}
StyleableDefinition styleable = styleables.getStyleableByName("MenuItem");
if (styleable == null) {
getLog().warn("No StyleableDefinition for MenuItem");
return;
}
for (AttributeDefinition attribute : styleable.getAttributes()) {
String name = attribute.getName();
// .lint.checks.AppCompatResourceDetector.
if (name.equals(ATTR_SHOW_AS_ACTION)) {
AndroidModuleModel model = AndroidModuleModel.get(facet);
if (model != null && GradleUtil.dependsOn(model, APPCOMPAT_LIB_ARTIFACT)) {
if (skippedAttributes.add(new XmlName(name, AUTO_URI))) {
registerAttribute(attribute, "MenuItem", AUTO_URI, element, callback);
}
continue;
}
}
if (skippedAttributes.add(new XmlName(name, ANDROID_URI))) {
registerAttribute(attribute, "MenuItem", ANDROID_URI, element, callback);
}
}
}
use of com.intellij.util.xml.XmlName in project android by JetBrains.
the class AttributeProcessingUtil method registerExistingAttributes.
@NotNull
private static Set<XmlName> registerExistingAttributes(@NotNull AndroidFacet facet, @NotNull XmlTag tag, @NotNull AndroidDomElement element, @NotNull AttributeProcessor callback) {
final Set<XmlName> result = new HashSet<>();
XmlAttribute[] attrs = tag.getAttributes();
for (XmlAttribute attr : attrs) {
String localName = attr.getLocalName();
if (!localName.endsWith(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED)) {
if (!"xmlns".equals(attr.getNamespacePrefix())) {
AttributeDefinition attrDef = AndroidDomUtil.getAttributeDefinition(facet, attr);
if (attrDef != null) {
String namespace = attr.getNamespace();
result.add(new XmlName(attr.getLocalName(), attr.getNamespace()));
registerAttribute(attrDef, null, namespace.length() > 0 ? namespace : null, element, callback);
}
}
}
}
return result;
}
Aggregations