本文整理汇总了Java中com.intellij.util.xml.Converter类的典型用法代码示例。如果您正苦于以下问题:Java Converter类的具体用法?Java Converter怎么用?Java Converter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Converter类属于com.intellij.util.xml包,在下文中一共展示了Converter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
public Converter getConverter(@NotNull GenericDomValue element) {
StyleItem item = (StyleItem)element;
String name = item.getName().getValue();
if (name != null) {
String[] strs = name.split(":");
if (strs.length == 1 || strs.length == 2) {
AndroidFacet facet = AndroidFacet.getInstance(element);
if (facet != null) {
String namespacePrefix = strs.length == 2 ? strs[0] : null;
String localName = strs[strs.length - 1];
return findConverterForAttribute(namespacePrefix, localName, facet, element);
}
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StyleItemConverter.java
示例2: getStaticallyRegisteredAttributes
import com.intellij.util.xml.Converter; //导入依赖的package包/类
private static Map<String, Pair<Type, Class>> getStaticallyRegisteredAttributes(final DomGenericInfo genericInfo) {
final Map<String, Pair<Type, Class>> map = new HashMap<String, Pair<Type, Class>>();
for (DomAttributeChildDescription description : genericInfo.getAttributeChildrenDescriptions()) {
final Type type = description.getType();
if (type instanceof ParameterizedType) {
final Type[] typeArguments = ((ParameterizedType)type).getActualTypeArguments();
if (typeArguments.length == 1) {
String name = description.getXmlElementName();
final Type attribType = typeArguments[0];
Class<? extends Converter> converterType = null;
final Convert converterAnnotation = description.getAnnotation(Convert.class);
if (converterAnnotation != null) {
converterType = converterAnnotation.value();
}
map.put(name.toLowerCase(Locale.US), new Pair<Type, Class>(attribType, converterType));
}
}
}
return map;
}
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:21,代码来源:AntDomExtender.java
示例3: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
public Converter getConverter(@NotNull GenericDomValue domElement) {
Module module = domElement.getModule();
ParamValue value = domElement.getParentOfType(ParamValue.class, false);
if (value != null) {
String paramName = value.getParamName().getStringValue();
if (paramName != null) {
for (ContextParamsProvider provider : Extensions.getExtensions(ContextParamsProvider.EP_NAME)) {
Converter converter = provider.getContextParamValueConverter(paramName, module);
if (converter != null) return converter;
}
}
}
return null;
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:17,代码来源:ContextParamValueConverter.java
示例4: registerConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public void registerConverter(@NotNull Converter<?> provider, @NotNull final PsiType type) {
registerConverter(provider, new Condition<Pair<PsiType, GenericDomValue>>() {
public boolean value(final Pair<PsiType, GenericDomValue> pair) {
return Comparing.equal(pair.getFirst(), type);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GenericDomValueConvertersRegistry.java
示例5: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Nullable
public Converter<?> getConverter(@NotNull GenericDomValue domValue, @Nullable PsiType type) {
final Pair<PsiType, GenericDomValue> pair = Pair.create(type, domValue);
for (@NotNull Condition<Pair<PsiType, GenericDomValue>> condition : myConditionConverters.keySet()) {
if (condition.value(pair)) {
return myConditionConverters.get(condition);
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GenericDomValueConvertersRegistry.java
示例6: completeTailsInFlagAttribute
import com.intellij.util.xml.Converter; //导入依赖的package包/类
private static void completeTailsInFlagAttribute(CompletionParameters parameters,
CompletionResultSet resultSet,
XmlAttributeValue parent) {
final String currentValue = parent.getValue();
if (currentValue == null || currentValue.length() == 0 || currentValue.endsWith("|")) {
return;
}
final PsiElement gp = parent.getParent();
if (!(gp instanceof XmlAttribute)) {
return;
}
final GenericAttributeValue domValue = DomManager.getDomManager(gp.getProject()).getDomElement((XmlAttribute)gp);
final Converter converter = domValue != null ? domValue.getConverter() : null;
if (!(converter instanceof FlagConverter)) {
return;
}
final TextRange valueRange = parent.getValueTextRange();
if (valueRange != null && valueRange.getEndOffset() == parameters.getOffset()) {
final Set<String> valueSet = ((FlagConverter)converter).getValues();
if (valueSet.size() > 0) {
final String prefix = resultSet.getPrefixMatcher().getPrefix();
if (valueSet.contains(prefix)) {
final ArrayList<String> filteredValues = new ArrayList<String>(valueSet);
//noinspection unchecked
DelimitedListConverter.filterVariants(filteredValues, domValue);
for (String variant : filteredValues) {
resultSet.addElement(LookupElementBuilder.create(prefix + "|" + variant));
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AndroidCompletionContributor.java
示例7: shouldCheckResolveProblems
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
protected boolean shouldCheckResolveProblems(GenericDomValue value) {
final Converter realConverter = WrappingConverter.getDeepestConverter(value.getConverter(), value);
return !(realConverter instanceof AndroidPackageConverter) &&
!(realConverter instanceof DeclareStyleableNameConverter) &&
!(realConverter instanceof OnClickConverter) &&
!(realConverter instanceof ConstantFieldConverter);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidDomInspection.java
示例8: shouldCheckResolveProblems
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
protected boolean shouldCheckResolveProblems(GenericDomValue value) {
if (!isElementInsideManagedFile(value)) {
return false;
}
Converter converter = value.getConverter();
if (converter instanceof MavenDomSoftAwareConverter) {
return !((MavenDomSoftAwareConverter)converter).isSoft(value);
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MavenModelInspection.java
示例9: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
public Converter getConverter(@NotNull GenericDomValue domElement) {
Project project = domElement.getManager().getProject();
JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
PsiClass psiClass = psiFacade.findClass(myType, GlobalSearchScope.allScope(project));
if (psiClass != null) {
GenericDomValueConvertersRegistry convertersRegistry = MavenDomConvertersRegistry.getInstance().getConvertersRegistry();
return convertersRegistry.getConverter(domElement, psiFacade.getElementFactory().createType(psiClass));
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MavenPluginCustomParameterValueConverter.java
示例10: getConverters
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@NotNull public List<Converter> getConverters(@NotNull GenericDomValue domElement) {
final String raw = domElement.getRawText();
if (raw != null) {
if (raw.contains("${") || raw.contains(File.separator) || (File.separatorChar != '/' && raw.contains("/"))) {
return Collections.<Converter>singletonList(new AntPathConverter());
}
}
return Collections.emptyList();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AntDomPropertyValueConverter.java
示例11: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Nullable
public Converter<?> getConverter(@NotNull GenericDomValue domValue, @Nullable PsiType type) {
final Pair<PsiType, GenericDomValue> pair = new Pair<PsiType, GenericDomValue>(type, domValue);
for (@NotNull Condition<Pair<PsiType, GenericDomValue>> condition : myConditionConverters.keySet()) {
if (condition.value(pair)) {
return myConditionConverters.get(condition);
}
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:GenericDomValueConvertersRegistry.java
示例12: getVariants
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@NotNull
private static Collection<?> getVariants(CompletionParameters parameters) {
if (!MavenDomUtil.isMavenFile(parameters.getOriginalFile())) return Collections.emptyList();
SmartList<?> result = new SmartList<Object>();
for (PsiReference each : getReferences(parameters)) {
if (each instanceof TagNameReference) continue;
if (each instanceof GenericDomValueReference) {
GenericDomValueReference reference = (GenericDomValueReference)each;
Converter converter = reference.getConverter();
if (converter instanceof MavenSmartConverter) {
result.addAll(((MavenSmartConverter)converter).getSmartVariants(reference.getConvertContext()));
}
else if (converter instanceof ResolvingConverter) {
//noinspection unchecked
result.addAll(((ResolvingConverter)converter).getVariants(reference.getConvertContext()));
}
}
else {
//noinspection unchecked
Collections.addAll((Collection)result, each.getVariants());
}
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:MavenSmartCompletionContributor.java
示例13: setConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
public DomExtension setConverter(@NotNull Converter converter) {
return setConverter(converter, false);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DomExtensionImpl.java
示例14: SetInvocation
import com.intellij.util.xml.Converter; //导入依赖的package包/类
protected SetInvocation(final Converter converter) {
myConverter = converter;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:SetInvocation.java
示例15: ConvertAnnotationImpl
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public ConvertAnnotationImpl(final Converter converter, final boolean soft) {
myConverter = converter;
mySoft = soft;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ConvertAnnotationImpl.java
示例16: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public Converter getConverter() {
return myConverter;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ConvertAnnotationImpl.java
示例17: value
import com.intellij.util.xml.Converter; //导入依赖的package包/类
@Override
public Class<? extends Converter> value() {
return myConverter.getClass();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ConvertAnnotationImpl.java
示例18: getConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public Converter getConverter(@NotNull GenericDomValue domElement) {
final List<Converter> converterList = getConverters(domElement);
return converterList.isEmpty()? null : converterList.get(0);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AntDomPropertyValueConverter.java
示例19: setConverter
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public DomExtension setConverter(@NotNull Converter converter) {
return setConverter(converter, false);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:DomExtensionImpl.java
示例20: value
import com.intellij.util.xml.Converter; //导入依赖的package包/类
public Class<? extends Converter> value() {
return myConverter.getClass();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:ConvertAnnotationImpl.java
注:本文中的com.intellij.util.xml.Converter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论