Skip to content

Conversation

@pacmano1
Copy link
Contributor

Enhance the map variable viewer to support JSON/XML formatting, export to disk, etc.

image

@pacmano1 pacmano1 requested a review from Copilot June 28, 2025 16:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .form UI 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 ContentFormatter class 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.*;
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid wildcard imports; explicitly import only the AWT classes you need to improve readability and prevent namespace clashes.

Suggested change
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;

Copilot uses AI. Check for mistakes.
package com.mirth.connect.client.ui;

import java.awt.*;
import java.awt.event.*;
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid wildcard imports; explicitly import only the event classes you need.

Suggested change
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

Copilot uses AI. Check for mistakes.
createContentArea();

// Create button panel (now includes all buttons)
createButtonPanel();
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call to createButtonPanel() appears unused (its result isn’t assigned or added). Remove the redundant invocation to avoid confusion.

Suggested change
createButtonPanel();

Copilot uses AI. Check for mistakes.
searchDialog.setVisible(true);
}

private void formatContent() {
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
isFormatted = true;
currentFormat = result.getFormatType();
} else {
showWarning("Could not format content. Format not recognized or content is invalid.");
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generic warning hides the underlying error. Use the formatter’s getErrorMessage() to display a more informative message.

Suggested change
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);

Copilot uses AI. Check for mistakes.
@pacmano1 pacmano1 closed this Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant