From 763321feae62ec68427363c4e51145d4224a3057 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sun, 22 Dec 2013 21:43:40 +0100 Subject: [PATCH] Reload problem fixed --- .../com/jpexs/decompiler/flash/gui/Main.java | 4 ++- .../jpexs/decompiler/flash/gui/MainFrame.java | 26 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 73a3b9bb0..82b1db869 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -328,7 +328,9 @@ public class Main { public static boolean reloadSWFs() { CancellableWorker.cancelBackgroundThreads(); - mainFrame.closeAll(); + if (mainFrame != null) { + mainFrame.closeAll(); + } if (Main.sourceInfos.isEmpty()) { Cache.clearAll(); System.gc(); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java index dad95314f..a3531cf24 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrame.java @@ -215,6 +215,7 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T private DeobfuscationDialog deobfuscationDialog; public JTree tagTree; private FlashPlayerPanel flashPanel; + private JPanel contentPanel; private JPanel displayPanel; private ImagePanel imagePanel; private ImagePanel previewImagePanel; @@ -233,6 +234,8 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T private static final String CARDFONTPANEL = "Font card"; private static final String FLASH_VIEWER_CARD = "FLASHVIEWER"; private static final String INTERNAL_VIEWER_CARD = "INTERNALVIEWER"; + private static final String SPLIT_PANE1 = "SPLITPANE1"; + private static final String WELCOME_PANEL = "WELCOMEPANEL"; private LineMarkedEditorPane textValue; private JSplitPane splitPane1; private JSplitPane splitPane2; @@ -351,6 +354,8 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T allSelectedIsTag = false; break; } + } else { + allSelectedIsTag = false; } } @@ -896,6 +901,13 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T } }); + CardLayout cl3 = new CardLayout(); + contentPanel = new JPanel(cl3); + contentPanel.add(welcomePanel, WELCOME_PANEL); + contentPanel.add(splitPane1, SPLIT_PANE1); + cnt.add(contentPanel); + cl3.show(contentPanel, WELCOME_PANEL); + View.centerScreen(this); tagTree.addKeyListener(new KeyAdapter() { @Override @@ -974,9 +986,8 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T } if (isWelcomeScreen) { - java.awt.Container cnt = getContentPane(); - cnt.remove(welcomePanel); - cnt.add(splitPane1, BorderLayout.CENTER); + CardLayout cl = (CardLayout) (contentPanel.getLayout()); + cl.show(contentPanel, SPLIT_PANE1); isWelcomeScreen = false; } @@ -985,9 +996,8 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T private void updateUi() { if (!isWelcomeScreen) { - java.awt.Container cnt = getContentPane(); - cnt.remove(splitPane1); - cnt.add(welcomePanel, BorderLayout.CENTER); + CardLayout cl = (CardLayout) (contentPanel.getLayout()); + cl.show(contentPanel, WELCOME_PANEL); isWelcomeScreen = true; } @@ -1017,7 +1027,9 @@ public final class MainFrame extends AppRibbonFrame implements ActionListener, T if (abcPanel != null && abcPanel.swf == swf) { abcPanel.clearSwf(); } - actionPanel.clearSource(); + if (actionPanel != null) { + actionPanel.clearSource(); + } oldValue = null; updateUi(); updateTagTree();