mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ui] restores "Go to file" for out of project content targets
This commit is contained in:
@@ -24,8 +24,12 @@ import com.intellij.openapi.application.ModalityState
|
||||
import com.intellij.openapi.application.ReadAction
|
||||
import com.intellij.openapi.util.Computable
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.psi.CommonClassNames
|
||||
import com.intellij.psi.PsiClass
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.ProjectScope
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.Consumer
|
||||
import com.intellij.util.concurrency.Semaphore
|
||||
@@ -344,6 +348,13 @@ class Intf {
|
||||
assert popup.calcSelectedIndex(popupElements.toArray(), 'PsiCl') == 0
|
||||
}
|
||||
|
||||
void "test out-of-project-content files"() {
|
||||
def scope = ProjectScope.getAllScope(project)
|
||||
def file = ReadAction.compute { myFixture.javaFacade.findClass(CommonClassNames.JAVA_LANG_OBJECT, scope).containingFile }
|
||||
def elements = getPopupElements(new GotoFileModel(project), "Object.class", true)
|
||||
assert file in elements
|
||||
}
|
||||
|
||||
private List<Object> getPopupElements(ChooseByNameModel model, String text, boolean checkboxState = false) {
|
||||
return calcPopupElements(createPopup(model), text, checkboxState)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -136,7 +136,8 @@ public class GotoFileModel extends FilteringGotoByModel<FileType> implements Dum
|
||||
if (element instanceof PsiFileSystemItem) {
|
||||
VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
|
||||
VirtualFile root = getTopLevelRoot(file);
|
||||
return root != null ? GotoFileCellRenderer.getRelativePathFromRoot(file, root) : null;
|
||||
return root != null ? GotoFileCellRenderer.getRelativePathFromRoot(file, root)
|
||||
: GotoFileCellRenderer.getRelativePath(file, myProject);
|
||||
}
|
||||
|
||||
return getElementName(element);
|
||||
|
||||
Reference in New Issue
Block a user