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


Java DomUtil.getFileElement方法代码示例

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


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

示例1: getProblemHolder

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Override
@NotNull
public DomElementsProblemsHolder getProblemHolder(DomElement element) {
  if (element == null || !element.isValid()) return EMPTY_PROBLEMS_HOLDER;
  final DomFileElement<DomElement> fileElement = DomUtil.getFileElement(element);

  synchronized (LOCK) {
    final XmlTag tag = fileElement.getRootElement().getXmlTag();
    if (tag != null) {
      final DomElementsProblemsHolder readyHolder = tag.getUserData(DOM_PROBLEM_HOLDER_KEY);
      if (readyHolder != null) {
        return readyHolder;
      }
    }
    return EMPTY_PROBLEMS_HOLDER;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DomElementAnnotationsManagerImpl.java

示例2: getHighlightStatus

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
public DomHighlightStatus getHighlightStatus(final DomElement element) {
  synchronized (LOCK) {
    final DomFileElement<DomElement> root = DomUtil.getFileElement(element);
    if (!isHolderOutdated(root.getFile())) {
      final DomElementsProblemsHolder holder = getProblemHolder(element);
      if (holder instanceof DomElementsProblemsHolderImpl) {
        DomElementsProblemsHolderImpl holderImpl = (DomElementsProblemsHolderImpl)holder;
        final List<DomElementsInspection> suitableInspections = getSuitableDomInspections(root, true);
        final DomElementsInspection mockInspection = getMockInspection(root);
        final boolean annotatorsFinished = mockInspection == null || holderImpl.isInspectionCompleted(mockInspection);
        final boolean inspectionsFinished = areInspectionsFinished(holderImpl, suitableInspections);
        if (annotatorsFinished) {
          if (suitableInspections.isEmpty() || inspectionsFinished) return DomHighlightStatus.INSPECTIONS_FINISHED;
          return DomHighlightStatus.ANNOTATORS_FINISHED;
        }
      }
    }
    return DomHighlightStatus.NONE;
  }

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

示例3: DomEvent

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
public DomEvent(@NotNull final DomElement element, boolean defined) {
  myDefined = defined;
  myElement = DomUtil.getFileElement(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DomEvent.java

示例4: getSuggestions

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
private String[] getSuggestions(int level) {
  Collection<String> result = new THashSet<String>();

  String value = mySelectedString.trim();
  boolean addUnqualifiedForm = true;

  XmlTag parent = PsiTreeUtil.getParentOfType(myContext, XmlTag.class, false);

  DomElement domParent = DomUtil.getDomElement(parent);
  if (domParent != null) {
    DomElement domSuperParent = domParent.getParent();
    DomFileElement<DomElement> domFile = DomUtil.getFileElement(domParent);
    if (domSuperParent != null && domFile != null && domFile.getRootElement() == domSuperParent) {
      value = domSuperParent.getXmlElementName();
      addUnqualifiedForm = false;
    }
    else {
      MavenDomShortArtifactCoordinates coordinates = DomUtil.getParentOfType(domParent, MavenDomShortArtifactCoordinates.class, false);
      if (coordinates != null && !(coordinates instanceof MavenDomProjectModel) && domParent != coordinates.getArtifactId()) {
        String artifactId = coordinates.getArtifactId().getStringValue();
        if (!StringUtil.isEmptyOrSpaces(artifactId)) {
          value = artifactId;
          addUnqualifiedForm = false;
        }
      }
    }
  }

  while (true) {
    String newValue = value.replaceAll("  ", " ");
    if (newValue.equals(value)) break;
    value = newValue;
  }

  value = value.replaceAll(" ", ".");
  List<String> parts = StringUtil.split(value, ".");
  String shortValue = parts.get(parts.size() - 1);

  if (addUnqualifiedForm) {
    result.add(value);
    result.add(shortValue);
  }

  String suffix = "";
  while (parent != null && level != 0) {
    suffix = parent.getName() + suffix;
    result.add(suffix);
    result.add(value + "." + suffix);
    result.add(shortValue + "." + suffix);
    suffix = "." + suffix;
    parent = parent.getParentTag();
    level--;
  }

  result = new ArrayList<String>(result);
  Collections.sort((List)result, CodeStyleSettingsManager.getSettings(myProject).PREFER_LONGER_NAMES ?
                                 StringLenComparator.getDescendingInstance() : StringLenComparator.getInstance());
  return ArrayUtil.toStringArray(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:IntroducePropertyDialog.java


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