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

The following examples show how to use com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry. These examples are extracted from open source projects. 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 Project: arma-intellij-plugin   Source File: SQFString.java    License: 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 Project: arma-intellij-plugin   Source File: SQFString.java    License: 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 Project: intellij-jsonnet   Source File: JsonnetNamedElementImpl.java    License: 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 4
Source Project: intellij   Source File: JavaClassQualifiedNameReference.java    License: 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 5
Source Project: consulo   Source File: PsiReferenceServiceImpl.java    License: 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 6
Source Project: consulo   Source File: CoreApplicationEnvironment.java    License: 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 7
Source Project: intellij-jsonnet   Source File: JsonnetNamedElementImpl.java    License: Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 8
Source Project: JetBrains-NASM-Language   Source File: NASMPsiImplUtil.java    License: MIT License 4 votes vote down vote up
@NotNull
public static PsiReference[] getReferences(@NotNull NASMIdentifier element) {
    return ReferenceProvidersRegistry.getReferencesFromProviders(element);
}
 
Example 9
Source Project: JetBrains-NASM-Language   Source File: NASMPsiImplUtil.java    License: MIT License 4 votes vote down vote up
@NotNull
public static PsiReference[] getReferences(@NotNull NASMLabelIdentifier element) {
    return ReferenceProvidersRegistry.getReferencesFromProviders(element);
}
 
Example 10
Source Project: idea-php-typo3-plugin   Source File: FluidElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
    return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 11
Source Project: idea-php-typo3-plugin   Source File: FluidLiteralMixin.java    License: MIT License 4 votes vote down vote up
@NotNull
@Override
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 12
@Override
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 13
Source Project: netbeans-mmd-plugin   Source File: PsiExtraFile.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 14
Source Project: intellij-latte   Source File: LatteMacroModifierElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 15
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 16
Source Project: intellij-latte   Source File: LattePhpStaticVariableElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 17
Source Project: intellij-latte   Source File: LattePhpMethodElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 18
Source Project: intellij-latte   Source File: LattePhpClassReferenceElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 19
Source Project: intellij-latte   Source File: LattePhpVariableElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 20
Source Project: intellij-latte   Source File: LattePhpConstantElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 21
Source Project: intellij-latte   Source File: LatteMacroTagElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 22
Source Project: intellij-latte   Source File: LattePhpPropertyElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 23
Source Project: intellij-latte   Source File: LattePhpClassUsageElementImpl.java    License: MIT License 4 votes vote down vote up
@NotNull
public PsiReference[] getReferences() {
	return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 24
Source Project: idea-latex   Source File: LatexElementImpl.java    License: 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 25
Source Project: idea-gitignore   Source File: IgnoreElementImpl.java    License: 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 26
Source Project: consulo   Source File: PsiCoreCommentImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
 
Example 27
Source Project: consulo   Source File: PsiPlainTextFileImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public PsiReference[] getReferences() {
  return ReferenceProvidersRegistry.getReferencesFromProviders(this,PsiPlainTextFile.class);
}