Java 类com.intellij.openapi.application.PluginPathManager 实例源码

项目:intellij-ce-playground    文件:BuildProcessClasspathManager.java   
@Nullable
private static File getPluginDir(IdeaPluginDescriptor plugin) {
  String pluginDirName = StringUtil.getShortName(plugin.getPluginId().getIdString());
  String extraDir = System.getProperty("idea.external.build.development.plugins.dir");
  if (extraDir != null) {
    File extraDirFile = new File(extraDir, pluginDirName);
    if (extraDirFile.isDirectory()) {
      return extraDirFile;
    }
  }
  File pluginHome = PluginPathManager.getPluginHome(pluginDirName);
  if (!pluginHome.isDirectory() && StringUtil.isCapitalized(pluginDirName)) {
    pluginHome = PluginPathManager.getPluginHome(StringUtil.decapitalize(pluginDirName));
  }
  return pluginHome.isDirectory() ? pluginHome : null;
}
项目:intellij-ce-playground    文件:ConfigurationsTest.java   
@BeforeMethod
public void setUp() throws Exception {
  JavaTestFixtureFactory.getFixtureFactory();   // registers Java module fixture builder
  final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
  final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName());
  myFixture = fixtureFactory.createTempDirTestFixture();
  myFixture.setUp();

  FileUtil.copyDir(new File(PluginPathManager.getPluginHomePath("testng") + "/testData/runConfiguration/module1"),
                   new File(myFixture.getTempDirPath()), false);

  myProjectFixture = testFixtureBuilder.getFixture();
  final JavaModuleFixtureBuilder javaModuleFixtureBuilder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
  javaModuleFixtureBuilder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src");
  javaModuleFixtureBuilder.addLibrary("testng", PathUtil.getJarPathForClass(AfterMethod.class));
  myProjectFixture.setUp();

}
项目:intellij-ce-playground    文件:HgAnnotateCommandTest.java   
@BeforeClass
private void loadEthalonAnnotations() throws IOException {
  myPluginRoot = new File(PluginPathManager.getPluginHomePath(HgVcs.VCS_NAME));
  myAnnotateDataDir = new File(myPluginRoot, "testData/annotate");
  myOutputsDir = new File(myAnnotateDataDir, "outputs");

  final File etalonFile = new File(myAnnotateDataDir, "etalon");

  XStream xStream = new XStream();
  FileReader reader = new FileReader(etalonFile);
  try {
    myAnnotations = (List<HgAnnotationLine>) xStream.fromXML(reader);
  }
  finally {
    reader.close();
  }
}
项目:intellij-ce-playground    文件:AddTestNGJarFixTest.java   
@BeforeMethod
public void setUp() throws Exception {
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
        final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName());
        myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
        final String dataPath = PluginPathManager.getPluginHomePath("testng") + "/testData";
        myFixture.setTestDataPath(dataPath);
        final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);

        builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("");
        //    builder.addContentRoot(dataPath);
        builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
        myFixture.setUp();
        final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject());
        myLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
        LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  });
}
项目:intellij-ce-playground    文件:EclipseEmlTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData", "eml");
  assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory());

  final File currentTestRoot = new File(testRoot, getTestName(true));
  assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory());

  VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot);
  copyDirContentsTo(vTestRoot, getProject().getBaseDir());
}
项目:intellij-ce-playground    文件:EclipseClasspathTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData", "round");
  assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory());

  final File currentTestRoot = new File(testRoot, getTestName(true));
  assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory());

  final VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot);
  copyDirContentsTo(vTestRoot, getProject().getBaseDir());
}
项目:intellij-ce-playground    文件:EclipseImlTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  final File testRoot = new File(PluginPathManager.getPluginHomePath("eclipse") + "/testData/iml");
  assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory());

  final File currentTestRoot = new File(testRoot, getTestName(true));
  assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory());

  VirtualFile vTestRoot = LocalFileSystem.getInstance().findFileByIoFile(currentTestRoot);
  copyDirContentsTo(vTestRoot, getProject().getBaseDir());
}
项目:intellij-ce-playground    文件:FormEnumUsageTest.java   
@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);
}
项目:intellij-ce-playground    文件:FormSourceCodeGeneratorTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();

  String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/sourceCodeGenerator/" + getTestName(true);
  PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
  myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
  myGenerator = new FormSourceCodeGenerator(getProject());
}
项目:intellij-ce-playground    文件:GitRepositoryReaderTest.java   
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> data() {
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea"));
  File dataDir = new File(new File(pluginRoot, "testData"), "repo");
  File[] testCases = dataDir.listFiles(FileUtilRt.ALL_DIRECTORIES);
  return ContainerUtil.map(testCases, new Function<File, Object[]>() {
    @Override
    public Object[] fun(File file) {
      return new Object[] { file.getName(), file };
    }
  });
}
项目:intellij-ce-playground    文件:HgTest.java   
@BeforeMethod
protected void setUp(final Method testMethod) throws Exception {
  // setting hg executable
  String exec = System.getenv(HG_EXECUTABLE_PATH);
  if (exec != null) {
    myClientBinaryPath = new File(exec);
  }
  if (exec == null || !myClientBinaryPath.exists()) {
    final File pluginRoot = new File(PluginPathManager.getPluginHomePath(HgVcs.VCS_NAME));
    myClientBinaryPath = new File(pluginRoot, "testData/bin");
  }

  myMainRepo = initRepositories();
  myProjectDir = new File(myMainRepo.getDirFixture().getTempDirPath());

  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        initProject(myProjectDir, testMethod.getName());
        activateVCS(HgVcs.VCS_NAME);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  });

  myChangeListManager = new HgTestChangeListManager(myProject);
  myTraceClient = true;
  doActionSilently(VcsConfiguration.StandardConfirmation.ADD);
  doActionSilently(VcsConfiguration.StandardConfirmation.REMOVE);
}
项目:intellij-ce-playground    文件:HgExecutor.java   
private static String findInSources(String programName, String unixExec, String winExec) {
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea"));
  File bin = new File(pluginRoot, FileUtil.toSystemDependentName("testData/bin"));
  File exec = new File(bin, SystemInfo.isWindows ? winExec : unixExec);
  if (exec.exists() && exec.canExecute()) {
    debug("Using " + programName + " from test data");
    return exec.getPath();
  }
  return null;
}
项目:intellij-ce-playground    文件:HgRepositoryReaderTest.java   
@Override
public void setUp() throws Exception {
  super.setUp();
  myHgDir = new File(myRepository.getPath(), ".hg");
  assertTrue(myHgDir.exists());
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea"));

  String pathToHg = "testData/repo/dot_hg";
  File testHgDir = new File(pluginRoot, FileUtil.toSystemDependentName(pathToHg));

  File cacheDir = new File(testHgDir, "cache");
  File testDirStateFile = new File(testHgDir, "dirstate");
  File testBranchFile = new File(testHgDir, "branch");
  File testBookmarkFile = new File(testHgDir, "bookmarks");
  File testCurrentBookmarkFile = new File(testHgDir, "bookmarks.current");
  File testTagFile = new File(testHgDir.getParentFile(), ".hgtags");
  File testLocalTagFile = new File(testHgDir, "localtags");
  FileUtil.copyDir(cacheDir, new File(myHgDir, "cache"));
  FileUtil.copy(testBranchFile, new File(myHgDir, "branch"));
  FileUtil.copy(testDirStateFile, new File(myHgDir, "dirstate"));
  FileUtil.copy(testBookmarkFile, new File(myHgDir, "bookmarks"));
  FileUtil.copy(testCurrentBookmarkFile, new File(myHgDir, "bookmarks.current"));
  FileUtil.copy(testTagFile, new File(myHgDir.getParentFile(), ".hgtags"));
  FileUtil.copy(testLocalTagFile, new File(myHgDir, "localtags"));

  myRepositoryReader = new HgRepositoryReader(myVcs, myHgDir);
  myBranches = readBranches();
  myBookmarks = readRefs(testBookmarkFile);
  myTags = readRefs(testTagFile);
  myLocalTags = readRefs(testLocalTagFile);
}
项目:intellij-ce-playground    文件:HgPlatformTest.java   
private static void setUpHgrc(@NotNull VirtualFile repositoryRoot) throws IOException {
  cd(".hg");
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea"));
  String pathToHgrc = "testData\\repo\\dot_hg";
  File hgrcFile = new File(new File(pluginRoot, FileUtil.toSystemIndependentName(pathToHgrc)), "hgrc");
  File hgrc = new File(new File(repositoryRoot.getPath(), ".hg"), "hgrc");
  FileUtil.appendToFile(hgrc, FileUtil.loadFile(hgrcFile));
  assertTrue(hgrc.exists());
  repositoryRoot.refresh(false, true);
}
项目:intellij-ce-playground    文件:SvnLockingTest.java   
@Before
public void setUp() throws Exception {
  super.setUp();
  //PlatformTestCase.initPlatformLangPrefix();
  File pluginRoot = new File(PluginPathManager.getPluginHomePath("svn4idea"));
  if (!pluginRoot.isDirectory()) {
    // try standalone mode
    Class aClass = Svn17TestCase.class;
    String rootPath = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
    pluginRoot = new File(rootPath).getParentFile().getParentFile().getParentFile();
  }
  myWorkingCopyRoot = new File(pluginRoot, "testData/move2unv");
  myLocks = new SvnTestWriteOperationLocks(new WorkingCopy(myWorkingCopyRoot, SVNURL.parseURIEncoded("http://a.b.c"), true));
}
项目:intellij-ce-playground    文件:CreateClassFixTest.java   
@Before
public void setUp() throws Exception {
  final Ref<Exception> ex = new Ref<Exception>();
  Runnable runnable = new Runnable() {
    public void run() {
      try {
        CreateClassFixTest.super.setUp();
        final JavaTestFixtureFactory fixtureFactory = JavaTestFixtureFactory.getFixtureFactory();
        final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = JavaTestFixtureFactory.createFixtureBuilder(getClass().getSimpleName());
        myFixture = fixtureFactory.createCodeInsightFixture(testFixtureBuilder.getFixture());
        myFixture.setTestDataPath(PluginPathManager.getPluginHomePath("devkit") + "/testData");

        testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class)
          .addContentRoot(myFixture.getTempDirPath()).addSourceRoot(getSourceRoot());
        myFixture.setUp();
        myFixture.enableInspections(new RegistrationProblemsInspection());
      }
      catch (Exception e) {
        ex.set(e);
      }
    }
  };
  invokeTestRunnable(runnable);
  final Exception exception = ex.get();
  if (exception != null) {
    throw exception;
  }
}
项目:intellij-ce-playground    文件:GroovyHotSwapper.java   
private static String getAgentJarPath() {
  final String userDefined = System.getProperty(GROOVY_HOTSWAP_AGENT_PATH);
  if (userDefined != null && new File(userDefined).exists()) {
    return userDefined;
  }

  final File ourJar = new File(PathUtil.getJarPathForClass(GroovyHotSwapper.class));
  if (ourJar.isDirectory()) { //development mode
    return PluginPathManager.getPluginHomePath("groovy") + "/hotswap/gragent.jar";
  }

  final File pluginDir = ourJar.getParentFile();
  return pluginDir.getPath() + File.separator + "agent" + File.separator + "gragent.jar";
}
项目:intellij-ce-playground    文件:IdeaDecompilerTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  myFixture.setTestDataPath(PluginPathManager.getPluginHomePath("java-decompiler") + "/plugin/testData");
}
项目:intellij-ce-playground    文件:TestNGSuiteTest.java   
@Override
protected String getBasePath() {
  return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/references";
}
项目:intellij-ce-playground    文件:GenerateGetterSetterTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("javaFX") + "/testData";
}
项目:intellij-ce-playground    文件:DuplicatedDataProviderNamesInspectionTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/";
}
项目:intellij-ce-playground    文件:AssertsWithoutMessagesTestNGInspectionTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/asserts_without_messages/";
}
项目:intellij-ce-playground    文件:ConvertJUnitInspectionTest.java   
@Override
protected String getBasePath() {
  return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/junit";
}
项目:intellij-ce-playground    文件:UndeclaredTestsInspectionTest.java   
@NonNls
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection";
}
项目:intellij-ce-playground    文件:DataProviderReturnTypeInspectionTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/";
}
项目:intellij-ce-playground    文件:TestNGDependsOnInspectionTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dependsOn/";
}
项目:intellij-ce-playground    文件:ConvertOldAnnotationInspectionTest.java   
@Override
protected String getBasePath() {
  return PluginPathManager.getPluginHomePathRelative("testng") + "/testData/configuration";
}
项目:intellij-ce-playground    文件:JavaFXImportTest.java   
@Override
protected void setUpModule() {
  super.setUpModule();
  PsiTestUtil.addLibrary(getModule(), "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar");
}
项目:intellij-ce-playground    文件:TestNGDataProviderInspectionTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("testng") + "/testData/inspection/dataProvider/";
}
项目:intellij-ce-playground    文件:JavaFXQuickfixTest.java   
@Override
  public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
  PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar");
  PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "groovy-1.8.0.jar");
  super.configureModule(module, model, contentEntry);
}
项目:intellij-ce-playground    文件:JavaFXCollapseSubtagToAttributeTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("javaFX") + "/testData/intentions/collapseToAttr/";
}
项目:intellij-ce-playground    文件:EclipseSettingsImportTest.java   
private static String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("eclipse") + "/testData/import/settings/";
}
项目:intellij-ce-playground    文件:MavenCustomRepositoryHelper.java   
private static String getOriginalTestDataPath() {
  String sourcesDir = System.getProperty("maven.sources.dir", PluginPathManager.getPluginHomePath("maven"));
  return FileUtil.toSystemIndependentName(sourcesDir + "/src/test/data");
}
项目:intellij-ce-playground    文件:MojoAnnotationInJavadocTest.java   
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("maven") + "/src/test/data/inspections";
}
项目:intellij-ce-playground    文件:CustomTypesTest.java   
protected String getMyTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/customTypes";
}
项目:intellij-ce-playground    文件:AntParsingTest.java   
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi";
}
项目:intellij-ce-playground    文件:AntHighlightingTest.java   
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant") + "/tests/data/highlighting/";
}
项目:intellij-ce-playground    文件:AntRenameTest.java   
@NotNull
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant").replace('\\', '/') + "/tests/data/psi/rename/";
}
项目:intellij-ce-playground    文件:AntResolveTest.java   
@Override
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/resolve/";
}
项目:intellij-ce-playground    文件:AntMultiFileCompletionTest.java   
protected String getTestDataPath() {
  return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/completion/";
}