Fixed: #1670 Parent component/window of dialogs not properly set

This commit is contained in:
Jindra Petřík
2021-03-27 09:11:00 +01:00
parent b5aee8412b
commit a7989d2d02
45 changed files with 351 additions and 253 deletions

View File

@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- [#1660] Empty thumbnail view on remove item
- [#1669] FILLSTYLE color handling in DefineShape3/4
- [#1668] Not removing SymbolClass/ExportAssets entry on character remove
- [#1670] Parent component/window of dialogs not properly set
## [14.3.1] - 2021-03-25
### Fixed
@@ -2166,6 +2167,7 @@ All notable changes to this project will be documented in this file.
[#1660]: https://www.free-decompiler.com/flash/issues/1660
[#1669]: https://www.free-decompiler.com/flash/issues/1669
[#1668]: https://www.free-decompiler.com/flash/issues/1668
[#1670]: https://www.free-decompiler.com/flash/issues/1670
[#1665]: https://www.free-decompiler.com/flash/issues/1665
[#1661]: https://www.free-decompiler.com/flash/issues/1661
[#1435]: https://www.free-decompiler.com/flash/issues/1435

View File

@@ -22,6 +22,7 @@ import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
@@ -50,7 +51,8 @@ public class AboutDialog extends AppDialog {
private static final String AUTHOR = "JPEXS";
public AboutDialog() {
public AboutDialog(Window owner) {
super(owner);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle(translate("dialog.title"));

View File

@@ -33,6 +33,7 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.io.File;
import java.lang.reflect.Field;
@@ -91,7 +92,8 @@ public class AdvancedSettingsDialog extends AppDialog {
private JButton resetButton;
public AdvancedSettingsDialog(String selectedCategory) {
public AdvancedSettingsDialog(Window owner, String selectedCategory) {
super(owner);
initComponents(selectedCategory);
View.centerScreen(this);
View.setWindowIcon(this);
@@ -491,7 +493,7 @@ public class AdvancedSettingsDialog extends AppDialog {
}
private void showRestartConfirmDialog() {
if (View.showConfirmDialog(this, translate("advancedSettings.restartConfirmation"), AppStrings.translate("message.warning"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
if (ViewMessages.showConfirmDialog(this, translate("advancedSettings.restartConfirmation"), AppStrings.translate("message.warning"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
try {
// todo: honfika: why?
Thread.sleep(1000);

View File

@@ -36,12 +36,12 @@ public abstract class AppDialog extends JDialog {
private ResourceBundle resourceBundle = ResourceBundle.getBundle(AppStrings.getResourcePath(getClass()));
public AppDialog() {
/*public AppDialog() {
View.installEscapeCloseOperation(this);
if (Configuration.useRibbonInterface.get()) {
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
}
}
}*/
public AppDialog(Window owner) {
super(owner);

View File

@@ -23,6 +23,7 @@ import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JPanel;
@@ -41,7 +42,8 @@ public class DebugLogDialog extends AppDialog {
private final Debugger debug;
public DebugLogDialog(Debugger debug) {
public DebugLogDialog(Window owner, Debugger debug) {
super(owner);
setSize(800, 600);
this.debug = debug;
setTitle(translate("dialog.title"));

View File

@@ -186,19 +186,19 @@ public class DebugPanel extends JPanel {
JMenuItem watchReadMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.read"));
watchReadMenuItem.addActionListener((ActionEvent e1) -> {
if (!Main.addWatch(v, watchParentId, true, false)) {
View.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
});
JMenuItem watchWriteMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.write"));
watchWriteMenuItem.addActionListener((ActionEvent e1) -> {
if (!Main.addWatch(v, watchParentId, false, true)) {
View.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
});
JMenuItem watchReadWriteMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.readwrite"));
watchReadWriteMenuItem.addActionListener((ActionEvent e1) -> {
if (!Main.addWatch(v, watchParentId, true, true)) {
View.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
});

View File

@@ -500,7 +500,7 @@ public class DebuggerHandler implements DebugConnectionListener {
disconnect();
Main.stopRun();
Main.stopWork();
View.showMessageDialog(Main.getMainFrame().getPanel(), AppStrings.translate("error.debug.listen").replace("%port%", "" + Debugger.DEBUG_PORT));
ViewMessages.showMessageDialog(Main.getMainFrame().getPanel(), AppStrings.translate("error.debug.listen").replace("%port%", "" + Debugger.DEBUG_PORT));
Main.getMainFrame().getPanel().updateMenu();
}
});

View File

@@ -51,6 +51,7 @@ import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.Arrays;
import java.util.List;
@@ -199,7 +200,8 @@ public class ExportDialog extends AppDialog {
return false;
}
public ExportDialog(List<TreeItem> exportables) {
public ExportDialog(Window owner, List<TreeItem> exportables) {
super(owner);
setTitle(translate("dialog.title"));
setResizable(false);

View File

@@ -99,7 +99,7 @@ public class FilesChangedDialog extends AppDialog {
@Override
public void setVisible(boolean b) {
if (b && !onTopInited) {
Main.getMainFrame().getWindow().addWindowListener(new WindowAdapter() {
Main.getDefaultDialogsOwner().addWindowListener(new WindowAdapter() {
@Override
public void windowDeactivated(WindowEvent e) {
Window wnd = e.getOppositeWindow();

View File

@@ -27,6 +27,7 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -134,7 +135,8 @@ public class FontEmbedDialog extends AppDialog {
faceSelection.setModel(FontPanel.getFaceModel((FontFamily) familyNamesSelection.getSelectedItem()));
}
public FontEmbedDialog(boolean hasLayout, FontFace selectedFace, String selectedChars) {
public FontEmbedDialog(Window owner, boolean hasLayout, FontFace selectedFace, String selectedChars) {
super(owner);
setSize(900, 600);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle(translate("dialog.title"));

View File

@@ -170,7 +170,7 @@ public class FontPanel extends JPanel {
if (!font.canDisplay(c)) {
String msg = translate("error.font.nocharacter").replace("%char%", "" + c);
Logger.getLogger(FontPanel.class.getName()).log(Level.SEVERE, msg);
View.showMessageDialog(null, msg, translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(FontPanel.this, msg, translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}
}
@@ -185,7 +185,7 @@ public class FontPanel extends JPanel {
if (oldchars.indexOf((int) c) > -1) {
int opt = -1;
if (!(yestoall || notoall)) {
opt = View.showOptionDialog(null, translate("message.font.add.exists").replace("%char%", "" + c), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, yesno, translate("button.yes"));
opt = ViewMessages.showOptionDialog(FontPanel.this, translate("message.font.add.exists").replace("%char%", "" + c), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, yesno, translate("button.yes"));
if (opt == 2) {
yestoall = true;
}
@@ -212,7 +212,7 @@ public class FontPanel extends JPanel {
}
if (replaced) {
if (View.showConfirmDialog(null, translate("message.font.replace.updateTexts"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) {
if (ViewMessages.showConfirmDialog(FontPanel.this, translate("message.font.replace.updateTexts"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) {
int fontId = ft.getFontId();
SWF swf = ft.getSwf();
for (Tag tag : swf.getTags()) {
@@ -603,7 +603,7 @@ public class FontPanel extends JPanel {
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
if (item instanceof FontTag) {
FontTag ft = (FontTag) item;
FontEmbedDialog fed = new FontEmbedDialog(ft.hasLayout() || ft.getCharacterCount() == 0, (FontFace) fontFaceSelection.getSelectedItem(), fontAddCharactersField.getText());
FontEmbedDialog fed = new FontEmbedDialog(Main.getDefaultDialogsOwner(), ft.hasLayout() || ft.getCharacterCount() == 0, (FontFace) fontFaceSelection.getSelectedItem(), fontAddCharactersField.getText());
if (fed.showDialog() == AppDialog.OK_OPTION) {
Set<Integer> selChars = fed.getSelectedChars();
if (!selChars.isEmpty() || fed.isImportAscentDescentLeading()) {
@@ -721,7 +721,7 @@ public class FontPanel extends JPanel {
}
private void buttonSetAdvanceValuesActionPerformed(ActionEvent evt) {
if (View.showConfirmDialog(null, AppStrings.translate("message.font.setadvancevalues"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.showSetAdvanceValuesMessage, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(FontPanel.this, AppStrings.translate("message.font.setadvancevalues"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.showSetAdvanceValuesMessage, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
fontTag.setAdvanceValues(((FontFace) fontFaceSelection.getSelectedItem()).font);
}
}

View File

@@ -43,7 +43,7 @@ public class FontPreviewDialog extends AppDialog {
* @param modal Will show as modal?
*/
public FontPreviewDialog(java.awt.Frame parent, boolean modal, Font font) {
super();
super(parent);
setModal(true);
initComponents();
View.setWindowIcon(this);

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
import java.awt.Component;
import javax.swing.JOptionPane;
/**
@@ -53,7 +54,12 @@ public class GuiAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler {
msg = "";
}
int result = View.showOptionDialog(null, AppStrings.translate("error.occured").replace("%error%", msg), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, "");
MainFrame mf = Main.getMainFrame();
Component cmp = null;
if (mf != null) {
cmp = mf.getPanel();
}
int result = ViewMessages.showOptionDialog(cmp, AppStrings.translate("error.occured").replace("%error%", msg), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, "");
if (result == AbortRetryIgnoreHandler.IGNORE_ALL) {
ignoreAll = true;
result = AbortRetryIgnoreHandler.IGNORE;

View File

@@ -276,7 +276,7 @@ public class LoadFromCacheFrame extends AppFrame {
}
Configuration.lastSaveDir.set(file.getParentFile().getAbsolutePath());
} catch (IOException ex) {
View.showMessageDialog(null, translate("error.file.write"));
ViewMessages.showMessageDialog(this, translate("error.file.write"));
}
}
}

View File

@@ -418,7 +418,7 @@ public class LoadFromMemoryFrame extends AppFrame {
}
Configuration.lastSaveDir.set(file.getParentFile().getAbsolutePath());
} catch (IOException ex) {
View.showMessageDialog(null, translate("error.file.write"));
ViewMessages.showMessageDialog(this, translate("error.file.write"));
}
}
}

View File

@@ -22,6 +22,7 @@ import com.jpexs.helpers.Helper;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
@@ -70,8 +71,8 @@ public class LoadingDialog extends AppDialog {
* Constructor
*
*/
public LoadingDialog() {
super();
public LoadingDialog(Window owner) {
super(owner);
setResizable(false);
setTitle(ApplicationInfo.shortApplicationVerName);
Container cntp = getContentPane();

View File

@@ -63,12 +63,14 @@ import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinReg;
import java.awt.AWTException;
import java.awt.Component;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -469,7 +471,7 @@ public class Main {
String flashVars = "";//key=val&key2=val2
String playerLocation = Configuration.playerLocation.get();
if (playerLocation.isEmpty() || (!new File(playerLocation).exists())) {
View.showMessageDialog(null, AppStrings.translate("message.playerpath.notset"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("message.playerpath.notset"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
advancedSettings("paths");
return;
}
@@ -505,7 +507,7 @@ public class Main {
String flashVars = "";//key=val&key2=val2
String playerLocation = Configuration.playerDebugLocation.get();
if (playerLocation.isEmpty() || (!new File(playerLocation).exists())) {
View.showMessageDialog(null, AppStrings.translate("message.playerpath.debug.notset"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("message.playerpath.debug.notset"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
Main.advancedSettings("paths");
return;
}
@@ -628,6 +630,20 @@ public class Main {
return mainFrame;
}
public static Component getDefaultMessagesComponent() {
if (mainFrame != null) {
return mainFrame.getPanel();
}
return null;
}
public static Window getDefaultDialogsOwner() {
if (mainFrame != null) {
return mainFrame.getWindow();
}
return null;
}
public static void loadFromCache() {
if (loadFromCacheFrame == null) {
loadFromCacheFrame = new LoadFromCacheFrame();
@@ -805,7 +821,7 @@ public class Main {
public SWF resolveUrl(final String url) {
int opt = -1;
if (!(yestoall || notoall)) {
opt = View.showOptionDialog(null, AppStrings.translate("message.imported.swf").replace("%url%", url), AppStrings.translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, yesno, AppStrings.translate("button.yes"));
opt = ViewMessages.showOptionDialog(getDefaultMessagesComponent(), AppStrings.translate("message.imported.swf").replace("%url%", url), AppStrings.translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, yesno, AppStrings.translate("button.yes"));
if (opt == 2) {
yestoall = true;
}
@@ -847,7 +863,7 @@ public class Main {
@Override
public void run() {
while (JOptionPane.YES_OPTION == View.showConfirmDialog(null, AppStrings.translate("message.imported.swf.manually").replace("%url%", url), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE)) {
while (JOptionPane.YES_OPTION == ViewMessages.showConfirmDialog(getDefaultMessagesComponent(), AppStrings.translate("message.imported.swf.manually").replace("%url%", url), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE)) {
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get()));
@@ -1160,15 +1176,15 @@ public class Main {
}
} catch (OutOfMemoryError ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, "Cannot load SWF file. Out of memory.");
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), "Cannot load SWF file. Out of memory.");
continue;
} catch (SwfOpenException ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, ex.getMessage());
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), ex.getMessage());
continue;
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
View.showMessageDialog(null, "Cannot load SWF file.");
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), "Cannot load SWF file.");
continue;
}
@@ -1300,7 +1316,7 @@ public class Main {
try {
File file = new File(swfFile);
if (!file.exists()) {
View.showMessageDialog(null, AppStrings.translate("open.error.fileNotFound"), AppStrings.translate("open.error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("open.error.fileNotFound"), AppStrings.translate("open.error"), JOptionPane.ERROR_MESSAGE);
return OpenFileResult.NOT_FOUND;
}
swfFile = file.getCanonicalPath();
@@ -1308,7 +1324,7 @@ public class Main {
OpenFileResult openResult = openFile(sourceInfo);
return openResult;
} catch (IOException ex) {
View.showMessageDialog(null, AppStrings.translate("open.error.cannotOpen"), AppStrings.translate("open.error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("open.error.cannotOpen"), AppStrings.translate("open.error"), JOptionPane.ERROR_MESSAGE);
return OpenFileResult.ERROR;
}
}
@@ -1564,9 +1580,9 @@ public class Main {
}
errorMessage += "\n";
errorMessage += AppStrings.translate("error.outOfMemory.64bit");
View.showMessageDialog(null, errorMessage, AppStrings.translate("error.outOfMemory.title"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), errorMessage, AppStrings.translate("error.outOfMemory.title"), JOptionPane.ERROR_MESSAGE);
} else {
View.showMessageDialog(null, AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("error.file.save") + ": " + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
}
@@ -1756,7 +1772,7 @@ public class Main {
autoCheckForUpdates();
offerAssociation();
loadingDialog = new LoadingDialog();
loadingDialog = new LoadingDialog(getDefaultDialogsOwner());
if (Configuration.checkForModifications.get()) {
try {
@@ -1934,7 +1950,7 @@ public class Main {
boolean offered = Configuration.offeredAssociation.get();
if (!offered) {
if (Platform.isWindows()) {
if ((!ContextMenuTools.isAddedToContextMenu()) && View.showConfirmDialog(null, "Do you want to add FFDec to context menu of SWF files?\n(Can be changed later from main menu)", "Context menu", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
if ((!ContextMenuTools.isAddedToContextMenu()) && ViewMessages.showConfirmDialog(getDefaultMessagesComponent(), "Do you want to add FFDec to context menu of SWF files?\n(Can be changed later from main menu)", "Context menu", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
ContextMenuTools.addToContextMenu(true, false);
}
}
@@ -2343,7 +2359,7 @@ public class Main {
}
public static void about() {
(new AboutDialog()).setVisible(true);
(new AboutDialog(mainFrame.getWindow())).setVisible(true);
}
public static void advancedSettings() {
@@ -2351,7 +2367,7 @@ public class Main {
}
public static void advancedSettings(String category) {
(new AdvancedSettingsDialog(category)).setVisible(true);
(new AdvancedSettingsDialog(mainFrame.getWindow(), category)).setVisible(true);
}
public static void autoCheckForUpdates() {
@@ -2464,7 +2480,7 @@ public class Main {
if (!versions.isEmpty()) {
View.execInEventDispatch(() -> {
NewVersionDialog newVersionDialog = new NewVersionDialog(versions);
NewVersionDialog newVersionDialog = new NewVersionDialog(mainFrame.getWindow(), versions);
newVersionDialog.setVisible(true);
Configuration.lastUpdatesCheckDate.set(Calendar.getInstance());
});
@@ -2529,7 +2545,7 @@ public class Main {
public void uncaughtException(Thread t, Throwable e) {
logger.log(Level.SEVERE, "Uncaught exception in thread: " + t.getName(), e);
if (e instanceof OutOfMemoryError && !Helper.is64BitJre() && Helper.is64BitOs()) {
View.showMessageDialog(null, AppStrings.translate("message.warning.outOfMemory32BitJre"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE);
ViewMessages.showMessageDialog(getDefaultMessagesComponent(), AppStrings.translate("message.warning.outOfMemory32BitJre"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE);
}
}
});

View File

@@ -420,7 +420,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
protected void debuggerReplaceTraceCallsActionPerformed(ActionEvent evt) {
ReplaceTraceDialog rtd = new ReplaceTraceDialog(Configuration.lastDebuggerReplaceFunction.get());
ReplaceTraceDialog rtd = new ReplaceTraceDialog(Main.getDefaultDialogsOwner(), Configuration.lastDebuggerReplaceFunction.get());
rtd.setVisible(true);
if (rtd.getValue() != null) {
String fname = rtd.getValue();
@@ -507,7 +507,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
if (!Main.checkForUpdates()) {
View.showMessageDialog(null, translate("update.check.nonewversion"), translate("update.check.title"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), translate("update.check.nonewversion"), translate("update.check.title"), JOptionPane.INFORMATION_MESSAGE);
}
}
@@ -518,7 +518,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
String helpUsURL = ApplicationInfo.PROJECT_PAGE;
if (!View.navigateUrl(helpUsURL)) {
View.showMessageDialog(null, translate("message.helpus").replace("%url%", helpUsURL));
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), translate("message.helpus").replace("%url%", helpUsURL));
}
}
@@ -529,7 +529,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
String homePageURL = ApplicationInfo.PROJECT_PAGE;
if (!View.navigateUrl(homePageURL)) {
View.showMessageDialog(null, translate("message.homepage").replace("%url%", homePageURL));
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), translate("message.homepage").replace("%url%", homePageURL));
}
}
@@ -543,7 +543,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
protected boolean reloadActionPerformed(ActionEvent evt) {
if (swf != null) {
if (!Configuration.showCloseConfirmation.get() || View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
if (!Configuration.showCloseConfirmation.get() || ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
Main.reloadFile(swf.swfList);
}
}
@@ -552,7 +552,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
protected boolean reloadAllActionPerformed(ActionEvent evt) {
if (swf != null) {
if (!Configuration.showCloseConfirmation.get() || View.showConfirmDialog(null, translate("message.confirm.reloadAll"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
if (!Configuration.showCloseConfirmation.get() || ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.reloadAll"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
Main.reloadApp();
}
@@ -608,7 +608,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
}*/
protected void setLanguageActionPerformed(ActionEvent evt) {
new SelectLanguageDialog().display();
new SelectLanguageDialog(Main.getDefaultDialogsOwner()).display();
}
protected void disableDecompilationActionPerformed(ActionEvent evt) {
@@ -651,7 +651,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
} else {
confStr += " " + translate("message.confirm.off");
}
if (View.showConfirmDialog(null, confStr, translate("message.parallel"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), confStr, translate("message.parallel"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
Configuration.parallelSpeedUp.set(selected);
} else {
button.setSelected(Configuration.parallelSpeedUp.get());
@@ -678,7 +678,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
AbstractButton button = (AbstractButton) evt.getSource();
boolean selected = button.isSelected();
if (View.showConfirmDialog(mainFrame.getPanel(), translate("message.confirm.autodeobfuscate") + "\r\n" + (selected ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.autodeobfuscate") + "\r\n" + (selected ? translate("message.confirm.on") : translate("message.confirm.off")), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
Configuration.autoDeobfuscate.set(selected);
mainFrame.getPanel().autoDeobfuscateChanged();
} else {
@@ -1079,7 +1079,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
+ "Max: " + (runtime.maxMemory() / 1024 / 1024) + "MB" + Helper.newLine
+ "Used: " + (runtime.totalMemory() / 1024 / 1024) + "MB" + Helper.newLine
+ "Free: " + (runtime.freeMemory() / 1024 / 1024) + "MB";
View.showMessageDialog(null, info);
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), info);
SWF nswf = mainFrame.getPanel().getCurrentSwf();
if (nswf != null) {
nswf.clearAllCache();
@@ -1134,7 +1134,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
Configuration.dumpView.set(true);
MainPanel mainPanel = mainFrame.getPanel();
if (mainPanel.isModified()) {
View.showMessageDialog(null, translate("message.warning.hexViewNotUpToDate"), translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningHexViewNotUpToDate);
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), translate("message.warning.hexViewNotUpToDate"), translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningHexViewNotUpToDate);
}
mainPanel.showView(MainPanel.VIEW_DUMP);
@@ -1144,7 +1144,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
private void debuggerSwitchActionPerformed(ActionEvent evt) {
boolean debuggerOn = isMenuChecked("/tools/debugger/debuggerSwitch");
if (!debuggerOn || View.showConfirmDialog((Component) mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
if (!debuggerOn || ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
switchDebugger();
mainFrame.getPanel().refreshDecompiled();
} else {
@@ -1188,10 +1188,10 @@ public abstract class MainFrameMenu implements MenuBuilder {
listeners.add(Main.getMainFrame().getPanel().getActionPanel());
if (swf.isAS3()) {
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
sr = new SearchResultsDialog<>(Main.getDefaultDialogsOwner(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
} else {
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
sr = new SearchResultsDialog<>(Main.getDefaultDialogsOwner(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
}
sr.setResults(Main.searchResultsStorage.getSearchResultsAt(mainFrame.getPanel().getAllSwfs(), fi));
sr.setVisible(true);
@@ -1209,7 +1209,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
}
protected void clearRecentSearchesForCurrentSwfActionPerformed(ActionEvent evt) {
if (View.showConfirmDialog(mainFrame.getPanel(), translate("message.confirm.recentSearches.clear"), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.recentSearches.clear"), translate("message.confirm"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
Main.searchResultsStorage.clearForSwf(swf);
}
}
@@ -1223,7 +1223,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
final String f = recentFiles.get(i);
ActionListener a = (ActionEvent e) -> {
if (Main.openFile(f, null) == OpenFileResult.NOT_FOUND) {
if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
if (ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
Configuration.removeRecentFile(f);
}
}

View File

@@ -190,9 +190,9 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
listeners.add(Main.getMainFrame().getPanel().getActionPanel());
SearchResultsDialog sr;
if (swf.isAS3()) {
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
sr = new SearchResultsDialog<>(Main.getDefaultDialogsOwner(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
} else {
sr = new SearchResultsDialog<>(Main.getMainFrame().getWindow(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
sr = new SearchResultsDialog<>(Main.getDefaultDialogsOwner(), searched, Main.searchResultsStorage.isIgnoreCaseAt(fi), Main.searchResultsStorage.isRegExpAt(fi), listeners);
}
sr.setResults(Main.searchResultsStorage.getSearchResultsAt(Main.getMainFrame().getPanel().getAllSwfs(), fi));
sr.setVisible(true);
@@ -251,7 +251,7 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
historyButton.addActionListener((ActionEvent ae) -> {
RecentFilesButton source = (RecentFilesButton) ae.getSource();
if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) {
if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
if (ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
Configuration.removeRecentFile(source.fileName);
}
}

View File

@@ -602,7 +602,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
Path.createDirectorySafe(fTempDir);
File ftemp = new File(tempDir);
ExportDialog exd = new ExportDialog(null);
ExportDialog exd = new ExportDialog(Main.getDefaultDialogsOwner(), null);
try {
files = exportSelection(new GuiAbortRetryIgnoreHandler(), tempDir, exd);
} catch (InterruptedException ex) {
@@ -751,7 +751,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
boolean valid;
int characterId = -1;
do {
val = View.showInputDialog(MainPanel.this, translate("message.input.gotoCharacter"), translate("message.input.gotoCharacter.title"), val);
val = ViewMessages.showInputDialog(MainPanel.this, translate("message.input.gotoCharacter"), translate("message.input.gotoCharacter.title"), val);
if (val == null) {
break;
}
@@ -765,7 +765,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (characterId > 0) {
CharacterTag tag = swf.getCharacter(characterId);
if (tag == null) {
View.showMessageDialog(MainPanel.this, translate("message.character.notfound").replace("%characterid%", "" + characterId), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("message.character.notfound").replace("%characterid%", "" + characterId), translate("error"), JOptionPane.ERROR_MESSAGE);
} else {
TreePath path = tagTree.getModel().getTreePath(tag);
if (path != null) {
@@ -958,7 +958,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
? translate("message.confirm.closeAll")
: translate("message.confirm.close").replace("{swfName}", swfList.toString());
return View.showConfirmDialog(this, message, translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(this, message, translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION;
}
public boolean isModified() {
@@ -1132,11 +1132,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public void renameIdentifier(SWF swf, String identifier) throws InterruptedException {
String oldName = identifier;
String newName = View.showInputDialog(translate("rename.enternew"), oldName);
String newName = ViewMessages.showInputDialog(this, translate("rename.enternew"), oldName);
if (newName != null) {
if (!oldName.equals(newName)) {
swf.renameAS2Identifier(oldName, newName);
View.showMessageDialog(null, translate("rename.finished.identifier"));
ViewMessages.showMessageDialog(this, translate("rename.finished.identifier"));
updateClassesList();
reload(true);
}
@@ -1150,7 +1150,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
oldName = constants.getString(constants.getMultiname(multiNameIndex).name_index);
}
String newName = View.showInputDialog(translate("rename.enternew"), oldName);
String newName = ViewMessages.showInputDialog(this, translate("rename.enternew"), oldName);
if (newName != null) {
if (!oldName.equals(newName)) {
int mulCount = 0;
@@ -1171,7 +1171,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
int fmulCount = mulCount;
View.execInEventDispatch(() -> {
View.showMessageDialog(null, translate("rename.finished.multiname").replace("%count%", Integer.toString(fmulCount)));
ViewMessages.showMessageDialog(this, translate("rename.finished.multiname").replace("%count%", Integer.toString(fmulCount)));
if (abcPanel != null) {
abcPanel.reload();
}
@@ -1212,7 +1212,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public boolean confirmExperimental() {
View.checkAccess();
return View.showConfirmDialog(null, translate("message.confirm.experimental"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(this, translate("message.confirm.experimental"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION;
}
public List<File> exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException {
@@ -2001,7 +2001,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
sr.setVisible(true);
searchResultsDialogs.add(sr);
if (!found) {
View.showMessageDialog(null, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
}
Main.stopWork();
@@ -2033,7 +2033,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
textSearchPanel.setSearchText(txt);
boolean found = textSearchPanel.setResults(fTextResult);
if (!found) {
View.showMessageDialog(null, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("message.search.notfound").replace("%searchtext%", txt), translate("message.search.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
}
Main.stopWork();
@@ -2210,7 +2210,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
try {
int cnt = get();
Main.stopWork();
View.showMessageDialog(null, translate("message.rename.renamed").replace("%count%", Integer.toString(cnt)));
ViewMessages.showMessageDialog(MainPanel.this, translate("message.rename.renamed").replace("%count%", Integer.toString(cnt)));
swf.assignClassesToSymbols();
swf.clearScriptCache();
if (abcPanel != null) {
@@ -2221,7 +2221,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error during renaming identifiers", ex);
Main.stopWork();
View.showMessageDialog(null, translate("error.occured").replace("%error%", ex.getClass().getSimpleName()));
ViewMessages.showMessageDialog(MainPanel.this, translate("error.occured").replace("%error%", ex.getClass().getSimpleName()));
}
});
}
@@ -2260,7 +2260,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}.execute();
} else {
View.showMessageDialog(null, translate("message.rename.notfound.multiname"), translate("message.rename.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("message.rename.notfound.multiname"), translate("message.rename.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
}
} else {
final String identifier = getActionPanel().getStringUnderCursor();
@@ -2287,7 +2287,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
}.execute();
} else {
View.showMessageDialog(null, translate("message.rename.notfound.identifier"), translate("message.rename.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("message.rename.notfound.identifier"), translate("message.rename.notfound.title"), JOptionPane.INFORMATION_MESSAGE);
}
}
}
@@ -2377,7 +2377,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
} catch (Exception ex) {
logger.log(Level.SEVERE, "FLA export error", ex);
View.showMessageDialog(null, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
}
Helper.freeMem();
return null;
@@ -2432,14 +2432,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public boolean handle(TextTag textTag) {
String msg = translate("error.text.import");
logger.log(Level.SEVERE, "{0}{1}", new Object[]{msg, getTextTagInfo(textTag)});
return View.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainImportError, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainImportError, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
}
@Override
public boolean handle(TextTag textTag, String message, long line) {
String msg = translate("error.text.invalid.continue").replace("%text%", message).replace("%line%", Long.toString(line));
logger.log(Level.SEVERE, "{0}{1}", new Object[]{msg, getTextTagInfo(textTag)});
return View.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainInvalidText, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(MainPanel.this, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, showAgainInvalidText, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION;
}
});
@@ -2465,16 +2465,16 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
As3ScriptReplacerInterface r = As3ScriptReplacerFactory.createByConfig();
if (!r.isAvailable()) {
if (r instanceof MxmlcAs3ScriptReplacer) {
if (View.showConfirmDialog(null, AppStrings.translate("message.flexpath.notset"), AppStrings.translate("error"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("message.flexpath.notset"), AppStrings.translate("error"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
Main.advancedSettings("paths");
}
} else if (r instanceof FFDecAs3ScriptReplacer) {
if (View.showConfirmDialog(this, AppStrings.translate("message.playerpath.lib.notset"), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("message.playerpath.lib.notset"), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
Main.advancedSettings("paths");
}
} else {
//Not translated yet - just in case there are more Script replacers in the future. Unused now.
View.showConfirmDialog(this, "Current script replacer is not available", "Script replacer not available", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE);
ViewMessages.showConfirmDialog(this, "Current script replacer is not available", "Script replacer not available", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE);
}
return null;
}
@@ -2503,7 +2503,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
updateClassesList();
}
View.showMessageDialog(this, translate("import.script.result").replace("%count%", Integer.toString(countAs2 + countAs3)));
ViewMessages.showMessageDialog(this, translate("import.script.result").replace("%count%", Integer.toString(countAs2 + countAs3)));
if (countAs2 != 0 || countAs3 != 0) {
reload(true);
}
@@ -2551,7 +2551,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
} else if (sel.isEmpty()) {
return;
}
final ExportDialog export = new ExportDialog(sel);
final ExportDialog export = new ExportDialog(Main.getDefaultDialogsOwner(), sel);
if (export.showExportDialog() == AppDialog.OK_OPTION) {
final String selFile = selectExportDir();
if (selFile != null) {
@@ -2569,7 +2569,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error during export", ex);
View.showMessageDialog(null, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage());
ViewMessages.showMessageDialog(null, translate("error.export") + ": " + ex.getClass().getName() + " " + ex.getLocalizedMessage());
}
return null;
}
@@ -2678,7 +2678,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return;
}
if (confirmExperimental()) {
RenameDialog renameDialog = new RenameDialog();
RenameDialog renameDialog = new RenameDialog(Main.getDefaultDialogsOwner());
if (renameDialog.showRenameDialog() == AppDialog.OK_OPTION) {
final RenameType renameType = renameDialog.getRenameType();
new CancellableWorker<Integer>() {
@@ -2699,7 +2699,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
try {
int cnt = get();
Main.stopWork();
View.showMessageDialog(null, translate("message.rename.renamed").replace("%count%", Integer.toString(cnt)));
ViewMessages.showMessageDialog(MainPanel.this, translate("message.rename.renamed").replace("%count%", Integer.toString(cnt)));
swf.assignClassesToSymbols();
swf.clearScriptCache();
if (abcPanel != null) {
@@ -2710,7 +2710,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error during renaming identifiers", ex);
Main.stopWork();
View.showMessageDialog(null, translate("error.occured").replace("%error%", ex.getClass().getSimpleName()));
ViewMessages.showMessageDialog(MainPanel.this, translate("error.occured").replace("%error%", ex.getClass().getSimpleName()));
}
});
}
@@ -2722,7 +2722,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
public void deobfuscate() {
View.checkAccess();
DeobfuscationDialog deobfuscationDialog = new DeobfuscationDialog();
DeobfuscationDialog deobfuscationDialog = new DeobfuscationDialog(Main.getDefaultDialogsOwner());
if (deobfuscationDialog.showDialog() == AppDialog.OK_OPTION) {
DeobfuscationLevel level = DeobfuscationLevel.getByLevel(deobfuscationDialog.codeProcessingLevel.getValue());
new CancellableWorker() {
@@ -2762,7 +2762,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
protected void done() {
View.execInEventDispatch(() -> {
Main.stopWork();
View.showMessageDialog(null, translate("work.deobfuscating.complete"));
ViewMessages.showMessageDialog(MainPanel.this, translate("work.deobfuscating.complete"));
clearAllScriptCache();
getABCPanel().reload();
@@ -2915,7 +2915,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (f == null || !f.canDisplay(character)) {
String msg = translate("error.font.nocharacter").replace("%char%", "" + character);
logger.log(Level.SEVERE, "{0} FontId: {1} TextId: {2}", new Object[]{msg, font.getCharacterId(), textTag.getCharacterId()});
ignoreMissingCharacters = View.showConfirmDialog(null, msg, translate("error"),
ignoreMissingCharacters = ViewMessages.showConfirmDialog(MainPanel.this, msg, translate("error"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE,
showAgainIgnoreMissingCharacters,
ignoreMissingCharacters ? JOptionPane.OK_OPTION : JOptionPane.CANCEL_OPTION) == JOptionPane.OK_OPTION;
@@ -2940,7 +2940,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
editor.markError();
}
View.showMessageDialog(null, translate("error.text.invalid").replace("%text%", ex.text).replace("%line%", Long.toString(ex.line)), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("error.text.invalid").replace("%text%", ex.text).replace("%line%", Long.toString(ex.line)), translate("error"), JOptionPane.ERROR_MESSAGE);
}
return false;
@@ -3033,7 +3033,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
if (!ok) {
View.showMessageDialog(null, translate("error.sound.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.sound.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
} else {
reload(true);
}
@@ -3053,7 +3053,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
swf.clearImageCache();
} catch (IOException ex) {
logger.log(Level.SEVERE, "Invalid image", ex);
View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
}
reload(true);
@@ -3081,7 +3081,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
swf.clearImageCache();
} catch (IOException ex) {
logger.log(Level.SEVERE, "Invalid image", ex);
View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(MainPanel.this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
}
reload(true);
}
@@ -3136,7 +3136,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
swf.clearImageCache();
} catch (IOException ex) {
logger.log(Level.SEVERE, "Invalid image", ex);
View.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
}
reload(true);
}
@@ -3144,7 +3144,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
private void showSvgImportWarning() {
View.showMessageDialog(null, AppStrings.translate("message.warning.svgImportExperimental"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningSvgImport);
ViewMessages.showMessageDialog(this, AppStrings.translate("message.warning.svgImportExperimental"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningSvgImport);
}
public void replaceAlphaButtonActionPerformed(ActionEvent evt) {
@@ -3166,7 +3166,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
swf.clearImageCache();
} catch (IOException ex) {
logger.log(Level.SEVERE, "Invalid alpha channel data", ex);
View.showMessageDialog(null, translate("error.image.alpha.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.image.alpha.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
}
reload(true);

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.Version;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.text.DateFormat;
import java.text.ParseException;
@@ -46,7 +47,8 @@ public class NewVersionDialog extends AppDialog {
private Version latestVersion;
public NewVersionDialog(List<Version> versions) {
public NewVersionDialog(Window owner, List<Version> versions) {
super(owner);
setSize(new Dimension(300, 150));
Container cnt = getContentPane();
cnt.setLayout(new BoxLayout(cnt, BoxLayout.PAGE_AXIS));
@@ -146,7 +148,7 @@ public class NewVersionDialog extends AppDialog {
if (View.navigateUrl(url)) {
Main.exit();
} else {
View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.SHORT_APPLICATION_NAME).replace("%newAppName%", latestVersion.versionName).replace("%projectPage%", ApplicationInfo.PROJECT_PAGE), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
ViewMessages.showMessageDialog(this, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.SHORT_APPLICATION_NAME).replace("%newAppName%", latestVersion.versionName).replace("%projectPage%", ApplicationInfo.PROJECT_PAGE), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
}
setVisible(false);

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.configuration.Configuration;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
@@ -45,7 +46,8 @@ public class RenameDialog extends AppDialog {
private int result = ERROR_OPTION;
public RenameDialog() {
public RenameDialog(Window owner) {
super(owner);
setSize(300, 150);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
int renameType = Configuration.lastRenameType.get();

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.Map;
import javax.swing.JButton;
@@ -43,7 +44,8 @@ public class ReplaceCharacterDialog extends AppDialog {
private int result = ERROR_OPTION;
public ReplaceCharacterDialog() {
public ReplaceCharacterDialog(Window owner) {
super(owner);
setSize(400, 150);
setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
setLayout(new BorderLayout());

View File

@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
@@ -60,7 +61,8 @@ public class ReplaceTraceDialog extends AppDialog {
return value;
}
public ReplaceTraceDialog(String defaultVal) {
public ReplaceTraceDialog(Window owner, String defaultVal) {
super(owner);
setTitle(translate("dialog.title"));
Container cnt = getContentPane();
cnt.setLayout(new BoxLayout(cnt, BoxLayout.Y_AXIS));

View File

@@ -201,7 +201,7 @@ public class SearchDialog extends AppDialog {
try {
Pattern pat = Pattern.compile(searchField.getText());
} catch (PatternSyntaxException ex) {
View.showMessageDialog(null, translate("error.invalidregexp"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.invalidregexp"), translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}
}

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -43,7 +44,8 @@ public class SelectLanguageDialog extends AppDialog {
protected static final String[] languages = new String[]{"en", "ca", "cs", "zh", "de", "es", "fr", "hu", "it", "ja", "nl", "pl", "pt", "pt-BR", "ru", "sv", "tr", "uk"};
public SelectLanguageDialog() {
public SelectLanguageDialog(Window owner) {
super(owner);
setSize(350, 130);
Container cnt1 = getContentPane();
JPanel cnt = new JPanel();

View File

@@ -475,111 +475,6 @@ public class View {
}
}
public static int showOptionDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageType, final Icon icon, final Object[] options, final Object initialValue) {
final int[] ret = new int[1];
execInEventDispatch(() -> {
ret[0] = JOptionPane.showOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue);
});
return ret[0];
}
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE);
}
public static int showConfirmDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageTyp) {
final int[] ret = new int[1];
execInEventDispatch(() -> {
ret[0] = JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageTyp);
});
return ret[0];
}
public static int showConfirmDialog(Component parentComponent, String message, String title, int optionType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE, showAgainConfig, defaultOption);
}
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
JCheckBox donotShowAgainCheckBox = null;
JPanel warPanel = null;
if (showAgainConfig != null) {
if (!showAgainConfig.get()) {
return defaultOption;
}
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
warPanel = new JPanel(new BorderLayout());
warPanel.add(warLabel, BorderLayout.CENTER);
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
}
final int[] ret = new int[1];
final Object messageObj = warPanel == null ? message : warPanel;
execInEventDispatch(() -> {
ret[0] = JOptionPane.showConfirmDialog(parentComponent, messageObj, title, optionType, messageType);
});
if (donotShowAgainCheckBox != null) {
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
}
return ret[0];
}
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType) {
showMessageDialog(parentComponent, message, title, messageType, null);
}
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType, ConfigurationItem<Boolean> showAgainConfig) {
execInEventDispatch(() -> {
Object msg = message;
JCheckBox donotShowAgainCheckBox = null;
if (showAgainConfig != null) {
if (!showAgainConfig.get()) {
return;
}
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
final JPanel warPanel = new JPanel(new BorderLayout());
warPanel.add(warLabel, BorderLayout.CENTER);
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
msg = warPanel;
}
final Object fmsg = msg;
JOptionPane.showMessageDialog(parentComponent, fmsg, title, messageType);
if (donotShowAgainCheckBox != null) {
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
}
});
}
public static void showMessageDialog(final Component parentComponent, final Object message) {
execInEventDispatch(() -> {
JOptionPane.showMessageDialog(parentComponent, message);
});
}
public static String showInputDialog(final Object message, final Object initialSelection) {
final String[] ret = new String[1];
execInEventDispatch(() -> {
ret[0] = JOptionPane.showInputDialog(message, initialSelection);
});
return ret[0];
}
public static String showInputDialog(Component parentComponent, final Object message, final String title, final Object initialSelection) {
final String[] ret = new String[1];
execInEventDispatch(() -> {
ret[0] = (String) JOptionPane.showInputDialog(parentComponent, message, title, JOptionPane.QUESTION_MESSAGE, null, null, initialSelection);
});
return ret[0];
}
public static SubstanceColorScheme getColorScheme() {
return SubstanceColorSchemeUtilities.getActiveColorScheme(new JButton(), ComponentState.ENABLED);
}

View File

@@ -0,0 +1,137 @@
/*
* Copyright (C) 2021 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.configuration.ConfigurationItem;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
/**
*
* @author JPEXS
*/
public class ViewMessages {
public static int showOptionDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageType, final Icon icon, final Object[] options, final Object initialValue) {
final int[] ret = new int[1];
View.execInEventDispatch(() -> {
ret[0] = JOptionPane.showOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue);
});
return ret[0];
}
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE);
}
public static int showConfirmDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageTyp) {
final int[] ret = new int[1];
View.execInEventDispatch(() -> {
ret[0] = JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageTyp);
});
return ret[0];
}
public static int showConfirmDialog(Component parentComponent, String message, String title, int optionType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE, showAgainConfig, defaultOption);
}
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
JCheckBox donotShowAgainCheckBox = null;
JPanel warPanel = null;
if (showAgainConfig != null) {
if (!showAgainConfig.get()) {
return defaultOption;
}
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
warPanel = new JPanel(new BorderLayout());
warPanel.add(warLabel, BorderLayout.CENTER);
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
}
final int[] ret = new int[1];
final Object messageObj = warPanel == null ? message : warPanel;
View.execInEventDispatch(() -> {
ret[0] = JOptionPane.showConfirmDialog(parentComponent, messageObj, title, optionType, messageType);
});
if (donotShowAgainCheckBox != null) {
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
}
return ret[0];
}
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType) {
showMessageDialog(parentComponent, message, title, messageType, null);
}
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType, ConfigurationItem<Boolean> showAgainConfig) {
View.execInEventDispatch(() -> {
Object msg = message;
JCheckBox donotShowAgainCheckBox = null;
if (showAgainConfig != null) {
if (!showAgainConfig.get()) {
return;
}
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
final JPanel warPanel = new JPanel(new BorderLayout());
warPanel.add(warLabel, BorderLayout.CENTER);
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
msg = warPanel;
}
final Object fmsg = msg;
JOptionPane.showMessageDialog(parentComponent, fmsg, title, messageType);
if (donotShowAgainCheckBox != null) {
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
}
});
}
public static void showMessageDialog(final Component parentComponent, final Object message) {
View.execInEventDispatch(() -> {
JOptionPane.showMessageDialog(parentComponent, message);
});
}
public static String showInputDialog(final Component parentComponent, final Object message, final Object initialSelection) {
final String[] ret = new String[1];
View.execInEventDispatch(() -> {
ret[0] = JOptionPane.showInputDialog(parentComponent, message, initialSelection);
});
return ret[0];
}
public static String showInputDialog(Component parentComponent, final Object message, final String title, final Object initialSelection) {
final String[] ret = new String[1];
View.execInEventDispatch(() -> {
ret[0] = (String) JOptionPane.showInputDialog(parentComponent, message, title, JOptionPane.QUESTION_MESSAGE, null, null, initialSelection);
});
return ret[0];
}
}

View File

@@ -58,6 +58,7 @@ import com.jpexs.decompiler.flash.gui.SearchListener;
import com.jpexs.decompiler.flash.gui.SearchPanel;
import com.jpexs.decompiler.flash.gui.TagEditorPanel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DecimalTableModel;
import com.jpexs.decompiler.flash.gui.abc.tablemodels.DoubleTableModel;
import com.jpexs.decompiler.flash.gui.abc.tablemodels.IntTableModel;
@@ -1439,7 +1440,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
return;
}
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS3Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS3Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
pack = decompiledTextArea.getScriptLeaf();
setDecompiledEditMode(true);
SwingWorker initReplaceWorker = new SwingWorker() {
@@ -1477,7 +1478,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
}
reload();
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
ViewMessages.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
} catch (As3ScriptReplaceException asre) {
StringBuilder sb = new StringBuilder();
int firstErrorLine = As3ScriptReplaceExceptionItem.LINE_UNKNOWN;
@@ -1508,9 +1509,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
}
if (scriptReplacer instanceof FFDecAs3ScriptReplacer) { //oldStyle error display - single error, no column
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", firstErrorText).replace("%line%", Long.toString(firstErrorLine)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", firstErrorText).replace("%line%", Long.toString(firstErrorLine)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} else {
View.showMessageDialog(this, sb.toString(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, sb.toString(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
decompiledTextArea.requestFocus();
@@ -1570,7 +1571,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
return;
}
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.removetrait"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("message.confirm.removetrait"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
if (scriptTraitsUsed) {
final int fTraitIndex = traitIndex;
@@ -1598,7 +1599,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
return;
}
if (newTraitDialog == null) {
newTraitDialog = new NewTraitDialog();
newTraitDialog = new NewTraitDialog(Main.getDefaultDialogsOwner());
}
int void_type = abc.constants.getPublicQnameId("void", true);//abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("void"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
int int_type = abc.constants.getPublicQnameId("int", true); //abc.constants.forceGetMultinameId(new Multiname(Multiname.QNAME, abc.constants.forceGetStringId("int"), abc.constants.forceGetNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.forceGetStringId("")), 0), -1, -1, new ArrayList<Integer>()));
@@ -1614,7 +1615,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
loopm:
do {
if (again) {
View.showMessageDialog(null, AppStrings.translate("error.trait.exists").replace("%name%", name), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.trait.exists").replace("%name%", name), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
again = false;
if (newTraitDialog.showDialog() != AppDialog.OK_OPTION) {

View File

@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.gui.GraphDialog;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.editor.DebuggableEditorPane;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
@@ -258,7 +259,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
args.put(1, 466561L); //param1
try {
Object o = abc.bodies.get(bodyIndex).getCode().execute(args, abc.constants);
View.showMessageDialog(this, "Returned object:" + o.toString());
ViewMessages.showMessageDialog(this, "Returned object:" + o.toString());
} catch (AVM2ExecutionException ex) {
Logger.getLogger(ASMSourceEditorPane.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -324,7 +325,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
} catch (AVM2ParseException ex) {
gotoLine((int) ex.line);
markError();
View.showMessageDialog(Main.getMainFrame().getPanel(), (ex.text + " on line " + ex.line), Main.getMainFrame().translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(Main.getDefaultMessagesComponent(), (ex.text + " on line " + ex.line), Main.getMainFrame().translate("error"), JOptionPane.ERROR_MESSAGE);
return false;
}
return true;

View File

@@ -23,6 +23,7 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.Hashtable;
import javax.swing.BoxLayout;
@@ -45,7 +46,8 @@ public class DeobfuscationDialog extends AppDialog {
private int result = ERROR_OPTION;
@SuppressWarnings("unchecked")
public DeobfuscationDialog() {
public DeobfuscationDialog(Window owner) {
super(owner);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setSize(new Dimension(330, 270));
setTitle(translate("dialog.title"));

View File

@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.gui.HeaderLabel;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.TagEditorPanel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@@ -319,7 +320,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
decompiledTextArea.gotoTrait(lastTrait);
}
setEditMode(false);
View.showMessageDialog(null, AppStrings.translate("message.trait.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showTraitSavedMessage);
ViewMessages.showMessageDialog(DetailPanel.this, AppStrings.translate("message.trait.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showTraitSavedMessage);
}
};

View File

@@ -20,7 +20,9 @@ import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.MissingSymbolHandler;
import com.jpexs.decompiler.flash.abc.types.Decimal;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import javax.swing.JOptionPane;
/**
@@ -31,22 +33,22 @@ public class DialogMissingSymbolHandler implements MissingSymbolHandler {
@Override
public boolean missingString(String value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.string").replace("%value%", value), AppStrings.translate("message.constant.new.string.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("message.constant.new.string").replace("%value%", value), AppStrings.translate("message.constant.new.string.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override
public boolean missingInt(long value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.integer").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("message.constant.new.integer").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.integer.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override
public boolean missingUInt(long value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("message.constant.new.unsignedinteger").replace("%value%", Long.toString(value)), AppStrings.translate("message.constant.new.unsignedinteger.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override
public boolean missingDouble(double value) {
return View.showConfirmDialog(null, AppStrings.translate("message.constant.new.double").replace("%value%", Double.toString(value)), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
return ViewMessages.showConfirmDialog(Main.getDefaultMessagesComponent(), AppStrings.translate("message.constant.new.double").replace("%value%", Double.toString(value)), AppStrings.translate("message.constant.new.double.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION;
}
@Override

View File

@@ -21,10 +21,12 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.gui.AppDialog;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JCheckBox;
@@ -86,7 +88,8 @@ public class NewTraitDialog extends AppDialog {
return nameField.getText();
}
public NewTraitDialog() {
public NewTraitDialog(Window owner) {
super(owner);
setSize(500, 300);
setTitle(translate("dialog.title"));
View.centerScreen(this);
@@ -165,7 +168,7 @@ public class NewTraitDialog extends AppDialog {
private void okButtonActionPerformed(ActionEvent evt) {
result = OK_OPTION;
if (nameField.getText().trim().isEmpty()) {
View.showMessageDialog(null, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.name"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}

View File

@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.FasterScrollPane;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
@@ -115,7 +116,7 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail {
return false;
}
} catch (AVM2ParseException ex) {
View.showMessageDialog(slotConstEditor, ex.text, AppStrings.translate("error.slotconst.typevalue"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(slotConstEditor, ex.text, AppStrings.translate("error.slotconst.typevalue"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (IOException ex) {
Logger.getLogger(SlotConstTraitDetailPanel.class.getName()).log(Level.SEVERE, null, ex);
@@ -130,7 +131,7 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail {
@Override
public void setEditMode(boolean val) {
if (val && active) {
View.showMessageDialog(null, AppStrings.translate("warning.initializers"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningInitializers);
ViewMessages.showMessageDialog(this, AppStrings.translate("warning.initializers"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningInitializers);
}
slotConstEditor.setEditable(val);
if (val) {

View File

@@ -45,6 +45,7 @@ import com.jpexs.decompiler.flash.gui.SearchListener;
import com.jpexs.decompiler.flash.gui.SearchPanel;
import com.jpexs.decompiler.flash.gui.TagEditorPanel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.controls.JPersistentSplitPane;
import com.jpexs.decompiler.flash.gui.controls.NoneSelectedButtonGroup;
import com.jpexs.decompiler.flash.gui.editor.DebuggableEditorPane;
@@ -1045,7 +1046,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
try {
Action.setConstantPools(src, constantPools, true);
} catch (ConstantPoolTooBigException ex) {
View.showMessageDialog(this, AppStrings.translate("error.constantPoolTooBig").replace("%index%", Integer.toString(ex.index)).replace("%size%", Integer.toString(ex.size)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.constantPoolTooBig").replace("%index%", Integer.toString(ex.index)).replace("%size%", Integer.toString(ex.size)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
} else {
src.setActions(ASMParser.parse(0, true, text, src.getSwf().version, false));
@@ -1054,7 +1055,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
SWF.uncache(src);
src.setModified();
setSource(this.src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
ViewMessages.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
@@ -1065,14 +1066,14 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
} catch (ActionParseException ex) {
editor.gotoLine((int) ex.line);
editor.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (Throwable ex) {
logger.log(Level.SEVERE, null, ex);
}
}
private void editDecompiledButtonActionPerformed(ActionEvent evt) {
if (View.showConfirmDialog(null, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS12Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("message.confirm.experimental.function"), AppStrings.translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, Configuration.warningExperimentalAS12Edit, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
setDecompiledEditMode(true);
}
}
@@ -1089,18 +1090,18 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
src.setModified();
setSource(src, false);
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
ViewMessages.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
setDecompiledEditMode(false);
} catch (IOException ex) {
logger.log(Level.SEVERE, "IOException during action compiling", ex);
} catch (ActionParseException ex) {
decompiledEditor.gotoLine((int) ex.line);
decompiledEditor.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (CompilationException ex) {
decompiledEditor.gotoLine((int) ex.line);
decompiledEditor.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (Throwable ex) {
logger.log(Level.SEVERE, null, ex);
}

View File

@@ -40,6 +40,7 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@@ -120,7 +121,8 @@ public class AddScriptDialog extends AppDialog {
private List<String> existingClasses = new ArrayList<>();
private List<Integer> spriteIdsWithDoInitAction;
public AddScriptDialog(SWF swf) {
public AddScriptDialog(Window owner, SWF swf) {
super(owner);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle(translate("dialog.title"));

View File

@@ -240,7 +240,7 @@ public class DebuggerTools {
public static void debuggerShowLog() {
initDebugger();
if (Main.debugDialog == null) {
Main.debugDialog = new DebugLogDialog(debugger);
Main.debugDialog = new DebugLogDialog(Main.getDefaultDialogsOwner(), debugger);
}
Main.debugDialog.setVisible(true);
}

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.exporters.amf.amf3.Amf3Exporter;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.FasterScrollPane;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane;
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3Importer;
import com.jpexs.decompiler.flash.importers.amf.amf3.Amf3ParseException;
@@ -144,7 +145,7 @@ public class Amf3ValueEditor extends JPanel implements GenericTagEditor, FullSiz
txthelp.setText(AppStrings.translate("generic.editor.amf3.help").replace("%scalar_samples%", SCALAR_SAMPLES).replace("%nonscalar_samples%", NONSCALAR_SAMPLES).replace("%reference_sample%", REFERENCE_SAMPLE));
txthelp.setEditable(false);
helpButton.addActionListener((ActionEvent e) -> {
View.showMessageDialog(null, txthelp);
ViewMessages.showMessageDialog(this, txthelp);
});
titlePanel.add(helpButton, BorderLayout.EAST);
add(titlePanel, BorderLayout.NORTH);

View File

@@ -22,6 +22,7 @@ import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
@@ -43,7 +44,8 @@ public class GotoAddressDialog extends AppDialog {
private final JCheckBox hexCheckBox;
private boolean okPressed = false;
public GotoAddressDialog() {
public GotoAddressDialog(Window owner) {
super(owner);
setDefaultCloseOperation(HIDE_ON_CLOSE);
setTitle(translate("dialog.title"));
lineTextField = new JTextField(10);

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.gui.hexview;
import com.jpexs.decompiler.flash.gui.AppDialog;
import com.jpexs.decompiler.flash.gui.Main;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -164,7 +165,7 @@ public class HexView extends JTable {
gotoAddressMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Long value = new GotoAddressDialog().showDialog();
Long value = new GotoAddressDialog(Main.getDefaultDialogsOwner()).showDialog();
if (value != null) {
selectByte(value);
}
@@ -253,7 +254,7 @@ public class HexView extends JTable {
@Override
public void keyReleased(KeyEvent e) {
if (e.isControlDown() && e.getKeyCode() == 'G') {
Long value = new GotoAddressDialog().showDialog();
Long value = new GotoAddressDialog(Main.getDefaultDialogsOwner()).showDialog();
if (value != null) {
selectByte(value);
}

View File

@@ -94,7 +94,7 @@ public class FirstInstance {
View.execInEventDispatch(new Runnable() {
@Override
public void run() {
Window wnd = Main.getMainFrame().getWindow();
Window wnd = Main.getDefaultDialogsOwner();
wnd.setAlwaysOnTop(true);
wnd.toFront();
wnd.requestFocus();

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.AppStrings;
import com.jpexs.decompiler.flash.gui.MainPanel;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
@@ -461,7 +462,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
}
});
if (View.showConfirmDialog(this, gotoPanel, AppStrings.translate("preview.gotoframe.dialog.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
if (ViewMessages.showConfirmDialog(this, gotoPanel, AppStrings.translate("preview.gotoframe.dialog.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) {
int frame = -1;
try {
frame = Integer.parseInt(frameField.getText());
@@ -469,7 +470,7 @@ public class PlayerControls extends JPanel implements MediaDisplayListener {
//handled as -1
}
if (frame <= 0 || frame > display.getTotalFrames()) {
View.showMessageDialog(this, AppStrings.translate("preview.gotoframe.dialog.frame.error").replace("%min%", "1").replace("%max%", "" + display.getTotalFrames()), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, AppStrings.translate("preview.gotoframe.dialog.frame.error").replace("%min%", "1").replace("%max%", "" + display.getTotalFrames()), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
return;
}
display.gotoFrame(frame - 1);

View File

@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.gui.GuiAbortRetryIgnoreHandler;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.MainFrame;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.utf8.Utf8InputStreamReader;
@@ -420,7 +421,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
try {
Files.copy(new File(r.targetFile).toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException ex) {
View.showMessageDialog(this, translate("error.save.as") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.save.as") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
}
} else {
@@ -492,7 +493,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
Files.copy(file.toPath(), new File(r.targetFile).toPath(), StandardCopyOption.REPLACE_EXISTING);
tableModel.fireTableCellUpdated(sel[0], 1/*size*/);
} catch (IOException ex) {
View.showMessageDialog(f, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(f, translate("error.replace") + "\r\n" + ex.getLocalizedMessage(), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
}
}
}
@@ -520,7 +521,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
int[] sel = getSelectedRows();
if (sel.length > 0) {
Replacement r = replacements.get(sel[0]);
String s = View.showInputDialog("URL", r.urlPattern);
String s = ViewMessages.showInputDialog(this, "URL", r.urlPattern);
if (s != null) {
r.urlPattern = s;
tableModel.setValueAt(s, sel[0], 2/*url*/);
@@ -575,7 +576,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen
} catch (NumberFormatException nfe) {
}
if ((port <= 0) || (port > 65535)) {
View.showMessageDialog(this, translate("error.port"), translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(this, translate("error.port"), translate("error"), JOptionPane.ERROR_MESSAGE);
started = false;
return;
}

View File

@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.MainPanel;
import com.jpexs.decompiler.flash.gui.ReplaceCharacterDialog;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.gui.abc.ClassesListTreeModel;
import com.jpexs.decompiler.flash.gui.action.AddScriptDialog;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
@@ -797,7 +798,7 @@ public class TagTreeContextMenu extends JPopupMenu {
SWF swf = itemr.getSwf();
CharacterTag characterTag = (CharacterTag) itemr;
int characterId = characterTag.getCharacterId();
ReplaceCharacterDialog replaceCharacterDialog = new ReplaceCharacterDialog();
ReplaceCharacterDialog replaceCharacterDialog = new ReplaceCharacterDialog(Main.getDefaultDialogsOwner());
if (replaceCharacterDialog.showDialog(swf, characterId) == AppDialog.OK_OPTION) {
int newCharacterId = replaceCharacterDialog.getCharacterId();
swf.replaceCharacterTags(characterTag, newCharacterId);
@@ -846,7 +847,7 @@ public class TagTreeContextMenu extends JPopupMenu {
String parts[];
loopinput:
while (true) {
className = View.showInputDialog(AppDialog.translateForDialog("classname", AddScriptDialog.class), className);
className = ViewMessages.showInputDialog(mainPanel, AppDialog.translateForDialog("classname", AddScriptDialog.class), className);
if (className == null || className.isEmpty()) {
return;
}
@@ -856,7 +857,7 @@ public class TagTreeContextMenu extends JPopupMenu {
DottedChain classNameDc = new DottedChain(parts, "");
for (ABCContainerTag ct : swf.getAbcList()) {
if (ct.getABC().findClassByName(classNameDc) > -1) {
View.showMessageDialog(mainPanel, AppDialog.translateForDialog("message.classexists", AddScriptDialog.class), mainPanel.translate("error"), JOptionPane.ERROR_MESSAGE);
ViewMessages.showMessageDialog(mainPanel, AppDialog.translateForDialog("message.classexists", AddScriptDialog.class), mainPanel.translate("error"), JOptionPane.ERROR_MESSAGE);
continue loopinput;
}
}
@@ -946,7 +947,7 @@ public class TagTreeContextMenu extends JPopupMenu {
FolderItem folder = (FolderItem) sel.get(0);
SWF swf = folder.getSwf();
AddScriptDialog addScriptDialog = new AddScriptDialog(swf);
AddScriptDialog addScriptDialog = new AddScriptDialog(Main.getDefaultDialogsOwner(), swf);
if (addScriptDialog.showDialog() == JOptionPane.OK_OPTION) {
if ((addScriptDialog.getScriptType() == AddScriptDialog.TYPE_FRAME)
|| (addScriptDialog.getScriptType() == AddScriptDialog.TYPE_SPRITE_FRAME)) {
@@ -1475,7 +1476,7 @@ public class TagTreeContextMenu extends JPopupMenu {
confirmationMessage = mainPanel.translate("message.confirm.removemultiple" + (removeDependencies ? "" : ".nodep")).replace("%count%", Integer.toString(tagsToRemove.size() + itemsToRemove.size() + itemCountFix));
}
if (View.showConfirmDialog(this, confirmationMessage, mainPanel.translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
if (ViewMessages.showConfirmDialog(mainPanel, confirmationMessage, mainPanel.translate("message.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
if (mainPanel.folderPreviewPanel.selectedItems.isEmpty()) {
tagTree.clearSelection();
}