diff --git a/src/com/jpexs/decompiler/flash/SWF.java b/src/com/jpexs/decompiler/flash/SWF.java
index 8c506fe0e..7e66be9de 100644
--- a/src/com/jpexs/decompiler/flash/SWF.java
+++ b/src/com/jpexs/decompiler/flash/SWF.java
@@ -90,7 +90,6 @@ import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
import com.jpexs.decompiler.flash.tags.Tag;
-import com.jpexs.decompiler.flash.tags.TagStub;
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
diff --git a/src/com/jpexs/decompiler/flash/SWFInputStream.java b/src/com/jpexs/decompiler/flash/SWFInputStream.java
index c64e28281..9bcd950f9 100644
--- a/src/com/jpexs/decompiler/flash/SWFInputStream.java
+++ b/src/com/jpexs/decompiler/flash/SWFInputStream.java
@@ -269,7 +269,6 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/src/com/jpexs/decompiler/flash/SWFLimitedInputStream.java b/src/com/jpexs/decompiler/flash/SWFLimitedInputStream.java
index 190ae9bba..2cc2db392 100644
--- a/src/com/jpexs/decompiler/flash/SWFLimitedInputStream.java
+++ b/src/com/jpexs/decompiler/flash/SWFLimitedInputStream.java
@@ -16,9 +16,6 @@
*/
package com.jpexs.decompiler.flash;
-import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
-import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
-import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.types.BUTTONCONDACTION;
diff --git a/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java b/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
index 93920670c..7cd58a207 100644
--- a/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
+++ b/src/com/jpexs/decompiler/flash/abc/usages/ConstVarMultinameUsage.java
@@ -1,83 +1,81 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.abc.usages;
-
-import com.jpexs.decompiler.flash.abc.ABC;
-import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
-import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
-import com.jpexs.decompiler.flash.abc.types.traits.Traits;
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
-import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
-import com.jpexs.decompiler.flash.helpers.NulWriter;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author JPEXS
- */
-public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
-
- public ConstVarMultinameUsage(List abcTags, ABC abc, int multinameIndex, int classIndex, int traitIndex, boolean isStatic, Traits traits, int parentTraitIndex) {
- super(abcTags,abc,multinameIndex, classIndex, traitIndex, isStatic, traits, parentTraitIndex);
- }
-
- @Override
- public String toString() {
- NulWriter nulWriter = new NulWriter();
- if (parentTraitIndex > -1) {
- if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
- } else {
- ((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
- }
- }
- try {
- ((TraitSlotConst) traits.traits.get(traitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
- } catch (InterruptedException ex) {
- //ignore
- }
-
- HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
- writer.appendNoHilight(super.toString() + " ");
- if (parentTraitIndex > -1) {
- if (isStatic) {
- ((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
- } else {
- ((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
- }
- }
- try {
- ((TraitSlotConst) traits.traits.get(traitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
- } catch (InterruptedException ex) {
- //ignore
- }
- return writer.toString();
- }
-
- public int getTraitIndex() {
- return traitIndex;
- }
-
- public boolean isStatic() {
- return isStatic;
- }
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.abc.usages;
+
+import com.jpexs.decompiler.flash.abc.ABC;
+import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
+import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst;
+import com.jpexs.decompiler.flash.abc.types.traits.Traits;
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
+import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
+import com.jpexs.decompiler.flash.helpers.NulWriter;
+import com.jpexs.decompiler.flash.tags.ABCContainerTag;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author JPEXS
+ */
+public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
+
+ public ConstVarMultinameUsage(List abcTags, ABC abc, int multinameIndex, int classIndex, int traitIndex, boolean isStatic, Traits traits, int parentTraitIndex) {
+ super(abcTags,abc,multinameIndex, classIndex, traitIndex, isStatic, traits, parentTraitIndex);
+ }
+
+ @Override
+ public String toString() {
+ NulWriter nulWriter = new NulWriter();
+ if (parentTraitIndex > -1) {
+ if (isStatic) {
+ ((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ } else {
+ ((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ }
+ }
+ try {
+ ((TraitSlotConst) traits.traits.get(traitIndex)).convertHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList(), false);
+ } catch (InterruptedException ex) {
+ //ignore
+ }
+
+ HilightedTextWriter writer = new HilightedTextWriter(Configuration.getCodeFormatting(), false);
+ writer.appendNoHilight(super.toString() + " ");
+ if (parentTraitIndex > -1) {
+ if (isStatic) {
+ ((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ } else {
+ ((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ }
+ }
+ try {
+ ((TraitSlotConst) traits.traits.get(traitIndex)).toStringHeader(null, "", abcTags, abc, isStatic, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList(), false);
+ } catch (InterruptedException ex) {
+ //ignore
+ }
+ return writer.toString();
+ }
+
+ public int getTraitIndex() {
+ return traitIndex;
+ }
+
+ public boolean isStatic() {
+ return isStatic;
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
index ed4f38d8b..05ae8a0e0 100644
--- a/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
+++ b/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java
@@ -34,7 +34,6 @@ import com.jpexs.decompiler.flash.helpers.HilightedTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.helpers.Helper;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/src/com/jpexs/decompiler/flash/configuration/Configuration.java
index c7735f398..ddb5cbd17 100644
--- a/src/com/jpexs/decompiler/flash/configuration/Configuration.java
+++ b/src/com/jpexs/decompiler/flash/configuration/Configuration.java
@@ -26,7 +26,6 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
diff --git a/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java b/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java
index e5f668791..dee2f5aeb 100644
--- a/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java
+++ b/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java
@@ -30,7 +30,6 @@ import com.jpexs.decompiler.flash.flv.VIDEODATA;
import com.jpexs.decompiler.flash.tags.DefineVideoStreamTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
diff --git a/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java b/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java
index 9c95d31b5..ffc33a24d 100644
--- a/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java
+++ b/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java
@@ -31,7 +31,6 @@ import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag;
import com.jpexs.decompiler.flash.tags.base.SoundTag;
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java
index ce3da41aa..84695aa67 100644
--- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java
+++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbon.java
@@ -1,230 +1,228 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Window;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowStateListener;
-import java.util.List;
-import javax.swing.JFrame;
-import org.pushingpixels.flamingo.api.ribbon.JRibbon;
-import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
-
-/**
- *
- * @author JPEXS
- */
-public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame {
-
- public MainPanel panel;
- private MainFrameMenu mainMenu;
-
- public MainFrameRibbon() {
- super();
-
- FlashPlayerPanel flashPanel = null;
- try {
- flashPanel = new FlashPlayerPanel(this);
- } catch (FlashUnsupportedException fue) {
- }
-
- Container cnt = getContentPane();
- cnt.setLayout(new BorderLayout());
- JRibbon ribbon = getRibbon();
- cnt.add(ribbon, BorderLayout.NORTH);
-
- boolean externalFlashPlayerUnavailable = flashPanel == null;
- mainMenu = new MainFrameRibbonMenu(this, ribbon, externalFlashPlayerUnavailable);
-
- panel = new MainPanel(this, mainMenu, flashPanel);
- panel.setBackground(Color.yellow);
- cnt.add(panel, BorderLayout.CENTER);
-
- int w = Configuration.guiWindowWidth.get();
- int h = Configuration.guiWindowHeight.get();
- Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
- if (w > dim.width) {
- w = dim.width;
- }
- if (h > dim.height) {
- h = dim.height;
- }
- setSize(w, h);
-
- boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get();
- boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get();
-
- int state = 0;
- if (maximizedHorizontal) {
- state |= JFrame.MAXIMIZED_HORIZ;
- }
- if (maximizedVertical) {
- state |= JFrame.MAXIMIZED_VERT;
- }
- setExtendedState(state);
-
- View.setWindowIcon(this);
- addWindowStateListener(new WindowStateListener() {
- @Override
- public void windowStateChanged(WindowEvent e) {
- int state = e.getNewState();
- Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ);
- Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT);
- }
- });
- addComponentListener(new ComponentAdapter() {
- @Override
- public void componentResized(ComponentEvent e) {
- int state = getExtendedState();
- if ((state & JFrame.MAXIMIZED_HORIZ) == 0) {
- Configuration.guiWindowWidth.set(getWidth());
- }
- if ((state & JFrame.MAXIMIZED_VERT) == 0) {
- Configuration.guiWindowHeight.set(getHeight());
- }
- }
- });
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
- Main.exit();
- }
- });
-
- View.centerScreen(this);
-
-
- }
-
- private static void getApplicationMenuButtons(Component comp, List ret) {
- if (comp instanceof JRibbonApplicationMenuButton) {
- ret.add((JRibbonApplicationMenuButton) comp);
- return;
- }
- if (comp instanceof java.awt.Container) {
- java.awt.Container cont = (java.awt.Container) comp;
- for (int i = 0; i < cont.getComponentCount(); i++) {
- getApplicationMenuButtons(cont.getComponent(i), ret);
- }
- }
- }
-
- @Override
- public void setVisible(boolean b) {
- super.setVisible(b);
-
- /* final MainFrameRibbon t = this;
-
- //TODO: Handle this better. This is awful :-(
- new Timer().schedule(new TimerTask() {
- @Override
- public void run() {
- List mbuttons = new ArrayList<>();
- getApplicationMenuButtons(t, mbuttons);
- if (mbuttons.size() < 2) {
- //return, task will run again
- return;
- }
-
- for (final JRibbonApplicationMenuButton mbutton : mbuttons) {
- mbutton.setIcon(View.getResizableIcon("buttonicon_256"));
- mbutton.setDisplayState(new CommandButtonDisplayState(
- "My Ribbon Application Menu Button", mbutton.getSize().width) {
- @Override
- public CommandButtonLayoutManager createLayoutManager(
- AbstractCommandButton commandButton) {
- return new CommandButtonLayoutManager() {
- @Override
- public int getPreferredIconSize() {
- return mbutton.getSize().width;
- }
-
- @Override
- public CommandButtonLayoutManager.CommandButtonLayoutInfo getLayoutInfo(
- AbstractCommandButton commandButton, Graphics g) {
- CommandButtonLayoutManager.CommandButtonLayoutInfo result = new CommandButtonLayoutManager.CommandButtonLayoutInfo();
- result.actionClickArea = new Rectangle(0, 0, 0, 0);
- result.popupClickArea = new Rectangle(0, 0, commandButton
- .getWidth(), commandButton.getHeight());
- result.popupActionRect = new Rectangle(0, 0, 0, 0);
- ResizableIcon icon = commandButton.getIcon();
- icon.setDimension(new Dimension(commandButton.getWidth(), commandButton.getHeight()));
- result.iconRect = new Rectangle(
- 0,
- 0,
- commandButton.getWidth(), commandButton.getHeight());
- result.isTextInActionArea = false;
- return result;
- }
-
- @Override
- public Dimension getPreferredSize(
- AbstractCommandButton commandButton) {
- return new Dimension(40, 40);
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- }
-
- @Override
- public Point getKeyTipAnchorCenterPoint(
- AbstractCommandButton commandButton) {
- // dead center
- return new Point(commandButton.getWidth() / 2,
- commandButton.getHeight() / 2);
- }
- };
- }
- });
-
- MyRibbonApplicationMenuButtonUI mui = (MyRibbonApplicationMenuButtonUI) mbutton.getUI();
- mui.setHoverIcon(View.getResizableIcon("buttonicon_hover_256"));
- mui.setNormalIcon(View.getResizableIcon("buttonicon_256"));
- mui.setClickIcon(View.getResizableIcon("buttonicon_down_256"));
- mbutton.repaint();
- }
- cancel(); //cancel task so it does not run again
- }
- }, 1, 50);*/
- panel.setVisible(b);
- }
-
- @Override
- public MainPanel getPanel() {
- return panel;
- }
-
- @Override
- public Window getWindow() {
- return this;
- }
-
-
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Window;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowStateListener;
+import java.util.List;
+import javax.swing.JFrame;
+import org.pushingpixels.flamingo.api.ribbon.JRibbon;
+import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
+
+/**
+ *
+ * @author JPEXS
+ */
+public final class MainFrameRibbon extends AppRibbonFrame implements MainFrame {
+
+ public MainPanel panel;
+ private MainFrameMenu mainMenu;
+
+ public MainFrameRibbon() {
+ super();
+
+ FlashPlayerPanel flashPanel = null;
+ try {
+ flashPanel = new FlashPlayerPanel(this);
+ } catch (FlashUnsupportedException fue) {
+ }
+
+ Container cnt = getContentPane();
+ cnt.setLayout(new BorderLayout());
+ JRibbon ribbon = getRibbon();
+ cnt.add(ribbon, BorderLayout.NORTH);
+
+ boolean externalFlashPlayerUnavailable = flashPanel == null;
+ mainMenu = new MainFrameRibbonMenu(this, ribbon, externalFlashPlayerUnavailable);
+
+ panel = new MainPanel(this, mainMenu, flashPanel);
+ panel.setBackground(Color.yellow);
+ cnt.add(panel, BorderLayout.CENTER);
+
+ int w = Configuration.guiWindowWidth.get();
+ int h = Configuration.guiWindowHeight.get();
+ Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
+ if (w > dim.width) {
+ w = dim.width;
+ }
+ if (h > dim.height) {
+ h = dim.height;
+ }
+ setSize(w, h);
+
+ boolean maximizedHorizontal = Configuration.guiWindowMaximizedHorizontal.get();
+ boolean maximizedVertical = Configuration.guiWindowMaximizedVertical.get();
+
+ int state = 0;
+ if (maximizedHorizontal) {
+ state |= JFrame.MAXIMIZED_HORIZ;
+ }
+ if (maximizedVertical) {
+ state |= JFrame.MAXIMIZED_VERT;
+ }
+ setExtendedState(state);
+
+ View.setWindowIcon(this);
+ addWindowStateListener(new WindowStateListener() {
+ @Override
+ public void windowStateChanged(WindowEvent e) {
+ int state = e.getNewState();
+ Configuration.guiWindowMaximizedHorizontal.set((state & JFrame.MAXIMIZED_HORIZ) == JFrame.MAXIMIZED_HORIZ);
+ Configuration.guiWindowMaximizedVertical.set((state & JFrame.MAXIMIZED_VERT) == JFrame.MAXIMIZED_VERT);
+ }
+ });
+ addComponentListener(new ComponentAdapter() {
+ @Override
+ public void componentResized(ComponentEvent e) {
+ int state = getExtendedState();
+ if ((state & JFrame.MAXIMIZED_HORIZ) == 0) {
+ Configuration.guiWindowWidth.set(getWidth());
+ }
+ if ((state & JFrame.MAXIMIZED_VERT) == 0) {
+ Configuration.guiWindowHeight.set(getHeight());
+ }
+ }
+ });
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ Main.exit();
+ }
+ });
+
+ View.centerScreen(this);
+
+
+ }
+
+ private static void getApplicationMenuButtons(Component comp, List ret) {
+ if (comp instanceof JRibbonApplicationMenuButton) {
+ ret.add((JRibbonApplicationMenuButton) comp);
+ return;
+ }
+ if (comp instanceof java.awt.Container) {
+ java.awt.Container cont = (java.awt.Container) comp;
+ for (int i = 0; i < cont.getComponentCount(); i++) {
+ getApplicationMenuButtons(cont.getComponent(i), ret);
+ }
+ }
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ super.setVisible(b);
+
+ /* final MainFrameRibbon t = this;
+
+ //TODO: Handle this better. This is awful :-(
+ new Timer().schedule(new TimerTask() {
+ @Override
+ public void run() {
+ List mbuttons = new ArrayList<>();
+ getApplicationMenuButtons(t, mbuttons);
+ if (mbuttons.size() < 2) {
+ //return, task will run again
+ return;
+ }
+
+ for (final JRibbonApplicationMenuButton mbutton : mbuttons) {
+ mbutton.setIcon(View.getResizableIcon("buttonicon_256"));
+ mbutton.setDisplayState(new CommandButtonDisplayState(
+ "My Ribbon Application Menu Button", mbutton.getSize().width) {
+ @Override
+ public CommandButtonLayoutManager createLayoutManager(
+ AbstractCommandButton commandButton) {
+ return new CommandButtonLayoutManager() {
+ @Override
+ public int getPreferredIconSize() {
+ return mbutton.getSize().width;
+ }
+
+ @Override
+ public CommandButtonLayoutManager.CommandButtonLayoutInfo getLayoutInfo(
+ AbstractCommandButton commandButton, Graphics g) {
+ CommandButtonLayoutManager.CommandButtonLayoutInfo result = new CommandButtonLayoutManager.CommandButtonLayoutInfo();
+ result.actionClickArea = new Rectangle(0, 0, 0, 0);
+ result.popupClickArea = new Rectangle(0, 0, commandButton
+ .getWidth(), commandButton.getHeight());
+ result.popupActionRect = new Rectangle(0, 0, 0, 0);
+ ResizableIcon icon = commandButton.getIcon();
+ icon.setDimension(new Dimension(commandButton.getWidth(), commandButton.getHeight()));
+ result.iconRect = new Rectangle(
+ 0,
+ 0,
+ commandButton.getWidth(), commandButton.getHeight());
+ result.isTextInActionArea = false;
+ return result;
+ }
+
+ @Override
+ public Dimension getPreferredSize(
+ AbstractCommandButton commandButton) {
+ return new Dimension(40, 40);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ }
+
+ @Override
+ public Point getKeyTipAnchorCenterPoint(
+ AbstractCommandButton commandButton) {
+ // dead center
+ return new Point(commandButton.getWidth() / 2,
+ commandButton.getHeight() / 2);
+ }
+ };
+ }
+ });
+
+ MyRibbonApplicationMenuButtonUI mui = (MyRibbonApplicationMenuButtonUI) mbutton.getUI();
+ mui.setHoverIcon(View.getResizableIcon("buttonicon_hover_256"));
+ mui.setNormalIcon(View.getResizableIcon("buttonicon_256"));
+ mui.setClickIcon(View.getResizableIcon("buttonicon_down_256"));
+ mbutton.repaint();
+ }
+ cancel(); //cancel task so it does not run again
+ }
+ }, 1, 50);*/
+ panel.setVisible(b);
+ }
+
+ @Override
+ public MainPanel getPanel() {
+ return panel;
+ }
+
+ @Override
+ public Window getWindow() {
+ return this;
+ }
+
+
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
index c90141f7f..b95beb797 100644
--- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
+++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
@@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.console.ContextMenuTools;
import com.jpexs.decompiler.flash.gui.helpers.CheckResources;
import com.jpexs.decompiler.flash.gui.treenodes.SWFNode;
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.helpers.Cache;
import com.jpexs.helpers.utf8.Utf8Helper;
import com.jpexs.process.ProcessTools;
diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
index 9f0ad034e..5098d5b76 100644
--- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java
@@ -45,7 +45,6 @@ import com.jpexs.decompiler.flash.tags.VideoFrameTag;
import com.jpexs.decompiler.flash.tags.base.AloneTag;
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
-import com.jpexs.decompiler.flash.tags.base.Container;
import com.jpexs.decompiler.flash.tags.base.ContainerItem;
import com.jpexs.decompiler.flash.tags.base.FontTag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
diff --git a/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java b/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
index 08f918783..288b8b197 100644
--- a/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
@@ -1,271 +1,259 @@
-/*
- * Copyright (C) 2014 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 .
- */
-
-package com.jpexs.decompiler.flash.gui;
-
-import java.awt.Color;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Event;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.lang.ref.WeakReference;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-import javax.swing.border.BevelBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.JTextComponent;
-import jsyntaxpane.actions.DocumentSearchData;
-import jsyntaxpane.actions.gui.QuickFindDialog;
-import jsyntaxpane.components.Markers;
-
-/**
- *
- * @author JPEXS
- */
-public class QuickFindPanel extends JPanel implements ActionListener, jsyntaxpane.actions.QuickFindHandler {
- public JTextField findTextField;
- public JButton prevButton,nextButton;
- public JCheckBox ignoreCaseCheckbox,regExpCheckbox,wrapCheckbox;
- public JLabel statusLabel;
-
- private Markers.SimpleMarker marker = new Markers.SimpleMarker(Color.PINK);
- private WeakReference target;
- private WeakReference dsd;
- private int oldCaretPosition;
-
- public QuickFindPanel(){
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
-
-
- setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
-
- JPanel pan1 = new JPanel(new WrapLayout());
- JPanel pan2 = new JPanel(new WrapLayout());
- pan1.setAlignmentX(0);
- pan2.setAlignmentX(0);
- pan1.setAlignmentY(0);
- pan2.setAlignmentY(0);
-
-
- JLabel jLabel1 = new javax.swing.JLabel();
- findTextField = new javax.swing.JTextField();
- prevButton = new javax.swing.JButton();
- nextButton = new javax.swing.JButton();
- ignoreCaseCheckbox = new javax.swing.JCheckBox();
- regExpCheckbox = new javax.swing.JCheckBox();
- wrapCheckbox = new javax.swing.JCheckBox();
- statusLabel = new javax.swing.JLabel();
-
- setName("QuickFindDialog"); // NOI18N
-
-
- jLabel1.setLabelFor(findTextField);
- java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle"); // NOI18N
- jLabel1.setText(bundle.getString("QuickFindDialog.jLabel1.text")); // NOI18N
- pan1.add(jLabel1);
-
- findTextField.setColumns(30);
- findTextField.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
- findTextField.setMaximumSize(new java.awt.Dimension(200, 24));
- findTextField.setMinimumSize(new java.awt.Dimension(60, 24));
- pan1.add(findTextField);
-
- prevButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/META-INF/images/small-icons/go-up.png"))); // NOI18N
- prevButton.setFocusable(false);
- prevButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
- prevButton.setOpaque(false);
- prevButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- prevButton.setActionCommand("PREVIOUS");
- prevButton.addActionListener(this);
- pan1.add(prevButton);
-
- nextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/META-INF/images/small-icons/go-down.png"))); // NOI18N
- nextButton.setFocusable(false);
- nextButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
- nextButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
- nextButton.setOpaque(false);
- nextButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- nextButton.setActionCommand("NEXT");
- nextButton.addActionListener(this);
- pan1.add(nextButton);
-
- ignoreCaseCheckbox.setMnemonic('C');
- ignoreCaseCheckbox.setText(bundle.getString("QuickFindDialog.jChkIgnoreCase.text")); // NOI18N
- ignoreCaseCheckbox.setFocusable(false);
- ignoreCaseCheckbox.setOpaque(false);
- ignoreCaseCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- pan2.add(ignoreCaseCheckbox);
- ignoreCaseCheckbox.addActionListener(this);
-
- regExpCheckbox.setMnemonic('R');
- regExpCheckbox.setText(bundle.getString("QuickFindDialog.jChkRegExp.text")); // NOI18N
- regExpCheckbox.setFocusable(false);
- regExpCheckbox.setOpaque(false);
- regExpCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- pan2.add(regExpCheckbox);
- regExpCheckbox.addActionListener(this);
-
- wrapCheckbox.setMnemonic('W');
- wrapCheckbox.setText(bundle.getString("QuickFindDialog.jChkWrap.text")); // NOI18N
- wrapCheckbox.setFocusable(false);
- wrapCheckbox.setOpaque(false);
- wrapCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- pan2.add(wrapCheckbox);
- wrapCheckbox.addActionListener(this);
-
-
- statusLabel.setFont(statusLabel.getFont().deriveFont(statusLabel.getFont().getStyle() | java.awt.Font.BOLD, statusLabel.getFont().getSize()-2));
- statusLabel.setForeground(java.awt.Color.red);
- pan2.add(statusLabel);
-
- add(pan1);
- add(pan2);
- setPreferredSize(getMinimumSize());
- setVisible(false);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- switch(e.getActionCommand()){
- case "PREVIOUS":
- if (dsd.get().doFindPrev(target.get())) {
- statusLabel.setText(null);
- } else {
- statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
- }
- break;
- case "NEXT":
- if (dsd.get().doFindNext(target.get())) {
- statusLabel.setText(null);
- } else {
- statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
- }
- break;
- }
- }
-
-
-
- @Override
- public void showQuickFind(final JTextComponent t,DocumentSearchData ds) {
- dsd = new WeakReference(ds);
- oldCaretPosition = t.getCaretPosition();
- Container view = t.getParent();
- Dimension wd = getSize();
- wd.width = t.getVisibleRect().width;
- Point loc = new Point(0, view.getHeight());
- setSize(wd);
- SwingUtilities.convertPointToScreen(loc, view);
- setLocation(loc);
- findTextField.setFont(t.getFont());
- final DocumentListener dl;
- findTextField.getDocument().addDocumentListener(dl = new DocumentListener() {
-
- @Override
- public void insertUpdate(DocumentEvent e) {
- updateFind();
- }
-
- @Override
- public void removeUpdate(DocumentEvent e) {
- updateFind();
- }
-
- @Override
- public void changedUpdate(DocumentEvent e) {
- updateFind();
- }
-
- private void updateFind() {
- JTextComponent t = target.get();
- DocumentSearchData d = dsd.get();
- String toFind = findTextField.getText();
- if (toFind == null || toFind.isEmpty()) {
- statusLabel.setText(null);
- return;
- }
- try {
- d.setWrap(wrapCheckbox.isSelected());
- d.setPattern(toFind,
- regExpCheckbox.isSelected(),
- ignoreCaseCheckbox.isSelected());
- // The dsd doFindNext will always find from current pos,
- // so we need to relocate to our saved pos before we call doFindNext
- statusLabel.setText(null);
- t.setCaretPosition(oldCaretPosition);
- if (!d.doFindNext(t)) {
- statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
- } else {
- statusLabel.setText(null);
- }
- } catch (PatternSyntaxException e) {
- statusLabel.setText(e.getDescription());
- }
- }
- });
- this.target = new WeakReference<>(t);
- Pattern p = dsd.get().getPattern();
- if (p != null) {
- findTextField.setText(p.pattern());
- }
- wrapCheckbox.setSelected(dsd.get().isWrap());
-
-
- setVisible(true);
- getParent().revalidate();
- getParent().repaint();
- findTextField.requestFocusInWindow();
- }
-/*
- @Override
- public void focusGained(FocusEvent e) {
-
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- removeFocusListener(this);
- setVisible(false);
- getParent().revalidate();
- getParent().repaint();
- }*/
-
-
-
-
-}
+/*
+ * Copyright (C) 2014 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 .
+ */
+
+package com.jpexs.decompiler.flash.gui;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.lang.ref.WeakReference;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.border.BevelBorder;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.JTextComponent;
+import jsyntaxpane.actions.DocumentSearchData;
+import jsyntaxpane.components.Markers;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class QuickFindPanel extends JPanel implements ActionListener, jsyntaxpane.actions.QuickFindHandler {
+ public JTextField findTextField;
+ public JButton prevButton,nextButton;
+ public JCheckBox ignoreCaseCheckbox,regExpCheckbox,wrapCheckbox;
+ public JLabel statusLabel;
+
+ private Markers.SimpleMarker marker = new Markers.SimpleMarker(Color.PINK);
+ private WeakReference target;
+ private WeakReference dsd;
+ private int oldCaretPosition;
+
+ public QuickFindPanel(){
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+
+
+ setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
+
+ JPanel pan1 = new JPanel(new WrapLayout());
+ JPanel pan2 = new JPanel(new WrapLayout());
+ pan1.setAlignmentX(0);
+ pan2.setAlignmentX(0);
+ pan1.setAlignmentY(0);
+ pan2.setAlignmentY(0);
+
+
+ JLabel jLabel1 = new javax.swing.JLabel();
+ findTextField = new javax.swing.JTextField();
+ prevButton = new javax.swing.JButton();
+ nextButton = new javax.swing.JButton();
+ ignoreCaseCheckbox = new javax.swing.JCheckBox();
+ regExpCheckbox = new javax.swing.JCheckBox();
+ wrapCheckbox = new javax.swing.JCheckBox();
+ statusLabel = new javax.swing.JLabel();
+
+ setName("QuickFindDialog"); // NOI18N
+
+
+ jLabel1.setLabelFor(findTextField);
+ java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle"); // NOI18N
+ jLabel1.setText(bundle.getString("QuickFindDialog.jLabel1.text")); // NOI18N
+ pan1.add(jLabel1);
+
+ findTextField.setColumns(30);
+ findTextField.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ findTextField.setMaximumSize(new java.awt.Dimension(200, 24));
+ findTextField.setMinimumSize(new java.awt.Dimension(60, 24));
+ pan1.add(findTextField);
+
+ prevButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/META-INF/images/small-icons/go-up.png"))); // NOI18N
+ prevButton.setFocusable(false);
+ prevButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ prevButton.setOpaque(false);
+ prevButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ prevButton.setActionCommand("PREVIOUS");
+ prevButton.addActionListener(this);
+ pan1.add(prevButton);
+
+ nextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/META-INF/images/small-icons/go-down.png"))); // NOI18N
+ nextButton.setFocusable(false);
+ nextButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ nextButton.setMargin(new java.awt.Insets(2, 2, 2, 2));
+ nextButton.setOpaque(false);
+ nextButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ nextButton.setActionCommand("NEXT");
+ nextButton.addActionListener(this);
+ pan1.add(nextButton);
+
+ ignoreCaseCheckbox.setMnemonic('C');
+ ignoreCaseCheckbox.setText(bundle.getString("QuickFindDialog.jChkIgnoreCase.text")); // NOI18N
+ ignoreCaseCheckbox.setFocusable(false);
+ ignoreCaseCheckbox.setOpaque(false);
+ ignoreCaseCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ pan2.add(ignoreCaseCheckbox);
+ ignoreCaseCheckbox.addActionListener(this);
+
+ regExpCheckbox.setMnemonic('R');
+ regExpCheckbox.setText(bundle.getString("QuickFindDialog.jChkRegExp.text")); // NOI18N
+ regExpCheckbox.setFocusable(false);
+ regExpCheckbox.setOpaque(false);
+ regExpCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ pan2.add(regExpCheckbox);
+ regExpCheckbox.addActionListener(this);
+
+ wrapCheckbox.setMnemonic('W');
+ wrapCheckbox.setText(bundle.getString("QuickFindDialog.jChkWrap.text")); // NOI18N
+ wrapCheckbox.setFocusable(false);
+ wrapCheckbox.setOpaque(false);
+ wrapCheckbox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ pan2.add(wrapCheckbox);
+ wrapCheckbox.addActionListener(this);
+
+
+ statusLabel.setFont(statusLabel.getFont().deriveFont(statusLabel.getFont().getStyle() | java.awt.Font.BOLD, statusLabel.getFont().getSize()-2));
+ statusLabel.setForeground(java.awt.Color.red);
+ pan2.add(statusLabel);
+
+ add(pan1);
+ add(pan2);
+ setPreferredSize(getMinimumSize());
+ setVisible(false);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switch(e.getActionCommand()){
+ case "PREVIOUS":
+ if (dsd.get().doFindPrev(target.get())) {
+ statusLabel.setText(null);
+ } else {
+ statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
+ }
+ break;
+ case "NEXT":
+ if (dsd.get().doFindNext(target.get())) {
+ statusLabel.setText(null);
+ } else {
+ statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
+ }
+ break;
+ }
+ }
+
+
+
+ @Override
+ public void showQuickFind(final JTextComponent t,DocumentSearchData ds) {
+ dsd = new WeakReference(ds);
+ oldCaretPosition = t.getCaretPosition();
+ Container view = t.getParent();
+ Dimension wd = getSize();
+ wd.width = t.getVisibleRect().width;
+ Point loc = new Point(0, view.getHeight());
+ setSize(wd);
+ SwingUtilities.convertPointToScreen(loc, view);
+ setLocation(loc);
+ findTextField.setFont(t.getFont());
+ final DocumentListener dl;
+ findTextField.getDocument().addDocumentListener(dl = new DocumentListener() {
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ updateFind();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ updateFind();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ updateFind();
+ }
+
+ private void updateFind() {
+ JTextComponent t = target.get();
+ DocumentSearchData d = dsd.get();
+ String toFind = findTextField.getText();
+ if (toFind == null || toFind.isEmpty()) {
+ statusLabel.setText(null);
+ return;
+ }
+ try {
+ d.setWrap(wrapCheckbox.isSelected());
+ d.setPattern(toFind,
+ regExpCheckbox.isSelected(),
+ ignoreCaseCheckbox.isSelected());
+ // The dsd doFindNext will always find from current pos,
+ // so we need to relocate to our saved pos before we call doFindNext
+ statusLabel.setText(null);
+ t.setCaretPosition(oldCaretPosition);
+ if (!d.doFindNext(t)) {
+ statusLabel.setText(java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle").getString("QuickFindDialog.NotFound"));
+ } else {
+ statusLabel.setText(null);
+ }
+ } catch (PatternSyntaxException e) {
+ statusLabel.setText(e.getDescription());
+ }
+ }
+ });
+ this.target = new WeakReference<>(t);
+ Pattern p = dsd.get().getPattern();
+ if (p != null) {
+ findTextField.setText(p.pattern());
+ }
+ wrapCheckbox.setSelected(dsd.get().isWrap());
+
+
+ setVisible(true);
+ getParent().revalidate();
+ getParent().repaint();
+ findTextField.requestFocusInWindow();
+ }
+/*
+ @Override
+ public void focusGained(FocusEvent e) {
+
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ removeFocusListener(this);
+ setVisible(false);
+ getParent().revalidate();
+ getParent().repaint();
+ }*/
+
+
+
+
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java b/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java
index be67492b8..56ce1b0b7 100644
--- a/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java
+++ b/src/com/jpexs/decompiler/flash/gui/SearchResultsDialog.java
@@ -1,122 +1,123 @@
-/*
- * Copyright (C) 2014 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 .
- */
-
-package com.jpexs.decompiler.flash.gui;
-
-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.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.List;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
-
-/**
- *
- * @author JPEXS
- */
-public class SearchResultsDialog extends AppDialog implements ActionListener{
- private final JList resultsList;
- private final DefaultListModel model;
- private final SearchListener listener;
-
- static final String ACTION_GOTO = "GOTO";
- static final String ACTION_CANCEL = "CLOSE";
-
- private final JButton gotoButton = new JButton(translate("button.goto"));
- private final JButton closeButton = new JButton(translate("button.close"));
-
- public SearchResultsDialog(Window owner,String text,SearchListener listener) {
- super(owner);
- setTitle(translate("dialog.title").replace("%text%", text));
- Container cnt=getContentPane();
- model = new DefaultListModel<>();
- resultsList = new JList<>(model);
- this.listener = listener;
-
- gotoButton.setActionCommand(ACTION_GOTO);
- gotoButton.addActionListener(this);
- closeButton.setActionCommand(ACTION_CANCEL);
- closeButton.addActionListener(this);
- JPanel buttonsPanel = new JPanel();
- buttonsPanel.setLayout(new FlowLayout());
- buttonsPanel.add(gotoButton);
- buttonsPanel.add(closeButton);
- resultsList.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- gotoElement();
- }
- }
-
- });
-
- cnt.setLayout(new BorderLayout());
- JScrollPane sp = new JScrollPane(resultsList);
- sp.setPreferredSize(new Dimension(300,300));
- cnt.add(sp,BorderLayout.CENTER);
- cnt.add(buttonsPanel,BorderLayout.SOUTH);
- pack();
- View.centerScreen(this);
- View.setWindowIcon(this);
- }
-
- public void setResults(List results){
- model.clear();
- for(E e:results){
- model.addElement(e);
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- switch (e.getActionCommand()) {
- case ACTION_GOTO:
- gotoElement();
- setVisible(false);
- break;
- case ACTION_CANCEL:
- setVisible(false);
- break;
- }
- }
-
- private void gotoElement(){
- if (resultsList.getSelectedIndex() != -1) {
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
- listener.updateSearchPos(resultsList.getSelectedValue());
- }
-
- });
- }
- }
-
-}
+/*
+ * Copyright (C) 2014 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 .
+ */
+
+package com.jpexs.decompiler.flash.gui;
+
+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.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.List;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
+/**
+ *
+ * @author JPEXS
+ * @param
+ */
+public class SearchResultsDialog extends AppDialog implements ActionListener{
+ private final JList resultsList;
+ private final DefaultListModel model;
+ private final SearchListener listener;
+
+ static final String ACTION_GOTO = "GOTO";
+ static final String ACTION_CANCEL = "CLOSE";
+
+ private final JButton gotoButton = new JButton(translate("button.goto"));
+ private final JButton closeButton = new JButton(translate("button.close"));
+
+ public SearchResultsDialog(Window owner,String text,SearchListener listener) {
+ super(owner);
+ setTitle(translate("dialog.title").replace("%text%", text));
+ Container cnt=getContentPane();
+ model = new DefaultListModel<>();
+ resultsList = new JList<>(model);
+ this.listener = listener;
+
+ gotoButton.setActionCommand(ACTION_GOTO);
+ gotoButton.addActionListener(this);
+ closeButton.setActionCommand(ACTION_CANCEL);
+ closeButton.addActionListener(this);
+ JPanel buttonsPanel = new JPanel();
+ buttonsPanel.setLayout(new FlowLayout());
+ buttonsPanel.add(gotoButton);
+ buttonsPanel.add(closeButton);
+ resultsList.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ gotoElement();
+ }
+ }
+
+ });
+
+ cnt.setLayout(new BorderLayout());
+ JScrollPane sp = new JScrollPane(resultsList);
+ sp.setPreferredSize(new Dimension(300,300));
+ cnt.add(sp,BorderLayout.CENTER);
+ cnt.add(buttonsPanel,BorderLayout.SOUTH);
+ pack();
+ View.centerScreen(this);
+ View.setWindowIcon(this);
+ }
+
+ public void setResults(List results){
+ model.clear();
+ for(E e:results){
+ model.addElement(e);
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switch (e.getActionCommand()) {
+ case ACTION_GOTO:
+ gotoElement();
+ setVisible(false);
+ break;
+ case ACTION_CANCEL:
+ setVisible(false);
+ break;
+ }
+ }
+
+ private void gotoElement(){
+ if (resultsList.getSelectedIndex() != -1) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ listener.updateSearchPos(resultsList.getSelectedValue());
+ }
+
+ });
+ }
+ }
+
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
index 555297300..017a21654 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
@@ -43,7 +43,6 @@ import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.HeaderLabel;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.MainPanel;
-import com.jpexs.decompiler.flash.gui.QuickFindPanel;
import com.jpexs.decompiler.flash.gui.SearchListener;
import com.jpexs.decompiler.flash.gui.SearchPanel;
import com.jpexs.decompiler.flash.gui.SearchResultsDialog;
@@ -94,24 +93,17 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.ActionMap;
import javax.swing.BoxLayout;
-import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComboBox;
-import javax.swing.JEditorPane;
import javax.swing.JLabel;
-import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JToggleButton;
-import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
@@ -121,13 +113,8 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
-import javax.swing.text.DefaultEditorKit;
-import javax.swing.text.JTextComponent;
import javax.swing.tree.TreePath;
import jsyntaxpane.DefaultSyntaxKit;
-import jsyntaxpane.actions.DocumentSearchData;
-import jsyntaxpane.actions.QuickFindAction;
-import jsyntaxpane.actions.SyntaxAction;
public class ABCPanel extends JPanel implements ItemListener, ActionListener, SearchListener, Freed {
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
index c79ffe2ec..60977b51f 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java
@@ -1,187 +1,186 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui.abc;
-
-import com.jpexs.decompiler.flash.abc.ABC;
-import com.jpexs.decompiler.flash.abc.types.Multiname;
-import com.jpexs.decompiler.flash.abc.types.Namespace;
-import com.jpexs.decompiler.flash.abc.usages.InsideClassMultinameUsage;
-import com.jpexs.decompiler.flash.abc.usages.MethodMultinameUsage;
-import com.jpexs.decompiler.flash.abc.usages.MultinameUsage;
-import com.jpexs.decompiler.flash.abc.usages.TraitMultinameUsage;
-import com.jpexs.decompiler.flash.gui.AppDialog;
-import com.jpexs.decompiler.flash.gui.AppFrame;
-import com.jpexs.decompiler.flash.gui.View;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Container;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.List;
-import javax.swing.JButton;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-/**
- *
- * @author JPEXS
- */
-public class UsageFrame extends AppDialog implements ActionListener, MouseListener {
-
- static final String ACTION_GOTO = "GOTO";
- static final String ACTION_CANCEL = "CANCEL";
-
- private final JButton gotoButton = new JButton(translate("button.goto"));
- private final JButton cancelButton = new JButton(translate("button.cancel"));
- private final JList usageList;
- private final UsageListModel usageListModel;
- private final ABCPanel abcPanel;
-
- public UsageFrame(List abcTags, ABC abc, int multinameIndex, ABCPanel abcPanel, boolean definitions) {
- super(abcPanel.getMainPanel().getMainFrame().getWindow());
- this.abcPanel = abcPanel;
- List usages = definitions?abc.findMultinameDefinition(abcTags,multinameIndex):abc.findMultinameUsage(abcTags,multinameIndex);
- Multiname m = abc.constants.constant_multiname.get(multinameIndex);
- if(m.namespace_index>0 && abc.constants.constant_namespace.get(m.namespace_index).kind != Namespace.KIND_PRIVATE)
- {
- for(ABCContainerTag at:abcTags){
- ABC a = at.getABC();
- if(a == abc){
- continue;
- }
- int mid=a.constants.getMultinameId(m,false);
- if(mid>0){
- usages.addAll(definitions?a.findMultinameDefinition(abcTags, mid):a.findMultinameUsage(abcTags, mid));
- }
- }
- }
- usageListModel = new UsageListModel();
- for (MultinameUsage u : usages) {
- usageListModel.addElement(u);
- }
- usageList = new JList<>(usageListModel);
- usageList.setBackground(Color.white);
- gotoButton.setActionCommand(ACTION_GOTO);
- gotoButton.addActionListener(this);
- cancelButton.setActionCommand(ACTION_CANCEL);
- cancelButton.addActionListener(this);
- JPanel buttonsPanel = new JPanel();
- buttonsPanel.setLayout(new FlowLayout());
- buttonsPanel.add(gotoButton);
- buttonsPanel.add(cancelButton);
-
- usageList.addMouseListener(this);
- Container cont = getContentPane();
- cont.setLayout(new BorderLayout());
- cont.add(new JScrollPane(usageList), BorderLayout.CENTER);
- cont.add(buttonsPanel, BorderLayout.SOUTH);
- setSize(400, 300);
- setTitle((definitions?translate("dialog.title.declaration"):translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc.constants));
- View.centerScreen(this);
- View.setWindowIcon(this);
- }
-
- public static void gotoUsage(final ABCPanel abcPanel,final MultinameUsage usage){
- if (usage instanceof InsideClassMultinameUsage) {
- final InsideClassMultinameUsage icu = (InsideClassMultinameUsage) usage;
-
- Runnable settrait = new Runnable() {
-
- @Override
- public void run() {
- abcPanel.decompiledTextArea.removeScriptListener(this);
- abcPanel.decompiledTextArea.setClassIndex(icu.classIndex);
- if (usage instanceof TraitMultinameUsage) {
- TraitMultinameUsage tmu = (TraitMultinameUsage) usage;
- int traitIndex;
- if (tmu.parentTraitIndex > -1) {
- traitIndex = tmu.parentTraitIndex;
- } else {
- traitIndex = tmu.traitIndex;
- }
- if (!tmu.isStatic) {
- traitIndex += abcPanel.abc.class_info.get(tmu.classIndex).static_traits.traits.size();
- }
- if (tmu instanceof MethodMultinameUsage) {
- MethodMultinameUsage mmu = (MethodMultinameUsage) usage;
- if (mmu.isInitializer == true) {
- traitIndex = abcPanel.abc.class_info.get(mmu.classIndex).static_traits.traits.size() + abcPanel.abc.instance_info.get(mmu.classIndex).instance_traits.traits.size() + (mmu.isStatic ? 1 : 0);
- }
- }
- abcPanel.decompiledTextArea.gotoTrait(traitIndex);
- }
- }
- };
-
-
- if(abcPanel.decompiledTextArea.getClassIndex() == icu.classIndex && abcPanel.abc == icu.abc){
- settrait.run();
- }else{
- abcPanel.decompiledTextArea.addScriptListener(settrait);
- abcPanel.hilightScript(abcPanel.swf, abcPanel.abc.instance_info.get(icu.classIndex).getName(abcPanel.abc.constants).getNameWithNamespace(abcPanel.abc.constants));
- }
- }
- }
-
- private void gotoUsage() {
- if (usageList.getSelectedIndex() != -1) {
- MultinameUsage usage = usageListModel.getUsage(usageList.getSelectedIndex());
- gotoUsage(abcPanel,usage);
- }
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- switch (e.getActionCommand()) {
- case ACTION_GOTO:
- gotoUsage();
- setVisible(false);
- break;
- case ACTION_CANCEL:
- setVisible(false);
- break;
- }
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- gotoUsage();
- }
- }
-
- @Override
- public void mousePressed(MouseEvent e) {
- }
-
- @Override
- public void mouseReleased(MouseEvent e) {
- }
-
- @Override
- public void mouseEntered(MouseEvent e) {
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- }
-}
+/*
+ * Copyright (C) 2010-2014 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 .
+ */
+package com.jpexs.decompiler.flash.gui.abc;
+
+import com.jpexs.decompiler.flash.abc.ABC;
+import com.jpexs.decompiler.flash.abc.types.Multiname;
+import com.jpexs.decompiler.flash.abc.types.Namespace;
+import com.jpexs.decompiler.flash.abc.usages.InsideClassMultinameUsage;
+import com.jpexs.decompiler.flash.abc.usages.MethodMultinameUsage;
+import com.jpexs.decompiler.flash.abc.usages.MultinameUsage;
+import com.jpexs.decompiler.flash.abc.usages.TraitMultinameUsage;
+import com.jpexs.decompiler.flash.gui.AppDialog;
+import com.jpexs.decompiler.flash.gui.View;
+import com.jpexs.decompiler.flash.tags.ABCContainerTag;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.List;
+import javax.swing.JButton;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class UsageFrame extends AppDialog implements ActionListener, MouseListener {
+
+ static final String ACTION_GOTO = "GOTO";
+ static final String ACTION_CANCEL = "CANCEL";
+
+ private final JButton gotoButton = new JButton(translate("button.goto"));
+ private final JButton cancelButton = new JButton(translate("button.cancel"));
+ private final JList usageList;
+ private final UsageListModel usageListModel;
+ private final ABCPanel abcPanel;
+
+ public UsageFrame(List abcTags, ABC abc, int multinameIndex, ABCPanel abcPanel, boolean definitions) {
+ super(abcPanel.getMainPanel().getMainFrame().getWindow());
+ this.abcPanel = abcPanel;
+ List usages = definitions?abc.findMultinameDefinition(abcTags,multinameIndex):abc.findMultinameUsage(abcTags,multinameIndex);
+ Multiname m = abc.constants.constant_multiname.get(multinameIndex);
+ if(m.namespace_index>0 && abc.constants.constant_namespace.get(m.namespace_index).kind != Namespace.KIND_PRIVATE)
+ {
+ for(ABCContainerTag at:abcTags){
+ ABC a = at.getABC();
+ if(a == abc){
+ continue;
+ }
+ int mid=a.constants.getMultinameId(m,false);
+ if(mid>0){
+ usages.addAll(definitions?a.findMultinameDefinition(abcTags, mid):a.findMultinameUsage(abcTags, mid));
+ }
+ }
+ }
+ usageListModel = new UsageListModel();
+ for (MultinameUsage u : usages) {
+ usageListModel.addElement(u);
+ }
+ usageList = new JList<>(usageListModel);
+ usageList.setBackground(Color.white);
+ gotoButton.setActionCommand(ACTION_GOTO);
+ gotoButton.addActionListener(this);
+ cancelButton.setActionCommand(ACTION_CANCEL);
+ cancelButton.addActionListener(this);
+ JPanel buttonsPanel = new JPanel();
+ buttonsPanel.setLayout(new FlowLayout());
+ buttonsPanel.add(gotoButton);
+ buttonsPanel.add(cancelButton);
+
+ usageList.addMouseListener(this);
+ Container cont = getContentPane();
+ cont.setLayout(new BorderLayout());
+ cont.add(new JScrollPane(usageList), BorderLayout.CENTER);
+ cont.add(buttonsPanel, BorderLayout.SOUTH);
+ setSize(400, 300);
+ setTitle((definitions?translate("dialog.title.declaration"):translate("dialog.title")) + abc.constants.getMultiname(multinameIndex).getNameWithNamespace(abc.constants));
+ View.centerScreen(this);
+ View.setWindowIcon(this);
+ }
+
+ public static void gotoUsage(final ABCPanel abcPanel,final MultinameUsage usage){
+ if (usage instanceof InsideClassMultinameUsage) {
+ final InsideClassMultinameUsage icu = (InsideClassMultinameUsage) usage;
+
+ Runnable settrait = new Runnable() {
+
+ @Override
+ public void run() {
+ abcPanel.decompiledTextArea.removeScriptListener(this);
+ abcPanel.decompiledTextArea.setClassIndex(icu.classIndex);
+ if (usage instanceof TraitMultinameUsage) {
+ TraitMultinameUsage tmu = (TraitMultinameUsage) usage;
+ int traitIndex;
+ if (tmu.parentTraitIndex > -1) {
+ traitIndex = tmu.parentTraitIndex;
+ } else {
+ traitIndex = tmu.traitIndex;
+ }
+ if (!tmu.isStatic) {
+ traitIndex += abcPanel.abc.class_info.get(tmu.classIndex).static_traits.traits.size();
+ }
+ if (tmu instanceof MethodMultinameUsage) {
+ MethodMultinameUsage mmu = (MethodMultinameUsage) usage;
+ if (mmu.isInitializer == true) {
+ traitIndex = abcPanel.abc.class_info.get(mmu.classIndex).static_traits.traits.size() + abcPanel.abc.instance_info.get(mmu.classIndex).instance_traits.traits.size() + (mmu.isStatic ? 1 : 0);
+ }
+ }
+ abcPanel.decompiledTextArea.gotoTrait(traitIndex);
+ }
+ }
+ };
+
+
+ if(abcPanel.decompiledTextArea.getClassIndex() == icu.classIndex && abcPanel.abc == icu.abc){
+ settrait.run();
+ }else{
+ abcPanel.decompiledTextArea.addScriptListener(settrait);
+ abcPanel.hilightScript(abcPanel.swf, abcPanel.abc.instance_info.get(icu.classIndex).getName(abcPanel.abc.constants).getNameWithNamespace(abcPanel.abc.constants));
+ }
+ }
+ }
+
+ private void gotoUsage() {
+ if (usageList.getSelectedIndex() != -1) {
+ MultinameUsage usage = usageListModel.getUsage(usageList.getSelectedIndex());
+ gotoUsage(abcPanel,usage);
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switch (e.getActionCommand()) {
+ case ACTION_GOTO:
+ gotoUsage();
+ setVisible(false);
+ break;
+ case ACTION_CANCEL:
+ setVisible(false);
+ break;
+ }
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ gotoUsage();
+ }
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/UsageListModel.java b/src/com/jpexs/decompiler/flash/gui/abc/UsageListModel.java
index 439cfe145..3912d52aa 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/UsageListModel.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/UsageListModel.java
@@ -1,46 +1,41 @@
-/*
- * Copyright (C) 2010-2014 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 .
- */
-package com.jpexs.decompiler.flash.gui.abc;
-
-import com.jpexs.decompiler.flash.abc.ABC;
-import com.jpexs.decompiler.flash.abc.usages.MultinameUsage;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.DefaultListModel;
-
-/**
- *
- * @author JPEXS
- */
-public class UsageListModel extends DefaultListModel