mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
Optimization: check for setting before initiating background action and checking if Lombok library exists
GitOrigin-RevId: 7338ae8b498eb527b1e305597080f753258136c2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
41b59c8dcb
commit
6cec315ce2
@@ -32,31 +32,33 @@ public class LombokProjectValidatorActivity implements StartupActivity.DumbAware
|
||||
final MessageBusConnection connection = project.getMessageBus().connect();
|
||||
connection.subscribe(BuildManagerListener.TOPIC, new LombokBuildManagerListener());
|
||||
|
||||
ReadAction.nonBlocking(() -> {
|
||||
if (project.isDisposed()) return null;
|
||||
if (ProjectSettings.isEnabled(project, ProjectSettings.IS_LOMBOK_VERSION_CHECK_ENABLED, false)) {
|
||||
ReadAction.nonBlocking(() -> {
|
||||
if (project.isDisposed()) return null;
|
||||
|
||||
final boolean hasLombokLibrary = LombokLibraryUtil.hasLombokLibrary(project);
|
||||
final boolean hasLombokLibrary = LombokLibraryUtil.hasLombokLibrary(project);
|
||||
|
||||
// If dependency is present and out of date notification setting is enabled (defaults to disabled)
|
||||
if (hasLombokLibrary && ProjectSettings.isEnabled(project, ProjectSettings.IS_LOMBOK_VERSION_CHECK_ENABLED, false)) {
|
||||
String lombokVersion = LombokLibraryUtil.getLombokVersionCached(project);
|
||||
// If dependency is present and out of date notification setting is enabled (defaults to disabled)
|
||||
if (hasLombokLibrary) {
|
||||
String lombokVersion = LombokLibraryUtil.getLombokVersionCached(project);
|
||||
|
||||
if (StringUtil.isNotEmpty(lombokVersion) && Version.isLessThan(lombokVersion, Version.LAST_LOMBOK_VERSION)) {
|
||||
return getNotificationGroup().createNotification(
|
||||
LombokBundle.message("config.warn.dependency.outdated.title"),
|
||||
LombokBundle.message("config.warn.dependency.outdated.message", project.getName(), lombokVersion, Version.LAST_LOMBOK_VERSION),
|
||||
NotificationType.WARNING);
|
||||
if (StringUtil.isNotEmpty(lombokVersion) && Version.isLessThan(lombokVersion, Version.LAST_LOMBOK_VERSION)) {
|
||||
return getNotificationGroup().createNotification(
|
||||
LombokBundle.message("config.warn.dependency.outdated.title"),
|
||||
LombokBundle.message("config.warn.dependency.outdated.message", project.getName(), lombokVersion, Version.LAST_LOMBOK_VERSION),
|
||||
NotificationType.WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}).expireWith(LombokPluginDisposable.getInstance(project))
|
||||
.coalesceBy(project, LombokProjectValidatorActivity.class)
|
||||
.finishOnUiThread(ModalityState.NON_MODAL, notification -> {
|
||||
if (notification != null) {
|
||||
notification.setListener(NotificationListener.URL_OPENING_LISTENER).notify(project);
|
||||
Disposer.register(LombokPluginDisposable.getInstance(project), notification::expire);
|
||||
}
|
||||
}).submit(AppExecutorUtil.getAppExecutorService());
|
||||
return null;
|
||||
}).expireWith(LombokPluginDisposable.getInstance(project))
|
||||
.coalesceBy(project, LombokProjectValidatorActivity.class)
|
||||
.finishOnUiThread(ModalityState.NON_MODAL, notification -> {
|
||||
if (notification != null) {
|
||||
notification.setListener(NotificationListener.URL_OPENING_LISTENER).notify(project);
|
||||
Disposer.register(LombokPluginDisposable.getInstance(project), notification::expire);
|
||||
}
|
||||
}).submit(AppExecutorUtil.getAppExecutorService());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user