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


Java DomUtil.hasXml方法代码示例

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


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

示例1: process

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
public T process(@NotNull MavenDomProjectModel projectDom) {
  MavenDomParent parent = projectDom.getMavenParent();
  MavenParentDesc parentDesc = null;
  if (DomUtil.hasXml(parent)) {
    String parentGroupId = parent.getGroupId().getStringValue();
    String parentArtifactId = parent.getArtifactId().getStringValue();
    String parentVersion = parent.getVersion().getStringValue();
    String parentRelativePath = parent.getRelativePath().getStringValue();
    if (StringUtil.isEmptyOrSpaces(parentRelativePath)) parentRelativePath = "../pom.xml";
    MavenId parentId = new MavenId(parentGroupId, parentArtifactId, parentVersion);
    parentDesc = new MavenParentDesc(parentId, parentRelativePath);
  }

  return process(myManager.getGeneralSettings(), MavenDomUtil.getVirtualFile(projectDom), parentDesc);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenDomProjectProcessorUtils.java

示例2: getProblemsMap

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
  if (map != null) {
    return map;
  }

  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
  if (domElement == myElement) {
    for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
      mergeMaps(problems, listMap);
    }
  } else {
    mergeMaps(problems, myCachedErrors.get(domElement));
    if (DomUtil.hasXml(domElement)) {
      domElement.acceptChildren(new DomElementVisitor() {
        public void visitDomElement(DomElement element) {
          mergeMaps(problems, getProblemsMap(element));
        }
      });
    }
  }

  myCachedChildrenErrors.put(domElement, problems);
  return problems;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:DomElementsProblemsHolderImpl.java

示例3: update

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof DomFileElementNode) {
    e.getPresentation().setVisible(false);
    return;
  }

  boolean enabled = false;
  if (selectedNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
    if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
      enabled = true;
    }
  }

  e.getPresentation().setEnabled(enabled);


  if (enabled) {
    e.getPresentation().setText(getPresentationText(selectedNode, ApplicationBundle.message("action.remove")));
  }
  else {
    e.getPresentation().setText(ApplicationBundle.message("action.remove"));
  }

  e.getPresentation().setIcon(AllIcons.General.Remove);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DeleteDomElement.java

示例4: getProblemsMap

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
  if (map != null) {
    return map;
  }

  final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
  if (domElement == myElement) {
    for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
      mergeMaps(problems, listMap);
    }
  } else {
    mergeMaps(problems, myCachedErrors.get(domElement));
    if (DomUtil.hasXml(domElement)) {
      domElement.acceptChildren(new DomElementVisitor() {
        @Override
        public void visitDomElement(DomElement element) {
          mergeMaps(problems, getProblemsMap(element));
        }
      });
    }
  }

  myCachedChildrenErrors.put(domElement, problems);
  return problems;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:DomElementsProblemsHolderImpl.java

示例5: findParent

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
public static MavenDomProjectModel findParent(@NotNull MavenDomParent mavenDomParent, Project project) {
  if (!DomUtil.hasXml(mavenDomParent)) return null;

  MavenId id = new MavenId(mavenDomParent.getGroupId().getStringValue(), mavenDomParent.getArtifactId().getStringValue(),
                           mavenDomParent.getVersion().getStringValue());
  MavenProject mavenProject = MavenProjectsManager.getInstance(project).findProject(id);

  return mavenProject != null ? MavenDomUtil.getMavenDomProjectModel(project, mavenProject.getFile()) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:MavenDomProjectProcessorUtils.java

示例6: checkModule

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
private static Set<PsiClass> checkModule(Module module, PsiClass psiClass, @Nullable Set<PsiClass> types, boolean includeActions) {
  final XmlFile pluginXml = PluginModuleType.getPluginXml(module);
  if (pluginXml == null) return null;
  final DomFileElement<IdeaPlugin> fileElement = DescriptorUtil.getIdeaPlugin(pluginXml);
  if (fileElement == null) return null;

  final String qualifiedName = psiClass.getQualifiedName();
  if (qualifiedName != null) {
    final RegistrationTypeFinder finder = new RegistrationTypeFinder(psiClass, types);

    // "main" plugin.xml
    processPluginXml(pluginXml, finder, includeActions);

    // <depends> plugin.xml files
    for (Dependency dependency : fileElement.getRootElement().getDependencies()) {
      final GenericAttributeValue<PathReference> configFileAttribute = dependency.getConfigFile();
      if (!DomUtil.hasXml(configFileAttribute)) continue;

      final PathReference configFile = configFileAttribute.getValue();
      if (configFile != null) {
        final PsiElement resolve = configFile.resolve();
        if (!(resolve instanceof XmlFile)) continue;
        final XmlFile depPluginXml = (XmlFile)resolve;
        if (DescriptorUtil.isPluginXml(depPluginXml)) {
          processPluginXml(depPluginXml, finder, includeActions);
        }
      }
    }

    types = finder.getTypes();
  }

  return types;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:DevKitInspectionBase.java

示例7: compute

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected String compute() {
  String pluginId = null;
  if (DomUtil.hasXml(getId())) {
    pluginId = getId().getStringValue();
  }
  else if (DomUtil.hasXml(getName())) {
    pluginId = getName().getStringValue();
  }
  return pluginId != null ? pluginId.trim() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IdeaPluginImpl.java

示例8: getEffectiveName

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String getEffectiveName() {
  if (DomUtil.hasXml(getName())) {
    return getName().getRawText();
  }
  return getQualifiedName().getRawText();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ExtensionPointImpl.java

示例9: getNamePrefix

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
@Override
public String getNamePrefix() {
  if (DomUtil.hasXml(getQualifiedName())) {
    return null;
  }

  final IdeaPlugin plugin = getParentOfType(IdeaPlugin.class, false);
  if (plugin == null) return null;

  return StringUtil.notNullize(plugin.getPluginId(), "com.intellij");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ExtensionPointImpl.java

示例10: getEffectiveQualifiedName

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String getEffectiveQualifiedName() {
  if (DomUtil.hasXml(getQualifiedName())) {
    return getQualifiedName().getRawText();
  }

  return getNamePrefix() + "." + getName().getRawText();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ExtensionPointImpl.java

示例11: update

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
public void update(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof DomFileElementNode) {
    e.getPresentation().setVisible(false);
    return;
  }

  boolean enabled = false;
  if (selectedNode instanceof BaseDomElementNode) {
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
    if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
      enabled = true;
    }
  }

  e.getPresentation().setEnabled(enabled);


  if (enabled) {
    e.getPresentation().setText(getPresentationText(selectedNode));
  }
  else {
    e.getPresentation().setText(ApplicationBundle.message("action.remove"));
  }

  e.getPresentation().setIcon(AllIcons.General.Remove);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:DeleteDomElement.java

示例12: getExtensionPointClass

import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@Nullable
private static PsiClass getExtensionPointClass(ExtensionPoint extensionPoint) {
  return DomUtil.hasXml(extensionPoint.getInterface()) ?
         extensionPoint.getInterface().getValue() : extensionPoint.getBeanClass().getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ExtensionPointDocumentationProvider.java


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