本文整理汇总了Java中com.intellij.psi.PsiReferenceRegistrar类的典型用法代码示例。如果您正苦于以下问题:Java PsiReferenceRegistrar类的具体用法?Java PsiReferenceRegistrar怎么用?Java PsiReferenceRegistrar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiReferenceRegistrar类属于com.intellij.psi包,在下文中一共展示了PsiReferenceRegistrar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(YAMLScalar.class),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (isConfigFile(element)) {
String valueText = ((YAMLScalar) element).getTextValue();
List<MacroResolver.Match> matches = new MacroResolver().resolve(valueText);
List<PsiReference> references = new ArrayList<>();
matches.stream()
.filter(match -> !match.isEscaped())
.map(match -> resolvePsiReferences(element, match.getReference(), (element instanceof YAMLQuotedText ? 1 : 0) + match.getStartPos()))
.forEach(references::addAll);
return references.toArray(new PsiReference[references.size()]);
}
return PsiReference.EMPTY_ARRAY;
}
});
}
示例2: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (isLiteralOfConfigurationAnnotation(element) || isCoffigMethod(element)) {
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
List<PsiReference> psiReferences = resolvePsiReferences(element, value, 1);
return psiReferences.toArray(new PsiReference[psiReferences.size()]);
}
return PsiReference.EMPTY_ARRAY;
}
});
}
示例3: PsiReferenceRegistrarImpl
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
public PsiReferenceRegistrarImpl(final Language language) {
myBindingCache = new ConcurrentFactoryMap<Class, ProviderBinding[]>() {
@Nullable
@Override
protected ProviderBinding[] create(Class key) {
List<ProviderBinding> result = ContainerUtil.newSmartList();
for (Class<?> bindingClass : myBindingsMap.keySet()) {
if (bindingClass.isAssignableFrom(key)) {
result.add(myBindingsMap.get(bindingClass));
}
}
for (Class<?> bindingClass : myNamedBindingsMap.keySet()) {
if (bindingClass.isAssignableFrom(key)) {
result.add(myNamedBindingsMap.get(bindingClass));
}
}
if (language != Language.ANY) {
final PsiReferenceRegistrar anyRegistrar = ReferenceProvidersRegistry.getInstance().getRegistrar(Language.ANY);
Collections.addAll(result, ((PsiReferenceRegistrarImpl)anyRegistrar).myBindingCache.get(key));
}
//noinspection unchecked
return result.toArray(new ProviderBinding[result.size()]);
}
};
}
示例4: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar psiReferenceRegistrar) {
// <service class="\Namespace\Interface" />
XmlAttributeValuePattern serviceTag = XmlHelper.getTagAttributeValuePattern(
XmlHelper.SERVICE_TAG,
XmlHelper.CLASS_ATTRIBUTE
);
psiReferenceRegistrar.registerReferenceProvider(
serviceTag,
new XmlReferenceProvider(new ReferenceResultsFiller[]{
InterfacesResultsFiller.INSTANCE
}));
// <service method="MethodName"/>
XmlAttributeValuePattern methodAttribute = XmlHelper.getMethodAttributePattern();
psiReferenceRegistrar.registerReferenceProvider(
methodAttribute,
new XmlReferenceProvider(new ReferenceResultsFiller[]{
new ServiceMethodResultsFiller()
})
);
}
示例5: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
// references from same language
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(KUserId.class).withLanguage(KLanguage.INSTANCE),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(PsiElement element, ProcessingContext context) {
if (element instanceof KUserId) {
final String key = element.getText();
return new PsiReference[]{new KReference((KUserId)element, new TextRange(0, key.length()))};
}
return new PsiReference[0];
}
}
);
}
示例6: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
final XmlFilePattern.Capture filePattern = xmlFile().withName(string().oneOf("plugin.xml", "feature.xml", "site.xml"));
registrar.registerReferenceProvider(
XmlPatterns.xmlAttributeValue().inFile(filePattern).withValue(string().startsWith("%")),
new PluginXmlPropertiesReferenceProvider()
);
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(XmlToken.class).inside(
xmlText().inside(
xmlTag().inFile(filePattern)
)
).withText(string().startsWith("%")),
new PluginXmlPropertiesReferenceProvider()
);
}
开发者ID:VladRassokhin,项目名称:eclipse-from-idea-development,代码行数:18,代码来源:PluginXmlPropertiesProvider.java
示例7: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(StandardPatterns.instanceOf(PhpPsiElement.class), new YiiPsiReferenceProvider());
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(PsiElement.class).withParent(isParamListInMethodWithName(".+?widget\\(.+"))
, new WidgetCallReferenceProvider());
//View-to-view
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(PhpPsiElement.class)
.withParent(isParamListInMethodWithName(".+?render(Partial)*\\(.+"))
.andNot(inFile(PlatformPatterns.string().endsWith("Controller.php")))
, new ViewRenderViewReferenceProvider());
//Controller-to-view
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(PhpPsiElement.class)
.withParent(isParamListInMethodWithName("(?sim).+?render(Partial)*\\(.+"))
.and(inFile(PlatformPatterns.string().endsWith("Controller.php")))
, new ControllerRenderViewReferenceProvider());
}
示例8: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
public void registerReferenceProviders(PsiReferenceRegistrar registrar)
{
registrar.registerReferenceProvider(psiElement(XmlAttributeValue.class).withParent(xmlAttribute().withLocalName("name", "href", "mode", "elements", "exclude-result-prefixes",
"extension-element-prefixes", "stylesheet-prefix").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))), new XsltReferenceProvider());
registrar.registerReferenceProvider(xmlAttributeValue().withValue(string().matches("[^()]+")).withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))),
SchemaTypeProvider.INSTANCE);
registrar.registerReferenceProvider(xmlAttributeValue().withParent(xmlAttribute("as").withParent(xmlTag().withNamespace(XsltSupport.XSLT_NS))).withValue(string().contains(":")),
new PsiReferenceProvider()
{
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context)
{
return new PsiReference[]{new NamespacePrefixReference(element)};
}
});
}
示例9: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
// ->dispatch("event_name")
registrar.registerReferenceProvider(
PhpPatternsHelper.STRING_METHOD_ARGUMENT,
new EventDispatchReferenceProvider()
);
}
示例10: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(
tagAttributeValuePattern("action", "bean", ITEMS_TYPE_FILE_NAME),
new HybrisSpringProcessReferenceProvider()
);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:8,代码来源:HybrisSpringProcessReferenceContributor.java
示例11: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(
tagAttributeValuePattern("transition", "to", ITEMS_TYPE_FILE_NAME),
new HybrisTransitionProcessReferenceProvider()
);
registrar.registerReferenceProvider(
tagAttributeValuePattern("then", ITEMS_TYPE_FILE_NAME),
new HybrisTransitionProcessReferenceProvider()
);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:12,代码来源:HybrisProcessReferenceContributor.java
示例12: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(
tagAttributeValuePattern("enumtype", "code", ITEMS_TYPE_FILE_NAME),
new HybrisEnumItemReferenceProvider()
);
registrar.registerReferenceProvider(
tagAttributeValuePattern("value", "code", ITEMS_TYPE_FILE_NAME).inside(insideTagPattern("enumtype")),
new HybrisEnumLiteralItemReferenceProvider()
);
registrar.registerReferenceProvider(
tagAttributeValuePattern("itemtype", "code", ITEMS_TYPE_FILE_NAME),
new HybrisModelItemReferenceProvider()
);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:16,代码来源:HybrisItemXmlReferenceContributor.java
示例13: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(
PlatformPatterns.psiElement(YAMLKeyValue.class),
new NodeTypeReferenceProvider()
);
}
示例14: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_SCHEMAS_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_RESPONSES_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_PARAMETERS_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_EXAMPLES_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_REQUEST_BODIES_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_HEADERS_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_LINKS_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(localReferencePattern(OpenApiConstants.LOCAL_CALLBACKS_PREFIX), createLocalReferenceProvider());
registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
registrar.registerReferenceProvider(componentFileReferencePattern(), createComponentFileReferenceProvider());
}
示例15: registerReferenceProviders
import com.intellij.psi.PsiReferenceRegistrar; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(localDefinitionsPattern(), createLocalReferenceProvider());
registrar.registerReferenceProvider(externalDefinitionsInRootPattern(), createExternalDefinitionsInRootReferenceProvider());
registrar.registerReferenceProvider(externalDefinitionsNotInRootPattern(), createExternalDefinitionsNotInRootReferenceProvider());
registrar.registerReferenceProvider(localParametersPattern(), createLocalReferenceProvider());
registrar.registerReferenceProvider(localResponsesPattern(), createLocalReferenceProvider());
registrar.registerReferenceProvider(filePattern(), createFileReferenceProvider());
registrar.registerReferenceProvider(tagsPattern(), createTagsReferenceProvider());
}