Java 类com.intellij.util.xml.DomService 实例源码

项目:hybris-integration-intellij-idea-plugin    文件:TSStructureViewTreeModel.java   
public TSStructureViewTreeModel(
    @NotNull XmlFile file,
    @NotNull Function<DomElement, DomService.StructureViewMode> descriptor,
    @Nullable Editor editor
) {
    super(
        file,
        DomElementsNavigationManager.getManager(file.getProject())
                                    .getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME),
        descriptor,
        editor
    );
    myNavigationProvider = DomElementsNavigationManager.getManager(file.getProject())
                                                       .getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);
    myDescriptor = descriptor;
}
项目:intellij-ce-playground    文件:DomStructureViewBuilder.java   
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) {
  return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true) {
    @Override
    public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element) {
      if (element instanceof XmlElement && ((XmlElement)element).isValid()) {
        final XmlElement xmlElement = (XmlElement)element;
        XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
        while (tag != null) {
          final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
          if (domElement != null) {
            for (DomElement curElement = domElement; curElement != null; curElement = curElement.getParent()) {
              if (myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW) {
                return super.expandPathToElement(curElement.getXmlElement());
              }
            }
          }
          tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
        }

      }
      return super.expandPathToElement(element);
    }
  };
}
项目:intellij-ce-playground    文件:ExtensionPointLocator.java   
private static void findExtensionPointCandidates(PsiClass psiClass, final List<ExtensionPointCandidate> list) {
  String name = psiClass.getQualifiedName();
  if (name == null) {
    return;
  }

  final Project project = psiClass.getProject();
  final Collection<VirtualFile> candidates = DomService.getInstance().getDomFileCandidates(IdeaPlugin.class, project, GlobalSearchScope.allScope(project));
  GlobalSearchScope scope = GlobalSearchScope.filesScope(project, candidates);
  PsiSearchHelper.SERVICE.getInstance(project).processUsagesInNonJavaFiles(name, new PsiNonJavaFileReferenceProcessor() {
    @Override
    public boolean process(PsiFile file, int startOffset, int endOffset) {
      PsiElement element = file.findElementAt(startOffset);
      processExtensionPointCandidate(element, list);
      return true;
    }
  }, scope);
}
项目:tools-idea    文件:DomStructureViewBuilder.java   
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
  return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project) {
    @Override
    public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element) {
      if (element instanceof XmlElement) {
        final XmlElement xmlElement = (XmlElement)element;
        XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
        while (tag != null) {
          final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
          if (domElement != null) {
            for (DomElement curElement = domElement; curElement != null; curElement = curElement.getParent()) {
              if (myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW) {
                return super.expandPathToElement(curElement.getXmlElement());
              }
            }
          }
          tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
        }

      }
      return super.expandPathToElement(element);
    }
  };
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureTreeElement.java   
public <T extends DomElement> TSStructureTreeElement(
    final T stableCopy,
    final Function<DomElement, DomService.StructureViewMode> myDescriptor,
    final DomElementNavigationProvider myNavigationProvider
) {
    super(stableCopy, myDescriptor, myNavigationProvider);
    this.myDescriptor = myDescriptor;
    this.myNavigationProvider = myNavigationProvider;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSStructureViewBuilder.java   
public TSStructureViewBuilder(
    final XmlFile file,
    final Function<DomElement, DomService.StructureViewMode> descriptor
) {
    super(file, descriptor);
    myFile = file;
    myDescriptor = descriptor;
}
项目:hybris-integration-intellij-idea-plugin    文件:TSXmlStructureViewBuilderProvider.java   
@Nullable
@Override
public StructureViewBuilder createStructureViewBuilder(@NotNull final XmlFile xmlFile) {
    if (!TypeSystemUtils.isTypeSystemXmlFile(xmlFile)) {
        return null;
    }
    return new TSStructureViewBuilder(xmlFile, (dom) -> {
        if (dom instanceof Attributes) {
            return DomService.StructureViewMode.SHOW_CHILDREN;
        }
        return DomService.StructureViewMode.SHOW;
    });
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaClassImpl.java   
public TSMetaClassImpl(
    final @NotNull TSMetaModelImpl model,
    final @NotNull String name,
    final @NotNull ItemType dom
) {
    super(name, dom);
    myMetaModel = model;
    myAllDoms.add(DomService.getInstance().createAnchor(dom));
    registerExtends(dom);
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaReferenceImpl.java   
public ReferenceEndImpl(
    final @NotNull TSMetaModelImpl metaModel,
    final @NotNull TSMetaReference owner,
    final @NotNull RelationElement dom
) {
    myOwner = owner;
    myMetaModel = metaModel;
    myDomAnchor = DomService.getInstance().createAnchor(dom);
    myTypeName = StringUtil.notNullize(dom.getType().getStringValue());
    myRole = StringUtil.notNullize(dom.getQualifier().getStringValue());
    myNavigatable = Optional.ofNullable(dom.getNavigable().getValue()).orElse(true);
}
项目:intellij-ce-playground    文件:IdeaPluginConverter.java   
@NotNull
public static Collection<IdeaPlugin> getPlugins(Project project, GlobalSearchScope scope) {
  if (DumbService.isDumb(project)) return Collections.emptyList();

  List<DomFileElement<IdeaPlugin>> files = DomService.getInstance().getFileElements(IdeaPlugin.class, project, scope);
  return ContainerUtil.map(files, new Function<DomFileElement<IdeaPlugin>, IdeaPlugin>() {
    public IdeaPlugin fun(DomFileElement<IdeaPlugin> ideaPluginDomFileElement) {
      return ideaPluginDomFileElement.getRootElement();
    }
  });
}
项目:tools-idea    文件:IdeaPluginConverter.java   
public static Collection<IdeaPlugin> getAllPlugins(final Project project) {
  if (DumbService.isDumb(project)) return Collections.emptyList();
  GlobalSearchScope scope = GlobalSearchScopesCore.projectProductionScope(project);
  List<DomFileElement<IdeaPlugin>> files = DomService.getInstance().getFileElements(IdeaPlugin.class, project, scope);
  return ContainerUtil.map(files, new Function<DomFileElement<IdeaPlugin>, IdeaPlugin>() {
    public IdeaPlugin fun(DomFileElement<IdeaPlugin> ideaPluginDomFileElement) {
      return ideaPluginDomFileElement.getRootElement();
    }
  });
}
项目:consulo-xml    文件:DomElementXmlDescriptor.java   
@Override
@NonNls
public String getName(final PsiElement context)
{
    final String name = getDefaultName();
    if(context instanceof XmlTag)
    {
        XmlTag tag = (XmlTag) context;
        final PsiFile file = tag.getContainingFile();
        DomElement element = myManager.getDomElement(tag);
        if(element == null && tag.getParentTag() != null)
        {
            element = myManager.getDomElement(tag.getParentTag());
        }
        if(element != null && file instanceof XmlFile && !(myChildrenDescription instanceof MyRootDomChildrenDescription))
        {
            final String namespace = DomService.getInstance().getEvaluatedXmlName(element).evaluateChildName(myChildrenDescription.getXmlName()).getNamespace(tag, (XmlFile) file);
            if(!tag.getNamespaceByPrefix("").equals(namespace))
            {
                final String s = tag.getPrefixByNamespace(namespace);
                if(StringUtil.isNotEmpty(s))
                {
                    return s + ":" + name;
                }
            }
        }
    }

    return name;
}
项目:consulo-xml    文件:DomStructureViewTreeModel.java   
public DomStructureViewTreeModel(
        @NotNull XmlFile file,
        @NotNull Function<DomElement, DomService.StructureViewMode> descriptor,
        @Nullable Editor editor)
{
    this(file, DomElementsNavigationManager.getManager(file.getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager
            .DEFAULT_PROVIDER_NAME), descriptor, editor);
}
项目:consulo-xml    文件:DomStructureViewTreeModel.java   
public DomStructureViewTreeModel(
        @NotNull XmlFile file,
        final DomElementNavigationProvider navigationProvider,
        @NotNull Function<DomElement, DomService.StructureViewMode> descriptor,
        @Nullable Editor editor)
{
    super(file, editor);
    myNavigationProvider = navigationProvider;
    myDescriptor = descriptor;
}
项目:consulo-xml    文件:DomStructureViewBuilder.java   
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project)
{
    return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor) fileEditor)
            .getEditor() : null), project, true)
    {
        @Override
        public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element)
        {
            if(element instanceof XmlElement && ((XmlElement) element).isValid())
            {
                final XmlElement xmlElement = (XmlElement) element;
                XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
                while(tag != null)
                {
                    final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
                    if(domElement != null)
                    {
                        for(DomElement curElement = domElement; curElement != null; curElement = curElement.getParent())
                        {
                            if(myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW)
                            {
                                return super.expandPathToElement(curElement.getXmlElement());
                            }
                        }
                    }
                    tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
                }

            }
            return super.expandPathToElement(element);
        }
    };
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaClassImpl.java   
public void addDomRepresentation(final @NotNull ItemType anotherDom) {
    myAllDoms.add(DomService.getInstance().createAnchor(anotherDom));
    registerExtends(anotherDom);
}
项目:hybris-integration-intellij-idea-plugin    文件:TSMetaEntityImpl.java   
public TSMetaEntityImpl(final String name, final D dom) {
    myDomAnchor = DomService.getInstance().createAnchor(dom);
    myName = name;
}
项目:intellij-ce-playground    文件:DomStructureViewBuilderProvider.java   
@Override
public DomService.StructureViewMode fun(DomElement element) {
  return DomService.StructureViewMode.SHOW;
}
项目:intellij-ce-playground    文件:DomStructureViewBuilder.java   
public DomStructureViewBuilder(final XmlFile file, final Function<DomElement,DomService.StructureViewMode> descriptor) {
  myFile = file;
  myDescriptor = descriptor;
}
项目:tools-idea    文件:DomStructureViewBuilderProvider.java   
@Override
public DomService.StructureViewMode fun(DomElement element) {
  return DomService.StructureViewMode.SHOW;
}
项目:tools-idea    文件:DomStructureViewBuilder.java   
public DomStructureViewBuilder(final XmlFile file, final Function<DomElement,DomService.StructureViewMode> descriptor) {
  myFile = file;
  myDescriptor = descriptor;
}
项目:consulo-xml    文件:DomStructureViewBuilderProvider.java   
@Override
public DomService.StructureViewMode fun(DomElement element) {
  return DomService.StructureViewMode.SHOW;
}
项目:consulo-xml    文件:DomStructureViewBuilder.java   
public DomStructureViewBuilder(final XmlFile file, final Function<DomElement, DomService.StructureViewMode> descriptor)
{
    myFile = file;
    myDescriptor = descriptor;
}
项目:consulo-xml    文件:DomStubBuilder.java   
@Override
public Stub buildStubTree(FileContent fileContent)
{
    VirtualFile file = fileContent.getFile();
    Project project = fileContent.getProject();
    PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
    if(!(psiFile instanceof XmlFile))
    {
        return null;
    }

    XmlFile xmlFile = (XmlFile) psiFile;
    try
    {
        XmlUtil.BUILDING_DOM_STUBS.set(Boolean.TRUE);
        psiFile.putUserData(CONTENT_FOR_DOM_STUBS, fileContent);
        DomFileElement<? extends DomElement> fileElement = DomManager.getDomManager(project).getFileElement(xmlFile);
        if(fileElement == null || !fileElement.getFileDescription().hasStubs())
        {
            return null;
        }

        XmlFileHeader header = DomService.getInstance().getXmlFileHeader(xmlFile);
        if(header.getRootTagLocalName() == null)
        {
            LOG.error("null root tag for " + fileElement + " for " + file);
        }
        FileStub fileStub = new FileStub(header);
        XmlTag rootTag = xmlFile.getRootTag();
        if(rootTag != null)
        {
            new DomStubBuilderVisitor(DomManagerImpl.getDomManager(project)).visitXmlElement(rootTag, fileStub, 0);
        }
        return fileStub;
    }
    finally
    {
        XmlUtil.BUILDING_DOM_STUBS.set(Boolean.FALSE);
        psiFile.putUserData(CONTENT_FOR_DOM_STUBS, null);
    }
}
项目:consulo-xml    文件:FileDescriptionCachedValueProvider.java   
public FileDescriptionCachedValueProvider(final DomManagerImpl domManager, final XmlFile xmlFile)
{
    myDomManager = domManager;
    myXmlFile = xmlFile;
    myDomService = DomService.getInstance();
}
项目:intellij-ce-playground    文件:BaseDomModelFactory.java   
protected BaseDomModelFactory(@NotNull Class<T> aClass, final Project project, @NonNls String name) {
  super(aClass, DomService.getInstance().createModelMerger());

  myProject = project;

  mySimpleDomModelFactory = createSimpleModelFactory(aClass, getModelMerger(), project, name);

  myMultipleDomModelFactory = createMultipleDomModelFactory(aClass, getModelMerger(), project, name);
}
项目:tools-idea    文件:BaseDomModelFactory.java   
protected BaseDomModelFactory(@NotNull Class<T> aClass, final Project project, @NonNls String name) {
  super(aClass, DomService.getInstance().createModelMerger());

  myProject = project;

  mySimpleDomModelFactory = createSimpleModelFactory(aClass, getModelMerger(), project, name);

  myMultipleDomModelFactory = createMultipleDomModelFactory(aClass, getModelMerger(), project, name);
}
项目:consulo-xml    文件:BaseDomModelFactory.java   
protected BaseDomModelFactory(@NotNull Class<T> aClass, final Project project, @NonNls String name) {
  super(aClass, DomService.getInstance().createModelMerger());

  myProject = project;

  mySimpleDomModelFactory = createSimpleModelFactory(aClass, getModelMerger(), project, name);

  myMultipleDomModelFactory = createMultipleDomModelFactory(aClass, getModelMerger(), project, name);
}