本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例8: getEffectiveName
import com.intellij.util.xml.DomUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String getEffectiveName() {
if (DomUtil.hasXml(getName())) {
return getName().getRawText();
}
return getQualifiedName().getRawText();
}
示例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");
}
示例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();
}
示例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);
}
示例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();
}