void () { PsiClass psiClass = JavaDirectoryService.getInstance().getClasses(getPackageDirectory("com/package1"))[0]; VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile(); FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject); FileEditor[] fileEditors = fileEditorManager.openFile(virtualFile, false); FileEditor fileEditor = fileEditors[0]; StructureViewComponent svc = (StructureViewComponent)fileEditor.getStructureViewBuilder() .createStructureView(fileEditor, myProject); Disposer.register(getTestRootDisposable(), svc); fileEditorManager.closeFile(virtualFile); PlatformTestUtil.waitForPromise(svc.rebuildAndUpdate()); PlatformTestUtil.assertTreeEqual( svc.getTree(), """ -Class2.java -Class2 +InnerClass1 +InnerClass2 getValue(): int myField1: boolean myField2: boolean myField3: boolean myField4: boolean """); PsiField innerClassField = psiClass.getInnerClasses()[0].getFields()[0]; svc.select(innerClassField, true); PlatformTestUtil.waitWhileBusy(svc.getTree()); PlatformTestUtil.assertTreeEqual( svc.getTree(), """ -Class2.java -Class2 -InnerClass1 +InnerClass12 myInnerClassField: int +InnerClass2 getValue(): int myField1: boolean myField2: boolean myField3: boolean myField4: boolean """); CommandProcessor.getInstance().executeCommand(myProject, () -> WriteCommandAction.runWriteCommandAction(null, () -> { try { innerClassField.delete(); } catch (IncorrectOperationException e) { fail(e.getLocalizedMessage()); } }), null, null); PlatformTestUtil.waitForAlarm(1000); PlatformTestUtil.assertTreeEqual( svc.getTree(), """ -Class2.java -Class2 -InnerClass1 +InnerClass12 +InnerClass2 getValue(): int myField1: boolean myField2: boolean myField3: boolean myField4: boolean """); }