Java Code Examples for com.intellij.ide.util.PropertiesComponent#getValues()

The following examples show how to use com.intellij.ide.util.PropertiesComponent#getValues() . 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: FlutterSdkUtil.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void updateKnownPaths(@SuppressWarnings("SameParameterValue") @NotNull final String propertyKey,
                                     @NotNull final String newPath) {
  final Set<String> allPaths = new LinkedHashSet<>();

  // Add the new value first; this ensures that it's the 'default' flutter sdk.
  allPaths.add(newPath);

  final PropertiesComponent props = PropertiesComponent.getInstance();

  // Add the existing known paths.
  final String[] oldPaths = props.getValues(propertyKey);
  if (oldPaths != null) {
    allPaths.addAll(Arrays.asList(oldPaths));
  }

  // Store the values back.
  if (allPaths.isEmpty()) {
    props.unsetValue(propertyKey);
  }
  else {
    props.setValues(propertyKey, ArrayUtil.toStringArray(allPaths));
  }
}
 
Example 2
Source File: FlutterSdkUtil.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void updateKnownPaths(@SuppressWarnings("SameParameterValue") @NotNull final String propertyKey,
                                     @NotNull final String newPath) {
  final Set<String> allPaths = new LinkedHashSet<>();

  // Add the new value first; this ensures that it's the 'default' flutter sdk.
  allPaths.add(newPath);

  final PropertiesComponent props = PropertiesComponent.getInstance();

  // Add the existing known paths.
  final String[] oldPaths = props.getValues(propertyKey);
  if (oldPaths != null) {
    allPaths.addAll(Arrays.asList(oldPaths));
  }

  // Store the values back.
  if (allPaths.isEmpty()) {
    props.unsetValue(propertyKey);
  }
  else {
    props.setValues(propertyKey, ArrayUtil.toStringArray(allPaths));
  }
}
 
Example 3
Source File: Properties.java    From idea-gitignore with MIT License 5 votes vote down vote up
/**
 * Stores information about dismissed notification about editing ignored file.
 *
 * @param project current project
 * @param file    current file
 */
public static void setDismissedIgnoredEditingNotification(@NotNull Project project, @NotNull VirtualFile file) {
    final PropertiesComponent props = properties(project);
    String[] values = props.getValues(DISMISSED_IGNORED_EDITING_NOTIFICATION);

    final HashSet<String> set = ContainerUtil.newHashSet(values != null ? values : new String[0]);
    set.add(file.getCanonicalPath());

    props.setValues(DISMISSED_IGNORED_EDITING_NOTIFICATION, set.toArray(new String[0]));
}
 
Example 4
Source File: Properties.java    From idea-gitignore with MIT License 3 votes vote down vote up
/**
 * Checks if user already dismissed notification about editing ignored file.
 *
 * @param project current project
 * @param file    current file
 * @return notification was dismissed
 */
public static boolean isDismissedIgnoredEditingNotification(@NotNull Project project, @NotNull VirtualFile file) {
    final PropertiesComponent props = properties(project);
    String[] values = props.getValues(DISMISSED_IGNORED_EDITING_NOTIFICATION);

    return ContainerUtil.newHashSet(values != null ? values : new String[0]).contains(file.getCanonicalPath());
}