extensibility for Pull Up and Push Down
[fedora-idea.git] / lang-api / src / com / intellij / psi / PsiReferenceRegistrar.java
blob6d8cb45ee10e172a3299bb0252a52e150fb41083
1 /*
2 * Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved.
3 * Use is subject to license terms.
4 */
5 package com.intellij.psi;
7 import com.intellij.openapi.project.Project;
8 import com.intellij.patterns.ElementPattern;
9 import com.intellij.patterns.PlatformPatterns;
10 import com.intellij.patterns.StandardPatterns;
11 import com.intellij.pom.references.PomReferenceProvider;
12 import org.jetbrains.annotations.NotNull;
14 /**
15 * @author peter
17 public abstract class PsiReferenceRegistrar {
18 public static final double DEFAULT_PRIORITY = 0.0;
19 public static final double HIGHER_PRIORITY = 100.0;
20 public static final double LOWER_PRIORITY = -100.0;
22 /**
23 * Register reference provider with default priority ({@link #DEFAULT_PRIORITY})
24 * @param pattern reference place description. See {@link StandardPatterns}, {@link PlatformPatterns} and their extenders
25 * @param provider
27 public void registerReferenceProvider(@NotNull ElementPattern<? extends PsiElement> pattern, @NotNull PsiReferenceProvider provider) {
28 registerReferenceProvider(pattern, provider, DEFAULT_PRIORITY);
32 /**
33 * Register reference provider
34 * @param pattern reference place description. See {@link StandardPatterns}, {@link PlatformPatterns} and their extenders
35 * @param provider
36 * @param priority @see DEFAULT_PRIORITY, HIGHER_PRIORITY, LOWER_PRIORITY
38 public abstract <T extends PsiElement> void registerReferenceProvider(@NotNull ElementPattern<T> pattern, @NotNull PsiReferenceProvider provider, double priority);
40 public <T extends PsiElement> void registerReferenceProvider(@NotNull ElementPattern<T> pattern, @NotNull PomReferenceProvider<T> provider) {
41 registerReferenceProvider(pattern, provider, DEFAULT_PRIORITY);
44 public abstract <T extends PsiElement> void registerReferenceProvider(@NotNull ElementPattern<T> pattern, @NotNull PomReferenceProvider<T> provider, double priority);
46 /**
47 * Return the project to register providers for.
48 * @return project or null, if POM references are registered
50 @Deprecated
51 public abstract Project getProject();