Enhanced map variable viewer#127
Enhanced map variable viewer#127pacmano1 wants to merge 3 commits intoOpenIntegrationEngine:mainfrom pacmano1:main
Conversation
There was a problem hiding this comment.
Pull Request Overview
Enhance the map variable viewer to support JSON/XML formatting, exporting to disk, and improved search and UI capabilities.
- Replace the NetBeans-generated
.formUI with a programmatic RSyntaxTextArea dialog - Add JSON/XML formatting and export features via a new
ContentFormatter - Introduce a standalone search dialog and context‐menu enhancements
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| client/src/com/mirth/connect/client/ui/ViewContentDialog.java | Revamped UI, added formatting, export, search, and context menus |
| client/src/com/mirth/connect/client/ui/ViewContentDialog.form | Removed legacy NetBeans form file |
Comments suppressed due to low confidence (2)
client/src/com/mirth/connect/client/ui/ViewContentDialog.java:1
- The license header was removed at the top of this file. Please re-add the appropriate license block to comply with project guidelines.
package com.mirth.connect.client.ui;
client/src/com/mirth/connect/client/ui/ViewContentDialog.java:410
- The new
ContentFormatterclass lacks unit tests for JSON, XML, and binary detection branches. Please add test coverage to verify formatting and error cases.
class ContentFormatter {
| // @formatter:off | ||
| package com.mirth.connect.client.ui; | ||
|
|
||
| import java.awt.*; |
There was a problem hiding this comment.
Avoid wildcard imports; explicitly import only the AWT classes you need to improve readability and prevent namespace clashes.
| import java.awt.*; | |
| import java.awt.Frame; | |
| import java.awt.event.ActionEvent; | |
| import java.awt.event.ActionListener; | |
| import java.awt.event.KeyEvent; | |
| import java.awt.event.KeyListener; | |
| import java.awt.BorderLayout; | |
| import java.awt.Dimension; | |
| import java.awt.GridBagConstraints; | |
| import java.awt.GridBagLayout; | |
| import java.awt.Insets; | |
| import java.awt.Point; | |
| import java.awt.Toolkit; |
| package com.mirth.connect.client.ui; | ||
|
|
||
| import java.awt.*; | ||
| import java.awt.event.*; |
There was a problem hiding this comment.
Avoid wildcard imports; explicitly import only the event classes you need.
| import java.awt.event.*; | |
| import java.awt.event.ActionEvent; | |
| import java.awt.event.ActionListener; | |
| import java.awt.event.KeyEvent; | |
| import java.awt.event.KeyListener; |
| createContentArea(); | ||
|
|
||
| // Create button panel (now includes all buttons) | ||
| createButtonPanel(); |
There was a problem hiding this comment.
This call to createButtonPanel() appears unused (its result isn’t assigned or added). Remove the redundant invocation to avoid confusion.
| createButtonPanel(); |
| searchDialog.setVisible(true); | ||
| } | ||
|
|
||
| private void formatContent() { |
There was a problem hiding this comment.
The formatting logic (JSON/XML parsing) runs on the EDT and may block the UI for large inputs. Consider moving it to a background thread or SwingWorker.
| isFormatted = true; | ||
| currentFormat = result.getFormatType(); | ||
| } else { | ||
| showWarning("Could not format content. Format not recognized or content is invalid."); |
There was a problem hiding this comment.
This generic warning hides the underlying error. Use the formatter’s getErrorMessage() to display a more informative message.
| showWarning("Could not format content. Format not recognized or content is invalid."); | |
| String errorMessage = result.getErrorMessage(); | |
| if (errorMessage == null || errorMessage.trim().isEmpty()) { | |
| errorMessage = "Could not format content. Format not recognized or content is invalid."; | |
| } | |
| showWarning(errorMessage); |
Enhance the map variable viewer to support JSON/XML formatting, export to disk, etc.