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


Java PomService.convertToPsi方法代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AbstractDomChildDescriptionImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GenericDomValueReference.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntDomMacrodefAttributeReference.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:AbstractDomChildDescriptionImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AntDomProject.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AntDomTargetReference.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AntDomProperty.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PropertyReferenceBase.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:AntDomProperty.java

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

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DomResolveConverter.java

示例12: getPsiElement

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

示例13: getDeclaration

import com.intellij.pom.references.PomService; //导入方法依赖的package包/类
@Nullable
public PsiElement getDeclaration(final Project project) {
  return PomService.convertToPsi(project, this);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:DomElementXmlDescriptor.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:5,代码来源:BaseImpl.java

示例15: getDeclaration

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


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