introduce more convenient getList/setList

GitOrigin-RevId: 84d44e2053b422fc8791ffe445865e4b4f48e2c3
This commit is contained in:
Vladimir Krivosheev
2022-01-09 12:33:56 +01:00
committed by intellij-monorepo-bot
parent b300f9cb19
commit f3aeb4f81d
13 changed files with 94 additions and 76 deletions

View File

@@ -11,6 +11,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.List;
/**
* Allows simple persistence of application/project-level values.
@@ -60,10 +62,27 @@ public abstract class PropertiesComponent {
*/
public abstract void setValue(@NonNls @NotNull String name, boolean value, boolean defaultValue);
/**
* @deprecated Use {@link #getList(String)}
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2022.3")
@Deprecated
public abstract String @Nullable [] getValues(@NonNls @NotNull String name);
/**
* @deprecated Use {@link #getList(String)}
*/
@ApiStatus.ScheduledForRemoval(inVersion = "2022.3")
@Deprecated
public abstract void setValues(@NonNls @NotNull String name, String[] values);
public abstract @Nullable List<String> getList(@NonNls @NotNull String name);
/**
* The passed collection will be copied.
*/
public abstract void setList(@NonNls @NotNull String name, @Nullable Collection<String> values);
/**
* Returns the project-level instance.
*/

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.scratch;
import com.intellij.icons.AllIcons;
@@ -13,9 +13,7 @@ import com.intellij.openapi.util.NlsContexts.PopupTitle;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Consumer;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.JBIterable;
import com.intellij.util.ui.EmptyIcon;
@@ -243,21 +241,25 @@ public abstract class LRUPopupBuilder<T> {
return popup;
}
private String @NotNull [] restoreLRUItems() {
return ObjectUtils.notNull(myPropertiesComponent.getValues(getLRUKey()), ArrayUtilRt.EMPTY_STRING_ARRAY);
private @NotNull List<String> restoreLRUItems() {
return Objects.requireNonNullElse(myPropertiesComponent.getList(getLRUKey()), Collections.emptyList());
}
private void storeLRUItems(@NotNull T t) {
String[] values = myPropertiesComponent.getValues(getLRUKey());
List<String> values = myPropertiesComponent.getList(getLRUKey());
List<String> lastUsed = new ArrayList<>(LRU_ITEMS);
lastUsed.add(getStorageId(t));
if (values != null) {
for (String value : values) {
if (!lastUsed.contains(value)) lastUsed.add(value);
if (lastUsed.size() == LRU_ITEMS) break;
if (!lastUsed.contains(value)) {
lastUsed.add(value);
}
if (lastUsed.size() == LRU_ITEMS) {
break;
}
}
}
myPropertiesComponent.setValues(getLRUKey(), ArrayUtilRt.toStringArray(lastUsed));
myPropertiesComponent.setList(getLRUKey(), lastUsed);
}

View File

@@ -51,7 +51,7 @@ internal class DoNotAskConfigurableUi {
private fun getValues(manager: PropertiesComponent, list: ArrayList<DoNotAskInfo>, forProject: Boolean) {
if (manager is BasePropertyService) {
manager.forEach { key, value ->
manager.forEachPrimitiveValue { key, value ->
if (key.startsWith(DO_NOT_ASK_KEY_PREFIX)) {
list.add(DoNotAskInfo(key.substring(DO_NOT_ASK_KEY_PREFIX.length), value, forProject))
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileChooser.ex;
import com.intellij.ide.IdeBundle;
@@ -34,7 +34,6 @@ import com.intellij.ui.SimpleListCellRenderer;
import com.intellij.ui.UIBundle;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Consumer;
import com.intellij.util.IconUtil;
@@ -162,23 +161,23 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
}
private void saveRecent(String path) {
List<String> files = new ArrayList<>(Arrays.asList(getRecentFiles()));
List<String> files = new ArrayList<>(getRecentFiles());
files.remove(path);
files.add(0, path);
while (files.size() > 30) {
files.remove(files.size() - 1);
}
PropertiesComponent.getInstance().setValues(RECENT_FILES_KEY, ArrayUtilRt.toStringArray(files));
PropertiesComponent.getInstance().setList(RECENT_FILES_KEY, files);
}
private String @NotNull [] getRecentFiles() {
String[] array = PropertiesComponent.getInstance().getValues(RECENT_FILES_KEY);
private @NotNull List<String> getRecentFiles() {
List<String> array = PropertiesComponent.getInstance().getList(RECENT_FILES_KEY);
if (array == null) {
return ArrayUtil.EMPTY_STRING_ARRAY;
return Collections.emptyList();
}
if (array.length > 0 && myPathTextField != null && myPathTextField.getField().getText().replace('\\', '/').equals(array[0])) {
return Arrays.copyOfRange(array, 1, array.length);
if (array.size() > 0 && myPathTextField != null && myPathTextField.getField().getText().replace('\\', '/').equals(array.get(0))) {
return array.subList(1, array.size());
}
return array;
}
@@ -239,7 +238,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
toolbarPanel.add(extraToolbarPanel, BorderLayout.SOUTH);
}
myPath = new ComboBox<>(getRecentFiles());
myPath = new ComboBox<>(getRecentFiles().toArray(ArrayUtilRt.EMPTY_STRING_ARRAY));
myPath.setEditable(true);
myPath.setRenderer(SimpleListCellRenderer.create((var label, @NlsContexts.Label var value, var index) -> {
label.setText(value);
@@ -620,15 +619,15 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
private void selectInTree(VirtualFile[] array, boolean requestFocus, boolean updatePathNeeded) {
myTreeIsUpdating = true;
final List<VirtualFile> fileList = Arrays.asList(array);
if (!Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
if (!Set.of(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
myFileSystemTree.select(array, () -> {
if (!myFileSystemTree.areHiddensShown() && !Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
if (!myFileSystemTree.areHiddensShown() && !Set.of(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
// try to select files in hidden folders
myFileSystemTree.showHiddens(true);
selectInTree(array, requestFocus, updatePathNeeded);
return;
}
if (array.length == 1 && !Arrays.asList(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
if (array.length == 1 && !Set.of(myFileSystemTree.getSelectedFiles()).containsAll(fileList)) {
// try to select a parent of a missed file
VirtualFile parent = array[0].getParent();
if (parent != null && parent.isValid()) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileChooser.impl;
import com.intellij.ide.IdeBundle;
@@ -177,18 +177,18 @@ final class NewFileChooserDialogImpl extends DialogWrapper implements FileChoose
}
private static Stream<String> recentPaths() {
String[] values = PropertiesComponent.getInstance().getValues(RECENT_FILES_KEY);
return values != null ? Stream.of(values) : Stream.empty();
List<String> values = PropertiesComponent.getInstance().getList(RECENT_FILES_KEY);
return values != null ? values.stream() : Stream.empty();
}
private static void updateRecentPaths(VirtualFile file) {
if (file.isInLocalFileSystem()) {
String[] newValues = Stream.concat(Stream.of(file.getPath()), recentPaths())
List<String> newValues = Stream.concat(Stream.of(file.getPath()), recentPaths())
.filter(p -> NioFiles.toPath(p) != null)
.distinct()
.limit(RECENT_FILES_LIMIT)
.toArray(String[]::new);
PropertiesComponent.getInstance().setValues(RECENT_FILES_KEY, newValues);
.collect(Collectors.toList());
PropertiesComponent.getInstance().setList(RECENT_FILES_KEY, newValues);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.keymap.impl;
import com.intellij.execution.ExecutionException;
@@ -24,7 +24,6 @@ import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -484,22 +483,22 @@ public final class SystemShortcuts {
return;
}
myMutedActions = new HashSet<>();
final String[] muted = PropertiesComponent.getInstance().getValues(MUTED_ACTIONS_KEY);
List<String> muted = PropertiesComponent.getInstance().getList(MUTED_ACTIONS_KEY);
if (muted != null) {
Collections.addAll(myMutedActions, muted);
myMutedActions.addAll(muted);
}
}
void addMutedAction(@NotNull String actId) {
init();
myMutedActions.add(actId);
PropertiesComponent.getInstance().setValues(MUTED_ACTIONS_KEY, ArrayUtilRt.toStringArray(myMutedActions));
PropertiesComponent.getInstance().setList(MUTED_ACTIONS_KEY, myMutedActions);
}
void removeMutedAction(@NotNull String actId) {
init();
myMutedActions.remove(actId);
PropertiesComponent.getInstance().setValues(MUTED_ACTIONS_KEY, ArrayUtilRt.toStringArray(myMutedActions));
PropertiesComponent.getInstance().setList(MUTED_ACTIONS_KEY, myMutedActions);
}
public boolean isMutedAction(@NotNull String actionId) {

View File

@@ -1066,6 +1066,11 @@
<component>PluginAdvertiserExtensions</component>
</components>
</obsoleteStorage>
<obsoleteStorage file="other.xml">
<components>
<component>PropertiesComponent</component>
</components>
</obsoleteStorage>
<obsoleteStorage file="menu.item.text.update.xml">
<components>
<component>ActionMenuItemUpdateCollector</component>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.changes;
@@ -204,7 +204,7 @@ public class ChangesViewManager implements ChangesViewEx,
private void migrateShowFlattenSetting() {
if (!myState.myShowFlatten) {
myState.groupingKeys = set(DEFAULT_GROUPING_KEYS);
myState.groupingKeys = Set.copyOf(DEFAULT_GROUPING_KEYS);
myState.myShowFlatten = true;
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.changes;
import com.intellij.CommonBundle;
@@ -32,10 +32,10 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.util.List;
import java.util.Set;
import static com.intellij.openapi.vcs.changes.ui.ChangesTree.DEFAULT_GROUPING_KEYS;
import static com.intellij.openapi.vcs.changes.ui.ChangesTree.GROUP_BY_ACTION_GROUP;
import static com.intellij.util.containers.ContainerUtil.set;
abstract class SpecificFilesViewDialog extends DialogWrapper {
protected JPanel myPanel;
@@ -116,7 +116,7 @@ abstract class SpecificFilesViewDialog extends DialogWrapper {
myPanel.add(toolbarPanel, BorderLayout.NORTH);
myPanel.add(ScrollPaneFactory.createScrollPane(myView), BorderLayout.CENTER);
myView.getGroupingSupport().setGroupingKeysOrSkip(set(DEFAULT_GROUPING_KEYS));
myView.getGroupingSupport().setGroupingKeysOrSkip(Set.copyOf(DEFAULT_GROUPING_KEYS));
}
protected void addCustomActions(@NotNull DefaultActionGroup group) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.changes.ui;
import com.intellij.ide.CommonActionsManager;
@@ -30,7 +30,6 @@ import com.intellij.ui.SmartExpander;
import com.intellij.ui.TreeSpeedSearch;
import com.intellij.ui.tree.TreeVisitor;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.Processor;
import com.intellij.util.containers.TreeTraversal;
import com.intellij.util.ui.tree.TreeUtil;
@@ -57,9 +56,6 @@ import static com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.DIRECTO
import static com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.MODULE_GROUPING;
import static com.intellij.openapi.vcs.changes.ui.VcsTreeModelData.*;
import static com.intellij.ui.tree.TreePathUtil.toTreePathArray;
import static com.intellij.util.ObjectUtils.notNull;
import static com.intellij.util.containers.ContainerUtil.ar;
import static com.intellij.util.containers.ContainerUtil.set;
import static com.intellij.util.ui.ThreeStateCheckBox.State;
import static java.util.stream.Collectors.toList;
@@ -87,7 +83,7 @@ public abstract class ChangesTree extends Tree implements DataProvider {
@Deprecated @NonNls private final static String FLATTEN_OPTION_KEY = "ChangesBrowser.SHOW_FLATTEN";
@NonNls protected static final String GROUPING_KEYS = "ChangesTree.GroupingKeys";
public static final String[] DEFAULT_GROUPING_KEYS = ar(DIRECTORY_GROUPING, MODULE_GROUPING);
public static final List<String> DEFAULT_GROUPING_KEYS = List.of(DIRECTORY_GROUPING, MODULE_GROUPING);
@NonNls public static final String GROUP_BY_ACTION_GROUP = "ChangesView.GroupBy";
@@ -206,13 +202,14 @@ public abstract class ChangesTree extends Tree implements DataProvider {
return result;
}
protected static void installGroupingSupport(@NotNull ChangesTree tree, @NotNull ChangesGroupingSupport groupingSupport,
@NotNull @NonNls String propertyName, @NonNls String... defaultGroupingKeys) {
groupingSupport.setGroupingKeysOrSkip(set(notNull(PropertiesComponent.getInstance(tree.getProject()).getValues(propertyName),
defaultGroupingKeys)));
protected static void installGroupingSupport(@NotNull ChangesTree tree,
@NotNull ChangesGroupingSupport groupingSupport,
@NotNull @NonNls String propertyName,
@NonNls List<String> defaultGroupingKeys) {
groupingSupport.setGroupingKeysOrSkip(
Set.copyOf(Objects.requireNonNullElse(PropertiesComponent.getInstance(tree.getProject()).getList(propertyName), defaultGroupingKeys)));
groupingSupport.addPropertyChangeListener(e -> {
PropertiesComponent.getInstance(tree.getProject()).setValues(propertyName,
ArrayUtilRt.toStringArray(groupingSupport.getGroupingKeys()));
PropertiesComponent.getInstance(tree.getProject()).setList(propertyName, groupingSupport.getGroupingKeys());
List<Object> oldSelection = selected(tree).userObjects();
tree.rebuildTree();
@@ -224,8 +221,7 @@ public abstract class ChangesTree extends Tree implements DataProvider {
PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
if (properties.isValueSet(FLATTEN_OPTION_KEY)) {
properties.setValues(GROUPING_KEYS, properties.isTrueValue(FLATTEN_OPTION_KEY) ? ArrayUtilRt.EMPTY_STRING_ARRAY
: DEFAULT_GROUPING_KEYS);
properties.setList(GROUPING_KEYS, properties.isTrueValue(FLATTEN_OPTION_KEY) ? Collections.emptyList() : DEFAULT_GROUPING_KEYS);
properties.unsetValue(FLATTEN_OPTION_KEY);
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.conflicts
import com.intellij.openapi.Disposable
@@ -23,9 +23,9 @@ import com.intellij.util.ui.update.DisposableUpdate
import com.intellij.util.ui.update.MergingUpdateQueue
import git4idea.GitUtil
import git4idea.conflicts.GitConflictsUtil.acceptConflictSide
import git4idea.conflicts.GitConflictsUtil.getConflictOperationLock
import git4idea.conflicts.GitConflictsUtil.getConflictType
import git4idea.conflicts.GitConflictsUtil.showMergeWindow
import git4idea.conflicts.GitConflictsUtil.getConflictOperationLock
import git4idea.merge.GitMergeUtil
import git4idea.repo.GitConflict
import git4idea.repo.GitRepository
@@ -38,13 +38,12 @@ import javax.swing.JComponent
import javax.swing.JPanel
import javax.swing.tree.DefaultTreeModel
class GitConflictsPanel(
internal class GitConflictsPanel(
private val project: Project,
private val mergeHandler: GitMergeHandler
) : Disposable {
private val panel: JComponent
private val conflictsTree: MyChangesTree
private val conflictsTree = MyChangesTree(project)
private val conflicts: MutableList<GitConflict> = ArrayList()
private val reversedRoots: MutableSet<VirtualFile> = HashSet()
@@ -54,8 +53,7 @@ class GitConflictsPanel(
private val eventDispatcher = EventDispatcher.create(Listener::class.java)
init {
conflictsTree = MyChangesTree(project)
conflictsTree.setKeepTreeState(true)
conflictsTree.isKeepTreeState = true
updateQueue = MergingUpdateQueue("GitConflictsView", 300, true, conflictsTree, this, null, Alarm.ThreadToUse.POOLED_THREAD)
@@ -227,7 +225,7 @@ private class MyChangesTree(project: Project)
override fun installGroupingSupport(): ChangesGroupingSupport {
val groupingSupport = ChangesGroupingSupport(myProject, this, false)
installGroupingSupport(this, groupingSupport, GROUPING_KEYS_PROPERTY, DIRECTORY_GROUPING)
installGroupingSupport(this, groupingSupport, GROUPING_KEYS_PROPERTY, listOf(DIRECTORY_GROUPING))
return groupingSupport
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package git4idea.index.ui
import com.intellij.dvcs.ui.RepositoryChangesBrowserNode
@@ -364,13 +364,13 @@ internal class GitStagePanel(private val tracker: GitStageTracker,
override fun installGroupingSupport(): ChangesGroupingSupport {
val result = ChangesGroupingSupport(project, this, false)
if (PropertiesComponent.getInstance(project).getValues(GROUPING_PROPERTY_NAME) == null) {
val oldGroupingKeys = (PropertiesComponent.getInstance(project).getValues(GROUPING_KEYS) ?: DEFAULT_GROUPING_KEYS).toMutableSet()
if (PropertiesComponent.getInstance(project).getList(GROUPING_PROPERTY_NAME) == null) {
val oldGroupingKeys = (PropertiesComponent.getInstance(project).getList(GROUPING_KEYS) ?: DEFAULT_GROUPING_KEYS).toMutableSet()
oldGroupingKeys.add(REPOSITORY_GROUPING)
PropertiesComponent.getInstance(project).setValues(GROUPING_PROPERTY_NAME, *oldGroupingKeys.toTypedArray())
PropertiesComponent.getInstance(project).setList(GROUPING_PROPERTY_NAME, oldGroupingKeys.toList())
}
installGroupingSupport(this, result, GROUPING_PROPERTY_NAME, *DEFAULT_GROUPING_KEYS + REPOSITORY_GROUPING)
installGroupingSupport(this, result, GROUPING_PROPERTY_NAME, DEFAULT_GROUPING_KEYS + REPOSITORY_GROUPING)
return result
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.gradle.statistics
@@ -13,7 +13,9 @@ import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.PathUtilRt
import com.intellij.util.concurrency.AppExecutorUtil
import com.intellij.util.text.trimMiddle
import org.jetbrains.kotlin.idea.statistics.*
import org.jetbrains.kotlin.idea.statistics.FUSEventGroups
import org.jetbrains.kotlin.idea.statistics.GradleStatisticsEvents
import org.jetbrains.kotlin.idea.statistics.KotlinFUSLogger
import org.jetbrains.kotlin.statistics.BuildSessionLogger
import org.jetbrains.kotlin.statistics.BuildSessionLogger.Companion.STATISTICS_FOLDER_NAME
import org.jetbrains.kotlin.statistics.fileloggers.MetricsContainer
@@ -24,8 +26,6 @@ import java.io.File
import java.util.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.io.path.Path
import kotlin.io.path.exists
@@ -50,7 +50,7 @@ class KotlinGradleFUSLogger : StartupActivity, DumbAware, Runnable {
// 2. the projectId should be stable and independent on IDE version
val presentableUrl = FileUtil.toSystemIndependentName(path)
val name =
PathUtilRt.getFileName(presentableUrl).toLowerCase(Locale.US).removeSuffix(ProjectFileType.DOT_DEFAULT_EXTENSION)
PathUtilRt.getFileName(presentableUrl).lowercase(Locale.US).removeSuffix(ProjectFileType.DOT_DEFAULT_EXTENSION)
val locationHash = Integer.toHexString((presentableUrl).hashCode())
val projectHash =
"${name.trimMiddle(name.length.coerceAtMost(254 - locationHash.length), useEllipsisSymbol = false)}.$locationHash"
@@ -244,11 +244,11 @@ class KotlinGradleFUSLogger : StartupActivity, DumbAware, Runnable {
}
}
private var gradleUserDirs: Array<String>
set(value) = PropertiesComponent.getInstance().setValues(
private var gradleUserDirs: List<String>
set(value) = PropertiesComponent.getInstance().setList(
GRADLE_USER_DIRS_PROPERTY_NAME, value
)
get() = PropertiesComponent.getInstance().getValues(GRADLE_USER_DIRS_PROPERTY_NAME) ?: emptyArray()
get() = PropertiesComponent.getInstance().getList(GRADLE_USER_DIRS_PROPERTY_NAME) ?: emptyList()
fun populateGradleUserDir(path: String) {
val currentState = gradleUserDirs
@@ -258,7 +258,7 @@ class KotlinGradleFUSLogger : StartupActivity, DumbAware, Runnable {
result.add(path)
result.addAll(currentState)
gradleUserDirs = result.filter { filePath -> Path(filePath).exists() }.take(MAXIMUM_USER_DIRS).toTypedArray()
gradleUserDirs = result.filter { filePath -> Path(filePath).exists() }.take(MAXIMUM_USER_DIRS)
}
}
}