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


Java DomFileElement类代码示例

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


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

示例1: getRoot

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
@Override
@NotNull
public StructureViewTreeElement getRoot() {
    XmlFile myFile = getPsiFile();
    final DomFileElement<DomElement> fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(
        myFile,
        DomElement.class
    );
    return fileElement == null ?
        new XmlFileTreeElement(myFile) :
        new TSStructureTreeElement(
            fileElement.getRootElement().createStableCopy(),
            myDescriptor,
            myNavigationProvider
        );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:TSStructureViewTreeModel.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: _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

示例8: getProblemHolder

import com.intellij.util.xml.DomFileElement; //导入依赖的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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DomElementAnnotationsManagerImpl.java

示例9: getHighlightStatus

import com.intellij.util.xml.DomFileElement; //导入依赖的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;
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DomElementAnnotationsManagerImpl.java

示例10: hasStubElementsOfType

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement,
                                     final Class<? extends DomElement> clazz) {
  final VirtualFile file = domFileElement.getFile().getVirtualFile();
  if (!(file instanceof VirtualFileWithId)) return false;

  final String clazzName = clazz.getName();
  final int virtualFileId = ((VirtualFileWithId)file).getId();

  CommonProcessors.FindFirstProcessor<? super PsiFile> processor =
    new CommonProcessors.FindFirstProcessor<PsiFile>();
  StubIndex.getInstance().processElements(KEY, clazzName,
                                          domFileElement.getFile().getProject(),
                                          GlobalSearchScope.fileScope(domFileElement.getFile()),
                                          new IdFilter() {
                                            @Override
                                            public boolean containsFileId(int id) {
                                              return id == virtualFileId;
                                            }
                                          },
                                          PsiFile.class, 
                                          processor
  );

  return processor.isFound();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DomElementClassIndex.java

示例11: hasStubElementsWithNamespaceKey

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey) {
  final VirtualFile file = domFileElement.getFile().getVirtualFile();
  if (!(file instanceof VirtualFileWithId)) return false;

  final int virtualFileId = ((VirtualFileWithId)file).getId();
  CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
  StubIndex.getInstance().processElements(
    KEY,
    namespaceKey,
    domFileElement.getFile().getProject(),
    GlobalSearchScope.fileScope(domFileElement.getFile()),
    new IdFilter() {
      @Override
      public boolean containsFileId(int id) {
        return id == virtualFileId;
      }
    },
    PsiFile.class, 
    processor
  );
  return processor.isFound();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DomNamespaceKeyIndex.java

示例12: computeCombinedModel

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
@Nullable
protected M computeCombinedModel(@NotNull Scope scope) {
  final List<M> models = getAllModels(scope);
  switch (models.size()) {
    case 0:
      return null;
    case 1:
      return models.get(0);
  }
  final Set<XmlFile> configFiles = new LinkedHashSet<XmlFile>();
  final LinkedHashSet<DomFileElement<T>> list = new LinkedHashSet<DomFileElement<T>>(models.size());
  for (M model: models) {
    final Set<XmlFile> files = model.getConfigFiles();
    for (XmlFile file: files) {
      ContainerUtil.addIfNotNull(getDomRoot(file), list);
    }
    configFiles.addAll(files);
  }
  final DomFileElement<T> mergedModel = getModelMerger().mergeModels(DomFileElement.class, list);
  final M firstModel = models.get(0);
  return createCombinedModel(configFiles, mergedModel, firstModel, scope);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CachedMultipleDomModelFactory.java

示例13: getVariants

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
@NotNull
public Object[] getVariants() {
  List<DomFileElement<MavenDomProjectModel>> files = MavenDomUtil.collectProjectModels(getProject());

  List<Object> result = new ArrayList<Object>();

  for (DomFileElement<MavenDomProjectModel> eachDomFile : files) {
    VirtualFile eachVFile = eachDomFile.getOriginalFile().getVirtualFile();
    if (Comparing.equal(eachVFile, myVirtualFile)) continue;

    PsiFile psiFile = eachDomFile.getFile();
    String modulePath = calcRelativeModulePath(myVirtualFile, eachVFile);

    result.add(LookupElementBuilder.create(psiFile, modulePath).withPresentableText(modulePath));
  }

  return result.toArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenModulePsiReference.java

示例14: doFix

import com.intellij.util.xml.DomFileElement; //导入依赖的package包/类
private void doFix(Editor editor, final DomFileElement<IdeaPlugin> element) {
  if (myEPCandidates.size() == 1) {
    registerExtension(element, myEPCandidates.get(0));
  }
  else {
    final BaseListPopupStep<ExtensionPointCandidate> popupStep =
      new BaseListPopupStep<ExtensionPointCandidate>("Choose Extension Point", myEPCandidates) {
        @Override
        public PopupStep onChosen(ExtensionPointCandidate selectedValue, boolean finalChoice) {
          registerExtension(element, selectedValue);
          return FINAL_CHOICE;
        }
      };
    JBPopupFactory.getInstance().createListPopup(popupStep).showInBestPositionFor(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RegisterExtensionFix.java

示例15: 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


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