use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class ApplicationImpl method disposeSelf.
private boolean disposeSelf(final boolean checkCanCloseProject) {
final ProjectManagerImpl manager = (ProjectManagerImpl) ProjectManagerEx.getInstanceEx();
if (manager != null) {
final boolean[] canClose = { true };
for (final Project project : manager.getOpenProjects()) {
try {
CommandProcessor.getInstance().executeCommand(project, () -> {
if (!manager.closeProject(project, true, true, checkCanCloseProject)) {
canClose[0] = false;
}
}, ApplicationBundle.message("command.exit"), null);
} catch (Throwable e) {
LOG.error(e);
}
if (!canClose[0]) {
return false;
}
}
}
runWriteAction(() -> Disposer.dispose(this));
Disposer.assertIsEmpty();
return true;
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class PlatformTestCase method cleanupApplicationCaches.
public static void cleanupApplicationCaches(Project project) {
if (project != null && !project.isDisposed()) {
UndoManagerImpl globalInstance = (UndoManagerImpl) UndoManager.getGlobalInstance();
if (globalInstance != null) {
globalInstance.dropHistoryInTests();
}
((UndoManagerImpl) UndoManager.getInstance(project)).dropHistoryInTests();
((DocumentReferenceManagerImpl) DocumentReferenceManager.getInstance()).cleanupForNextTest();
((PsiManagerImpl) PsiManager.getInstance(project)).cleanupForNextTest();
}
final ProjectManager projectManager = ProjectManager.getInstance();
assert projectManager != null : "The ProjectManager is not initialized yet";
ProjectManagerImpl projectManagerImpl = (ProjectManagerImpl) projectManager;
if (projectManagerImpl.isDefaultProjectInitialized()) {
Project defaultProject = projectManager.getDefaultProject();
((PsiManagerImpl) PsiManager.getInstance(defaultProject)).cleanupForNextTest();
}
AsyncHighlighterUpdater.completeAsyncTasks();
((FileBasedIndexImpl) FileBasedIndex.getInstance()).cleanupForNextTest();
LocalFileSystemImpl localFileSystem = (LocalFileSystemImpl) LocalFileSystem.getInstance();
if (localFileSystem != null) {
localFileSystem.cleanupForNextTest();
}
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class DummyCachingFileSystem method getProject.
@Nullable
public Project getProject(@Nullable String projectId) {
Project project = ((ProjectManagerImpl) ProjectManager.getInstance()).findOpenProjectByHash(projectId);
if (ApplicationManager.getApplication().isUnitTestMode() && project != null) {
registerDisposeCallback(project);
DISPOSE_CALLBACK.set(project, Boolean.TRUE);
}
return project;
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method tearDown.
@Override
protected void tearDown() throws Exception {
try {
Project project = getProject();
if (project != null) {
doPostponedFormatting(project);
((ProjectManagerImpl) ProjectManagerEx.getInstanceEx()).closeProject(project, false, false, false);
}
} finally {
myDaemonCodeAnalyzer = null;
super.tearDown();
}
}
use of com.intellij.openapi.project.impl.ProjectManagerImpl in project android by JetBrains.
the class ThemeEditorVirtualFileTest method testRightProject.
/**
* Tests that the theme editor works with the right virtual file
* when there are several projects with the same name open.
*/
public void testRightProject() throws IOException {
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
Project otherProject = projectManager.newProject(getProject().getName(), FileUtilRt.generateRandomTemporaryPath().getPath(), true, true);
try {
assertNotNull(otherProject);
projectManager.openProject(otherProject);
ThemeEditorVirtualFile themeEditorVirtualFile = ThemeEditorVirtualFile.getThemeEditorFile(myModule.getProject());
VirtualFile virtualFile = themeEditorVirtualFile.getFileSystem().findFileByPath(themeEditorVirtualFile.getPath());
assertEquals(themeEditorVirtualFile, virtualFile);
} finally {
if (otherProject != null) {
((ProjectManagerImpl) projectManager).forceCloseProject(otherProject, true);
}
}
}
Aggregations