本文整理汇总了Java中org.jetbrains.android.facet.AndroidFacet.getResourceManager方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidFacet.getResourceManager方法的具体用法?Java AndroidFacet.getResourceManager怎么用?Java AndroidFacet.getResourceManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.android.facet.AndroidFacet
的用法示例。
在下文中一共展示了AndroidFacet.getResourceManager方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findConverterForAttribute
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
private static ResolvingConverter findConverterForAttribute(String nsPrefix,
String localName,
@NotNull AndroidFacet facet,
@NotNull GenericDomValue element) {
ResourceManager manager = facet.getResourceManager("android".equals(nsPrefix)
? AndroidUtils.SYSTEM_RESOURCE_PACKAGE
: null, element.getXmlElement());
if (manager != null) {
AttributeDefinitions attrDefs = manager.getAttributeDefinitions();
if (attrDefs != null) {
AttributeDefinition attr = attrDefs.getAttrDefByName(localName);
if (attr != null) {
return AndroidDomUtil.getConverter(attr);
}
}
}
return null;
}
示例2: getAttributeDefinition
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static AttributeDefinition getAttributeDefinition(@NotNull AndroidFacet facet, @NotNull XmlAttribute attribute) {
String localName = attribute.getLocalName();
String namespace = attribute.getNamespace();
boolean isFramework = namespace.equals(ANDROID_URI);
if (!isFramework && TOOLS_URI.equals(namespace)) {
// Treat tools namespace attributes as aliases for Android namespaces: see http://tools.android.com/tips/layout-designtime-attributes
isFramework = true;
// However, there are some attributes with other meanings: http://tools.android.com/tech-docs/tools-attributes
// Filter some of these out such that they are not treated as the (unrelated but identically named) platform attributes
if (ATTR_CONTEXT.equals(localName)
|| ATTR_IGNORE.equals(localName)
|| ATTR_LOCALE.equals(localName)
|| ATTR_TARGET_API.equals(localName)) {
return null;
}
}
ResourceManager manager = facet.getResourceManager(isFramework ? SYSTEM_RESOURCE_PACKAGE : null);
if (manager != null) {
AttributeDefinitions attrDefs = manager.getAttributeDefinitions();
if (attrDefs != null) {
return attrDefs.getAttrDefByName(localName);
}
}
return null;
}
示例3: registerAttributes
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
protected static void registerAttributes(AndroidFacet facet,
DomElement element,
@NotNull String[] styleableNames,
@Nullable String resPackage,
MyCallback callback,
MyAttributeProcessor processor,
Set<XmlName> skipNames) {
ResourceManager manager = facet.getResourceManager(resPackage);
if (manager == null) return;
AttributeDefinitions attrDefs = manager.getAttributeDefinitions();
if (attrDefs == null) return;
StyleableDefinition[] styleables = getStyleables(attrDefs, styleableNames);
registerAttributes(facet, element, styleables, resPackage, callback, processor, skipNames);
}
示例4: collectTargets
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private void collectTargets(AndroidFacet facet, ResourceValue resValue, List<PsiElement> elements, boolean attrReference) {
ResourceType resType = resValue.getType();
if (resType == null) {
return;
}
ResourceManager manager = facet.getResourceManager(resValue.getPackage(), myElement);
if (manager != null) {
String resName = resValue.getResourceName();
if (resName != null) {
manager.collectLazyResourceElements(resType.getName(), resName, attrReference, myElement, elements);
}
}
}
示例5: addResourceReferenceValues
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void addResourceReferenceValues(AndroidFacet facet,
char prefix,
String type,
@Nullable String resPackage,
Collection<ResourceValue> result,
boolean explicitResourceType) {
final ResourceManager manager = facet.getResourceManager(resPackage);
if (manager != null) {
for (String name : manager.getResourceNames(type)) {
result.add(referenceTo(prefix, type, resPackage, name, explicitResourceType));
}
}
}
示例6: resolveStyleRef
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static PsiElement resolveStyleRef(StyleRefData styleRef, AndroidFacet facet) {
final ResourceManager resourceManager = facet.getResourceManager(styleRef.getStylePackage());
if (resourceManager == null) {
return null;
}
final List<ValueResourceInfoImpl> infos = resourceManager.findValueResourceInfos(
ResourceType.STYLE.getName(), styleRef.getStyleName(), true, false);
return infos.size() == 1 ? infos.get(0).computeXmlElement() : null;
}
示例7: textStyle
import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static SimpleTextAttributes textStyle(RadComponent component, String value, boolean system, StringBuilder colorValue) {
if (value.startsWith("@") && !value.startsWith("@id/") && !value.startsWith("@+id/") && !value.startsWith("@android:id/")) {
try {
int start = system ? ANDROID_PREFIX.length() : 1;
int index = value.indexOf('/', start + 1);
String type = value.substring(start, index);
String name = value.substring(index + 1);
Module module = RadModelBuilder.getModule(component);
if (module != null) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
ResourceManager manager = facet.getResourceManager(system ? AndroidUtils.SYSTEM_RESOURCE_PACKAGE : null);
if (manager != null) {
List<ResourceElement> resources = manager.findValueResources(type, name, false);
if ("color".equalsIgnoreCase(type) && !resources.isEmpty()) {
colorValue.append(resources.get(0).getRawText());
}
if (resources.isEmpty() && manager.findResourceFiles(type, name, false).isEmpty()) {
return SimpleTextAttributes.ERROR_ATTRIBUTES;
}
}
}
}
}
catch (Throwable e) {
}
}
return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}