mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow to change settings of a notification programmatically
This commit is contained in:
@@ -19,6 +19,8 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class NotificationsConfiguration implements Notifications {
|
||||
public abstract void changeSettings(String groupDisplayName, NotificationDisplayType displayType, boolean shouldLog);
|
||||
|
||||
public static NotificationsConfiguration getNotificationsConfiguration() {
|
||||
return ApplicationManager.getApplication().getComponent(NotificationsConfiguration.class);
|
||||
}
|
||||
|
||||
+6
-1
@@ -139,7 +139,7 @@ public class NotificationsConfigurationImpl extends NotificationsConfiguration i
|
||||
@NotNull NotificationDisplayType displayType,
|
||||
boolean shouldLog) {
|
||||
if (!isRegistered(groupDisplayName)) {
|
||||
myIdToSettingsMap.put(groupDisplayName, new NotificationSettings(groupDisplayName, displayType, shouldLog));
|
||||
changeSettings(groupDisplayName, displayType, shouldLog);
|
||||
} else if (displayType == NotificationDisplayType.TOOL_WINDOW && !hasToolWindowCapability(groupDisplayName)) {
|
||||
// the first time with tool window capability
|
||||
ObjectUtils.assertNotNull(_getSettings(groupDisplayName)).setDisplayType(NotificationDisplayType.TOOL_WINDOW);
|
||||
@@ -147,6 +147,11 @@ public class NotificationsConfigurationImpl extends NotificationsConfiguration i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSettings(String groupDisplayName, NotificationDisplayType displayType, boolean shouldLog) {
|
||||
myIdToSettingsMap.put(groupDisplayName, new NotificationSettings(groupDisplayName, displayType, shouldLog));
|
||||
}
|
||||
|
||||
public synchronized boolean isRegistered(@NotNull final String id) {
|
||||
return myIdToSettingsMap.containsKey(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user