当前位置: 首页>>代码示例>>Java>>正文


Java GenericDomValue类代码示例

本文整理汇总了Java中com.intellij.util.xml.GenericDomValue的典型用法代码示例。如果您正苦于以下问题:Java GenericDomValue类的具体用法?Java GenericDomValue怎么用?Java GenericDomValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GenericDomValue类属于com.intellij.util.xml包,在下文中一共展示了GenericDomValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReferenceCanonicalText

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
public static String getReferenceCanonicalText(final String name, @Nullable final AbstractMethodParams methodParams) {
  StringBuilder sb = new StringBuilder(name);
  if (methodParams == null) {
    sb.append("()");
  }
  else if (methodParams.getXmlTag() != null) {
    sb.append("(");
    final List<GenericDomValue<PsiType>> list = methodParams.getMethodParams();
    boolean first = true;
    for (GenericDomValue<PsiType> value : list) {
      if (first) first = false;
      else sb.append(", ");
      sb.append(value.getStringValue());
    }
    sb.append(")");
  }
  return sb.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AbstractMethodResolveConverter.java

示例2: checkDomElement

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
/**
 * The default implementations checks for resolve problems (if {@link #shouldCheckResolveProblems(com.intellij.util.xml.GenericDomValue)}
 * returns true), then runs annotators (see {@link com.intellij.util.xml.DomFileDescription#createAnnotator()}),
 * checks for {@link com.intellij.util.xml.Required} and {@link com.intellij.util.xml.ExtendClass} annotation
 * problems, checks for name identity (see {@link com.intellij.util.xml.NameValue} annotation) and custom annotation
 * checkers (see {@link com.intellij.util.xml.highlighting.DomCustomAnnotationChecker}).
 *
 * @param element element to check
 * @param holder  a place to add problems to
 * @param helper  helper object
 */
@Override
protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
  final int oldSize = holder.getSize();
  if (element instanceof GenericDomValue) {
    final GenericDomValue genericDomValue = (GenericDomValue) element;
    if (shouldCheckResolveProblems(genericDomValue)) {
      helper.checkResolveProblems(genericDomValue, holder);
    }
  }
  for (final Class<? extends T> aClass : getDomClasses()) {
    helper.runAnnotators(element, holder, aClass);
  }
  if (oldSize != holder.getSize()) return;

  if (!helper.checkRequired(element, holder).isEmpty()) return;
  if (!(element instanceof GenericAttributeValue) && !GenericDomValue.class.equals(ReflectionUtil.getRawType(element.getDomElementType()))) {
    if (!helper.checkNameIdentity(element, holder).isEmpty()) return;
  }

  helper.checkCustomAnnotations(element, holder);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:BasicDomElementsInspection.java

示例3: createReferences

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] createReferences(GenericDomValue value, final PsiElement element, final ConvertContext context) {
  return new PsiReference[]{new WebReference(element) {
    @NotNull
    @Override
    public Object[] getVariants() {
      Module module = context.getModule();

      if (module != null) {
        String name = MavenRepositoriesProvider.getInstance().getRepositoryUrl(getRepositoryId(context));
        if (!StringUtil.isEmptyOrSpaces(name)) return new Object[]{name};
      }
      return super.getVariants();
    }
  }};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenRepositoryConverter.java

示例4: getConverter

import com.intellij.util.xml.GenericDomValue; //导入依赖的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

示例5: registerConverter

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
public void registerConverter(@NotNull Converter<?> provider, @NotNull Class type) {
  final String name = type.getCanonicalName();
  registerConverter(provider, new Condition<Pair<PsiType, GenericDomValue>>() {
    public boolean value(final Pair<PsiType, GenericDomValue> pair) {
      return pair.first != null && Comparing.equal(name, pair.first.getCanonicalText());
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GenericDomValueConvertersRegistry.java

示例6: createDomTarget

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) {
  if (parent instanceof AntDomElement && nameElement.equals(((AntDomElement)parent).getId())) { // id attrib is defined
    return DomTarget.getTarget(parent, (GenericDomValue)nameElement);
  }
  if (parent instanceof AntDomProperty && nameElement.equals(((AntDomProperty)parent).getEnvironment())) { // environment attrib is defined
    return DomTarget.getTarget(parent, (GenericDomValue)nameElement);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AntDomDeclarationSearcher.java

示例7: GenericDomValuePattern

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
protected GenericDomValuePattern(final Class<T> aClass) {
  super(new InitialPatternCondition(aClass) {
    @Override
    public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
      return o instanceof GenericDomValue && aClass.equals(DomUtil.getGenericValueParameter(((GenericDomValue)o).getDomElementType()));
    }

  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GenericDomValuePattern.java

示例8: createGenericValueControl

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@NotNull
private static BaseControl createGenericValueControl(final Type type, final GenericDomValue<?> element, boolean commitOnEveryChange) {
  final DomStringWrapper stringWrapper = new DomStringWrapper(element);
  final Class rawType = ReflectionUtil.getRawType(type);
  if (type instanceof Class && Enum.class.isAssignableFrom(rawType)) {
    return new ComboControl(stringWrapper, rawType);
  }
  if (DomElement.class.isAssignableFrom(rawType)) {
    final ComboControl control = new ComboControl(element);
    final Required annotation = element.getAnnotation(Required.class);
    if (annotation == null || !annotation.value() || !annotation.nonEmpty()) {
      control.setNullable(true);
    }
    return control;
  }

  final DomFixedWrapper wrapper = new DomFixedWrapper(element);
  if (type.equals(boolean.class) || type.equals(Boolean.class)) {
    return new BooleanControl(wrapper);
  }
  if (type.equals(String.class)) {
    return getDomUIFactory().createTextControl(wrapper, commitOnEveryChange);
  }

  final BaseControl customControl = getDomUIFactory().createCustomControl(type, stringWrapper, commitOnEveryChange);
  if (customControl != null) return customControl;

  return getDomUIFactory().createTextControl(stringWrapper, commitOnEveryChange);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DomUIFactory.java

示例9: getConverters

import com.intellij.util.xml.GenericDomValue; //导入依赖的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

示例10: getNameElement

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@Override
@Nullable
protected GenericDomValue getNameElement(final RngDefine element) {
  final GenericAttributeValue<String> id = element.getNameAttr();
  if (id.getXmlElement() != null) {
    return id;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RngDefineMetaData.java

示例11: createReferences

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] createReferences(GenericDomValue<ResourceValue> value, PsiElement element, ConvertContext context) {
  if (element instanceof XmlAttributeValue) {
    // parent="" is allowed; it's used to deliberately allow style A.B.C to not be a child of A.B
    XmlAttributeValue attributeValue = (XmlAttributeValue)element;
    if (attributeValue.isValid() && attributeValue.getValue().isEmpty()) {
      return PsiReference.EMPTY_ARRAY;
    }
  }

  final PsiReference[] refsFromSuper = super.createReferences(value, element, context);

  final ResourceValue resValue = value.getValue();

  if (resValue == null || resValue.getPackage() != null) {
    return refsFromSuper;
  }
  final AndroidFacet facet = AndroidFacet.getInstance(context);

  if (facet != null) {
    final PsiReference[] refs = getReferencesInStyleName(value, facet);

    if (refs.length > 0) {
      return ArrayUtil.mergeArrays(refsFromSuper, refs);
    }
  }
  return refsFromSuper;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ParentStyleConverter.java

示例12: isElementInsideManagedFile

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
private static boolean isElementInsideManagedFile(GenericDomValue value) {
  VirtualFile virtualFile = DomUtil.getFile(value).getVirtualFile();
  if (virtualFile == null) {
    return false;
  }

  MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(value.getManager().getProject());

  return projectsManager.findProject(virtualFile) != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MavenModelInspection.java

示例13: createReferences

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] createReferences(GenericDomValue<String> value, PsiElement element, ConvertContext context) {
  final int length = element.getTextLength();
  if (length > 1) {
    return new PsiReference[]{new MyReference((XmlAttributeValue)element, new TextRange(1, length - 1))};
  }
  return PsiReference.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:OnClickConverter.java

示例14: createReferences

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@NotNull
@Override
public PsiReference[] createReferences(GenericDomValue value, PsiElement element, ConvertContext context) {
  if (isClassContext(context)) {
    return myPsiClassConverter.createReferences(value, element, context);
  }

  return myResourceReferenceConverter.createReferences(value, element, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MetadataValueConverter.java

示例15: getReferenceVariants

import com.intellij.util.xml.GenericDomValue; //导入依赖的package包/类
@Override
protected Object[] getReferenceVariants(final ConvertContext context, final GenericDomValue<List<AttributeFormat>> value) {
  List<AttributeFormat> variants = new ArrayList<AttributeFormat>();
  Collections.addAll(variants, AttributeFormat.values());
  filterVariants(variants, value);
  String[] stringVariants = new String[variants.size()];
  for (int i = 0, variantsSize = variants.size(); i < variantsSize; i++) {
    stringVariants[i] = StringUtil.decapitalize(variants.get(i).name());
  }
  return stringVariants;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FormatConverter.java


注:本文中的com.intellij.util.xml.GenericDomValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。