com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry Java Examples

The following examples show how to use com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SQFString.java    From arma-intellij-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
	List<SQFVariableInStringReference> currentFileRefs = SQFScope.getVariableReferencesFor(this);
	PsiReference[] refsFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this);
	if (currentFileRefs.size() == 0 && refsFromProviders.length == 0) {
		return PsiReference.EMPTY_ARRAY;
	}
	PsiReference[] refsAsArray = new PsiReference[currentFileRefs.size() + refsFromProviders.length];
	int i = 0;
	for (; i < currentFileRefs.size(); i++) {
		refsAsArray[i] = currentFileRefs.get(i);
	}
	for (int j = 0; j < refsFromProviders.length; i++, j++) {
		refsAsArray[i] = refsFromProviders[j];
	}
	return refsAsArray;
}
 
Example #2
Source File: SQFString.java    From arma-intellij-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
	List<SQFVariableInStringReference> currentFileRefs = SQFScope.getVariableReferencesFor(this);
	PsiReference[] refsFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this);
	if (currentFileRefs.size() == 0 && refsFromProviders.length == 0) {
		return PsiReference.EMPTY_ARRAY;
	}
	PsiReference[] refsAsArray = new PsiReference[currentFileRefs.size() + refsFromProviders.length];
	int i = 0;
	for (; i < currentFileRefs.size(); i++) {
		refsAsArray[i] = currentFileRefs.get(i);
	}
	for (int j = 0; j < refsFromProviders.length; i++, j++) {
		refsAsArray[i] = refsFromProviders[j];
	}
	return refsAsArray;
}
 
Example #3
Source File: CoreApplicationEnvironment.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CoreApplicationEnvironment(@Nonnull Disposable parentDisposable) {
  myParentDisposable = parentDisposable;

  myFileTypeRegistry = new CoreFileTypeRegistry();

  myApplication = createApplication(myParentDisposable);
  ApplicationManager.setApplication(myApplication, myParentDisposable);
  myLocalFileSystem = createLocalFileSystem();
  myJarFileSystem = createJarFileSystem();

  final InjectingContainer appContainer = myApplication.getInjectingContainer();
  registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(DocumentImpl::new, null));

  VirtualFileSystem[] fs = {myLocalFileSystem, myJarFileSystem};
  VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(myApplication, fs);
  registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager);

  registerApplicationExtensionPoint(ASTLazyFactory.EP.getExtensionPointName(), ASTLazyFactory.class);
  registerApplicationExtensionPoint(ASTLeafFactory.EP.getExtensionPointName(), ASTLeafFactory.class);
  registerApplicationExtensionPoint(ASTCompositeFactory.EP.getExtensionPointName(), ASTCompositeFactory.class);

  addExtension(ASTLazyFactory.EP.getExtensionPointName(), new DefaultASTLazyFactory());
  addExtension(ASTLeafFactory.EP.getExtensionPointName(), new DefaultASTLeafFactory());
  addExtension(ASTCompositeFactory.EP.getExtensionPointName(), new DefaultASTCompositeFactory());

  registerApplicationService(EncodingManager.class, new CoreEncodingRegistry());
  registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager());
  registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
  registerApplicationService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry());
  registerApplicationService(StubTreeLoader.class, new CoreStubTreeLoader());
  registerApplicationService(PsiReferenceService.class, new PsiReferenceServiceImpl());
  registerApplicationService(MetaDataRegistrar.class, new MetaRegistry());

  registerApplicationService(ProgressManager.class, createProgressIndicatorProvider());

  registerApplicationService(JobLauncher.class, createJobLauncher());
  registerApplicationService(CodeFoldingSettings.class, new CodeFoldingSettings());
  registerApplicationService(CommandProcessor.class, new CoreCommandProcessor());
}
 
Example #4
Source File: PsiReferenceServiceImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
@Nonnull
@Override
public List<PsiReference> getReferences(@Nonnull PsiElement element, @Nonnull Hints hints) {
  if (element instanceof ContributedReferenceHost) {
    return Arrays.asList(ReferenceProvidersRegistry.getReferencesFromProviders(element, hints));
  }
  if (element instanceof HintedReferenceHost) {
    return Arrays.asList(((HintedReferenceHost)element).getReferences(hints));
  }
  return Arrays.asList(element.getReferences());
}
 
Example #5
Source File: JavaClassQualifiedNameReference.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public PsiReference[] getReferences(String attributeName, StringLiteral literal) {
  if (!JAVA_CLASS_STRING_TYPES.contains(attributeName)) {
    return PsiReference.EMPTY_ARRAY;
  }
  return ReferenceProvidersRegistry.getReferencesFromProviders(literal);
}
 
Example #6
Source File: JsonnetNamedElementImpl.java    From intellij-jsonnet with Apache License 2.0 5 votes vote down vote up
@Override
public PsiReference getReference() {
    PsiReference[] referencesFromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this);
    if (referencesFromProviders.length == 1)
        return referencesFromProviders[0];
    else
        return null;
}
 
Example #7
Source File: LattePhpStaticVariableElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #8
Source File: PsiPlainTextFileImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this,PsiPlainTextFile.class);
}
 
Example #9
Source File: PsiCoreCommentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #10
Source File: IgnoreElementImpl.java    From idea-gitignore with MIT License 4 votes vote down vote up
/**
 * Gets {@link PsiReference} list for given element.
 *
 * @return {@link PsiReference} list
 */
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #11
Source File: LatexElementImpl.java    From idea-latex with MIT License 4 votes vote down vote up
/**
 * Gets {@link PsiReference} list for given element.
 *
 * @return {@link PsiReference} list
 */
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #12
Source File: LattePhpClassUsageElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #13
Source File: LattePhpPropertyElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #14
Source File: LatteMacroTagElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #15
Source File: LattePhpConstantElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #16
Source File: LattePhpVariableElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #17
Source File: LattePhpClassReferenceElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #18
Source File: LattePhpMethodElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #19
Source File: LattePhpNamespaceReferenceElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #20
Source File: LatteMacroModifierElementImpl.java    From intellij-latte with MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #21
Source File: PsiExtraFile.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #22
Source File: JSGraphQLEndpointStringLiteralPsiElement.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@Override
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #23
Source File: FluidLiteralMixin.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #24
Source File: FluidElementImpl.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example #25
Source File: NASMPsiImplUtil.java    From JetBrains-NASM-Language with MIT License 4 votes vote down vote up
@NotNull
public static PsiReference[] getReferences(@NotNull NASMLabelIdentifier element) {
    return ReferenceProvidersRegistry.getReferencesFromProviders(element);
}
 
Example #26
Source File: NASMPsiImplUtil.java    From JetBrains-NASM-Language with MIT License 4 votes vote down vote up
@NotNull
public static PsiReference[] getReferences(@NotNull NASMIdentifier element) {
    return ReferenceProvidersRegistry.getReferencesFromProviders(element);
}
 
Example #27
Source File: JsonnetNamedElementImpl.java    From intellij-jsonnet with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}