mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
minor movement
This commit is contained in:
+15
@@ -51,6 +51,21 @@ public class ReplacePathToMacroMap extends PathMacroMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void putIfAbsent(@NonNls final String pathWithPrefix,
|
||||
@NonNls final String substitutionWithPrefix,
|
||||
final boolean check) {
|
||||
if (check && containsPath(pathWithPrefix))
|
||||
return;
|
||||
|
||||
if (StringUtil.endsWithChar(pathWithPrefix, '/')) {
|
||||
myMacroMap.put(pathWithPrefix, substitutionWithPrefix + "/");
|
||||
myMacroMap.put(pathWithPrefix.substring(0, pathWithPrefix.length() - 1), substitutionWithPrefix);
|
||||
}
|
||||
else {
|
||||
myMacroMap.put(pathWithPrefix, substitutionWithPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
public String substitute(String text, boolean caseSensitive) {
|
||||
if (text == null) {
|
||||
//noinspection ConstantConditions
|
||||
|
||||
+7
-24
@@ -30,7 +30,6 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -68,14 +67,14 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
path = StringUtil.trimEnd(FileUtil.toSystemIndependentName(path), "/");
|
||||
boolean check = false;
|
||||
while (StringUtil.isNotEmpty(path) && path.contains("/")) {
|
||||
putIfAbsent(result, "file:" + path, "file:" + macro, check);
|
||||
putIfAbsent(result, "file:/" + path, "file:/" + macro, check);
|
||||
putIfAbsent(result, "file://" + path, "file://" + macro, check);
|
||||
putIfAbsent(result, "jar:" + path, "jar:" + macro, check);
|
||||
putIfAbsent(result, "jar:/" + path, "jar:/" + macro, check);
|
||||
putIfAbsent(result, "jar://" + path, "jar://" + macro, check);
|
||||
result.putIfAbsent("file:" + path, "file:" + macro, check);
|
||||
result.putIfAbsent("file:/" + path, "file:/" + macro, check);
|
||||
result.putIfAbsent("file://" + path, "file://" + macro, check);
|
||||
result.putIfAbsent("jar:" + path, "jar:" + macro, check);
|
||||
result.putIfAbsent("jar:/" + path, "jar:/" + macro, check);
|
||||
result.putIfAbsent("jar://" + path, "jar://" + macro, check);
|
||||
if (!path.equalsIgnoreCase("e:/") && !path.equalsIgnoreCase("r:/") && !path.equalsIgnoreCase("p:/")) {
|
||||
putIfAbsent(result, path, macro, check);
|
||||
result.putIfAbsent(path, macro, check);
|
||||
}
|
||||
|
||||
if (path.equals(stopAt)) {
|
||||
@@ -93,22 +92,6 @@ public class BasePathMacroManager extends PathMacroManager {
|
||||
return VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL);
|
||||
}
|
||||
|
||||
private static void putIfAbsent(final ReplacePathToMacroMap result,
|
||||
@NonNls final String pathWithPrefix,
|
||||
@NonNls final String substitutionWithPrefix,
|
||||
final boolean check) {
|
||||
if (check && result.containsPath(pathWithPrefix))
|
||||
return;
|
||||
|
||||
if (StringUtil.endsWithChar(pathWithPrefix, '/')) {
|
||||
result.put(pathWithPrefix, substitutionWithPrefix + "/");
|
||||
result.put(pathWithPrefix.substring(0, pathWithPrefix.length()-1), substitutionWithPrefix);
|
||||
}
|
||||
else {
|
||||
result.put(pathWithPrefix, substitutionWithPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
protected ExpandMacroToPathMap getExpandMacroMap() {
|
||||
ExpandMacroToPathMap result = new ExpandMacroToPathMap();
|
||||
for (Map.Entry<String, String> entry : PathMacrosImpl.getGlobalSystemMacros().entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user