Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@
*/
package org.httprpc.sierra.tools.previewer;

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you configure your editor so it doesn't reorder imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no problem, will do!

import org.fife.rsta.ui.search.FindDialog;
import org.fife.rsta.ui.search.ReplaceDialog;
import org.fife.rsta.ui.search.SearchEvent;
import org.fife.rsta.ui.search.SearchListener;
import org.fife.ui.autocomplete.AutoCompletion;
import org.fife.ui.autocomplete.CompletionProvider;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import org.httprpc.sierra.Outlet;
import org.httprpc.sierra.UILoader;
import org.httprpc.sierra.tools.previewer.engine.RenderingEngine;
import org.httprpc.sierra.tools.previewer.model.RenderError;
import org.httprpc.sierra.tools.previewer.model.RenderResult;

import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
Expand All @@ -38,7 +32,6 @@
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.KeyStroke;
import javax.swing.SwingWorker;
Expand All @@ -47,16 +40,22 @@
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import org.fife.rsta.ui.search.FindDialog;
import org.fife.rsta.ui.search.ReplaceDialog;
import org.fife.rsta.ui.search.SearchEvent;
import org.fife.rsta.ui.search.SearchListener;
import org.fife.ui.autocomplete.AutoCompletion;
import org.fife.ui.autocomplete.CompletionProvider;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.fife.ui.rtextarea.SearchEngine;
import org.fife.ui.rtextarea.SearchResult;
import org.httprpc.sierra.Outlet;
import org.httprpc.sierra.UILoader;
import org.httprpc.sierra.tools.previewer.engine.RenderingEngine;
import org.httprpc.sierra.tools.previewer.model.RenderError;
import org.httprpc.sierra.tools.previewer.model.RenderResult;

/**
* The main application window for the Sierra UI Previewer. UI is defined in
Expand Down Expand Up @@ -85,19 +84,21 @@ public class MainFrame extends JFrame implements SearchListener {
private @Outlet JMenuItem exitItem = null;
private @Outlet JMenuItem aboutItem = null;
private @Outlet JSplitPane splitPane = null;
private @Outlet JScrollPane editorScrollPane = null;
private @Outlet JPanel previewPanel = null;
private @Outlet JLabel statusBar = null;
private @Outlet JLabel filePathLabel = null; // The <label> for the file path
private @Outlet JLabel filePathLabel = null;


// --- Manually Created Components ---
private FindDialog findDialog = null;
private ReplaceDialog replaceDialog = null;
private RSyntaxTextArea editorPane = null;
private RTextScrollPane editorScrollPane = null;


public MainFrame() {
super("Sierra UI Previewer");

Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Trailing whitespace should be removed for consistency with the rest of the codebase.

Suggested change

Copilot uses AI. Check for mistakes.
renderingEngine = new RenderingEngine();
recentFilesManager = new RecentFilesManager(MainFrame.class);

Expand Down Expand Up @@ -245,7 +246,7 @@ private void setupCustomEditor() {
editorPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
editorPane.setCodeFoldingEnabled(true);
editorPane.setAntiAliasingEnabled(true);
editorPane.setEditable(true); // Ensure it's editable
editorPane.setEditable(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it editable by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep good catch, I'll remove


var provider = createCompletionProvider();

Expand All @@ -258,8 +259,11 @@ private void setupCustomEditor() {
if (provider != null) {
ac.install(editorPane);
}
editorScrollPane = new RTextScrollPane(editorPane);
editorScrollPane.setLineNumbersEnabled(true);
editorScrollPane.setFoldIndicatorEnabled(true);
splitPane.setLeftComponent(editorScrollPane);

editorScrollPane.setViewportView(editorPane);
}

// -- Extra search/replace functionality
Expand Down
Loading