diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java index c817ff5e7..19706b6f1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/annotations/Multiline.java @@ -16,10 +16,17 @@ */ package com.jpexs.decompiler.flash.types.annotations; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + /** * The String field can have large multiline text * * @author JPEXS */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) public @interface Multiline { } diff --git a/src/com/jpexs/browsers/cache/chrome/ChromeCache.java b/src/com/jpexs/browsers/cache/chrome/ChromeCache.java index 0ed9efb1c..f0ab181c7 100644 --- a/src/com/jpexs/browsers/cache/chrome/ChromeCache.java +++ b/src/com/jpexs/browsers/cache/chrome/ChromeCache.java @@ -54,7 +54,11 @@ public class ChromeCache implements CacheImplementation { public static ChromeCache getInstance() { if (instance == null) { - instance = new ChromeCache(); + synchronized (ChromeCache.class) { + if (instance == null) { + instance = new ChromeCache(); + } + } } return instance; } diff --git a/src/com/jpexs/browsers/cache/firefox/FirefoxCache.java b/src/com/jpexs/browsers/cache/firefox/FirefoxCache.java index a68fb6b9f..ec8e281ef 100644 --- a/src/com/jpexs/browsers/cache/firefox/FirefoxCache.java +++ b/src/com/jpexs/browsers/cache/firefox/FirefoxCache.java @@ -40,7 +40,11 @@ public class FirefoxCache implements CacheImplementation { public static FirefoxCache getInstance() { if (instance == null) { - instance = new FirefoxCache(); + synchronized (FirefoxCache.class) { + if (instance == null) { + instance = new FirefoxCache(); + } + } } return instance; } diff --git a/src/com/jpexs/decompiler/flash/gui/FontFace.java b/src/com/jpexs/decompiler/flash/gui/FontFace.java index 37bf4ba60..4e04cb993 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontFace.java +++ b/src/com/jpexs/decompiler/flash/gui/FontFace.java @@ -60,10 +60,7 @@ public class FontFace implements Comparable { return false; } final FontFace other = (FontFace) obj; - if (!Objects.equals(this.font, other.font)) { - return false; - } - return true; + return Objects.equals(this.font, other.font); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/FontFamily.java b/src/com/jpexs/decompiler/flash/gui/FontFamily.java index f5a3c3418..50a0a35b2 100644 --- a/src/com/jpexs/decompiler/flash/gui/FontFamily.java +++ b/src/com/jpexs/decompiler/flash/gui/FontFamily.java @@ -60,10 +60,7 @@ public class FontFamily implements Comparable { return false; } final FontFamily other = (FontFamily) obj; - if (!Objects.equals(this.familyEn, other.familyEn)) { - return false; - } - return true; + return Objects.equals(this.familyEn, other.familyEn); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java index 16814dc64..4bfc17504 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagPanel.java @@ -291,11 +291,9 @@ public class GenericTagPanel extends JPanel implements ChangeListener { try { //If countField exists, decrement, otherwise do nothing Field countField = obj.getClass().getDeclaredField(swfType.countField()); - if (countField != null) { - int cnt = countField.getInt(obj); - cnt--; - countField.setInt(obj, cnt); - } + int cnt = countField.getInt(obj); + cnt--; + countField.setInt(obj, cnt); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { //ignored } @@ -343,11 +341,9 @@ public class GenericTagPanel extends JPanel implements ChangeListener { try { //If countField exists, increment, otherwise do nothing Field countField = obj.getClass().getDeclaredField(swfType.countField()); - if (countField != null) { - int cnt = countField.getInt(obj); - cnt++; - countField.setInt(obj, cnt); - } + int cnt = countField.getInt(obj); + cnt++; + countField.setInt(obj, cnt); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { //ignored } diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index f0cba06bb..e1780ce00 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -129,7 +129,7 @@ public class GenericTagTreePanel extends GenericTagPanel { try { type = ReflectionTools.getValue(obj, field, index).getClass(); } catch (IllegalArgumentException | IllegalAccessException ex) { - ex.printStackTrace(); + Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, "Fixing characters order failed, recursion detected."); return null; } SWFType swfType = field.getAnnotation(SWFType.class); @@ -197,7 +197,7 @@ public class GenericTagTreePanel extends GenericTagPanel { Object obj = path.getLastPathComponent(); boolean ret = super.isCellEditable(e) - && path != null && (tree.getModel().isLeaf(obj)); + && tree.getModel().isLeaf(obj); return ret; } @@ -320,8 +320,8 @@ public class GenericTagTreePanel extends GenericTagPanel { } } } - } else if (e.getClickCount() == 2) { - //myDoubleClick(selRow, selPath); + //} else if (e.getClickCount() == 2) { + // myDoubleClick(selRow, selPath); } } } @@ -479,10 +479,7 @@ public class GenericTagTreePanel extends GenericTagPanel { if (!Objects.equals(this.field, other.field)) { return false; } - if (this.index != other.index) { - return false; - } - return true; + return this.index == other.index; } } @@ -797,7 +794,7 @@ public class GenericTagTreePanel extends GenericTagPanel { if (value instanceof Boolean) { fieldMap.put(sf, (Boolean) value); } else if (value instanceof Integer) { - int intValue = (int) value; + int intValue = (Integer) value; boolean found = false; for (int i : cond.options()) { if (i == intValue) { @@ -866,11 +863,9 @@ public class GenericTagTreePanel extends GenericTagPanel { try { //If countField exists, increment, otherwise do nothing Field countField = obj.getClass().getDeclaredField(swfArray.countField()); - if (countField != null) { - int cnt = countField.getInt(obj); - cnt++; - countField.setInt(obj, cnt); - } + int cnt = countField.getInt(obj); + cnt++; + countField.setInt(obj, cnt); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { //ignored } @@ -903,11 +898,9 @@ public class GenericTagTreePanel extends GenericTagPanel { try { //If countField exists, decrement, otherwise do nothing Field countField = obj.getClass().getDeclaredField(swfArray.countField()); - if (countField != null) { - int cnt = countField.getInt(obj); - cnt--; - countField.setInt(obj, cnt); - } + int cnt = countField.getInt(obj); + cnt--; + countField.setInt(obj, cnt); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { //ignored } diff --git a/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java b/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java index 5951f8376..9fa6f3ccd 100644 --- a/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java +++ b/src/com/jpexs/decompiler/flash/gui/LicenseUpdater.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 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 . */ @@ -65,8 +65,8 @@ public class LicenseUpdater { You should have received a copy of the GNU Lesser General Public License along with this library. - - + + */ int defaultStartYear = 2010; int defaultFinalYear = 2015; @@ -137,11 +137,8 @@ public class LicenseUpdater { } catch (IOException ex) { } - FileOutputStream fos; - try { - fos = new FileOutputStream(f); + try (FileOutputStream fos = new FileOutputStream(f)) { fos.write(baos.toByteArray()); - fos.close(); } catch (IOException ex) { } } diff --git a/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java b/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java index b2fd89948..b5c98c52d 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadingPanel.java @@ -135,7 +135,7 @@ public class LoadingPanel extends JPanel { g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - AffineTransform t = AffineTransform.getRotateInstance(getRotation(), size / 2, size / 2); + AffineTransform t = AffineTransform.getRotateInstance(getRotation(), size / 2.0, size / 2.0); g2.setTransform(t); g2.drawImage(lastImage, 0, 0, this); } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index fcfbce222..a356b7f70 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -107,11 +107,11 @@ import javax.swing.filechooser.FileFilter; */ public class Main { - public static ProxyFrame proxyFrame; + protected static ProxyFrame proxyFrame; private static List sourceInfos = new ArrayList<>(); - public static LoadingDialog loadingDialog; + protected static LoadingDialog loadingDialog; public static ModeFrame modeFrame; @@ -127,9 +127,9 @@ public class Main { public static final int UPDATE_SYSTEM_MINOR = 2; - public static LoadFromMemoryFrame loadFromMemoryFrame; + private static LoadFromMemoryFrame loadFromMemoryFrame; - public static LoadFromCacheFrame loadFromCacheFrame; + private static LoadFromCacheFrame loadFromCacheFrame; private static final Logger logger = Logger.getLogger(Main.class.getName()); @@ -171,12 +171,18 @@ public class Main { public static void ensureMainFrame() { if (mainFrame == null) { - if (Configuration.useRibbonInterface.get()) { - mainFrame = new MainFrameRibbon(); - } else { - mainFrame = new MainFrameClassic(); + synchronized (Main.class) { + if (mainFrame == null) { + MainFrame frame; + if (Configuration.useRibbonInterface.get()) { + frame = new MainFrameRibbon(); + } else { + frame = new MainFrameClassic(); + } + frame.getPanel().setErrorState(ErrorLogFrame.getInstance().getErrorState()); + mainFrame = frame; + } } - mainFrame.getPanel().setErrorState(ErrorLogFrame.getInstance().getErrorState()); } } @@ -1277,8 +1283,13 @@ public class Main { private static void initDebugger() { if (debugger == null) { - debugger = new Debugger(Configuration.debuggerPort.get()); - debugger.start(); + synchronized (Main.class) { + if (debugger == null) { + Debugger dbg = new Debugger(Configuration.debuggerPort.get()); + dbg.start(); + debugger = dbg; + } + } } } @@ -1467,10 +1478,13 @@ public class Main { public static void clearLogFile() { Logger logger = Logger.getLogger(""); - if (fileTxt != null) { - fileTxt.flush(); - fileTxt.close(); + + FileHandler oldFileTxt = fileTxt; + fileTxt = null; + if (oldFileTxt != null) { logger.removeHandler(fileTxt); + oldFileTxt.flush(); + oldFileTxt.close(); } String fileName; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 62d6e7dc0..f456d51b6 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -572,7 +572,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec @Override public void propertyChange(PropertyChangeEvent pce) { if (splitsInited) { - Configuration.guiSplitPane1DividerLocation.set((int) pce.getNewValue()); + Configuration.guiSplitPane1DividerLocation.set((Integer) pce.getNewValue()); } } }); @@ -581,7 +581,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec @Override public void propertyChange(PropertyChangeEvent pce) { if (detailPanel.isVisible()) { - Configuration.guiSplitPane2DividerLocation.set((int) pce.getNewValue()); + Configuration.guiSplitPane2DividerLocation.set((Integer) pce.getNewValue()); } } }); @@ -2368,9 +2368,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec preferScript = true; } - if (flashPanel != null) { - //flashPanel.specialPlayback = false; - } + //if (flashPanel != null) { + // flashPanel.specialPlayback = false; + //} folderPreviewPanel.setItems(new ArrayList()); previewPanel.clear(); stopFlashPlayer(); diff --git a/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java b/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java index 15bcc0bce..c81cd27a2 100644 --- a/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java +++ b/src/com/jpexs/decompiler/flash/gui/MyProgressBarUI.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 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 . */ @@ -38,9 +38,9 @@ public class MyProgressBarUI extends SubstanceProgressBarUI { public void stateChanged(ChangeEvent e) { SubstanceCoreUtilities.testComponentStateChangeThreadingViolation(progressBar); - if (displayTimeline != null) { //Main Change - this should be first - //displayTimeline.abort(); - } + //if (displayTimeline != null) { //Main Change - this should be first + // displayTimeline.abort(); + //} int currValue = progressBar.getValue(); int span = progressBar.getMaximum() - progressBar.getMinimum(); @@ -69,12 +69,12 @@ public class MyProgressBarUI extends SubstanceProgressBarUI { displayTimeline);*/ boolean isInCellRenderer = (SwingUtilities.getAncestorOfClass( CellRendererPane.class, progressBar) != null); - if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) { - displayTimeline.play(); - } else { - displayedValue = currValue; - progressBar.repaint(); - } + //if (false) {//currValue > 0 && !isInCellRenderer && Math.abs(pixelDelta) > 5) { + // displayTimeline.play(); + //} else { + displayedValue = currValue; + progressBar.repaint(); + //} } } diff --git a/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java b/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java index b27d093be..c8a7c84c4 100644 --- a/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java +++ b/src/com/jpexs/decompiler/flash/gui/MyRibbonApplicationMenuButtonUI.java @@ -177,11 +177,10 @@ public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuB if (regular == null) { return; } - if (regular != null) { - Graphics2D g2d = (Graphics2D) g.create(); - regular.paintIcon(this.applicationMenuButton, g2d, 0, 0); - g2d.dispose(); - } + + Graphics2D g2d = (Graphics2D) g.create(); + regular.paintIcon(this.applicationMenuButton, g2d, 0, 0); + g2d.dispose(); } /* diff --git a/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java b/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java index 390b079f7..db41baeed 100644 --- a/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/NewVersionDialog.java @@ -101,9 +101,11 @@ public class NewVersionDialog extends AppDialog implements ActionListener { } changesText.setContentType("text/html"); changesText.setText("" + changesStr + ""); - JLabel newAvailableLabel = new JLabel("
" + translate("newversionavailable") + " " + latestVersion.appName + " " + translate("version") + " " + latestVersion.versionName + "
", SwingConstants.CENTER); - newAvailableLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); - cnt.add(newAvailableLabel); + if (latestVersion != null) { + JLabel newAvailableLabel = new JLabel("
" + translate("newversionavailable") + " " + latestVersion.appName + " " + translate("version") + " " + latestVersion.versionName + "
", SwingConstants.CENTER); + newAvailableLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); + cnt.add(newAvailableLabel); + } JLabel changeslogLabel = new JLabel("" + translate("changeslog") + ""); changeslogLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 03d47c21c..34f8365ce 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -194,7 +194,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { @Override public void propertyChange(PropertyChangeEvent pce) { if (splitsInited && getRightComponent().isVisible()) { - Configuration.guiPreviewSplitPaneDividerLocation.set((int) pce.getNewValue()); + Configuration.guiPreviewSplitPaneDividerLocation.set((Integer) pce.getNewValue()); } } }); @@ -894,9 +894,9 @@ public class PreviewPanel extends JSplitPane implements ActionListener { new ShowFrameTag(swf).writeTag(sos2); new ShowFrameTag(swf).writeTag(sos2); - if (flashPanel != null) { - //flashPanel.specialPlayback = true; - } + //if (flashPanel != null) { + // flashPanel.specialPlayback = true; + //} } else if (tagObj instanceof DefineVideoStreamTag) { new PlaceObject2Tag(swf, false, false, false, false, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null).writeTag(sos2); diff --git a/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java b/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java index fd92b9f04..eaf42bfb8 100644 --- a/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/SelectLanguageDialog.java @@ -46,7 +46,7 @@ public class SelectLanguageDialog extends AppDialog implements ActionListener { public String languageCode = null; - public static final String[] languages = new String[]{"en", "ca", "cs", "zh", "de", "es", "fr", "hu", "nl", "pl", "pt", "pt-BR", "ru", "sv", "uk"}; + protected static final String[] languages = new String[]{"en", "ca", "cs", "zh", "de", "es", "fr", "hu", "nl", "pl", "pt", "pt-BR", "ru", "sv", "uk"}; public SelectLanguageDialog() { setSize(350, 130); diff --git a/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java b/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java index 66ab30ccf..bdd1bf524 100644 --- a/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java +++ b/src/com/jpexs/decompiler/flash/gui/SoundTagPlayer.java @@ -223,7 +223,7 @@ public class SoundTagPlayer implements MediaDisplay { if (active) { clip.stop(); } - clip.setMicrosecondPosition(frame * FRAME_DIVISOR); + clip.setMicrosecondPosition((long) frame * FRAME_DIVISOR); if (active) { clip.start(); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index e240d47b2..5f37f494d 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -182,7 +182,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL } } - public synchronized void setClassIndex(int classIndex) { + public void setClassIndex(int classIndex) { this.classIndex = classIndex; } @@ -529,16 +529,15 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL Highlighting tm = Highlighting.searchPos(methodHighlights, pos); if (tm != null) { String name = ""; - if (abc != null) { - if (classIndex > -1) { - name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, false); - } + if (classIndex > -1) { + name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, false); } + Trait currentTrait = null; currentTraitHighlight = Highlighting.searchPos(traitHighlights, pos); if (currentTraitHighlight != null) { lastTraitIndex = (int) currentTraitHighlight.getProperties().index; - if ((abc != null) && (classIndex != -1)) { + if (classIndex != -1) { currentTrait = getCurrentTrait(); isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex); if (currentTrait != null) { @@ -579,13 +578,11 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL currentMethodHighlight = null; String name = ""; currentTrait = null; - if (abc != null) { - name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, false); - currentTrait = getCurrentTrait(); - isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex); - if (currentTrait != null) { - name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList(), false); - } + name = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc.constants, false); + currentTrait = getCurrentTrait(); + isStatic = abc.isStaticTraitId(classIndex, lastTraitIndex); + if (currentTrait != null) { + name += ":" + currentTrait.getName(abc).getName(abc.constants, new ArrayList(), false); } displayMethod(pos, abc.findMethodIdByTraitId(classIndex, lastTraitIndex), name, currentTrait, isStatic); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java index 2d78094ca..126f8cdf7 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/MethodTraitDetailPanel.java @@ -38,11 +38,7 @@ public class MethodTraitDetailPanel extends JPanel implements TraitDetail { @Override public boolean save() { - if (!methodCodePanel.save()) { - return false; - } - - return true; + return methodCodePanel.save(); } @Override diff --git a/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java b/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java index a297d8dbf..dfd41d6f5 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java @@ -17,12 +17,10 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.tags.ABCContainerTag; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; -import java.util.List; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.event.ListSelectionEvent; @@ -68,10 +66,6 @@ public class TraitsList extends JList implements ListSelectionListener { setClassIndex(-1, -1); } - private List getAbcTags() { - return abc == null ? null : abc.getSwf().getAbcList(); - } - public void setClassIndex(int classIndex, int scriptIndex) { if (classIndex >= abc.instance_info.size()) { return; @@ -80,9 +74,7 @@ public class TraitsList extends JList implements ListSelectionListener { if (classIndex == -1) { setModel(new DefaultListModel<>()); } else { - if (abc != null) { - setModel(new TraitsListModel(abc, classIndex, scriptIndex, sorted)); - } + setModel(new TraitsListModel(abc, classIndex, scriptIndex, sorted)); } } diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index 92234c2f8..63cab323e 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -597,7 +597,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { - Configuration.guiActionSplitPaneDividerLocation.set((int) pce.getNewValue()); + Configuration.guiActionSplitPaneDividerLocation.set((Integer) pce.getNewValue()); } }); diff --git a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java index 26c019281..779c435cf 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java +++ b/src/com/jpexs/decompiler/flash/gui/player/PlayerControls.java @@ -138,10 +138,11 @@ public class PlayerControls extends JPanel implements ActionListener { private static Font notUnderlinedFont = null; static { - notUnderlinedFont = new JLabel().getFont(); + Font font = new JLabel().getFont(); + notUnderlinedFont = font; Map fontAttributes = new HashMap<>(); fontAttributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); - underlinedFont = notUnderlinedFont.deriveFont(fontAttributes); + underlinedFont = font.deriveFont(fontAttributes); } public PlayerControls(final MainPanel mainPanel, MediaDisplay display) { diff --git a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index 61ddfe8e0..8772f6640 100644 --- a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -491,13 +491,6 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe Replacement r = replacements.get(sel[0]); JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(Configuration.lastOpenDir.get())); - String n = r.urlPattern; - if (n.contains("?")) { - n = n.substring(0, n.indexOf('?')); - } - if (n.contains("/")) { - n = n.substring(n.lastIndexOf('/')); - } String ext = ".swf"; final String extension = ext; FileFilter swfFilter = new FileFilter() { diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java index 9fc3d98b8..c02c44df1 100644 --- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java @@ -43,31 +43,31 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe private final Timeline timeLine; - public static Color motionTweenColor = new Color(0x59, 0xfe, 0x7c); + public static final Color motionTweenColor = new Color(0x59, 0xfe, 0x7c); - public static Color shapeTweenColor = new Color(0xd1, 0xac, 0xf1); + public static final Color shapeTweenColor = new Color(0xd1, 0xac, 0xf1); - public static Color frameColor = new Color(0xbd, 0xd8, 0xfc); + public static final Color frameColor = new Color(0xbd, 0xd8, 0xfc); - public static Color emptyFrameColor = Color.white; + public static final Color emptyFrameColor = Color.white; - public static Color emptyFrameSecondColor = new Color(0xea, 0xf2, 0xfc); + public static final Color emptyFrameSecondColor = new Color(0xea, 0xf2, 0xfc); - public static Color borderColor = Color.black; + public static final Color borderColor = Color.black; - public static Color emptyBorderColor = new Color(0xbd, 0xd8, 0xfc); + public static final Color emptyBorderColor = new Color(0xbd, 0xd8, 0xfc); - public static Color keyColor = Color.black; + public static final Color keyColor = Color.black; - public static Color aColor = Color.black; + public static final Color aColor = Color.black; - public static Color stopColor = Color.white; + public static final Color stopColor = Color.white; - public static Color stopBorderColor = Color.black; + public static final Color stopBorderColor = Color.black; - public static Color borderLinesColor = new Color(0xde, 0xde, 0xde); + public static final Color borderLinesColor = new Color(0xde, 0xde, 0xde); - public static Color selectedColor = new Color(113, 174, 235); + public static final Color selectedColor = new Color(113, 174, 235); public static final int borderLinesLength = 2; diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java index 854bee3b9..5348cb883 100644 --- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java @@ -44,11 +44,11 @@ public class TimelinePanel extends JPanel { public static final int FRAME_HEIGHT = 18; - public static Color selectedColor = new Color(0xff, 0x99, 0x99); + public static final Color selectedColor = new Color(0xff, 0x99, 0x99); - public static Color selectedBorderColor = new Color(0xcc, 0, 0); + public static final Color selectedBorderColor = new Color(0xcc, 0, 0); - public static Color backgroundColor = new Color(0xd9, 0xe7, 0xfa); + public static final Color backgroundColor = new Color(0xd9, 0xe7, 0xfa); public Timeline getTimeline() { return timeline;