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


Java PsiTestUtil.removeAllRoots方法代码示例

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


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

示例1: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/searchInLibs";
  VirtualFile rootFile = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete, false);

  final VirtualFile projectRoot = rootFile.findChild("project");
  assertNotNull(projectRoot);

  final VirtualFile innerSourceRoot = projectRoot.findChild("src2");
  assertNotNull(innerSourceRoot);

  VirtualFile libRoot = rootFile.findChild("lib");
  final VirtualFile libClassesRoot = libRoot.findChild("classes");
  final VirtualFile libSrcRoot = libRoot.findChild("src");
  final VirtualFile libSrc2Root = libRoot.findChild("src2");
  assertNotNull(libRoot);

  PsiTestUtil.removeAllRoots(myModule, null);
  PsiTestUtil.addSourceRoot(myModule, projectRoot);
  PsiTestUtil.addSourceRoot(myModule, innerSourceRoot);
  List<String> sourceRoots = Arrays.asList(libSrcRoot.getUrl(), libSrc2Root.getUrl());
  List<String> classesRoots = Collections.singletonList(libClassesRoot.getUrl());
  ModuleRootModificationUtil.addModuleLibrary(myModule, "lib", classesRoots, sourceRoots);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SearchInLibsTest.java

示例2: setupModule

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private Module setupModule(String moduleName, final String className) throws IOException {
  final VirtualFile root1 = myFixture.getTempDirFixture().findOrCreateDir(moduleName);
  final Module module = PsiTestUtil.addModule(getProject(), JavaModuleType.getModuleType(), moduleName, root1);
  PsiTestUtil.removeAllRoots(module, IdeaTestUtil.getMockJdk18());
  PsiTestUtil.addSourceRoot(module, root1, true);
  myFixture.addFileToProject(moduleName + "/p/" + className + ".java",
                             "package p;\n" +
                             "public class " + className + " extends junit.framework.TestCase {\n" +
                             "  public void testName1(){}" +
                             "}");
  final String pathForClass = PathUtil.getJarPathForClass(TestCase.class);
  PsiTestUtil.addLibrary(module,
                         "junit4",
                         StringUtil.getPackageName(pathForClass, File.separatorChar),
                         StringUtil.getShortName(pathForClass, File.separatorChar));
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JUnitClasspathTest.java

示例3: doPackageCopy

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void doPackageCopy() throws Exception {
  String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
  String rootBefore = root + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);

  final VirtualFile targetVDir = rootDir.findChild("p2");
  final PsiDirectory sourceP1Dir = myPsiManager.findDirectory(rootDir.findChild("p1"));
  final PsiDirectory targetP2Dir = myPsiManager.findDirectory(targetVDir);
  new CopyClassesHandler().doCopy(new PsiElement[]{sourceP1Dir}, targetP2Dir);

  String rootAfter = root + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CopyClassTest.java

示例4: doTest

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void doTest(String className) throws Exception {
  String rootBefore = getRoot() + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
  PsiClass classToInline = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
  assertEquals(null, InlineToAnonymousClassHandler.getCannotInlineMessage(classToInline));
  InlineToAnonymousClassProcessor processor = new InlineToAnonymousClassProcessor(myProject, 
                                                                                  classToInline,
                                                                                  null, false, false, false);
  UsageInfo[] usages = processor.findUsages();
  MultiMap<PsiElement,String> conflicts = processor.getConflicts(usages);
  assertEquals(0, conflicts.size());
  processor.run();

  String rootAfter = getRoot() + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:InlineToAnonymousClassMultifileTest.java

示例5: doTest

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void doTest(String className, String methodName) throws Exception {
  String rootBefore = getRoot() + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
  PsiClass aClass = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
  assertTrue(aClass != null);
  PsiElement element = aClass.findMethodsByName(methodName, false)[0];
  assertTrue(element instanceof PsiMethod);
  PsiMethod method = (PsiMethod)element;
  final boolean condition = InlineMethodProcessor.checkBadReturns(method) && !InlineUtil.allUsagesAreTailCalls(method);
  assertFalse("Bad returns found", condition);

  InlineOptions options = new MockInlineMethodOptions();
  final InlineMethodProcessor processor = new InlineMethodProcessor(getProject(), method, null, myEditor, options.isInlineThisOnly());
  processor.run();

  String rootAfter = getRoot() + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InlineMethodMultifileTest.java

示例6: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FormEnumUsageTest.java

示例7: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
  String root = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/src";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiConcurrencyStressTest.java

示例8: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
  String root = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/src15";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("mock 1.5"));
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:Src15RepositoryUseTest.java

示例9: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/findUsages/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FindUsagesTest.java

示例10: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
  String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/findUsages15/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("java 1.5"));
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FindUsages15Test.java

示例11: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/cycle/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CyclicDependenciesTest.java

示例12: doTest

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void doTest(String testName, String newPackageName, String fileNameNearFirstClass, String... classNames) throws Exception {
  String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClassAndFile/" + testName;

  String rootBefore = root + "/before";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);

  performAction(newPackageName, fileNameNearFirstClass, classNames);

  String rootAfter = root + "/after";
  VirtualFile rootDir2 = LocalFileSystem.getInstance().findFileByPath(rootAfter.replace(File.separatorChar, '/'));
  myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
  PlatformTestUtil.assertDirectoriesEqual(rootDir2, rootDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MoveClassAndFileTest.java

示例13: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = JavaTestUtil.getJavaTestDataPath() + "/psi/arrayIndexOutOfBounds/src";
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  myProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ArrayIndexOutOfBoundsTest.java

示例14: doTest

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void doTest() throws Exception {
  String rootBefore = getRoot();
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
  PsiPackage pack1 = myJavaFacade.findPackage("pack1");
  PsiPackage pack2 = myJavaFacade.findPackage("pack2");
  assertTrue(CopyHandler.canCopy(new PsiElement[]{pack1.getDirectories()[0], pack2.getDirectories()[0]}));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CopyTest.java

示例15: setUp

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/search/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UsagesInAnalyzingDependenciesTest.java


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