本文整理汇总了Java中com.intellij.pom.references.PomService.convertToPsi方法的典型用法代码示例。如果您正苦于以下问题:Java PomService.convertToPsi方法的具体用法?Java PomService.convertToPsi怎么用?Java PomService.convertToPsi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.pom.references.PomService
的用法示例。
在下文中一共展示了PomService.convertToPsi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: getDeclaration
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@Override
@Nullable
public PsiElement getDeclaration(final Project project) {
return PomService.convertToPsi(project, this);
}
示例11: getPsiElement
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@Override
public PsiElement getPsiElement(@Nullable T resolvedValue) {
if (resolvedValue == null) return null;
DomTarget target = DomTarget.getTarget(resolvedValue);
return target == null ? super.getPsiElement(resolvedValue) : PomService.convertToPsi(target);
}
示例12: getPsiElement
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@NotNull
@Override
public PsiElement getPsiElement() {
return PomService.convertToPsi(this);
}
示例13: getDeclaration
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@Nullable
public PsiElement getDeclaration(final Project project) {
return PomService.convertToPsi(project, this);
}
示例14: getIdentifyingPsiElement
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
public PsiElement getIdentifyingPsiElement() {
final DomTarget target = DomTarget.getTarget(this);
return target == null? getXmlElement() : PomService.convertToPsi(target);
}
示例15: getDeclaration
import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@Override
@Nullable
public PsiElement getDeclaration(final Project project)
{
return PomService.convertToPsi(project, this);
}