mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -228,15 +228,8 @@ public final class LoadTextUtil {
|
||||
|
||||
@NotNull
|
||||
private static Charset getDefaultCharsetFromEncodingManager(@NotNull VirtualFile virtualFile) {
|
||||
Charset result = null;
|
||||
Charset specifiedExplicitly = EncodingRegistry.getInstance().getEncoding(virtualFile, true);
|
||||
if (specifiedExplicitly != null) {
|
||||
result = specifiedExplicitly;
|
||||
}
|
||||
if (result == null) {
|
||||
result = EncodingRegistry.getInstance().getDefaultCharset();
|
||||
}
|
||||
return result;
|
||||
return ObjectUtils.notNull(specifiedExplicitly, EncodingRegistry.getInstance().getDefaultCharset());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -677,9 +670,8 @@ public final class LoadTextUtil {
|
||||
return virtualFile.getUserData(CHARSET_WAS_DETECTED_FROM_BYTES);
|
||||
}
|
||||
|
||||
private static void setCharsetAutoDetectionReason(
|
||||
@NotNull VirtualFile virtualFile,
|
||||
@Nullable("null if was not detected, otherwise the reason it was") AutoDetectionReason reason) {
|
||||
private static void setCharsetAutoDetectionReason(@NotNull VirtualFile virtualFile,
|
||||
@Nullable("null if was not detected, otherwise the reason it was") AutoDetectionReason reason) {
|
||||
virtualFile.putUserData(CHARSET_WAS_DETECTED_FROM_BYTES, reason);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,13 +100,11 @@ public class UsageViewUtil {
|
||||
Set<UsageInfo> set = new LinkedHashSet<>(Arrays.asList(usages));
|
||||
|
||||
// Replace duplicates of move rename usage infos in injections from non code usages of master files
|
||||
String newTextInNonCodeUsage = null;
|
||||
|
||||
for(UsageInfo usage:usages) {
|
||||
if (!(usage instanceof NonCodeUsageInfo)) continue;
|
||||
newTextInNonCodeUsage = ((NonCodeUsageInfo)usage).newText;
|
||||
break;
|
||||
}
|
||||
String newTextInNonCodeUsage =
|
||||
Arrays.stream(usages)
|
||||
.filter(usage -> usage instanceof NonCodeUsageInfo)
|
||||
.map(usage -> ((NonCodeUsageInfo)usage).newText)
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if (newTextInNonCodeUsage != null) {
|
||||
for(UsageInfo usage:usages) {
|
||||
|
||||
Reference in New Issue
Block a user