mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
svn: Migrate "String" to "Url" in "SvnRepositoryCache"
This commit is contained in:
@@ -25,13 +25,11 @@ public class CacheLoader extends Loader {
|
||||
@Override
|
||||
public void load(@NotNull final RepositoryTreeNode node, @NotNull final Expander expander) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
final String nodeUrl = node.getURL().toString();
|
||||
|
||||
final List<DirectoryEntry> cached = myCache.getChildren(nodeUrl);
|
||||
final List<DirectoryEntry> cached = myCache.getChildren(node.getURL());
|
||||
if (cached != null) {
|
||||
refreshNode(node, cached, expander);
|
||||
}
|
||||
final String error = myCache.getError(nodeUrl);
|
||||
final String error = myCache.getError(node.getURL());
|
||||
if (error != null) {
|
||||
refreshNodeError(node, error);
|
||||
}
|
||||
|
||||
+2
-2
@@ -50,12 +50,12 @@ class RepositoryLoader extends Loader {
|
||||
}
|
||||
|
||||
private void setResults(@NotNull Pair<RepositoryTreeNode, Expander> data, @NotNull List<DirectoryEntry> children) {
|
||||
myCache.put(data.first.getURL().toString(), children);
|
||||
myCache.put(data.first.getURL(), children);
|
||||
refreshNode(data.first, children, data.second);
|
||||
}
|
||||
|
||||
private void setError(@NotNull Pair<RepositoryTreeNode, Expander> data, @NotNull String message) {
|
||||
myCache.put(data.first.getURL().toString(), message);
|
||||
myCache.put(data.first.getURL(), message);
|
||||
refreshNodeError(data.first, message);
|
||||
}
|
||||
|
||||
|
||||
+8
-7
@@ -3,27 +3,28 @@ package org.jetbrains.idea.svn.dialogs.browserCache
|
||||
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.util.containers.ContainerUtil.createSoftMap
|
||||
import org.jetbrains.idea.svn.api.Url
|
||||
import org.jetbrains.idea.svn.browse.DirectoryEntry
|
||||
|
||||
class SvnRepositoryCache private constructor() {
|
||||
private val myMap = createSoftMap<String, List<DirectoryEntry>>()
|
||||
private val myErrorsMap = createSoftMap<String, String>()
|
||||
private val myMap = createSoftMap<Url, List<DirectoryEntry>>()
|
||||
private val myErrorsMap = createSoftMap<Url, String>()
|
||||
|
||||
fun getChildren(parent: String) = myMap[parent]
|
||||
fun getChildren(parent: Url) = myMap[parent]
|
||||
|
||||
fun getError(parent: String) = myErrorsMap[parent]
|
||||
fun getError(parent: Url) = myErrorsMap[parent]
|
||||
|
||||
fun put(parent: String, error: String) {
|
||||
fun put(parent: Url, error: String) {
|
||||
myMap.remove(parent)
|
||||
myErrorsMap[parent] = error
|
||||
}
|
||||
|
||||
fun put(parent: String, children: List<DirectoryEntry>) {
|
||||
fun put(parent: Url, children: List<DirectoryEntry>) {
|
||||
myErrorsMap.remove(parent)
|
||||
myMap[parent] = children
|
||||
}
|
||||
|
||||
fun remove(parent: String) {
|
||||
fun remove(parent: Url) {
|
||||
myErrorsMap.remove(parent)
|
||||
myMap.remove(parent)
|
||||
}
|
||||
|
||||
+7
-9
@@ -28,9 +28,9 @@ public class SyntheticWorker {
|
||||
}
|
||||
|
||||
public void removeSelf() {
|
||||
final String parentUrl;
|
||||
final Url parentUrl;
|
||||
try {
|
||||
parentUrl = removePathTail(myUrl).toString();
|
||||
parentUrl = removePathTail(myUrl);
|
||||
}
|
||||
catch (SvnBindException e) {
|
||||
return;
|
||||
@@ -50,16 +50,14 @@ public class SyntheticWorker {
|
||||
}
|
||||
|
||||
public void addSyntheticChildToSelf(final Url newUrl, final Url repositoryUrl, final String name, final boolean isDir) {
|
||||
final String currentUrlAsString = myUrl.toString();
|
||||
|
||||
final List<DirectoryEntry> children = myCache.getChildren(currentUrlAsString);
|
||||
final List<DirectoryEntry> children = myCache.getChildren(myUrl);
|
||||
if (children == null) {
|
||||
return;
|
||||
}
|
||||
children.add(createSyntheticEntry(newUrl, repositoryUrl, name, isDir));
|
||||
|
||||
sort(children, DirectoryEntry.CASE_INSENSITIVE_ORDER);
|
||||
myCache.put(currentUrlAsString, children);
|
||||
myCache.put(myUrl, children);
|
||||
}
|
||||
|
||||
public void copyTreeToSelf(final RepositoryTreeNode node) {
|
||||
@@ -84,7 +82,7 @@ public class SyntheticWorker {
|
||||
@Override
|
||||
@NotNull
|
||||
public Object fun(final RepositoryTreeNode repositoryTreeNode) {
|
||||
myCache.remove(repositoryTreeNode.getURL().toString());
|
||||
myCache.remove(repositoryTreeNode.getURL());
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +99,7 @@ public class SyntheticWorker {
|
||||
@Override
|
||||
@NotNull
|
||||
public Object fun(final RepositoryTreeNode repositoryTreeNode) {
|
||||
final List<DirectoryEntry> children = myCache.getChildren(repositoryTreeNode.getURL().toString());
|
||||
final List<DirectoryEntry> children = myCache.getChildren(repositoryTreeNode.getURL());
|
||||
if (children == null) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
@@ -111,7 +109,7 @@ public class SyntheticWorker {
|
||||
for (DirectoryEntry child : children) {
|
||||
newChildren.add(createSyntheticEntry(convertUrl(child.getUrl()), child.getRepositoryRoot(), child.getName(), child.isDirectory()));
|
||||
}
|
||||
myCache.put(convertUrl(repositoryTreeNode.getURL()).toString(), newChildren);
|
||||
myCache.put(convertUrl(repositoryTreeNode.getURL()), newChildren);
|
||||
}
|
||||
catch (SvnBindException ignored) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user