use of com.intellij.openapi.project.impl.ProjectManagerImpl in project android by JetBrains.
the class GradleModuleImportTest method tearDown.
/**
* {@link ProjectManagerEx}
*/
@Override
protected void tearDown() throws Exception {
try {
if (myFixture != null) {
myFixture.tearDown();
myFixture = null;
}
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
Project[] openProjects = projectManager.getOpenProjects();
if (openProjects.length > 0) {
final Project project = openProjects[0];
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
Disposer.dispose(project);
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
if (projectManager instanceof ProjectManagerImpl) {
Collection<Project> projectsStillOpen = projectManager.closeTestProject(project);
if (!projectsStillOpen.isEmpty()) {
Project project = projectsStillOpen.iterator().next();
projectsStillOpen.clear();
throw new AssertionError("Test project is not disposed: " + project + ";\n created in: " + PlatformTestCase.getCreationPlace(project));
}
}
}
});
}
if (dir != null && dir.isDirectory()) {
ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Boolean, IOException>() {
@Override
public Boolean compute() throws IOException {
VirtualFile vfile = findFileByIoFile(dir, true);
if (vfile != null) {
vfile.delete(GradleModuleImportTest.this);
}
return true;
}
});
}
} finally {
super.tearDown();
}
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class PlatformTestCase method closeAndDisposeProjectAndCheckThatNoOpenProjects.
public static void closeAndDisposeProjectAndCheckThatNoOpenProjects(@NotNull final Project projectToClose) {
RunAll runAll = new RunAll();
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
if (projectManager instanceof ProjectManagerImpl) {
for (Project project : projectManager.closeTestProject(projectToClose)) {
runAll = runAll.append(() -> {
throw new IllegalStateException("Test project is not disposed: " + project + ";\n created in: " + getCreationPlace(project));
}).append(() -> ((ProjectManagerImpl) projectManager).closeProject(project, false, true, false));
}
}
runAll.append(() -> WriteAction.run(() -> Disposer.dispose(projectToClose))).run();
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class LightPlatformTestCase method clearUncommittedDocuments.
public static void clearUncommittedDocuments(@NotNull Project project) {
PsiDocumentManagerImpl documentManager = (PsiDocumentManagerImpl) PsiDocumentManager.getInstance(project);
documentManager.clearUncommittedDocuments();
ProjectManagerImpl projectManager = (ProjectManagerImpl) ProjectManager.getInstance();
if (projectManager.isDefaultProjectInitialized()) {
Project defaultProject = projectManager.getDefaultProject();
((PsiDocumentManagerImpl) PsiDocumentManager.getInstance(defaultProject)).clearUncommittedDocuments();
}
}
Aggregations