mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-12 22:08:07 +00:00
Set parent component for Save/Open file dialogs
This commit is contained in:
@@ -291,9 +291,7 @@ public class AdvancedSettingsDialog extends AppDialog {
|
||||
fc.setFileFilter(allSupportedFilter);
|
||||
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
int returnVal = fc.showOpenDialog(Main.getDefaultMessagesComponent());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
return Helper.fixDialogFile(fc.getSelectedFile()).getAbsolutePath();
|
||||
} else {
|
||||
|
||||
@@ -390,9 +390,7 @@ public class FontEmbedDialog extends AppDialog {
|
||||
};
|
||||
fc.setFileFilter(ttfFilter);
|
||||
fc.setAcceptAllFileFilterUsed(true);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
|
||||
@@ -751,9 +751,7 @@ public class FontPanel extends JPanel {
|
||||
fc.setFileFilter(ttfFilter);
|
||||
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame fr = new JFrame();
|
||||
View.setWindowIcon(fr);
|
||||
int returnVal = fc.showOpenDialog(fr);
|
||||
int returnVal = fc.showOpenDialog(Main.getDefaultMessagesComponent());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
|
||||
@@ -262,9 +262,7 @@ public class LoadFromCacheFrame extends AppFrame {
|
||||
});
|
||||
}
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(LoadFromCacheFrame.this) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try {
|
||||
if (selected.size() == 1) {
|
||||
|
||||
@@ -398,9 +398,7 @@ public class LoadFromMemoryFrame extends AppFrame {
|
||||
});
|
||||
}
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(LoadFromMemoryFrame.this) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try {
|
||||
if (selected.length == 1) {
|
||||
|
||||
@@ -914,9 +914,7 @@ public class Main {
|
||||
};
|
||||
fc.addChoosableFileFilter(gfxFilter);
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
int returnVal = fc.showOpenDialog(getDefaultMessagesComponent());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File selFile = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
@@ -1534,9 +1532,7 @@ public class Main {
|
||||
}
|
||||
final String extension = ext;
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(getDefaultMessagesComponent()) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
FileFilter selFilter = fc.getFileFilter();
|
||||
try {
|
||||
@@ -1706,9 +1702,7 @@ public class Main {
|
||||
fc.addChoosableFileFilter(binaryFilter);
|
||||
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
int returnVal = fc.showOpenDialog(getDefaultMessagesComponent());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File[] selFiles = fc.getSelectedFiles();
|
||||
|
||||
@@ -2349,9 +2349,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File sf = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
|
||||
@@ -3267,9 +3265,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
first = false;
|
||||
}
|
||||
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
File result = fc.getSelectedFile();
|
||||
Configuration.lastOpenDir.set(Helper.fixDialogFile(result).getParentFile().getAbsolutePath());
|
||||
return result;
|
||||
|
||||
@@ -395,9 +395,7 @@ public class DumpTree extends JTree {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
String selDir = Configuration.lastOpenDir.get();
|
||||
fc.setCurrentDirectory(new File(selDir));
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
File sf = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(sf))) {
|
||||
byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData;
|
||||
|
||||
@@ -414,9 +414,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
|
||||
};
|
||||
fc.setFileFilter(swfFilter);
|
||||
fc.setAcceptAllFileFilterUsed(true);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try {
|
||||
Files.copy(new File(r.targetFile).toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
@@ -485,15 +483,13 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
|
||||
};
|
||||
fc.setFileFilter(swfFilter);
|
||||
fc.setAcceptAllFileFilterUsed(true);
|
||||
JFrame f = new JFrame();
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showOpenDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try {
|
||||
Files.copy(file.toPath(), new File(r.targetFile).toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
tableModel.fireTableCellUpdated(sel[0], 1/*size*/);
|
||||
} catch (IOException ex) {
|
||||
ViewMessages.showMessageDialog(f, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
ViewMessages.showMessageDialog(this, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user