i18n and normalize names for notification groups in Java plugin (IDEA-256552)

GitOrigin-RevId: 13f4bce1a4753d5575fe1404115832c0abb5602c
This commit is contained in:
Dmitry Jemerov
2022-01-09 14:50:21 +01:00
committed by intellij-monorepo-bot
parent f5b9cb1969
commit 398a58faea
12 changed files with 49 additions and 34 deletions

View File

@@ -320,7 +320,7 @@ element.with.manifest.button.use.existing.manifest=&Use Existing Manifest...
element.with.manifest.label.meta.inf.manifest.mf.file.not.found=META-INF/MANIFEST.MF file not found
element.with.manifest.label.manifest.file=Manifest &File:
notification.group.title.jps.cannot.start.compiler=Cannot start compilation
notification.group.title.jps.cannot.start.compiler=Build failed to start
notification.action.jps.open.configuration.dialog=Configure...
notification.title.jps.cannot.start.compiler=Cannot start compiler
notification.title.cpu.snapshot.build.has.been.captured=Build CPU snapshot has been captured

View File

@@ -645,3 +645,4 @@ label.select.project.type.to.configure=Select project type to configure
language.level.combo.lts.versions=LTS Versions
language.level.combo.other.versions=Other Versions
project.or.module.jdk.misconfigured={0, choice, 0#Project|1#Module} JDK is misconfigured
notification.group.build.script.found=Build script found

View File

@@ -37,7 +37,7 @@ import com.intellij.util.SystemProperties
import java.io.File
import javax.swing.event.HyperlinkEvent
private val NOTIFICATION_GROUP = NotificationGroup("Build Script Found", NotificationDisplayType.STICKY_BALLOON, true)
private val NOTIFICATION_GROUP = NotificationGroupManager.getInstance().getNotificationGroup("Build Script Found")
private val SETUP_JAVA_PROJECT_IS_DISABLED = SystemProperties.getBooleanProperty("idea.java.project.setup.disabled", false)
private const val SCAN_DEPTH_LIMIT = 5

View File

@@ -6,9 +6,7 @@ import com.intellij.core.JavaPsiBundle;
import com.intellij.execution.process.ProcessIOExecutorService;
import com.intellij.ide.JavaUiBundle;
import com.intellij.jarRepository.services.MavenRepositoryServicesManager;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.notification.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.PathMacroManager;
@@ -88,6 +86,8 @@ public final class JarRepositoryManager {
ProcessIOExecutorService.INSTANCE);
}
public static NotificationGroup GROUP = NotificationGroupManager.getInstance().getNotificationGroup("Repository");
public static boolean hasRunningTasks() {
return ourTasksInProgress.get() > 0; // todo: count tasks on per-project basis?
}
@@ -341,7 +341,7 @@ public final class JarRepositoryManager {
sb.append(root.getFile().getName());
}
@NlsSafe final String content = sb.toString();
Notifications.Bus.notify(new Notification("Repository", title, content, NotificationType.INFORMATION), project);
Notifications.Bus.notify(GROUP.createNotification(title, content, NotificationType.INFORMATION), project);
}
public static void searchArtifacts(Project project,

View File

@@ -108,8 +108,8 @@ public class RepositoryLibrarySynchronizer implements StartupActivity.DumbAware
String libraryText = validLibraries.size() == 1
? "'" + validLibraries.iterator().next().getPresentableName() + "' library"
: validLibraries.size() + " libraries";
Notifications.Bus.notify(new Notification(
"Repository", JavaUiBundle.message("notification.title.repository.libraries.cleanup"),
Notifications.Bus.notify(JarRepositoryManager.GROUP.createNotification(
JavaUiBundle.message("notification.title.repository.libraries.cleanup"),
JavaUiBundle.message("notification.text.duplicated.urls.were.removed", libraryText, ApplicationNamesInfo.getInstance().getFullProductName()),
NotificationType.INFORMATION
), project);

View File

@@ -2,8 +2,8 @@
package com.intellij.jarRepository.settings
import com.intellij.ide.JavaUiBundle
import com.intellij.jarRepository.JarRepositoryManager
import com.intellij.jarRepository.RepositoryLibrarySynchronizer
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.notification.Notifications
import com.intellij.openapi.project.Project
@@ -20,10 +20,10 @@ fun reloadAllRepositoryLibraries(project: Project) {
.map { RepositoryUtils.reloadDependencies(project, it) }
.collectResults()
.onSuccess {
Notifications.Bus.notify(Notification("Repository",
JavaUiBundle.message("notification.title.repository.library.synchronization"),
JavaUiBundle.message("notification.content.libraries.reloaded", it.size),
NotificationType.INFORMATION), project)
Notifications.Bus.notify(JarRepositoryManager.GROUP.createNotification(
JavaUiBundle.message("notification.title.repository.library.synchronization"),
JavaUiBundle.message("notification.content.libraries.reloaded", it.size),
NotificationType.INFORMATION), project)
}
}

View File

@@ -2,8 +2,7 @@
package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.ide.JavaUiBundle;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationGroupManager;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -89,7 +88,7 @@ public final class JavadocQuarantineStatusCleaner {
LOG.warn(error);
String title = JavaUiBundle.message("quarantine.cleaner");
String message = JavaUiBundle.message("quarantine.error.message", error.getMessage());
new Notification(NotificationGroup.createIdWithTitle("Quarantine Cleaner", title), title, message, NotificationType.WARNING)
NotificationGroupManager.getInstance().getNotificationGroup("Quarantine Cleaner").createNotification(title, message, NotificationType.WARNING)
.notify(null);
}
}.queue();

View File

@@ -98,9 +98,11 @@ public final class RepositoryUtils {
roots == null || roots.isEmpty() ?
() -> {
String message = JavaUiBundle.message("notification.content.no.files.were.downloaded", properties.getMavenId());
Notifications.Bus.notify(new Notification("Repository", JavaUiBundle.message(
"notification.title.repository.library.synchronization"),
message, NotificationType.ERROR), project);
Notifications.Bus.notify(
JarRepositoryManager.GROUP.createNotification(
JavaUiBundle.message("notification.title.repository.library.synchronization"),
message, NotificationType.ERROR),
project);
promise.setError(message);
} :
() -> {

View File

@@ -283,7 +283,9 @@
key="notification.group.title.jps.cannot.start.compiler" />
<notificationGroup id="JDK resolve problems"
toolWindowId="Build"
displayType="BALLOON" />
displayType="BALLOON"
bundle="messages.JavaBundle"
key="notification.group.jdk.resolve.problems"/>
<registryKey key="ide.jps.use.build.tool.window" defaultValue="true" description="Enables 'Build' toolwindow for JPS compilation messages"/>
<applicationService serviceImplementation="com.intellij.compiler.server.BuildManager" preload="true"/>
@@ -2206,17 +2208,17 @@
<notificationGroup id="Clean artifact" displayType="BALLOON" hideFromSettings="true"/>
<notificationGroup id="Compiler" displayType="NONE" bundle="messages.JavaCompilerBundle" key="notification.group.compiler"/>
<notificationGroup id="Build Profiler" displayType="STICKY_BALLOON" hideFromSettings="true"/>
<notificationGroup id="Analyze thread dump" displayType="TOOL_WINDOW" toolWindowId="Run" isLogByDefault="false"/>
<notificationGroup id="JSHELL_NOTIFICATIONS" displayType="BALLOON"/>
<notificationGroup id="Repository" displayType="BALLOON"/>
<notificationGroup id="Analyze thread dump" displayType="TOOL_WINDOW" toolWindowId="Run" isLogByDefault="false" hideFromSettings="true"/>
<notificationGroup id="JSHELL_NOTIFICATIONS" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.jshell"/>
<notificationGroup id="Repository" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.repository"/>
<notificationGroup id="HotSwap" displayType="TOOL_WINDOW" toolWindowId="Debug" bundle="messages.JavaDebuggerBundle" key="notification.group.hotswap"/>
<notificationGroup id="Source searcher" displayType="BALLOON"/>
<notificationGroup id="Accepted language levels" displayType="STICKY_BALLOON"/>
<notificationGroup id="Quarantine Cleaner" displayType="BALLOON" bundle="messages.JavaUiBundle" key="quarantine.cleaner"/>
<notificationGroup id="Build Script Found" displayType="STICKY_BALLOON"/>
<notificationGroup id="Java Preview Features" displayType="BALLOON"/>
<notificationGroup id="Remove redundant exports/opens" displayType="BALLOON"/>
<notificationGroup id="Setup SDK" displayType="BALLOON"/>
<notificationGroup id="Source searcher" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.source.searcher"/>
<notificationGroup id="Accepted language levels" displayType="STICKY_BALLOON" bundle="messages.JavaBundle" key="notification.group.language.level"/>
<notificationGroup id="Quarantine Cleaner" displayType="BALLOON" hideFromSettings="true"/>
<notificationGroup id="Build Script Found" displayType="STICKY_BALLOON" bundle="messages.JavaUiBundle" key="notification.group.build.script.found"/>
<notificationGroup id="Java Preview Features" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.preview.features"/>
<notificationGroup id="Remove redundant exports/opens" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.redundant.exports"/>
<notificationGroup id="Setup SDK" displayType="BALLOON" bundle="messages.JavaBundle" key="notification.group.setup.sdk"/>
<compiler.task implementation="com.intellij.execution.scratch.JavaScratchCompilationSupport"/>
<registryKey key="load.maven.dependencies.timeout" defaultValue="120" description="How long (in minutes) idea will wait for results of synchronized maven dependencies resolution"/>

View File

@@ -45,10 +45,12 @@ import java.util.TreeSet;
)
public class AcceptedLanguageLevelsSettings implements PersistentStateComponent<AcceptedLanguageLevelsSettings>, StartupActivity {
private static final NotificationGroup NOTIFICATION_GROUP =
new NotificationGroup("Accepted language levels", NotificationDisplayType.STICKY_BALLOON, true);
NotificationGroupManager.getInstance().getNotificationGroup("Accepted language levels");
private static final NotificationGroup PREVIEW_NOTIFICATION_GROUP = NotificationGroup.balloonGroup("Java Preview Features");
private static final String IGNORE_USED_PREVIEW_FEATURES = "ignore.preview.features.used";
private static final NotificationGroup PREVIEW_NOTIFICATION_GROUP =
NotificationGroupManager.getInstance().getNotificationGroup("Java Preview Features");
private static final String IGNORE_USED_PREVIEW_FEATURES = "ignore.preview.features.used";
@XCollection(propertyElementName = "explicitly-accepted", elementName = "name", valueAttributeName = "")
public List<String> acceptedNames = new ArrayList<>();

View File

@@ -10,6 +10,7 @@ import com.intellij.ide.ExporterToTextFile;
import com.intellij.ide.ui.UISettings;
import com.intellij.java.JavaBundle;
import com.intellij.notification.NotificationGroup;
import com.intellij.notification.NotificationGroupManager;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColors;
@@ -331,7 +332,7 @@ public final class ThreadDumpPanel extends JPanel implements DataProvider {
}
}
private static final class CopyToClipboardAction extends DumbAwareAction {
private static final NotificationGroup GROUP = NotificationGroup.toolWindowGroup("Analyze thread dump", ToolWindowId.RUN, false);
private static final NotificationGroup GROUP = NotificationGroupManager.getInstance().getNotificationGroup("Analyze thread dump");
private final List<? extends ThreadState> myThreadDump;
private final Project myProject;

View File

@@ -1707,3 +1707,11 @@ dialog.title.move.directory=Move Directory
progress.title.checking.if.class.exists=Check target class ''{0}'' exists
quickfix.find.cause.description=Attempts to highlight code elements that resulted in this warning and explain how exactly they contribute.
completion.generate.via.wizard=(generate via wizard)
notification.group.jdk.resolve.problems=Failed to resolve JDK
notification.group.jshell=JShell problem occurred
notification.group.repository=JAR files synchronized with repository
notification.group.source.searcher=Failed to find sources for JAR file
notification.group.language.level=Preview Java language level requires accepting license
notification.group.preview.features=Preview Java language level may be discontinued
notification.group.redundant.exports=Redundant exports/opens can be removed
notification.group.setup.sdk=JDK configured