mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-101631 Updating Maven snapshots with sources does not synchronize sources to latest when navigating to class
This commit is contained in:
@@ -801,6 +801,22 @@ public class StringUtil extends StringUtilRt {
|
||||
return testee.startsWith(firstPrefix) && testee.regionMatches(l1, secondPrefix, 0, l2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to testee.startsWith(firstPrefix + secondPrefix + thirdPrefix) but avoids creating an object for concatenation.
|
||||
*/
|
||||
public static boolean startsWithConcatenationOf(@NotNull String testee,
|
||||
@NotNull String firstPrefix,
|
||||
@NotNull String secondPrefix,
|
||||
@NotNull String thirdPrefix) {
|
||||
int l1 = firstPrefix.length();
|
||||
int l2 = secondPrefix.length();
|
||||
int l3 = thirdPrefix.length();
|
||||
if (testee.length() < l1 + l2 + l3) return false;
|
||||
return testee.startsWith(firstPrefix)
|
||||
&& testee.regionMatches(l1, secondPrefix, 0, l2)
|
||||
&& testee.regionMatches(l1 + l2, thirdPrefix, 0, l3);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String trimEnd(@NotNull String s, @NonNls @NotNull String suffix) {
|
||||
if (s.endsWith(suffix)) {
|
||||
|
||||
+3
-3
@@ -140,9 +140,9 @@ public class MavenArtifact implements Serializable {
|
||||
return getRelativePathForExtraArtifact(null, null);
|
||||
}
|
||||
|
||||
public String getFileNameWithBaseVersion() {
|
||||
public String getFileNameWithBaseVersion(@Nullable String extraArtifactClassifier, @Nullable String customExtension) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
appendFileName(res, null, null);
|
||||
appendFileName(res, extraArtifactClassifier, customExtension);
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MavenArtifact implements Serializable {
|
||||
result.append('/');
|
||||
result.append(myArtifactId);
|
||||
result.append('/');
|
||||
result.append(myVersion);
|
||||
result.append(myBaseVersion);
|
||||
result.append('/');
|
||||
|
||||
appendFileName(result, extraArtifactClassifier, customExtension);
|
||||
|
||||
+11
-2
@@ -334,8 +334,17 @@ public class MavenRootModelAdapter {
|
||||
library.addRoot(newUrl, type);
|
||||
}
|
||||
|
||||
private static boolean isRepositoryUrl(MavenArtifact artifact, String url, String classifier, String extension) {
|
||||
return url.endsWith(artifact.getRelativePathForExtraArtifact(classifier, extension) + JarFileSystem.JAR_SEPARATOR);
|
||||
private static boolean isRepositoryUrl(MavenArtifact artifact, String url, @Nullable String classifier, @Nullable String extension) {
|
||||
if (!url.contains(artifact.getGroupId() + '/' + artifact.getArtifactId() + '/' + artifact.getBaseVersion() + '/' + artifact.getArtifactId() + '-')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String fileName = artifact.getFileNameWithBaseVersion(classifier, extension);
|
||||
assert StringUtil.startsWithConcatenationOf(fileName, artifact.getArtifactId(), "-", artifact.getVersion());
|
||||
|
||||
String suffix = fileName.substring(artifact.getArtifactId().length() + 1 + artifact.getVersion().length());
|
||||
|
||||
return StringUtil.trimEnd(url, "!/").endsWith(suffix);
|
||||
}
|
||||
|
||||
public static boolean isChangedByUser(Library library) {
|
||||
|
||||
Reference in New Issue
Block a user