Skip to content

Commit caa8b1b

Browse files
committed
feat: replace JOptionPane error dialogs with NotificationUtil for error handling
1 parent df959c3 commit caa8b1b

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

src/main/java/com/laker/postman/panel/collections/left/LeftTopPanel.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ private void importCurlToCollection(String defaultCurl) {
248248
try {
249249
CurlRequest curlRequest = CurlParser.parse(curlText);
250250
if (curlRequest.url == null) {
251-
JOptionPane.showMessageDialog(mainFrame,
252-
I18nUtil.getMessage(MessageKeys.COLLECTIONS_IMPORT_CURL_PARSE_FAIL),
253-
I18nUtil.getMessage(MessageKeys.GENERAL_ERROR), JOptionPane.ERROR_MESSAGE);
251+
NotificationUtil.showError(I18nUtil.getMessage(MessageKeys.COLLECTIONS_IMPORT_CURL_PARSE_FAIL));
254252
return;
255253
}
256254
// 构造HttpRequestItem
@@ -310,9 +308,7 @@ private void importCurlToCollection(String defaultCurl) {
310308
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(""), null);
311309
}
312310
} catch (Exception ex) {
313-
JOptionPane.showMessageDialog(mainFrame,
314-
I18nUtil.getMessage(MessageKeys.COLLECTIONS_IMPORT_CURL_PARSE_ERROR, ex.getMessage()),
315-
I18nUtil.getMessage(MessageKeys.GENERAL_ERROR), JOptionPane.ERROR_MESSAGE);
311+
NotificationUtil.showError(I18nUtil.getMessage(MessageKeys.COLLECTIONS_IMPORT_CURL_PARSE_ERROR, ex.getMessage()));
316312
}
317313
}
318314

src/main/java/com/laker/postman/panel/collections/right/RequestEditPanel.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.laker.postman.service.http.HttpUtil;
1717
import com.laker.postman.util.I18nUtil;
1818
import com.laker.postman.util.MessageKeys;
19+
import com.laker.postman.util.NotificationUtil;
1920
import jiconfont.icons.font_awesome.FontAwesome;
2021
import jiconfont.swing.IconFontSwing;
2122
import lombok.Getter;
@@ -586,9 +587,7 @@ public void mousePressed(MouseEvent e) {
586587
return;
587588
}
588589
} catch (Exception ex) {
589-
JOptionPane.showMessageDialog(SingletonFactory.getInstance(RequestEditPanel.class),
590-
I18nUtil.getMessage(MessageKeys.PARSE_CURL_ERROR, ex.getMessage()),
591-
I18nUtil.getMessage(MessageKeys.ERROR), JOptionPane.ERROR_MESSAGE);
590+
NotificationUtil.showError(I18nUtil.getMessage(MessageKeys.PARSE_CURL_ERROR, ex.getMessage()));
592591
}
593592
}
594593
}

0 commit comments

Comments
 (0)