blob: 7fefd48b70a2e6eb6e16e7a191a5ee12e9f82891 [file] [log] [blame]
/*
* Copyright 2017 The Bazel Authors. All rights reserved.
*
* 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.
*/
package com.google.idea.blaze.java.lang.build.references;
import com.intellij.psi.PsiReferenceContributor;
import com.intellij.psi.PsiReferenceRegistrar;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider;
import com.intellij.psi.util.ClassKind;
/** Provides BUILD references to java classes from fully-qualified class names. */
public class JavaClassReferenceContributor extends PsiReferenceContributor {
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
JavaClassReferenceProvider provider = new JavaClassReferenceProvider();
provider.setOption(JavaClassReferenceProvider.CLASS_KIND, ClassKind.CLASS);
registrar.registerReferenceProvider(
JavaClassQualifiedNameReference.PATTERN, new JavaClassReferenceProvider());
}
}