Skip to content

Commit

Permalink
chore: avoid usage of deprecated API
Browse files Browse the repository at this point in the history
  • Loading branch information
jansorg authored and ahtrotta committed Nov 15, 2023
1 parent c8a5ddd commit cb4b74b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.impl.NotificationFullContent;
import com.intellij.openapi.util.NlsContexts;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -15,7 +14,19 @@
* Notification, which implements {@link NotificationFullContent} to show all of its content.
*/
class AppMapFullContentNotification extends Notification implements NotificationFullContent {
public AppMapFullContentNotification(@NotNull @NonNls String groupId, @Nullable Icon icon, @Nullable @NlsContexts.NotificationTitle String title, @Nullable @NlsContexts.NotificationSubtitle String subtitle, @Nullable @NlsContexts.NotificationContent String content, @NotNull NotificationType type, @Nullable NotificationListener listener) {
super(groupId, icon, title, subtitle, content, type, listener);
public AppMapFullContentNotification(@NotNull @NonNls String groupId,
@Nullable Icon icon,
@Nullable String title,
@Nullable String subtitle,
@NotNull String content,
@NotNull NotificationType type,
@Nullable NotificationListener listener) {
super(groupId, content, type);
setTitle(title);
setSubtitle(subtitle);
setIcon(icon);
if (listener != null) {
setListener(listener);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
import appland.installGuide.InstallGuideEditorProvider;
import appland.installGuide.InstallGuideViewPage;
import appland.startup.FirstAppMapLaunchStartupActivity;
import appland.toolwindow.AppMapToolWindowFactory;
import appland.webviews.findings.FindingsOverviewEditorProvider;
import com.intellij.ide.BrowserUtil;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationAction;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ui.EdtInvocationManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.function.Consumer;

import static appland.AppMapBundle.lazy;
Expand All @@ -40,7 +36,7 @@ public static void showExpiringRecordingNotification(@NotNull Project project,

ApplicationManager.getApplication().invokeLater(() -> {
// cast to Icon to avoid an ambiguity with 2021.2
var notification = new Notification(REMOTE_RECORDING_ID, (Icon) null, type);
var notification = new Notification(REMOTE_RECORDING_ID, "", type);
if (title != null) {
notification.setTitle(title);
}
Expand Down
6 changes: 4 additions & 2 deletions plugin-core/src/main/java/appland/upload/AppMapUploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import appland.AppMapBundle;
import appland.Icons;
import appland.settings.AppMapProjectSettingsService;
import com.google.common.html.HtmlEscapers;
import com.google.gson.GsonBuilder;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
Expand All @@ -19,7 +20,6 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Urls;
import com.intellij.util.io.HttpRequests;
import org.apache.commons.lang.StringEscapeUtils;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
Expand Down Expand Up @@ -102,7 +102,9 @@ public void run(@NotNull ProgressIndicator indicator) {
LOG.warn("Uploading AppMap failed", e);
ApplicationManager.getApplication().invokeLater(() -> {
Messages.showErrorDialog(project,
AppMapBundle.get("upload.uploadFailed.message", file.getName(), StringEscapeUtils.escapeHtml(e.getMessage())),
AppMapBundle.get("upload.uploadFailed.message",
file.getName(),
HtmlEscapers.htmlEscaper().escape(e.getMessage())),
AppMapBundle.get("upload.uploadFailed.title"));
});
}
Expand Down

0 comments on commit cb4b74b

Please sign in to comment.