本文整理汇总了Java中com.intellij.pom.PomTarget类的典型用法代码示例。如果您正苦于以下问题:Java PomTarget类的具体用法?Java PomTarget怎么用?Java PomTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PomTarget类属于com.intellij.pom包,在下文中一共展示了PomTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAliasingUsages
import com.intellij.pom.PomTarget; //导入依赖的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;
}
示例2: getElementDescription
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public String getElementDescription(@NotNull PomTarget element, @NotNull ElementDescriptionLocation location) {
if (!(element instanceof DomTarget)) return null;
final DomTarget target = (DomTarget)element;
DomElement domElement = target.getDomElement();
final ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
final ElementPresentation presentation = template != null ? template.createPresentation(domElement) : domElement.getPresentation();
if (location == UsageViewTypeLocation.INSTANCE) {
return presentation.getTypeName();
}
if (location == UsageViewNodeTextLocation.INSTANCE || location == UsageViewLongNameLocation.INSTANCE) {
return presentation.getTypeName() + " " + StringUtil.notNullize(presentation.getElementName(), "''");
}
if (location instanceof HighlightUsagesDescriptionLocation) {
return presentation.getTypeName();
}
return null;
}
示例3: isReferenceTo
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public boolean isReferenceTo(final PsiElement element) {
final Converter<T> converter = getConverter();
if (converter instanceof ResolvingConverter) {
T value = myGenericValue.getValue();
if (value instanceof DomElement && element instanceof PomTargetPsiElementImpl) {
PomTarget target = ((PomTargetPsiElementImpl)element).getTarget();
if (target instanceof DomTarget) {
if (value.equals(((DomTarget)target).getDomElement())) {
return true;
}
}
}
return ((ResolvingConverter<T>)converter).isReferenceTo(element, getStringValue(), value, getConvertContext());
}
return super.isReferenceTo(element);
}
示例4: generateDoc
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public String generateDoc(PsiElement element, final PsiElement originalElement) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DelegatePsiTarget) {
element = ((DelegatePsiTarget)target).getNavigationElement();
}
}
final DomElement domElement = DomUtil.getDomElement(element);
if (domElement == null) {
return null;
}
ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
if (template != null) {
String documentation = template.createPresentation(domElement).getDocumentation();
if (documentation != null) return documentation;
}
return ElementPresentationManager.getDocumentationForElement(domElement);
}
示例5: getAdditionalUseScope
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DomTarget) {
DomElement domElement = ((DomTarget)target).getDomElement();
if (domElement instanceof ExtensionPoint) {
return createProjectXmlFilesScope(element);
}
}
}
if (element instanceof PsiClass &&
PsiUtil.isIdeaProject(element.getProject()) &&
((PsiClass)element).hasModifierProperty(PsiModifier.PUBLIC)) {
return createProjectXmlFilesScope(element);
}
return null;
}
示例6: shouldHighlightAsUnresolved
import com.intellij.pom.PomTarget; //导入依赖的package包/类
private static boolean shouldHighlightAsUnresolved(@NotNull GrReferenceExpression referenceExpression) {
if (GrHighlightUtil.isDeclarationAssignment(referenceExpression)) return false;
GrExpression qualifier = referenceExpression.getQualifier();
if (qualifier != null && qualifier.getType() == null && !isRefToPackage(qualifier)) return false;
if (qualifier != null &&
referenceExpression.getDotTokenType() == GroovyTokenTypes.mMEMBER_POINTER &&
referenceExpression.multiResolve(false).length > 0) {
return false;
}
if (!GroovyUnresolvedHighlightFilter.shouldHighlight(referenceExpression)) return false;
CollectConsumer<PomTarget> consumer = new CollectConsumer<PomTarget>();
for (PomDeclarationSearcher searcher : PomDeclarationSearcher.EP_NAME.getExtensions()) {
searcher.findDeclarationsAt(referenceExpression, 0, consumer);
if (!consumer.getResult().isEmpty()) return false;
}
return true;
}
示例7: findDeclarationsAt
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public void findDeclarationsAt(@NotNull PsiElement element, int offsetInElement, Consumer<PomTarget> consumer) {
String name = SpockUtils.getNameByReference(element);
if (name == null) return;
GrMethod method = PsiTreeUtil.getParentOfType(element, GrMethod.class);
if (method == null) return;
PsiClass containingClass = method.getContainingClass();
if (containingClass == null) return;
if (!GroovyPsiManager.isInheritorCached(containingClass, SpockUtils.SPEC_CLASS_NAME)) return;
Map<String, SpockVariableDescriptor> cachedValue = SpockUtils.getVariableMap(method);
SpockVariableDescriptor descriptor = cachedValue.get(name);
if (descriptor == null) return;
if (descriptor.getNavigationElement() == element) {
consumer.consume(descriptor.getVariable());
}
}
示例8: addAliasingUsages
import com.intellij.pom.PomTarget; //导入依赖的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;
}
示例9: getElementDescription
import com.intellij.pom.PomTarget; //导入依赖的package包/类
public String getElementDescription(@NotNull PomTarget element, @NotNull ElementDescriptionLocation location) {
if (!(element instanceof DomTarget)) return null;
final DomTarget target = (DomTarget)element;
DomElement domElement = target.getDomElement();
final ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
final ElementPresentation presentation = template != null ? template.createPresentation(domElement) : domElement.getPresentation();
if (location == UsageViewTypeLocation.INSTANCE) {
return presentation.getTypeName();
}
if (location == UsageViewNodeTextLocation.INSTANCE || location == UsageViewLongNameLocation.INSTANCE) {
return presentation.getTypeName() + " " + StringUtil.notNullize(presentation.getElementName(), "''");
}
if (location instanceof HighlightUsagesDescriptionLocation) {
return presentation.getTypeName();
}
return null;
}
示例10: isReferenceTo
import com.intellij.pom.PomTarget; //导入依赖的package包/类
public boolean isReferenceTo(final PsiElement element) {
final Converter<T> converter = getConverter();
if (converter instanceof ResolvingConverter) {
T value = myGenericValue.getValue();
if (value instanceof DomElement && element instanceof PomTargetPsiElementImpl) {
PomTarget target = ((PomTargetPsiElementImpl)element).getTarget();
if (target instanceof DomTarget) {
if (value.equals(((DomTarget)target).getDomElement())) {
return true;
}
}
}
return ((ResolvingConverter<T>)converter).isReferenceTo(element, getStringValue(), value, getConvertContext());
}
return super.isReferenceTo(element);
}
示例11: generateDoc
import com.intellij.pom.PomTarget; //导入依赖的package包/类
public String generateDoc(PsiElement element, final PsiElement originalElement) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DelegatePsiTarget) {
element = ((DelegatePsiTarget)target).getNavigationElement();
}
}
final DomElement domElement = DomUtil.getDomElement(element);
if (domElement == null) {
return null;
}
ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
if (template != null) {
String documentation = template.createPresentation(domElement).getDocumentation();
if (documentation != null) return documentation;
}
return ElementPresentationManager.getDocumentationForElement(domElement);
}
示例12: addAliasingUsages
import com.intellij.pom.PomTarget; //导入依赖的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;
}
示例13: findDeclarationsAt
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Override
public void findDeclarationsAt(@NotNull PsiElement element, int offsetInElement, Consumer<PomTarget> consumer) {
if (element instanceof AppleScriptSelectorId) {
AppleScriptHandlerInterleavedParameters handler;
final PsiElement contextElement = element.getContext() != null ? element.getContext().getContext() : null;
if (contextElement instanceof AppleScriptHandlerInterleavedParameters) {
handler = (AppleScriptHandlerInterleavedParameters) contextElement;
consumer.consume(handler);
}
}
}
示例14: pomElement
import com.intellij.pom.PomTarget; //导入依赖的package包/类
public static PsiElementPattern.Capture<PomTargetPsiElement> pomElement(final ElementPattern<? extends PomTarget> targetPattern) {
return new PsiElementPattern.Capture<PomTargetPsiElement>(PomTargetPsiElement.class).with(new PatternCondition<PomTargetPsiElement>("withPomTarget") {
@Override
public boolean accepts(@NotNull final PomTargetPsiElement element, final ProcessingContext context) {
return targetPattern.accepts(element.getTarget(), context);
}
});
}
示例15: getNameIdentifierRange
import com.intellij.pom.PomTarget; //导入依赖的package包/类
@Nullable
public static TextRange getNameIdentifierRange(PsiFile file, PsiElement element) {
final InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(element.getProject());
if (element instanceof PomTargetPsiElement) {
final PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof PsiDeclaredTarget) {
final PsiDeclaredTarget declaredTarget = (PsiDeclaredTarget)target;
final TextRange range = declaredTarget.getNameIdentifierRange();
if (range != null) {
if (range.getStartOffset() < 0 || range.getLength() <= 0) {
return null;
}
final PsiElement navElement = declaredTarget.getNavigationElement();
if (PsiUtilBase.isUnderPsiRoot(file, navElement)) {
return injectedManager.injectedToHost(navElement, range.shiftRight(navElement.getTextRange().getStartOffset()));
}
}
}
}
if (!PsiUtilBase.isUnderPsiRoot(file, element)) {
return null;
}
PsiElement identifier = IdentifierUtil.getNameIdentifier(element);
if (identifier != null && PsiUtilBase.isUnderPsiRoot(file, identifier)) {
return injectedManager.injectedToHost(identifier, identifier.getTextRange());
}
return null;
}