changed file editor/viewer behaviour
This commit is contained in:
parent
686e3ac121
commit
1c7e5d3e64
@ -15,7 +15,7 @@ import java.nio.file.Files;
|
||||
/**
|
||||
* Internal file editor/viewer
|
||||
*/
|
||||
public class FileEditor extends JDialog {
|
||||
public class FileEditor extends JFrame {
|
||||
private JTextArea textArea;
|
||||
private JScrollPane scrollPane;
|
||||
private File file;
|
||||
@ -61,12 +61,16 @@ public class FileEditor extends JDialog {
|
||||
}
|
||||
|
||||
public FileEditor(Window parent, File file, String virtualPath, AppConfig config, boolean readOnly) {
|
||||
super(parent, (readOnly ? "Viewer - " : "Editor - ") + (virtualPath != null ? virtualPath.substring(virtualPath.lastIndexOf(File.separator) + 1) : file.getName()), ModalityType.MODELESS);
|
||||
super((readOnly ? "Viewer - " : "Editor - ") + (virtualPath != null ? virtualPath.substring(virtualPath.lastIndexOf(File.separator) + 1) : file.getName()));
|
||||
this.file = file;
|
||||
this.virtualPath = virtualPath;
|
||||
this.config = config;
|
||||
this.readOnly = readOnly;
|
||||
|
||||
// Set window properties for non-modal window
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
setLocationRelativeTo(parent);
|
||||
|
||||
if (isImageFile(file) && virtualPath == null) {
|
||||
initImageList();
|
||||
}
|
||||
@ -85,7 +89,6 @@ public class FileEditor extends JDialog {
|
||||
}
|
||||
|
||||
// Intercept window close (X) so we run the same save-confirm flow as other close actions
|
||||
setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user