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


Java PomService类代码示例

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


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

示例1: addAliasingUsages

import com.intellij.pom.references.PomService; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget,
                                         @NotNull final FindUsagesOptions options,
                                         @NotNull final Processor<UsageInfo> processor) {
  for (AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
    for (final AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget)) {
      boolean success = ReferencesSearch
        .search(new ReferencesSearch.SearchParameters(ApplicationManager.getApplication().runReadAction(new Computable<PsiElement>() {
          @Override
          public PsiElement compute() {
            return PomService.convertToPsi(psiTarget);
          }
        }), options.searchScope, false, options.fastTrack))
        .forEach(new ReadActionProcessor<PsiReference>() {
          @Override
          public boolean processInReadAction(final PsiReference reference) {
            return addResult(reference, options, processor);
          }
        });
      if (!success) return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaFindUsagesHelper.java

示例2: getDeclaration

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Override
@Nullable
public PsiElement getDeclaration(final Project project) {
  DomElement domDeclaration = getDomDeclaration();
  if (domDeclaration != null) {
    final DomTarget target = DomTarget.getTarget(domDeclaration);
    if (target != null) {
      return PomService.convertToPsi(target);
    }
    return domDeclaration.getXmlElement();
  }
  final DomAnchor anchor = getUserData(DomExtensionImpl.KEY_DOM_DECLARATION);
  if (anchor != null) {
    return anchor.getContainingFile();
  }
  final SmartPsiElementPointer<?> pointer = getUserData(DomExtensionImpl.DECLARING_ELEMENT_KEY);
  if (pointer != null) {
    final PsiElement element = pointer.getElement();
    if (element != null) {
      return element;
    }
  }

  return PomService.convertToPsi(project, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractDomChildDescriptionImpl.java

示例3: resolveInner

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Nullable
protected PsiElement resolveInner(T o) {
  final Converter<T> converter = getConverter();
  if (converter instanceof ResolvingConverter) {
    return ((ResolvingConverter<T>)converter).resolve(o, getConvertContext());
  }

  if (o instanceof PsiElement) {
    return (PsiElement)o;
  }
  if (o instanceof DomElement) {
    DomTarget target = DomTarget.getTarget((DomElement)o);
    return target == null ? null : PomService.convertToPsi(target);
  }
  if (o instanceof MergedObject) {
    final List<T> list = ((MergedObject<T>)o).getImplementations();
    for (final T o1 : list) {
      final PsiElement psiElement = resolveInner(o1);
      if (psiElement != null) {
        return psiElement;
      }
    }
  }
  return o != null ? getElement() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GenericDomValueReference.java

示例4: resolve

import com.intellij.pom.references.PomService; //导入依赖的package包/类
public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) {
  final PsiElement element = psiReference.getElement();
  if (element == null) {
    return null;
  }
  final DomElement domElement = DomUtil.getDomElement(element);
  if (domElement == null) {
    return null;
  }
  final AntDomMacroDef macrodef = domElement.getParentOfType(AntDomMacroDef.class, false);
  if (macrodef == null) {
    return null;
  }
  final String name = AntStringResolver.computeString(domElement, psiReference.getCanonicalText());
  for (AntDomMacrodefAttribute attribute : macrodef.getMacroAttributes()) {
    if (name.equals(attribute.getName().getStringValue())) {
      final DomTarget target = DomTarget.getTarget(attribute);
      return target != null? PomService.convertToPsi(target) : null;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntDomMacrodefAttributeReference.java

示例5: addAliasingUsages

import com.intellij.pom.references.PomService; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget,
                                         @NotNull final Processor<UsageInfo> processor,
                                         @NotNull final FindUsagesOptions options) {
  for (AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
    for (AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget)) {
      boolean success = ReferencesSearch
        .search(new ReferencesSearch.SearchParameters(PomService.convertToPsi(psiTarget), options.searchScope, false, options.fastTrack))
        .forEach(new ReadActionProcessor<PsiReference>() {
          @Override
          public boolean processInReadAction(final PsiReference reference) {
            return addResult(processor, reference, options);
          }
        });
      if (!success) return false;
    }
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaFindUsagesHandler.java

示例6: getDeclaration

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Nullable
public PsiElement getDeclaration(final Project project) {
  DomElement domDeclaration = getDomDeclaration();
  if (domDeclaration != null) {
    final DomTarget target = DomTarget.getTarget(domDeclaration);
    if (target != null) {
      return PomService.convertToPsi(target);
    }
    return domDeclaration.getXmlElement();
  }
  final DomAnchor anchor = getUserData(DomExtensionImpl.KEY_DOM_DECLARATION);
  if (anchor != null) {
    return anchor.getContainingFile();
  }
  final SmartPsiElementPointer<?> pointer = getUserData(DomExtensionImpl.DECLARING_ELEMENT_KEY);
  if (pointer != null) {
    final PsiElement element = pointer.getElement();
    if (element != null) {
      return element;
    }
  }

  return PomService.convertToPsi(project, this);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:AbstractDomChildDescriptionImpl.java

示例7: addAliasingUsages

import com.intellij.pom.references.PomService; //导入依赖的package包/类
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget, @NotNull final FindUsagesOptions options, @NotNull final Processor<UsageInfo> processor)
{
	for(AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME))
	{
		for(final AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget))
		{
			boolean success = ReferencesSearch.search(new ReferencesSearch.SearchParameters(ReadAction.compute(() -> PomService.convertToPsi(psiTarget)), options.searchScope, false, options
					.fastTrack)).forEach(new ReadActionProcessor<PsiReference>()
			{
				@Override
				public boolean processInReadAction(final PsiReference reference)
				{
					return addResult(reference, options, processor);
				}
			});
			if(!success)
			{
				return false;
			}
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:JavaFindUsagesHelper.java

示例8: getNavigationElement

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Nullable
public PsiElement getNavigationElement(String propertyName) {
  final DomTarget target = DomTarget.getTarget(this);
  final PsiElement nameElementPsi = target != null ? PomService.convertToPsi(target) : null;
  if (nameElementPsi != null) {
    return nameElementPsi;
  }
  final XmlElement xmlElement = getXmlElement();
  return xmlElement != null? xmlElement.getNavigationElement() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AntDomProject.java

示例9: resolve

import com.intellij.pom.references.PomService; //导入依赖的package包/类
public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) {
  final TargetResolver.Result result = ((AntDomTargetReference)psiReference).doResolve(psiReference.getCanonicalText());
  if (result == null) {
    return null;
  }
  final Pair<AntDomTarget,String> pair = result.getResolvedTarget(psiReference.getCanonicalText());
  final DomTarget domTarget = pair != null && pair.getFirst() != null ? DomTarget.getTarget(pair.getFirst()) : null;
  return domTarget != null? PomService.convertToPsi(domTarget) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AntDomTargetReference.java

示例10: getNavigationElement

import com.intellij.pom.references.PomService; //导入依赖的package包/类
public PsiElement getNavigationElement(final String propertyName) {
  DomTarget domTarget = DomTarget.getTarget(this);
  if (domTarget == null) {
    final GenericAttributeValue<String> environment = getEnvironment();
    if (environment.getRawText() != null) {
      domTarget = DomTarget.getTarget(this, environment);
    }
    if (domTarget == null) {
      final GenericAttributeValue<String> resource = getResource();
      if (resource.getRawText() != null) {
        domTarget = DomTarget.getTarget(this, resource);
      }
    }
  }
  
  if (domTarget != null) {
    final PsiElement psi = PomService.convertToPsi(domTarget);
    if (psi != null) {
      return psi;
    }
  }

  final PsiFileSystemItem psiFile = getFile().getValue();
  if (psiFile != null) {
    final String prefix = getPropertyPrefixValue();
    String _propertyName = propertyName;
    if (prefix != null) {
      if (!propertyName.startsWith(prefix)) {
        return null;
      }
      _propertyName = propertyName.substring(prefix.length());
    }
    final PropertiesFile pf = toPropertiesFile(psiFile);
    if (pf != null) {
      final IProperty property = pf.findPropertyByKey(_propertyName);
      return property != null? property.getPsiElement() : null;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AntDomProperty.java

示例11: registerReferenceProviders

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName("key"),
                                      new PsiReferenceProvider() {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
      PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(element.getContainingFile());
      if (propertiesFile == null) return PsiReference.EMPTY_ARRAY;
      XmlProperty property = new XmlProperty(PsiTreeUtil.getParentOfType(element, XmlTag.class), (XmlPropertiesFileImpl)propertiesFile);
      return new PsiReference[] { new PsiReferenceBase.Immediate<PsiElement>(element, PomService.convertToPsi(property))};
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:XmlPropertiesReferenceContributor.java

示例12: getResolveResults

import com.intellij.pom.references.PomService; //导入依赖的package包/类
protected static ResolveResult[] getResolveResults(List<IProperty> properties) {
  if (properties.isEmpty()) return ResolveResult.EMPTY_ARRAY;

  final ResolveResult[] results = new ResolveResult[properties.size()];
  for (int i = 0; i < properties.size(); i++) {
    IProperty property = properties.get(i);
    results[i] = new PsiElementResolveResult(property instanceof PsiElement ? (PsiElement)property : PomService.convertToPsi(
                      (PsiTarget)property));
  }
  return results;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PropertyReferenceBase.java

示例13: getNavigationElement

import com.intellij.pom.references.PomService; //导入依赖的package包/类
public PsiElement getNavigationElement(final String propertyName) {
  DomTarget domTarget = DomTarget.getTarget(this);
  if (domTarget == null) {
    final GenericAttributeValue<String> environment = getEnvironment();
    if (environment.getRawText() != null) {
      domTarget = DomTarget.getTarget(this, environment);
    }
    if (domTarget == null) {
      final GenericAttributeValue<String> resource = getResource();
      if (resource.getRawText() != null) {
        domTarget = DomTarget.getTarget(this, resource);
      }
    }
  }
  
  if (domTarget != null) {
    final PsiElement psi = PomService.convertToPsi(domTarget);
    if (psi != null) {
      return psi;
    }
  }

  final PsiFileSystemItem psiFile = getFile().getValue();
  if (psiFile != null) {
    final String prefix = getPropertyPrefixValue();
    String _propertyName = propertyName;
    if (prefix != null) {
      if (!propertyName.startsWith(prefix)) {
        return null;
      }
      _propertyName = propertyName.substring(prefix.length());
    }
    if (psiFile instanceof PropertiesFile) {
      final IProperty property = ((PropertiesFile)psiFile).findPropertyByKey(_propertyName);
      return property != null? property.getPsiElement() : null;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:AntDomProperty.java

示例14: registerReferenceProviders

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName("key"),
                                      new PsiReferenceProvider() {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
      PropertiesFile propertiesFile = PropertiesUtil.getPropertiesFile(element.getContainingFile());
      if (propertiesFile == null) return PsiReference.EMPTY_ARRAY;
      XmlProperty property = new XmlProperty(PsiTreeUtil.getParentOfType(element, XmlTag.class), (XmlPropertiesFile)propertiesFile);
      return new PsiReference[] { new PsiReferenceBase.Immediate<PsiElement>(element, PomService.convertToPsi(property))};
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:XmlPropertiesReferenceContributor.java

示例15: getDeclaration

import com.intellij.pom.references.PomService; //导入依赖的package包/类
@Override
@Nullable
public PsiElement getDeclaration(final Project project) {
  return PomService.convertToPsi(project, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DomElementXmlDescriptor.java


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