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


Java DomElement.getXmlElementName方法代码示例

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


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

示例1: getLocationString

import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
/**
 * Returns the location of the object (for example, the package of a class). The location
 * string is used by some renderers and usually displayed as grayed text next to the item name.
 *
 * @return the location description, or null if none is applicable.
 */
@Nullable
public String getLocationString() {
    final DomElement dom = getElement();
    final String attrValue = localizeAttribute(dom);
    if (attrValue != null) {
        return attrValue;
    }
    final String itemTypeValue = localizeItemType(dom);
    if (itemTypeValue != null) {
        return itemTypeValue;
    }
    final String modifiersValue = localizeModifiers(dom);
    if (modifiersValue != null) {
        return modifiersValue;
    }
    final String descriptionValue = localizeDescription(dom);
    if (descriptionValue != null) {
        return descriptionValue;
    }
    final String xmlElementName = dom.getXmlElementName();
    if (xmlElementName == null) {
        return null;
    }

    if (xmlElementName.equalsIgnoreCase(getPresentableText())) {
        return null;
    }
    return xmlElementName;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:36,代码来源:TSStructureTreeElement.java

示例2: RemoveDomElementQuickFix

import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
public RemoveDomElementQuickFix(@NotNull DomElement element) {
  myIsTag = element.getXmlElement() instanceof XmlTag;
  myName = element.getXmlElementName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoveDomElementQuickFix.java

示例3: getSuggestions

import com.intellij.util.xml.DomElement; //导入方法依赖的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.DomElement.getXmlElementName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。