PsiReferenceRegistrar: cleanup

GitOrigin-RevId: cb84d0abd9c3abaca854e20343b3af4abfaf6a8b
This commit is contained in:
Yann Cébron
2019-08-22 01:50:10 +03:00
committed by intellij-monorepo-bot
parent d6350e2cf6
commit b7b3d101d7
@@ -1,52 +1,43 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi;
import com.intellij.patterns.ElementPattern;
import org.jetbrains.annotations.NotNull;
/**
* Allows to register reference providers for specific locations. The locations are described by
* {@link com.intellij.patterns.ElementPattern}s. If a pattern matches some PSI element, then the corresponding
* {@link com.intellij.psi.PsiReferenceProvider#getReferencesByElement(PsiElement, com.intellij.util.ProcessingContext)} is executed, from
* Allows to register reference providers for specific locations.
* <p>
* The locations are described by {@link ElementPattern}s. If a pattern matches some PSI element, then the corresponding
* {@link PsiReferenceProvider#getReferencesByElement(PsiElement, com.intellij.util.ProcessingContext)} is executed, from
* which one can return the references whose {@link PsiReference#getElement()} is the same as the first parameter of
* {@link com.intellij.psi.PsiReferenceProvider#getReferencesByElement(PsiElement, com.intellij.util.ProcessingContext)}.
* {@link PsiReferenceProvider#getReferencesByElement(PsiElement, com.intellij.util.ProcessingContext)}.
*
* @author peter
*/
public abstract class PsiReferenceRegistrar {
public static final double DEFAULT_PRIORITY = 0.0;
public static final double HIGHER_PRIORITY = 100.0;
public static final double LOWER_PRIORITY = -100.0;
/**
* Register reference provider with default priority ({@link #DEFAULT_PRIORITY})
* @param pattern reference place description. See {@link com.intellij.patterns.StandardPatterns}, {@link com.intellij.patterns.PlatformPatterns} and their extenders
* Register reference provider with default priority ({@link #DEFAULT_PRIORITY}).
*
* @param pattern reference place description. See {@link com.intellij.patterns.StandardPatterns}, {@link com.intellij.patterns.PlatformPatterns} and their extenders.
* @param provider provider to be registered
*/
public void registerReferenceProvider(@NotNull ElementPattern<? extends PsiElement> pattern, @NotNull PsiReferenceProvider provider) {
registerReferenceProvider(pattern, provider, DEFAULT_PRIORITY);
}
/**
* Register reference provider
* @param pattern reference place description. See {@link com.intellij.patterns.StandardPatterns}, {@link com.intellij.patterns.PlatformPatterns} and their extenders
* Register reference provider with custom priority.
*
* @param pattern reference place description. See {@link com.intellij.patterns.StandardPatterns}, {@link com.intellij.patterns.PlatformPatterns} and their extenders.
* @param provider provider to be registered
* @param priority @see DEFAULT_PRIORITY, HIGHER_PRIORITY, LOWER_PRIORITY
* @param priority see {@link #DEFAULT_PRIORITY), {@link #HIGHER_PRIORITY}, {@link #LOWER_PRIORITY}
*/
public abstract <T extends PsiElement> void registerReferenceProvider(@NotNull ElementPattern<T> pattern, @NotNull PsiReferenceProvider provider, double priority);
public abstract <T extends PsiElement> void registerReferenceProvider(@NotNull ElementPattern<T> pattern,
@NotNull PsiReferenceProvider provider,
double priority);
}