Java Code Examples for com.intellij.openapi.project.Project#getLocationHash()

The following examples show how to use com.intellij.openapi.project.Project#getLocationHash() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Return the FlutterSdk for the given project.
 * <p>
 * Returns null if the Dart SDK is not set or does not exist.
 */
@Nullable
public static FlutterSdk getFlutterSdk(@NotNull final Project project) {
  if (project.isDisposed()) {
    return null;
  }
  final DartSdk dartSdk = DartPlugin.getDartSdk(project);
  if (dartSdk == null) {
    return null;
  }

  final String dartPath = dartSdk.getHomePath();
  if (!dartPath.endsWith(DART_SDK_SUFFIX)) {
    return null;
  }

  final String sdkPath = dartPath.substring(0, dartPath.length() - DART_SDK_SUFFIX.length());

  // Cache based on the project and path ('e41cfa3d:/Users/devoncarew/projects/flutter/flutter').
  final String cacheKey = project.getLocationHash() + ":" + sdkPath;

  synchronized (projectSdkCache) {
    if (!projectSdkCache.containsKey(cacheKey)) {
      projectSdkCache.put(cacheKey, FlutterSdk.forPath(sdkPath));
    }

    return projectSdkCache.get(cacheKey);
  }
}
 
Example 2
/**
 * Return the FlutterSdk for the given project.
 * <p>
 * Returns null if the Dart SDK is not set or does not exist.
 */
@Nullable
public static FlutterSdk getFlutterSdk(@NotNull final Project project) {
  if (project.isDisposed()) {
    return null;
  }
  final DartSdk dartSdk = DartPlugin.getDartSdk(project);
  if (dartSdk == null) {
    return null;
  }

  final String dartPath = dartSdk.getHomePath();
  if (!dartPath.endsWith(DART_SDK_SUFFIX)) {
    return null;
  }

  final String sdkPath = dartPath.substring(0, dartPath.length() - DART_SDK_SUFFIX.length());

  // Cache based on the project and path ('e41cfa3d:/Users/devoncarew/projects/flutter/flutter').
  final String cacheKey = project.getLocationHash() + ":" + sdkPath;

  synchronized (projectSdkCache) {
    if (!projectSdkCache.containsKey(cacheKey)) {
      projectSdkCache.put(cacheKey, FlutterSdk.forPath(sdkPath));
    }

    return projectSdkCache.get(cacheKey);
  }
}
 
Example 3
Source Project: intellij   File: BlazeDataStorage.java    License: Apache License 2.0 5 votes vote down vote up
public static File getProjectCacheDir(Project project, BlazeImportSettings importSettings) {
  String locationHash = importSettings.getLocationHash();

  // Legacy support: The location hash used to be just the project hash
  if (Strings.isNullOrEmpty(locationHash)) {
    locationHash = project.getLocationHash();
  }

  return new File(getProjectConfigurationDir(), locationHash);
}
 
Example 4
Source Project: consulo   File: CompilerPaths.java    License: Apache License 2.0 4 votes vote down vote up
public static String getCompilerSystemDirectoryName(Project project) {
  return getPresentableName(project) + "" + project.getLocationHash();
}
 
Example 5
Source Project: consulo   File: ExternalSystemTaskId.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
public static String getProjectId(@Nonnull Project project) {
  return project.isDisposed() ? project.getName() : project.getName() + ":" + project.getLocationHash();
}
 
Example 6
Source Project: consulo   File: IntegrationKey.java    License: Apache License 2.0 4 votes vote down vote up
public IntegrationKey(@Nonnull Project ideProject, @Nonnull ProjectSystemId externalSystemId, @Nonnull String externalProjectConfigPath) {
  this(ideProject.getName(), ideProject.getLocationHash(), externalSystemId, externalProjectConfigPath);
}
 
Example 7
Source Project: consulo   File: LocalHistoryImpl.java    License: Apache License 2.0 4 votes vote down vote up
private static String getProjectId(Project p) {
  return p.getLocationHash();
}
 
Example 8
Source Project: consulo   File: VcsUserRegistryImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
VcsUserRegistryImpl(@Nonnull Project project) {
  final File mapFile = new File(USER_CACHE_APP_DIR, project.getLocationHash() + "." + STORAGE_VERSION);
  myPersistentEnumerator = initEnumerator(mapFile);
  myInterner = new Interner<>();
}
 
Example 9
Source Project: consulo   File: PersistentUtil.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
public static String calcLogId(@Nonnull Project project, @Nonnull Map<VirtualFile, VcsLogProvider> logProviders) {
  int hashcode = calcLogProvidersHash(logProviders);
  return project.getLocationHash() + "." + Integer.toHexString(hashcode);
}
 
Example 10
Source Project: consulo   File: TestStateStorage.java    License: Apache License 2.0 4 votes vote down vote up
public static File getTestHistoryRoot(Project project) {
  return new File(TEST_HISTORY_PATH, project.getLocationHash());
}