use of com.intellij.openapi.roots.ex.ProjectRootManagerEx in project intellij-community by JetBrains.
the class UpdateCacheTest method testAddExcludeRoot.
public void testAddExcludeRoot() throws Exception {
// to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems();
ProjectRootManagerEx rootManager = (ProjectRootManagerEx) ProjectRootManager.getInstance(myProject);
final VirtualFile root = rootManager.getContentRoots()[0];
final VirtualFile dir = root.findChild("aDir");
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
VirtualFile newFile = createChildData(dir, "New.java");
setFileText(newFile, "class A{ Exception e;} //todo");
}
}.execute().throwException();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiTestUtil.addExcludedRoot(myModule, dir);
PsiClass exceptionClass = myJavaFacade.findClass("java.lang.Exception", GlobalSearchScope.allScope(getProject()));
assertNotNull(exceptionClass);
checkUsages(exceptionClass, new String[] { "1.java" });
checkTodos(new String[] {});
}
use of com.intellij.openapi.roots.ex.ProjectRootManagerEx in project intellij-community by JetBrains.
the class UpdateCacheTest method testRemoveExcludeRoot.
public void testRemoveExcludeRoot() throws Exception {
ProjectRootManagerEx rootManager = (ProjectRootManagerEx) ProjectRootManager.getInstance(myProject);
final VirtualFile root = rootManager.getContentRoots()[0];
final VirtualFile dir = root.findChild("aDir");
PsiTestUtil.addExcludedRoot(myModule, dir);
// to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems();
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
VirtualFile newFile = createChildData(dir, "New.java");
setFileText(newFile, "class A{ Exception e;} //todo");
}
}.execute().throwException();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
// to update caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems();
PsiTestUtil.removeExcludedRoot(myModule, dir);
PsiClass exceptionClass = myJavaFacade.findClass("java.lang.Exception", GlobalSearchScope.allScope(getProject()));
assertNotNull(exceptionClass);
checkUsages(exceptionClass, new String[] { "1.java", "2.java", "New.java" });
checkTodos(new String[] { "2.java", "New.java" });
}
use of com.intellij.openapi.roots.ex.ProjectRootManagerEx in project intellij-community by JetBrains.
the class UpdateCacheTest method testSCR6066.
public void testSCR6066() throws Exception {
ProjectRootManagerEx rootManager = (ProjectRootManagerEx) ProjectRootManager.getInstance(myProject);
final VirtualFile root = rootManager.getContentRoots()[0];
// to initialize caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems();
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
VirtualFile newFile = createChildData(root, "New.java");
setFileText(newFile, "class A{ Exception e;} //todo");
}
}.execute().throwException();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
// to update caches
PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems();
PsiTestUtil.addExcludedRoot(myModule, root);
PsiClass exceptionClass = myJavaFacade.findClass("java.lang.Exception", GlobalSearchScope.allScope(getProject()));
assertNotNull(exceptionClass);
checkUsages(exceptionClass, new String[] {});
checkTodos(new String[] {});
}
use of com.intellij.openapi.roots.ex.ProjectRootManagerEx in project intellij-community by JetBrains.
the class ModuleRootManagerImpl method makeRootsChange.
void makeRootsChange(@NotNull Runnable runnable) {
ProjectRootManagerEx projectRootManagerEx = (ProjectRootManagerEx) ProjectRootManager.getInstance(myModule.getProject());
// IMPORTANT: should be the first listener!
projectRootManagerEx.makeRootsChange(runnable, false, myModule.isLoaded());
}
Aggregations