diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 86c09967bf2..97ada497428 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -286,8 +286,8 @@
-
-
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoClassContributor.java b/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoClassContributor.java
deleted file mode 100644
index 505f2d400b0..00000000000
--- a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoClassContributor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2010-2015 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.kotlin.idea.caches;
-
-import com.intellij.navigation.GotoClassContributor;
-import com.intellij.navigation.NavigationItem;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex;
-import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope;
-import org.jetbrains.kotlin.name.FqName;
-import org.jetbrains.kotlin.psi.KtClassOrObject;
-import org.jetbrains.kotlin.psi.KtEnumEntry;
-import org.jetbrains.kotlin.psi.KtNamedDeclaration;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class KotlinGotoClassContributor implements GotoClassContributor {
- @Override
- public String getQualifiedName(NavigationItem item) {
- if (item instanceof KtNamedDeclaration) {
- KtNamedDeclaration jetClass = (KtNamedDeclaration) item;
- FqName name = jetClass.getFqName();
- if (name != null) {
- return name.asString();
- }
- }
-
- return null;
- }
-
- @Override
- public String getQualifiedNameSeparator() {
- return ".";
- }
-
- @NotNull
- @Override
- public String[] getNames(Project project, boolean includeNonProjectItems) {
- return ArrayUtil.toObjectArray(KotlinClassShortNameIndex.getInstance().getAllKeys(project), String.class);
- }
-
- @NotNull
- @Override
- public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
- GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
- Collection classesOrObjects =
- KotlinClassShortNameIndex.getInstance().get(name, project, KotlinSourceFilterScope.sourceAndClassFiles(scope, project));
-
- if (classesOrObjects.isEmpty()) {
- return NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY;
- }
-
- List items = new ArrayList();
- for (KtClassOrObject classOrObject : classesOrObjects) {
- if (classOrObject != null && !(classOrObject instanceof KtEnumEntry)) {
- items.add(classOrObject);
- }
- }
-
- return ArrayUtil.toObjectArray(items, NavigationItem.class);
- }
-}
diff --git a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoSymbolContributor.java b/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoSymbolContributor.java
deleted file mode 100644
index ff39ecf5f59..00000000000
--- a/idea/src/org/jetbrains/kotlin/idea/caches/KotlinGotoSymbolContributor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2010-2015 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.kotlin.idea.caches;
-
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.intellij.navigation.ChooseByNameContributor;
-import com.intellij.navigation.NavigationItem;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.stubs.StubIndex;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex;
-import org.jetbrains.kotlin.idea.stubindex.KotlinPropertyShortNameIndex;
-import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class KotlinGotoSymbolContributor implements ChooseByNameContributor {
- @NotNull
- @Override
- public String[] getNames(Project project, boolean includeNonProjectItems) {
- Collection items = StubIndex.getInstance().getAllKeys(KotlinFunctionShortNameIndex.getInstance().getKey(), project);
- items.addAll(StubIndex.getInstance().getAllKeys(KotlinPropertyShortNameIndex.getInstance().getKey(), project));
-
- return ArrayUtil.toStringArray(items);
- }
-
- @NotNull
- @Override
- public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
- GlobalSearchScope baseScope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
- GlobalSearchScope noLibrarySourceScope = KotlinSourceFilterScope.sourceAndClassFiles(baseScope, project);
-
- Collection extends NavigationItem> functions = KotlinFunctionShortNameIndex.getInstance().get(name, project, noLibrarySourceScope);
- Collection extends NavigationItem> properties = KotlinPropertyShortNameIndex.getInstance().get(name, project, noLibrarySourceScope);
-
- List items = new ArrayList(Collections2.filter(functions, Predicates.notNull()));
- items.addAll(properties);
-
- return ArrayUtil.toObjectArray(items, NavigationItem.class);
- }
-}
diff --git a/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt b/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt
new file mode 100644
index 00000000000..74af93771f3
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2010-2016 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.kotlin.idea.goto
+
+import com.intellij.navigation.ChooseByNameContributor
+import com.intellij.navigation.GotoClassContributor
+import com.intellij.navigation.NavigationItem
+import com.intellij.openapi.project.Project
+import com.intellij.psi.search.GlobalSearchScope
+import com.intellij.psi.stubs.StubIndex
+import org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex
+import org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex
+import org.jetbrains.kotlin.idea.stubindex.KotlinPropertyShortNameIndex
+import org.jetbrains.kotlin.idea.stubindex.KotlinSourceFilterScope
+import org.jetbrains.kotlin.psi.KtEnumEntry
+import org.jetbrains.kotlin.psi.KtNamedDeclaration
+
+class KotlinGotoClassContributor : GotoClassContributor {
+ override fun getQualifiedName(item: NavigationItem): String? {
+ val declaration = item as? KtNamedDeclaration ?: return null
+ return declaration.fqName?.asString()
+ }
+
+ override fun getQualifiedNameSeparator() = "."
+
+ override fun getNames(project: Project, includeNonProjectItems: Boolean): Array {
+ return KotlinClassShortNameIndex.getInstance().getAllKeys(project).toTypedArray()
+ }
+
+ override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array {
+ val scope = if (includeNonProjectItems) GlobalSearchScope.allScope(project) else GlobalSearchScope.projectScope(project)
+ val classesOrObjects = KotlinClassShortNameIndex.getInstance().get(name, project, KotlinSourceFilterScope.sourceAndClassFiles(scope, project))
+
+ if (classesOrObjects.isEmpty()) return NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY
+
+ return classesOrObjects.filter { it != null && it !is KtEnumEntry }.toTypedArray()
+ }
+}
+
+
+class KotlinGotoSymbolContributor : ChooseByNameContributor {
+ override fun getNames(project: Project, includeNonProjectItems: Boolean): Array {
+ return listOf(KotlinFunctionShortNameIndex.getInstance(), KotlinPropertyShortNameIndex.getInstance()).flatMap {
+ StubIndex.getInstance().getAllKeys(it.key, project)
+ }.toTypedArray()
+ }
+
+ override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array {
+ val baseScope = if (includeNonProjectItems) GlobalSearchScope.allScope(project) else GlobalSearchScope.projectScope(project)
+ val noLibrarySourceScope = KotlinSourceFilterScope.sourceAndClassFiles(baseScope, project)
+
+ val functions = KotlinFunctionShortNameIndex.getInstance().get(name, project, noLibrarySourceScope)
+ val properties = KotlinPropertyShortNameIndex.getInstance().get(name, project, noLibrarySourceScope)
+
+ return functions.plus(properties).filterNotNull().toTypedArray()
+ }
+}
\ No newline at end of file