當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。