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

The following examples show how to use com.intellij.openapi.project.Project#getLocationHash() . 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
Source File: FlutterSdk.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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
Source File: FlutterSdk.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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 File: BlazeDataStorage.java    From intellij with 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 File: CompilerPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String getCompilerSystemDirectoryName(Project project) {
  return getPresentableName(project) + "" + project.getLocationHash();
}
 
Example 5
Source File: ExternalSystemTaskId.java    From consulo with 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 File: IntegrationKey.java    From consulo with 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 File: LocalHistoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static String getProjectId(Project p) {
  return p.getLocationHash();
}
 
Example 8
Source File: VcsUserRegistryImpl.java    From consulo with 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 File: PersistentUtil.java    From consulo with 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 File: TestStateStorage.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static File getTestHistoryRoot(Project project) {
  return new File(TEST_HISTORY_PATH, project.getLocationHash());
}