use of com.intellij.openapi.project.ex.ProjectManagerEx in project android by JetBrains.
the class NewProjectSetup method openProject.
@NotNull
Project openProject(@NotNull String projectPath) throws IOException {
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
Project newProject = projectManager.loadProject(projectPath);
if (newProject == null) {
throw new NullPointerException("Failed to open project at '" + projectPath + "'");
}
return newProject;
}
use of com.intellij.openapi.project.ex.ProjectManagerEx in project android by JetBrains.
the class AndroidGradleTestCase method tearDown.
@Override
protected void tearDown() throws Exception {
myModules = null;
try {
Messages.setTestDialog(TestDialog.DEFAULT);
if (myFixture != null) {
try {
Project project = myFixture.getProject();
// that here, otherwise the testsuite will leak
if (AndroidProjectInfo.getInstance(project).requiresAndroidModel()) {
AndroidGradleProjectComponent projectComponent = AndroidGradleProjectComponent.getInstance(project);
projectComponent.projectClosed();
}
} finally {
try {
myFixture.tearDown();
} catch (Exception e) {
LOG.warn("Failed to tear down " + myFixture.getClass().getSimpleName(), e);
}
myFixture = null;
}
}
GradleProjectImporter.ourSkipSetupFromTest = false;
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
Project[] openProjects = projectManager.getOpenProjects();
if (openProjects.length > 0) {
PlatformTestCase.closeAndDisposeProjectAndCheckThatNoOpenProjects(openProjects[0]);
}
} finally {
try {
assertEquals(0, ProjectManager.getInstance().getOpenProjects().length);
} finally {
//noinspection ThrowFromFinallyBlock
super.tearDown();
}
}
}
use of com.intellij.openapi.project.ex.ProjectManagerEx 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();
}
}
Aggregations