use of com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane in project intellij-community by JetBrains.
the class ProjectViewUpdatingTest method testUpdateProjectView.
public void testUpdateProjectView() throws Exception {
getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject), new FormMergerTreeStructureProvider(myProject));
final AbstractProjectViewPSIPane pane = myStructure.createPane();
final JTree tree = pane.getTree();
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " +PsiDirectory: updateProjectView\n" + getRootFiles() + " +External Libraries\n");
final PsiJavaFile classFile = (PsiJavaFile) getContentDirectory().findSubdirectory("src").findSubdirectory("com").findSubdirectory("package1").findFile("Form1.java");
final PsiClass aClass = classFile.getClasses()[0];
final PsiFile containingFile = aClass.getContainingFile();
pane.select(aClass, containingFile.getVirtualFile(), true);
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " Form2.form\n" + " -Form:Form1\n" + " [Form1]\n" + " Form1.form\n" + getRootFiles() + " +External Libraries\n", true);
CommandProcessor.getInstance().executeCommand(myProject, () -> new RenameProcessor(myProject, aClass, "Form1_renamed", false, false).run(), null, null);
PlatformTestUtil.waitForAlarm(600);
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " Form2.form\n" + " -Form:Form1_renamed\n" + " Form1.form\n" + " [Form1_renamed]\n" + getRootFiles() + " +External Libraries\n", true);
TreeUtil.collapseAll(pane.getTree(), -1);
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " +PsiDirectory: updateProjectView\n" + getRootFiles() + " +External Libraries\n");
final PsiClass aClass2 = JavaDirectoryService.getInstance().createClass(getContentDirectory().findSubdirectory("src").findSubdirectory("com").findSubdirectory("package1"), "Class6");
PlatformTestUtil.waitForAlarm(600);
final PsiFile containingFile2 = aClass2.getContainingFile();
pane.select(aClass2, containingFile2.getVirtualFile(), true);
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " [Class6]\n" + " Form2.form\n" + " +Form:Form1_renamed\n" + getRootFiles() + " +External Libraries\n", true);
}
use of com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane in project intellij-community by JetBrains.
the class NavigateFromSourceTest method testShowClassMembers.
public void testShowClassMembers() throws Exception {
useStandardProviders();
final PsiClass[] classes = JavaDirectoryService.getInstance().getClasses(getPackageDirectory());
sortClassesByName(classes);
PsiClass psiClass = classes[0];
final AbstractProjectViewPSIPane pane = myStructure.createPane();
final PsiFile containingFile = psiClass.getContainingFile();
final VirtualFile virtualFile = containingFile.getVirtualFile();
myStructure.checkNavigateFromSourceBehaviour(psiClass, virtualFile, pane);
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" + " -PsiDirectory: showClassMembers\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " [Class1]\n" + " Class2\n" + getRootFiles() + " +External Libraries\n", true);
changeClassTextAndTryToNavigate("class Class11 {}", (PsiJavaFile) containingFile, pane, "-Project\n" + " -PsiDirectory: showClassMembers\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " -Class1.java\n" + " [Class11]\n" + " Class2\n" + getRootFiles() + " +External Libraries\n");
changeClassTextAndTryToNavigate("class Class1 {}", (PsiJavaFile) containingFile, pane, "-Project\n" + " -PsiDirectory: showClassMembers\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " [Class1]\n" + " Class2\n" + getRootFiles() + " +External Libraries\n");
doTestMultipleSelection(pane, ((PsiJavaFile) containingFile).getClasses()[0]);
}
use of com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane in project intellij-community by JetBrains.
the class TestProjectTreeStructure method createPane.
public AbstractProjectViewPSIPane createPane() {
final AbstractProjectViewPSIPane pane = new TestProjectViewPSIPane(myProject, this, 9);
pane.createComponent();
Disposer.register(this, pane);
return pane;
}
use of com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane in project intellij-community by JetBrains.
the class FormMergerTreeStructureProviderTest method testStandardProvidersForm1.
public void testStandardProvidersForm1() {
final AbstractProjectViewPSIPane pane = myStructure.createPane();
getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject), new FormMergerTreeStructureProvider(myProject));
assertStructureEqual(getPackageDirectory(), "PsiDirectory: package1\n" + " PsiClass:Class1\n" + " PsiJavaFile:Class2.java\n" + " PsiClass:Class2\n" + " PsiClass:Class3\n" + " PsiJavaFile:Class4.java\n" + " PsiFile(plain text):Form2.form\n" + " Form:Form1\n" + " PsiClass:Form1\n" + " PsiFile(plain text):Form1.form\n");
PsiFile psiFile = getPackageDirectory().findFile("Form1.form");
VirtualFile virtualFile = psiFile.getContainingFile().getVirtualFile();
myStructure.checkNavigateFromSourceBehaviour(psiFile, virtualFile, pane);
}
use of com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane in project intellij-community by JetBrains.
the class FormMergerTreeStructureProviderTest method testStandardProviders.
public void testStandardProviders() {
final AbstractProjectViewPSIPane pane = myStructure.createPane();
getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject), new FormMergerTreeStructureProvider(myProject));
assertStructureEqual(getPackageDirectory(), "PsiDirectory: package1\n" + " PsiClass:Class1\n" + " PsiJavaFile:Class2.java\n" + " PsiClass:Class2\n" + " PsiClass:Class3\n" + " PsiJavaFile:Class4.java\n" + " PsiFile(plain text):Form2.form\n" + " Form:Form1\n" + " PsiClass:Form1\n" + " PsiFile(plain text):Form1.form\n");
PsiClass psiClass = ((PsiJavaFile) getPackageDirectory().findFile("Form1.java")).getClasses()[0];
myStructure.checkNavigateFromSourceBehaviour(psiClass, psiClass.getContainingFile().getVirtualFile(), pane);
}
Aggregations