本文整理汇总了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;
}
}
示例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;
}
}
示例3: DomEvent
import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
public DomEvent(@NotNull final DomElement element, boolean defined) {
myDefined = defined;
myElement = DomUtil.getFileElement(element);
}
示例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);
}