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


Java DomFileElement.getRootElement方法代码示例

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


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

示例1: getFlowsInScope

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@NotNull
private static List<DomElement> getFlowsInScope(Project project, GlobalSearchScope searchScope) {
    final List<DomElement> result = new ArrayList<>();
    final Collection<VirtualFile> files = FileTypeIndex.getFiles(StdFileTypes.XML, searchScope);
    final DomManager manager = DomManager.getDomManager(project);
    for (VirtualFile file : files) {
        final PsiFile xmlFile = PsiManager.getInstance(project).findFile(file);
        if (isMuleFile(xmlFile)) {
            final DomFileElement<Mule> fileElement = manager.getFileElement((XmlFile) xmlFile, Mule.class);
            if (fileElement != null) {
                final Mule rootElement = fileElement.getRootElement();
                result.addAll(rootElement.getFlows());
                result.addAll(rootElement.getSubFlows());
            }
        }
    }
    return result;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:19,代码来源:MuleConfigUtils.java

示例2: findGlobalElementInFile

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
private static XmlTag findGlobalElementInFile(Project project, String elementName, VirtualFile file) {
    final DomManager manager = DomManager.getDomManager(project);
    final PsiFile xmlFile = PsiManager.getInstance(project).findFile(file);
    if (isMuleFile(xmlFile)) {
        final DomFileElement<Mule> fileElement = manager.getFileElement((XmlFile) xmlFile, Mule.class);
        if (fileElement != null) {
            final Mule rootElement = fileElement.getRootElement();
            final XmlTag[] subTags = rootElement.getXmlTag().getSubTags();
            for (XmlTag subTag : subTags) {
                if (isGlobalElement(subTag)) {
                    if (elementName.equals(subTag.getAttributeValue(MuleConfigConstants.NAME_ATTRIBUTE))) {
                        return subTag;
                    }
                }
            }
        }
    }
    return null;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:21,代码来源:MuleConfigUtils.java

示例3: findFlowInFile

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
private static XmlTag findFlowInFile(Project project, String flowName, VirtualFile file) {
    final DomManager manager = DomManager.getDomManager(project);
    final PsiFile xmlFile = PsiManager.getInstance(project).findFile(file);
    if (isMuleFile(xmlFile)) {
        final DomFileElement<Mule> fileElement = manager.getFileElement((XmlFile) xmlFile, Mule.class);
        if (fileElement != null) {
            final Mule rootElement = fileElement.getRootElement();
            final List<Flow> flows = rootElement.getFlows();
            for (Flow flow : flows) {
                if (flowName.equals(flow.getName().getValue())) {
                    return flow.getXmlTag();
                }
            }
            final List<SubFlow> subFlows = rootElement.getSubFlows();
            for (SubFlow subFlow : subFlows) {
                if (flowName.equals(subFlow.getName().getValue())) {
                    return subFlow.getXmlTag();
                }
            }
        }
    }
    return null;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:25,代码来源:MuleConfigUtils.java

示例4: getGlobalElementsInScope

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@NotNull
private static List<XmlTag> getGlobalElementsInScope(Project project, GlobalSearchScope searchScope) {
    final List<XmlTag> result = new ArrayList<>();
    final Collection<VirtualFile> files = FileTypeIndex.getFiles(StdFileTypes.XML, searchScope);
    final DomManager manager = DomManager.getDomManager(project);
    for (VirtualFile file : files) {
        final PsiFile xmlFile = PsiManager.getInstance(project).findFile(file);
        if (isMuleFile(xmlFile)) {
            final DomFileElement<Mule> fileElement = manager.getFileElement((XmlFile) xmlFile, Mule.class);
            if (fileElement != null) {
                final Mule rootElement = fileElement.getRootElement();
                final XmlTag[] subTags = rootElement.getXmlTag().getSubTags();
                for (XmlTag subTag : subTags) {
                    if (isGlobalElement(subTag)) {
                        result.add(subTag);
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:23,代码来源:MuleConfigUtils.java

示例5: buildChildren

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Override
protected SimpleNode[] buildChildren() {
    List<SimpleNode> myConfigNodes = new ArrayList<>();

    final DomManager manager = DomManager.getDomManager(myProject);
    final DomFileElement<Mule> fileElement = manager.getFileElement((XmlFile) myXmlFile, Mule.class);

    if (fileElement != null) {
        final Mule rootElement = fileElement.getRootElement();
        XmlTag[] subTags = rootElement.getXmlTag().getSubTags();

        for (XmlTag nextTag : subTags) {
            MuleElementType muleElementType = MuleConfigUtils.getMuleElementTypeFromXmlElement(nextTag);

            if (muleElementType != null && //This is a global config
                    (MuleElementType.CONFIG.equals(muleElementType) || (MuleElementType.TRANSPORT_CONNECTOR.equals(muleElementType)))) {

                GlobalConfigNode nextConfigNode = new GlobalConfigNode(this, nextTag);
                myConfigNodes.add(nextConfigNode);
            }
        }
    }
    return myConfigNodes.toArray(new SimpleNode[]{});
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:25,代码来源:GlobalConfigsTreeStructure.java

示例6: _getOrCreateProblemsHolder

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
private DomElementsProblemsHolderImpl _getOrCreateProblemsHolder(final DomFileElement element) {
  DomElementsProblemsHolderImpl holder;
  final DomElement rootElement = element.getRootElement();
  final XmlTag rootTag = rootElement.getXmlTag();
  if (rootTag == null) return new DomElementsProblemsHolderImpl(element);

  holder = rootTag.getUserData(DOM_PROBLEM_HOLDER_KEY);
  if (isHolderOutdated(element.getFile()) || holder == null) {
    holder = new DomElementsProblemsHolderImpl(element);
    rootTag.putUserData(DOM_PROBLEM_HOLDER_KEY, holder);
    final CachedValue<Boolean> cachedValue = CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<Boolean>() {
      @Override
      public Result<Boolean> compute() {
        return new Result<Boolean>(Boolean.FALSE, element, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, DomElementAnnotationsManagerImpl.this, ProjectRootManager.getInstance(myProject));
      }
    }, false);
    cachedValue.getValue();
    element.getFile().putUserData(CACHED_VALUE_KEY, cachedValue);
  }
  return holder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DomElementAnnotationsManagerImpl.java

示例7: checkIncludes

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
private boolean checkIncludes(PsiFile layoutFile, PsiElement idElement) {
    AndroidFacet facet = AndroidFacet.getInstance(idElement);
    PsiFile containingFile = idElement.getContainingFile();
    DomFileElement<AndroidDomElement> fileElement = DomManager.getDomManager(layoutFile.getProject()).getFileElement((XmlFile) layoutFile, AndroidDomElement.class);
    boolean found = false;

    if (fileElement != null) {
        AndroidDomElement rootElement = fileElement.getRootElement();
        List<Include> includes = DomUtil.getChildrenOfType(rootElement, Include.class);
        for (Include include : includes) {
            ResourceValue value = include.getLayout().getValue();
            if (value != null) {
                if (facet != null) {
                    if (value.getResourceType() != null && value.getResourceName() != null) {
                        List<PsiFile> resourceFiles = facet.getLocalResourceManager().findResourceFiles(value.getResourceType(), value.getResourceName());
                        if (!resourceFiles.isEmpty()) {

                            found = isInAllIncludes(idElement, found, resourceFiles);
                        }
                    }
                }
            }
        }
    }
    return found;
}
 
开发者ID:erikzielke,项目名称:butterknife_inspections,代码行数:27,代码来源:ButterKnifeNoViewWithIdInspection.java

示例8: _getOrCreateProblemsHolder

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
private DomElementsProblemsHolderImpl _getOrCreateProblemsHolder(final DomFileElement element) {
  DomElementsProblemsHolderImpl holder;
  final DomElement rootElement = element.getRootElement();
  final XmlTag rootTag = rootElement.getXmlTag();
  if (rootTag == null) return new DomElementsProblemsHolderImpl(element);

  holder = rootTag.getUserData(DOM_PROBLEM_HOLDER_KEY);
  if (isHolderOutdated(element.getFile()) || holder == null) {
    holder = new DomElementsProblemsHolderImpl(element);
    rootTag.putUserData(DOM_PROBLEM_HOLDER_KEY, holder);
    final CachedValue<Boolean> cachedValue = CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<Boolean>() {
      @Override
      public Result<Boolean> compute() {
        return new Result<Boolean>(Boolean.FALSE, element, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myModificationTracker, ProjectRootManager.getInstance(myProject));
      }
    }, false);
    cachedValue.getValue();
    element.getFile().putUserData(CACHED_VALUE_KEY, cachedValue);
  }
  return holder;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:DomElementAnnotationsManagerImpl.java

示例9: createStructureViewBuilder

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
/**
 * construct view builder
 *
 * @param xmlFile xml file
 * @return structure view builder
 */
@Nullable public StructureViewBuilder createStructureViewBuilder(@NotNull final XmlFile xmlFile) {
    final DomFileElement fileElement = getFileElement(xmlFile);
    if (fileElement == null) {
        return null;
    }
    return new TreeBasedStructureViewBuilder() {
        @NotNull
        public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
            return new StructureViewComponent(fileEditor, createStructureViewModel(), project);
        }

        @NotNull
        public StructureViewModel createStructureViewModel() {
            return new SqlMapConfigStructureViewTreeModel(xmlFile, fileElement.getRootElement());
        }
    };
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:24,代码来源:SqlMapConfigStructureViewBuilderProvider.java

示例10: createStructureViewBuilder

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
/**
 * construct view builder
 *
 * @param xmlFile xml file
 * @return structure view builder
 */
@Nullable public StructureViewBuilder createStructureViewBuilder(@NotNull final XmlFile xmlFile) {
    final DomFileElement fileElement = getFileElement(xmlFile);
    if (fileElement == null) {
        return null;
    }
    return new TreeBasedStructureViewBuilder() {
        @NotNull
        public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
            return new StructureViewComponent(fileEditor, createStructureViewModel(), project);
        }

        @NotNull
        public StructureViewModel createStructureViewModel() {
            return new SqlMapStructureViewTreeModel(xmlFile, fileElement.getRootElement());
        }
    };
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:24,代码来源:SqlMapStructureViewBuilderProvider.java

示例11: getXmlTagForSQLCompletion

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
/**
 * get xml tag for code completion
 *
 * @param psiElement psiElement
 * @param psiFile    current file
 * @return xml tag
 */
@Nullable
public static XmlTag getXmlTagForSQLCompletion(PsiElement psiElement, PsiFile psiFile) {
    if (!psiFile.isPhysical()) {
        if (psiElement.getParent().getClass().getName().contains("com.intellij.sql.psi")) {   // text only
              if (!psiElement.isPhysical()) {   //injected sql mode
                  //todo jacky resolve parameter code completion in sql
                  List<Pair<PsiElement,TextRange>> files = InjectedLanguageUtil.getInjectedPsiFiles(psiElement);
                  InjectedLanguageManager manager = InjectedLanguageManager.getInstance(psiElement.getProject());
                  PsiLanguageInjectionHost psiLanguageInjectionHost = manager.getInjectionHost(psiElement);
                  if (psiElement.getContainingFile() instanceof XmlFile) {
                      XmlFile xmlFile = (XmlFile) psiElement.getContainingFile();
                      final DomFileElement fileElement = DomManager.getDomManager(psiFile.getProject()).getFileElement(xmlFile, DomElement.class);
                      if (fileElement != null && fileElement.getRootElement() instanceof SqlMap) {
                          return getParentSentence(psiElement);
                      }
                  }
              }
        }
    }
    return null;
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:29,代码来源:SqlMapSymbolCompletionData.java

示例12: getAntDomProjectForceAntFile

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
public static AntDomProject getAntDomProjectForceAntFile(PsiFile psiFile)
{
	if(psiFile instanceof XmlFile)
	{
		final DomManager domManager = DomManager.getDomManager(psiFile.getProject());
		DomFileElement<AntDomProject> fileElement = domManager.getFileElement((XmlFile) psiFile, AntDomProject.class);
		if(fileElement == null)
		{
			ForcedAntFileAttribute.forceAntFile(psiFile.getVirtualFile(), true);
			fileElement = domManager.getFileElement((XmlFile) psiFile, AntDomProject.class);
		}
		return fileElement != null ? fileElement.getRootElement() : null;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:17,代码来源:AntSupport.java

示例13: getRoot

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
public <T extends DomElement> T getRoot(@Nullable JavaEEModuleExtension<?> facet, @NotNull Class<T> type)
{
	if(facet != null)
	{
		ConfigFile item = facet.getDescriptorsContainer().getConfigFile(meta);
		if(item != null)
		{
			XmlFile xml = item.getXmlFile();
			if(xml != null)
			{
				DomFileElement<T> element = DomManager.getDomManager(facet.getModule().getProject()).getFileElement(xml, type);
				if(element != null)
				{
					return element.getRootElement();
				}
			}
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:22,代码来源:JavaeeDescriptor.java

示例14: getRootElement

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
public static <T> T getRootElement(final PsiFile file, final Class<T> domClass, final Module module)
{
	if(!(file instanceof XmlFile))
	{
		return null;
	}
	final DomManager domManager = DomManager.getDomManager(file.getProject());
	final DomFileElement<DomElement> element = domManager.getFileElement((XmlFile) file, DomElement.class);
	if(element == null)
	{
		return null;
	}
	final DomElement root = element.getRootElement();
	if(!ReflectionUtil.isAssignable(domClass, root.getClass()))
	{
		return null;
	}
	return (T) root;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:21,代码来源:JamCommonUtil.java

示例15: getGrammar

import com.intellij.util.xml.DomFileElement; //导入方法依赖的package包/类
@Nullable
public static Grammar getGrammar(@NotNull XmlFile element) {
  if (element instanceof RncFile) {
    return ((RncFile)element).getGrammar();
  }
  final DomFileElement<RngGrammar> fileElement = DomManager.getDomManager(element.getProject()).getFileElement(element, RngGrammar.class);
  return fileElement != null ? fileElement.getRootElement() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GrammarFactory.java


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