Added implementation of ClsCustomNavigationPolicy for Kotlin libraries.

This commit is contained in:
Evgeny Gerashchenko
2012-03-06 23:28:07 +04:00
parent 91adb13380
commit 2a9c124957
2 changed files with 49 additions and 0 deletions
+1
View File
@@ -154,6 +154,7 @@
<stubIndex implementation="org.jetbrains.jet.plugin.stubindex.JetExtensionFunctionNameIndex"/>
<contentBasedClassFileProcessor implementation="org.jetbrains.jet.plugin.JetContentBasedFileSubstitutor" />
<psi.clsCustomNavigationPolicy implementation="org.jetbrains.jet.plugin.JetClsNavigationPolicy" />
<editorNotificationProvider implementation="org.jetbrains.jet.plugin.quickfix.ConfigureKotlinLibraryNotificationProvider"/>
@@ -0,0 +1,48 @@
/*
* Copyright 2000-2012 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.
*/
package org.jetbrains.jet.plugin;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.compiled.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetDeclaration;
/**
* @author Evgeny Gerashchenko
* @since 3/2/12
*/
public class JetClsNavigationPolicy implements ClsCustomNavigationPolicy {
@Override
public PsiElement getNavigationElement(@NotNull ClsClassImpl clsClass) {
return getJetDeclarationByClsElement(clsClass);
}
@Override
public PsiElement getNavigationElement(@NotNull ClsMethodImpl clsMethod) {
return getJetDeclarationByClsElement(clsMethod);
}
@Override
public PsiElement getNavigationElement(@NotNull ClsFieldImpl clsField) {
return getJetDeclarationByClsElement(clsField);
}
private static JetDeclaration getJetDeclarationByClsElement(ClsElementImpl clsElement) {
JetDecompiledData decompiledData = JetDecompiledData.getDecompiledData((ClsFileImpl) clsElement.getContainingFile());
return decompiledData.getJetDeclarationByClsElement(clsElement);
}
}