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


Java PathManager.getHomePath方法代码示例

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


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

示例1: findEcjJarFile

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Nullable
public static File findEcjJarFile() {
  File[] libs = {new File(PathManager.getHomePath(), "lib"), new File(PathManager.getHomePath(), "community/lib")};
  for (File lib : libs) {
    File[] children = lib.listFiles(new FilenameFilter() {
      @Override
      public boolean accept(File dir, String name) {
        return name.startsWith("ecj-") && name.endsWith(".jar");
      }
    });
    if (children != null && children.length > 0) {
      return children[0];
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EclipseCompilerTool.java

示例2: setupSdkHome

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private static boolean setupSdkHome() {
  String homePath = PathManager.getHomePath();
  assertNotNull(homePath);
  // The relative paths in the output file below is relative to the sdk-common directory in tools/base
  // (it's from one of the unit tests there)
  File rootDir = new File(homePath, ".." + File.separator + "base" + File.separator + "sdk-common");
  if (!rootDir.isDirectory()) {
    // Also check for an IDEA project structure where sdk-common is located in this location:
    rootDir = new File(homePath, "android" + File.separator + "tools-base" + File.separator + "sdk-common");
    if (!rootDir.isDirectory()) {
      return false;
    }
  }
  AbstractAaptOutputParser.ourRootDir = rootDir;
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BuildOutputParserTest.java

示例3: getPluginCustomPath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Nullable
public static String getPluginCustomPath() {
    String[] variants = { PathManager.getHomePath(), PathManager.getPluginsPath() };

    for (String variant : variants) {
        String path = variant + "/" + getProductId();
        if (LocalFileSystem.getInstance().findFileByPath(path) != null) {
            return path;
        }
    }
    return null;
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:13,代码来源:Plugin.java

示例4: getBasePath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Override
protected String getBasePath() {
  String homePath = PathManager.getHomePath();
  File candidate = new File(homePath, "community/RegExpSupport");
  if (candidate.isDirectory()) {
    return "/community/RegExpSupport/testData/completion";
  }
  return "/RegExpSupport/testData/completion";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RegExpCompletionTest.java

示例5: getLibraryClassesRoots

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@NotNull
@Override
public List<String> getLibraryClassesRoots() {
  File annotationsJar = new File(PathManager.getHomePath(), "redist/annotations-java8.jar");
  if (annotationsJar.exists()) {
    return Collections.singletonList(FileUtil.toSystemIndependentName(annotationsJar.getAbsolutePath()));
  }
  return getPathsToAnnotationsDirectoriesInDevelopmentMode("annotations-java8");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JetBrainsAnnotationsExternalLibraryResolver.java

示例6: getTestDataPath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
/**
 * Tries to return test data path for the given lookup strategy.
 *
 * @param strategy    lookup strategy to use
 * @return            test data path for the given strategy
 * @throws IllegalStateException    if it's not possible to find valid test data path for the given strategy
 */
@NonNls
public static String getTestDataPath(TestDataLookupStrategy strategy) throws IllegalStateException {
  String homePath = PathManager.getHomePath();

  List<String> relativePaths = TEST_DATA_RELATIVE_PATHS.get(strategy);
  if (relativePaths.isEmpty()) {
    throw new IllegalStateException(
      String.format("Can't determine test data path. Reason: no predefined relative paths are configured for test data "
                    + "lookup strategy %s. Configured mappings: %s", strategy, TEST_DATA_RELATIVE_PATHS)
    );
  }

  File candidate = null;
  for (String relativePath : relativePaths) {
    candidate = new File(homePath, relativePath);
    if (candidate.isDirectory()) {
      return candidate.getPath();
    }
  }

  if (candidate == null) {
    throw new IllegalStateException("Can't determine test data path. Looks like programming error - reached 'if' block that was "
                                    + "never expected to be executed");
  }
  return candidate.getPath();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PathManagerEx.java

示例7: guessTestDataLookupStrategyOnDirectoryAvailability

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
/**
 * Tries to check test data lookup strategy by target test data directories availability.
 * <p/>
 * Such an approach has a drawback that it doesn't work correctly at number of scenarios, e.g. when
 * <code>'community'</code> test is executed under <code>'ultimate'</code> project.
 *
 * @return    test data lookup strategy based on target test data directories availability
 */
private static TestDataLookupStrategy guessTestDataLookupStrategyOnDirectoryAvailability() {
  String homePath = PathManager.getHomePath();
  for (Map.Entry<TestDataLookupStrategy, List<String>> entry : TEST_DATA_RELATIVE_PATHS.entrySet()) {
    for (String relativePath : entry.getValue()) {
      if (new File(homePath, relativePath).isDirectory()) {
        return entry.getKey();
      }
    }
  }
  return TestDataLookupStrategy.ULTIMATE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PathManagerEx.java

示例8: getCommunityPath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public static String getCommunityPath() {
  final String homePath = PathManager.getHomePath();
  if (new File(homePath, "community/.idea").isDirectory()) {
    return homePath + File.separatorChar + "community";
  }
  return homePath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PlatformTestUtil.java

示例9: getAndroidSdkPath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Nullable
private static File getAndroidSdkPath() {
  String studioHome = PathManager.getHomePath();
  if (isEmpty(studioHome)) {
    LOG.info("Unable to find Studio home directory");
  }
  else {
    LOG.info(String.format("Found Studio home directory at: '%1$s'", studioHome));
    for (String path : ANDROID_SDK_RELATIVE_PATHS) {
      File dir = new File(studioHome, path);
      String absolutePath = toCanonicalPath(dir.getAbsolutePath());
      LOG.info(String.format("Looking for Android SDK at '%1$s'", absolutePath));
      if (AndroidSdkType.getInstance().isValidSdkHome(absolutePath)) {
        LOG.info(String.format("Found Android SDK at '%1$s'", absolutePath));
        return new File(absolutePath);
      }
    }
  }
  LOG.info("Unable to locate SDK within the Android studio installation.");

  String androidHomeValue = System.getenv(SdkConstants.ANDROID_HOME_ENV);
  String msg = String.format("Checking if ANDROID_HOME is set: '%1$s' is '%2$s'", SdkConstants.ANDROID_HOME_ENV, androidHomeValue);
  LOG.info(msg);

  if (!isEmpty(androidHomeValue) && AndroidSdkType.getInstance().isValidSdkHome(androidHomeValue)) {
    LOG.info("Using Android SDK specified by the environment variable.");
    return new File(toSystemDependentName(androidHomeValue));
  }

  String sdkPath = getLastSdkPathUsedByAndroidTools();
  if (!isEmpty(sdkPath) && AndroidSdkType.getInstance().isValidSdkHome(androidHomeValue)) {
    msg = String.format("Last SDK used by Android tools: '%1$s'", sdkPath);
  } else {
    msg = "Unable to locate last SDK used by Android tools";
  }
  LOG.info(msg);
  return sdkPath == null ? null : new File(toSystemDependentName(sdkPath));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidStudioSpecificInitializer.java

示例10: getPythonCommunityPath

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public static String getPythonCommunityPath() {
  File pathFromUltimate = new File(PathManager.getHomePath(), "community/python");
  if (pathFromUltimate.exists()) {
    return pathFromUltimate.getPath();
  }
  return new File(PathManager.getHomePath(), "python").getPath();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PythonHelpersLocator.java

示例11: getAospSourceDir

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
/**
 * @return a full path to the user's AOSP source tree (e.g. the directory expected to contain tools/adt/idea etc including the GUI tests.
 */
@Nullable
public static File getAospSourceDir() {
  // If running tests from the IDE, we can find the AOSP directly without user environment variable help
  File home = new File(PathManager.getHomePath());
  if (home.exists()) {
    File parentFile = home.getParentFile();
    if (parentFile != null && "tools".equals(parentFile.getName())) {
      return parentFile.getParentFile();
    }
  }

  String aosp = System.getenv(AOSP_SOURCE_PATH);
  if (aosp == null) {
    String sdk = System.getenv(ADT_SDK_SOURCE_PATH);
    if (sdk != null) {
      aosp = sdk + File.separator + "..";
    }
  }
  if (aosp != null) {
    File dir = new File(aosp);
    assertTrue(dir.getPath() + " (pointed to by " + AOSP_SOURCE_PATH + " or " + ADT_SDK_SOURCE_PATH + " does not exist", dir.exists());
    return dir;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GuiTests.java

示例12: checkInstallation

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
private static void checkInstallation() {
  String studioHome = PathManager.getHomePath();
  if (isEmpty(studioHome)) {
    LOG.info("Unable to find Studio home directory");
    return;
  }
  File studioHomePath = new File(toSystemDependentName(studioHome));
  if (!studioHomePath.isDirectory()) {
    LOG.info(String.format("The path '%1$s' does not belong to an existing directory", studioHomePath.getPath()));
    return;
  }
  File androidPluginLibFolderPath = new File(studioHomePath, join("plugins", "android", "lib"));
  if (!androidPluginLibFolderPath.isDirectory()) {
    LOG.info(String.format("The path '%1$s' does not belong to an existing directory", androidPluginLibFolderPath.getPath()));
    return;
  }

  // Look for signs that the installation is corrupt due to improper updates (typically unzipping on top of previous install)
  // which doesn't delete files that have been removed or renamed
  String cause = null;
  File[] children = notNullize(androidPluginLibFolderPath.listFiles());
  if (hasMoreThanOneBuilderModelFile(children)) {
    cause = "(Found multiple versions of builder-model-*.jar in plugins/android/lib.)";
  } else if (new File(studioHomePath, join("plugins", "android-designer")).exists()) {
    cause = "(Found plugins/android-designer which should not be present.)";
  }
  if (cause != null) {
    String msg = "Your Android Studio installation is corrupt and will not work properly.\n" +
                 cause + "\n" +
                 "This usually happens if Android Studio is extracted into an existing older version.\n\n" +
                 "Please reinstall (and make sure the new installation directory is empty first.)";
    String title = "Corrupt Installation";
    int option = Messages.showDialog(msg, title, new String[]{"Quit", "Proceed Anyway"}, 0, Messages.getErrorIcon());
    if (option == 0) {
      ApplicationManagerEx.getApplicationEx().exit();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidStudioSpecificInitializer.java

示例13: JarFileSystemImpl

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public JarFileSystemImpl() {
  boolean noCopy = SystemProperties.getBooleanProperty("idea.jars.nocopy", !SystemInfo.isWindows);
  myNoCopyJarPaths = noCopy ? null : ContainerUtil.newConcurrentSet(FileUtil.PATH_HASHING_STRATEGY);

  // to prevent platform .jar files from copying
  boolean runningFromDist = new File(PathManager.getLibPath(), "openapi.jar").exists();
  myNoCopyJarDir = !runningFromDist ? null : new File(PathManager.getHomePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JarFileSystemImpl.java

示例14: getBundledAntInstallation

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
@Nullable
private static JpsAntInstallation getBundledAntInstallation() {
  String antPath = System.getProperty(BUNDLED_ANT_PATH_PROPERTY);
  File antHome;
  if (antPath != null) {
    antHome = new File(antPath);
  }
  else {
    final String appHome = PathManager.getHomePath();
    if (appHome == null) {
      LOG.debug("idea.home.path and " + BUNDLED_ANT_PATH_PROPERTY + " aren't specified, bundled Ant won't be configured");
      return null;
    }

    antHome = new File(appHome, "lib" + File.separator + "ant");
    if (!antHome.exists()) {
      File communityAntHome = new File(appHome, "community" + File.separator + "lib" + File.separator + "ant");
      if (communityAntHome.exists()) {
        antHome = communityAntHome;
      }
    }
  }
  if (!antHome.exists()) {
    LOG.debug("Bundled Ant not found at " + antHome.getAbsolutePath());
    return null;
  }

  String antLib = new File(antHome, "lib").getAbsolutePath();
  return new JpsAntInstallationImpl(antHome, "Bundled Ant", Collections.<String>emptyList(), Collections.singletonList(antLib));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:JpsAntExtensionService.java

示例15: getTestDataRoot

import com.intellij.openapi.application.PathManager; //导入方法依赖的package包/类
public static String getTestDataRoot() {
  String homePath = PathManager.getHomePath();
  File candidate = new File(homePath, "community/RegExpSupport");
  if (candidate.isDirectory()) {
    return new File(candidate, "testData").getPath();
  }
  return new File(homePath, "RegExpSupport/testData").getPath();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BaseParseTestCase.java


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