当前位置: 首页>>代码示例>>Java>>正文


Java PsiTestUtil.removeExcludedRoot方法代码示例

本文整理汇总了Java中com.intellij.testFramework.PsiTestUtil.removeExcludedRoot方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTestUtil.removeExcludedRoot方法的具体用法?Java PsiTestUtil.removeExcludedRoot怎么用?Java PsiTestUtil.removeExcludedRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.testFramework.PsiTestUtil的用法示例。


在下文中一共展示了PsiTestUtil.removeExcludedRoot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFileModuleExcludeRootUnderDirectoryRoot

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testFileModuleExcludeRootUnderDirectoryRoot() throws IOException {
  VirtualFile fileExcludeRoot = createChildData(mySrcDir1, "fileExcludeRoot.txt");
  assertTrue(myFileIndex.isInContent(fileExcludeRoot));
  assertTrue(myFileIndex.isInSource(fileExcludeRoot));
  assertIteratedContent(myFileIndex, Arrays.asList(fileExcludeRoot), null);

  PsiTestUtil.addExcludedRoot(myModule, fileExcludeRoot);
  assertFalse(myFileIndex.isInContent(fileExcludeRoot));
  assertFalse(myFileIndex.isInSource(fileExcludeRoot));
  assertNull(myFileIndex.getContentRootForFile(fileExcludeRoot));
  assertEquals(myModule1Dir, myFileIndex.getContentRootForFile(fileExcludeRoot, false));
  assertNull(myFileIndex.getModuleForFile(fileExcludeRoot));
  assertEquals(myModule, myFileIndex.getModuleForFile(fileExcludeRoot, false));
  assertExcluded(fileExcludeRoot, myModule);
  assertIteratedContent(myFileIndex, null, Arrays.asList(fileExcludeRoot));

  // removing file exclude root
  PsiTestUtil.removeExcludedRoot(myModule, fileExcludeRoot);
  assertTrue(myFileIndex.isInContent(fileExcludeRoot));
  assertTrue(myFileIndex.isInSource(fileExcludeRoot));
  assertIteratedContent(myFileIndex, Arrays.asList(fileExcludeRoot), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DirectoryIndexTest.java

示例2: testFileModuleExcludeRootUnderFileRoot

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testFileModuleExcludeRootUnderFileRoot() throws IOException {
  VirtualFile fileRoot = createChildData(myRootVFile, "fileRoot.txt");
  PsiTestUtil.addContentRoot(myModule, fileRoot);
  checkInfo(fileRoot, myModule, false, false, "", null);
  assertTrue(myFileIndex.isInContent(fileRoot));
  assertIteratedContent(myFileIndex, Arrays.asList(fileRoot), null);
  
  PsiTestUtil.addExcludedRoot(myModule, fileRoot);
  assertFalse(myFileIndex.isInContent(fileRoot));
  assertExcluded(fileRoot, myModule);
  assertIteratedContent(myFileIndex, null, Arrays.asList(fileRoot));
 
  // removing file exclude root
  PsiTestUtil.removeExcludedRoot(myModule, fileRoot);
  checkInfo(fileRoot, myModule, false, false, "", null);
  assertTrue(myFileIndex.isInContent(fileRoot));
  assertIteratedContent(myFileIndex, Arrays.asList(fileRoot), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DirectoryIndexTest.java

示例3: testRemoveExcludeRoot

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
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);

  PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to initialize caches

  new WriteCommandAction.Simple(getProject()) {
    @Override
    protected void run() throws Throwable {
      VirtualFile newFile = dir.createChildData(null, "New.java");
      VfsUtil.saveText(newFile, "class A{ Exception e;} //todo");
    }
  }.execute().throwException();

  PsiDocumentManager.getInstance(myProject).commitAllDocuments();

  PsiTodoSearchHelper.SERVICE.getInstance(myProject).findFilesWithTodoItems(); // to update caches

  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"});
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:UpdateCacheTest.java


注:本文中的com.intellij.testFramework.PsiTestUtil.removeExcludedRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。