mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (NIO; formatting)
GitOrigin-RevId: 8555325d09a2e9c7e7b548d2a3bf7199ff21e64d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
32fdc0eaf5
commit
2a63f8fb98
+15
-16
@@ -29,11 +29,9 @@ import com.intellij.openapi.updateSettings.UpdateStrategyCustomization;
|
||||
import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.openapi.util.BuildNumber;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.HtmlBuilder;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
@@ -45,6 +43,9 @@ import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -113,7 +114,7 @@ final class UpdateCheckerComponent {
|
||||
if (future != null) future.cancel(false);
|
||||
}
|
||||
|
||||
private static void showWhatsNewNotification(@NotNull Project project) {
|
||||
private static void showWhatsNewNotification(Project project) {
|
||||
PropertiesComponent properties = PropertiesComponent.getInstance();
|
||||
String updateHtmlMessage = properties.getValue(UPDATE_WHATS_NEW_MESSAGE);
|
||||
if (updateHtmlMessage == null) {
|
||||
@@ -147,7 +148,7 @@ final class UpdateCheckerComponent {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void updateDefaultChannel(@NotNull UpdateSettings settings) {
|
||||
private static void updateDefaultChannel(UpdateSettings settings) {
|
||||
ChannelStatus current = settings.getSelectedChannelStatus();
|
||||
LOG.info("channel: " + current.getCode());
|
||||
boolean eap = ApplicationInfoEx.getInstanceEx().isMajorEAP();
|
||||
@@ -168,7 +169,7 @@ final class UpdateCheckerComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private static void scheduleFirstCheck(@NotNull UpdateSettings settings) {
|
||||
private static void scheduleFirstCheck(UpdateSettings settings) {
|
||||
BuildNumber currentBuild = ApplicationInfo.getInstance().getBuild();
|
||||
BuildNumber lastBuildChecked = BuildNumber.fromString(settings.getLastBuildChecked());
|
||||
long timeSinceLastCheck = max(System.currentTimeMillis() - settings.getLastTimeChecked(), 0);
|
||||
@@ -191,7 +192,7 @@ final class UpdateCheckerComponent {
|
||||
UpdateChecker.updateAndShowResult().doWhenProcessed(() -> getInstance().queueNextCheck(CHECK_INTERVAL));
|
||||
}
|
||||
|
||||
private static void snapPackageNotification(@NotNull UpdateSettings settings) {
|
||||
private static void snapPackageNotification(UpdateSettings settings) {
|
||||
if (ExternalUpdateManager.ACTUAL != ExternalUpdateManager.SNAP) {
|
||||
return;
|
||||
}
|
||||
@@ -242,7 +243,7 @@ final class UpdateCheckerComponent {
|
||||
UpdateSettings.getInstance().saveLastCheckedInfo(true);
|
||||
}
|
||||
|
||||
private static void showUpdatedPluginsNotification(@NotNull Project project) {
|
||||
private static void showUpdatedPluginsNotification(Project project) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return;
|
||||
}
|
||||
@@ -261,7 +262,7 @@ final class UpdateCheckerComponent {
|
||||
}
|
||||
|
||||
try {
|
||||
FileUtil.writeToFile(getUpdatedPluginsFile(), StringUtil.join(list, LineSeparator.getSystemLineSeparator().getSeparatorString()));
|
||||
Files.write(getUpdatedPluginsFile(), list);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn(e);
|
||||
@@ -311,13 +312,12 @@ final class UpdateCheckerComponent {
|
||||
}, "plugins.updated.after.restart").notify(project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Set<String> getUpdatedPlugins() {
|
||||
try {
|
||||
File file = getUpdatedPluginsFile();
|
||||
if (file.isFile()) {
|
||||
List<String> list = FileUtil.loadLines(file);
|
||||
FileUtil.delete(file);
|
||||
Path file = getUpdatedPluginsFile();
|
||||
if (Files.isRegularFile(file)) {
|
||||
List<String> list = Files.readAllLines(file);
|
||||
Files.delete(file);
|
||||
return new HashSet<>(list);
|
||||
}
|
||||
}
|
||||
@@ -327,8 +327,7 @@ final class UpdateCheckerComponent {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static File getUpdatedPluginsFile() {
|
||||
return new File(PathManager.getConfigPath(), ".updated_plugins_list");
|
||||
private static Path getUpdatedPluginsFile() {
|
||||
return Paths.get(PathManager.getConfigPath(), ".updated_plugins_list");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-16
@@ -27,9 +27,8 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
|
||||
return ExternalUpdateManager.ACTUAL == null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public UpdateOptions getState() {
|
||||
public @NotNull UpdateOptions getState() {
|
||||
return myState;
|
||||
}
|
||||
|
||||
@@ -38,13 +37,11 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
|
||||
myState = state;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getLastBuildChecked() {
|
||||
public @Nullable String getLastBuildChecked() {
|
||||
return myState.getLastBuildChecked();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getStoredPluginHosts() {
|
||||
public @NotNull List<String> getStoredPluginHosts() {
|
||||
return myState.getPluginHosts();
|
||||
}
|
||||
|
||||
@@ -88,13 +85,11 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
|
||||
return myState.getLastTimeChecked();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getIgnoredBuildNumbers() {
|
||||
public @NotNull List<String> getIgnoredBuildNumbers() {
|
||||
return myState.getIgnoredBuildNumbers();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ChannelStatus getSelectedChannelStatus() {
|
||||
public @NotNull ChannelStatus getSelectedChannelStatus() {
|
||||
return ChannelStatus.fromCode(myState.getUpdateChannelType());
|
||||
}
|
||||
|
||||
@@ -102,16 +97,14 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
|
||||
myState.setUpdateChannelType(channel.getCode());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<ChannelStatus> getActiveChannels() {
|
||||
public @NotNull List<ChannelStatus> getActiveChannels() {
|
||||
UpdateStrategyCustomization tweaker = UpdateStrategyCustomization.getInstance();
|
||||
return Stream.of(ChannelStatus.values())
|
||||
.filter(ch -> ch == ChannelStatus.EAP || ch == ChannelStatus.RELEASE || tweaker.isChannelActive(ch))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ChannelStatus getSelectedActiveChannel() {
|
||||
public @NotNull ChannelStatus getSelectedActiveChannel() {
|
||||
UpdateStrategyCustomization tweaker = UpdateStrategyCustomization.getInstance();
|
||||
ChannelStatus current = getSelectedChannelStatus();
|
||||
return tweaker.isChannelActive(current)
|
||||
@@ -119,8 +112,7 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
|
||||
: getActiveChannels().stream().filter(ch -> ch.compareTo(current) > 0).findFirst().orElse(ChannelStatus.RELEASE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getPluginHosts() {
|
||||
public @NotNull List<String> getPluginHosts() {
|
||||
List<String> hosts = new ArrayList<>(myState.getPluginHosts());
|
||||
String pluginHosts = System.getProperty("idea.plugin.hosts");
|
||||
if (pluginHosts != null) {
|
||||
|
||||
Reference in New Issue
Block a user