mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
deprecate NotificationsAdapter
GitOrigin-RevId: a79ddbd44ed4232f2112134ac9691e406ddb089d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4033060e2b
commit
46a27bfb5f
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.notification;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
@@ -25,19 +11,25 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
*/
|
||||
public interface Notifications {
|
||||
Topic<Notifications> TOPIC = Topic.create("Notifications", Notifications.class, Topic.BroadcastDirection.NONE);
|
||||
|
||||
String SYSTEM_MESSAGES_GROUP_ID = "System Messages";
|
||||
|
||||
void notify(@NotNull Notification notification);
|
||||
default void notify(@NotNull Notification notification) {
|
||||
}
|
||||
|
||||
void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType);
|
||||
void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType, boolean shouldLog);
|
||||
void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType, boolean shouldLog, boolean shouldReadAloud);
|
||||
default void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType) {
|
||||
}
|
||||
|
||||
default void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType, boolean shouldLog) {
|
||||
}
|
||||
|
||||
default void register(@NotNull String groupDisplayName,
|
||||
@NotNull NotificationDisplayType defaultDisplayType,
|
||||
boolean shouldLog,
|
||||
boolean shouldReadAloud) {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UtilityClassWithoutPrivateConstructor"})
|
||||
class Bus {
|
||||
|
||||
@@ -1,41 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.notification;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Notifications} directly
|
||||
*/
|
||||
@Deprecated
|
||||
public class NotificationsAdapter implements Notifications {
|
||||
@Override
|
||||
public void notify(@NotNull Notification notification) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@NotNull String groupDisplayName, @NotNull NotificationDisplayType defaultDisplayType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@NotNull String groupDisplayName,
|
||||
@NotNull NotificationDisplayType defaultDisplayType,
|
||||
boolean shouldLog) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@NotNull String groupDisplayName,
|
||||
@NotNull NotificationDisplayType defaultDisplayType,
|
||||
boolean shouldLog,
|
||||
boolean shouldReadAloud) {
|
||||
}
|
||||
}
|
||||
|
||||
+2
-16
@@ -1,23 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.notification;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
|
||||
public abstract class NotificationsConfiguration extends NotificationsAdapter {
|
||||
public abstract class NotificationsConfiguration implements Notifications {
|
||||
/**
|
||||
* If notification group ID starts with this prefix it wouldn't be shown in Preferences
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.notification;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EventLog {
|
||||
private final LogModel myModel = new LogModel(null, ApplicationManager.getApplication());
|
||||
|
||||
public EventLog() {
|
||||
ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new NotificationsAdapter() {
|
||||
ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new Notifications() {
|
||||
@Override
|
||||
public void notify(@NotNull Notification notification) {
|
||||
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
@@ -468,7 +468,7 @@ public class EventLog {
|
||||
printNotification(notification);
|
||||
}
|
||||
|
||||
project.getMessageBus().connect(project).subscribe(Notifications.TOPIC, new NotificationsAdapter() {
|
||||
project.getMessageBus().connect(project).subscribe(Notifications.TOPIC, new Notifications() {
|
||||
@Override
|
||||
public void notify(@NotNull Notification notification) {
|
||||
printNotification(notification);
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.notification.impl;
|
||||
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.notification.NotificationsAdapter;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -18,7 +17,7 @@ import java.util.concurrent.Executor;
|
||||
class MacEventReader {
|
||||
private static final int MAX_MESSAGE_LENGTH = 100;
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.notification.impl.MacEventReader");
|
||||
private static final NotificationsAdapter ourNotificationAdapter = new NotificationsAdapter() {
|
||||
private static final Notifications ourNotificationAdapter = new Notifications() {
|
||||
@Override
|
||||
public void notify(@NotNull Notification notification) {
|
||||
process(notification);
|
||||
|
||||
+3
-6
@@ -70,10 +70,7 @@ import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
*/
|
||||
public class NotificationsManagerImpl extends NotificationsManager {
|
||||
public final class NotificationsManagerImpl extends NotificationsManager {
|
||||
public static final Color DEFAULT_TEXT_COLOR = new JBColor(Gray._0, Gray._191);
|
||||
private static final Color TEXT_COLOR = JBColor.namedColor("Notification.foreground", DEFAULT_TEXT_COLOR);
|
||||
public static final Color FILL_COLOR = JBColor.namedColor("Notification.background", new JBColor(Gray._242, new Color(78, 80, 82)));
|
||||
@@ -1038,14 +1035,14 @@ public class NotificationsManagerImpl extends NotificationsManager {
|
||||
}
|
||||
}
|
||||
|
||||
private static void showPopup(@NotNull LinkLabel link, @NotNull DefaultActionGroup group) {
|
||||
private static void showPopup(@NotNull LinkLabel<?> link, @NotNull DefaultActionGroup group) {
|
||||
if (link.isShowing()) {
|
||||
ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
|
||||
menu.getComponent().show(link, JBUIScale.scale(-10), link.getHeight() + JBUIScale.scale(2));
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyNotificationListener extends NotificationsAdapter {
|
||||
private static class MyNotificationListener implements Notifications {
|
||||
private final Project myProject;
|
||||
|
||||
private MyNotificationListener(@Nullable Project project) {
|
||||
|
||||
@@ -4,7 +4,6 @@ package org.jetbrains.settingsRepository
|
||||
import com.intellij.configurationStore.ComponentStoreImpl
|
||||
import com.intellij.notification.Notification
|
||||
import com.intellij.notification.Notifications
|
||||
import com.intellij.notification.NotificationsAdapter
|
||||
import com.intellij.openapi.application.AppUIExecutor
|
||||
import com.intellij.openapi.application.Application
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
@@ -48,7 +47,7 @@ internal class AutoSyncManager(private val icsManager: IcsManager) {
|
||||
}
|
||||
|
||||
fun registerListeners(project: Project) {
|
||||
project.messageBus.connect().subscribe(Notifications.TOPIC, object : NotificationsAdapter() {
|
||||
project.messageBus.connect().subscribe(Notifications.TOPIC, object : Notifications {
|
||||
override fun notify(notification: Notification) {
|
||||
if (!icsManager.isActive) {
|
||||
return
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.intellij.tasks;
|
||||
import com.intellij.configurationStore.XmlSerializer;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.notification.NotificationsAdapter;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.util.PasswordUtil;
|
||||
@@ -43,7 +42,7 @@ public class TaskManagerTest extends TaskManagerTestCase {
|
||||
|
||||
public void testNotifications() {
|
||||
final Ref<Notification> notificationRef = new Ref<>();
|
||||
getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(Notifications.TOPIC, new NotificationsAdapter() {
|
||||
getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(Notifications.TOPIC, new Notifications() {
|
||||
@Override
|
||||
public void notify(@NotNull Notification notification) {
|
||||
notificationRef.set(notification);
|
||||
|
||||
Reference in New Issue
Block a user