versions) {
- setSize(new Dimension(500, 300));
- Container cnt = getContentPane();
- cnt.setLayout(new BoxLayout(cnt, BoxLayout.PAGE_AXIS));
- JEditorPane changesText = new JEditorPane();
- changesText.setEditable(false);
- changesText.setFont(UIManager.getFont("TextField.font"));
- String changesStr = "";
- SimpleDateFormat serverFormatter = new SimpleDateFormat("MM/dd/yyyy");
- DateFormat formatter;
- String customFormat = translate("customDateFormat");
- if (customFormat.equals("default")) {
- formatter = DateFormat.getDateInstance();
- } else {
- formatter = new SimpleDateFormat(customFormat);
- }
- boolean first = true;
- for (Version v : versions) {
- if (!first) {
- changesStr += "
";
- }
- first = false;
- changesStr += "" + translate("version") + " " + v.versionName + (v.nightly ? " nightly " + v.revision : "") + "
";
- String releaseDate = v.releaseDate;
- try {
- Date date = serverFormatter.parse(releaseDate);
- releaseDate = formatter.format(date);
- } catch (ParseException ex) {
- Logger.getLogger(NewVersionDialog.class.getName()).log(Level.SEVERE, null, ex);
- }
- changesStr += translate("releasedate") + " " + releaseDate;
- if (!v.changes.isEmpty()) {
- changesStr += "
";
- changesStr += "";
- for (String type : v.changes.keySet()) {
- changesStr += type + ":" + "
";
- for (String ch : v.changes.get(type)) {
- changesStr += " - " + ch + "
";
- }
- }
- changesStr += "";
- }
- }
- latestVersion = null;
- if (!versions.isEmpty()) {
- latestVersion = versions.get(0);
- }
- changesText.setContentType("text/html");
- changesText.setText("" + changesStr + "");
- JLabel newAvailableLabel = new JLabel("" + translate("newversionavailable") + " " + latestVersion.appName + " " + translate("version") + " " + latestVersion.versionName + (latestVersion.nightly ? " " + latestVersion.revision : "") + "", SwingConstants.CENTER);
- newAvailableLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
- cnt.add(newAvailableLabel);
-
- JLabel changeslogLabel = new JLabel("" + translate("changeslog") + "");
- changeslogLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
- cnt.add(changeslogLabel);
-
- JScrollPane span = new JScrollPane(changesText);
- span.setAlignmentX(JLabel.CENTER_ALIGNMENT);
- cnt.add(span);
- JPanel buttonsPanel = new JPanel(new FlowLayout());
- JButton buttonOk = new JButton(translate("button.ok"));
- buttonOk.setActionCommand(ACTION_OK);
- buttonOk.addActionListener(this);
-
- JButton buttonCancel = new JButton(translate("button.cancel"));
- buttonCancel.setActionCommand(ACTION_CANCEL);
- buttonCancel.addActionListener(this);
-
- buttonsPanel.add(buttonOk);
- buttonsPanel.add(buttonCancel);
- buttonsPanel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
-
- JLabel downloadNowLabel = new JLabel("" + translate("downloadnow") + "", SwingConstants.CENTER);
- downloadNowLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
- cnt.add(downloadNowLabel);
- cnt.add(buttonsPanel);
-
- setResizable(false);
- setTitle(translate("dialog.title"));
- this.getRootPane().setDefaultButton(buttonOk);
- View.centerScreen(this);
- setModalityType(ModalityType.APPLICATION_MODAL);
- changesText.setCaretPosition(0);
- View.setWindowIcon(this);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand() == ACTION_OK) {
- java.awt.Desktop desktop = null;
- if (java.awt.Desktop.isDesktopSupported()) {
- desktop = java.awt.Desktop.getDesktop();
- if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
- try {
- if (latestVersion.updateLink != null) {
- java.net.URI uri = new java.net.URI(latestVersion.updateLink);
- desktop.browse(uri);
- } else {
- java.net.URI uri = new java.net.URI(ApplicationInfo.updatePage);
- desktop.browse(uri);
- }
- Main.exit();
- } catch (URISyntaxException | IOException ex) {
- }
- } else {
- desktop = null;
- }
- }
- if (desktop == null) {
- View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.SHORT_APPLICATION_NAME).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", ApplicationInfo.PROJECT_PAGE), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
- }
- }
- setVisible(false);
- }
-}
+/*
+ * 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.ApplicationInfo;
+import com.jpexs.decompiler.flash.Version;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class NewVersionDialog extends AppDialog implements ActionListener {
+
+ static final String ACTION_OK = "OK";
+ static final String ACTION_CANCEL = "CANCEL";
+
+ Version latestVersion;
+
+ public NewVersionDialog(List versions) {
+ setSize(new Dimension(500, 300));
+ Container cnt = getContentPane();
+ cnt.setLayout(new BoxLayout(cnt, BoxLayout.PAGE_AXIS));
+ JEditorPane changesText = new JEditorPane();
+ changesText.setEditable(false);
+ changesText.setFont(UIManager.getFont("TextField.font"));
+ String changesStr = "";
+ SimpleDateFormat serverFormatter = new SimpleDateFormat("MM/dd/yyyy");
+ DateFormat formatter;
+ String customFormat = translate("customDateFormat");
+ if (customFormat.equals("default")) {
+ formatter = DateFormat.getDateInstance();
+ } else {
+ formatter = new SimpleDateFormat(customFormat);
+ }
+ boolean first = true;
+ for (Version v : versions) {
+ if (!first) {
+ changesStr += "
";
+ }
+ first = false;
+ changesStr += "" + translate("version") + " " + v.versionName + (v.nightly ? " nightly " + v.revision : "") + "
";
+ String releaseDate = v.releaseDate;
+ try {
+ Date date = serverFormatter.parse(releaseDate);
+ releaseDate = formatter.format(date);
+ } catch (ParseException ex) {
+ Logger.getLogger(NewVersionDialog.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ changesStr += translate("releasedate") + " " + releaseDate;
+ if (!v.changes.isEmpty()) {
+ changesStr += "
";
+ changesStr += "";
+ for (String type : v.changes.keySet()) {
+ changesStr += type + ":" + "
";
+ for (String ch : v.changes.get(type)) {
+ changesStr += " - " + ch + "
";
+ }
+ }
+ changesStr += "";
+ }
+ }
+ latestVersion = null;
+ if (!versions.isEmpty()) {
+ latestVersion = versions.get(0);
+ }
+ changesText.setContentType("text/html");
+ changesText.setText("" + changesStr + "");
+ JLabel newAvailableLabel = new JLabel("" + translate("newversionavailable") + " " + latestVersion.appName + " " + translate("version") + " " + latestVersion.versionName + (latestVersion.nightly ? " " + latestVersion.revision : "") + "", SwingConstants.CENTER);
+ newAvailableLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+ cnt.add(newAvailableLabel);
+
+ JLabel changeslogLabel = new JLabel("" + translate("changeslog") + "");
+ changeslogLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+ cnt.add(changeslogLabel);
+
+ JScrollPane span = new JScrollPane(changesText);
+ span.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+ cnt.add(span);
+ JPanel buttonsPanel = new JPanel(new FlowLayout());
+ JButton buttonOk = new JButton(translate("button.ok"));
+ buttonOk.setActionCommand(ACTION_OK);
+ buttonOk.addActionListener(this);
+
+ JButton buttonCancel = new JButton(translate("button.cancel"));
+ buttonCancel.setActionCommand(ACTION_CANCEL);
+ buttonCancel.addActionListener(this);
+
+ buttonsPanel.add(buttonOk);
+ buttonsPanel.add(buttonCancel);
+ buttonsPanel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+
+ JLabel downloadNowLabel = new JLabel("" + translate("downloadnow") + "", SwingConstants.CENTER);
+ downloadNowLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+ cnt.add(downloadNowLabel);
+ cnt.add(buttonsPanel);
+
+ setResizable(false);
+ setTitle(translate("dialog.title"));
+ this.getRootPane().setDefaultButton(buttonOk);
+ View.centerScreen(this);
+ setModalityType(ModalityType.APPLICATION_MODAL);
+ changesText.setCaretPosition(0);
+ View.setWindowIcon(this);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand() == ACTION_OK) {
+ String url;
+ if (latestVersion.updateLink != null) {
+ url = latestVersion.updateLink;
+ } else {
+ url = ApplicationInfo.updatePage;
+ }
+ if (View.navigateUrl(url)) {
+ Main.exit();
+ } else {
+ View.showMessageDialog(null, translate("newvermessage").replace("%oldAppName%", ApplicationInfo.SHORT_APPLICATION_NAME).replace("%newAppName%", latestVersion.appName).replace("%projectPage%", ApplicationInfo.PROJECT_PAGE), translate("newversion"), JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+ setVisible(false);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java b/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
index 22a76611b..e89cb1dd6 100644
--- a/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/QuickFindPanel.java
@@ -23,6 +23,7 @@ import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.ref.WeakReference;
+import java.util.ResourceBundle;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.swing.BorderFactory;
@@ -80,7 +81,7 @@ public class QuickFindPanel extends JPanel implements ActionListener {
setName("QuickFindDialog"); // NOI18N
jLabel1.setLabelFor(findTextField);
- java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("jsyntaxpane/Bundle"); // NOI18N
+ ResourceBundle bundle = ResourceBundle.getBundle("jsyntaxpane/Bundle"); // NOI18N
jLabel1.setText(bundle.getString("QuickFindDialog.jLabel1.text")); // NOI18N
pan1.add(jLabel1);
diff --git a/src/com/jpexs/decompiler/flash/gui/SearchDialog.java b/src/com/jpexs/decompiler/flash/gui/SearchDialog.java
index 092e68bc2..65a4b6822 100644
--- a/src/com/jpexs/decompiler/flash/gui/SearchDialog.java
+++ b/src/com/jpexs/decompiler/flash/gui/SearchDialog.java
@@ -1,133 +1,134 @@
-/*
- * 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 java.awt.Container;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Image;
-import java.awt.Window;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JTextField;
-
-/**
- *
- * @author JPEXS
- */
-public class SearchDialog extends AppDialog implements ActionListener {
-
- static final String ACTION_OK = "OK";
- static final String ACTION_CANCEL = "CANCEL";
-
- public JTextField searchField = new MyTextField();
- public JCheckBox ignoreCaseCheckBox = new JCheckBox(translate("checkbox.ignorecase"));
- public JCheckBox regexpCheckBox = new JCheckBox(translate("checkbox.regexp"));
- public JRadioButton searchInASRadioButton = new JRadioButton(translate("checkbox.searchAS"));
- public JRadioButton searchInTextsRadioButton = new JRadioButton(translate("checkbox.searchText"));
- public boolean result = false;
-
- public SearchDialog(Window owner) {
- super(owner);
- setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
- Container cnt = getContentPane();
- setSize(400, 150);
- cnt.setLayout(new BoxLayout(cnt, BoxLayout.PAGE_AXIS));
- JPanel panButtons = new JPanel(new FlowLayout());
- JButton okButton = new JButton(translate("button.ok"));
- okButton.setActionCommand(ACTION_OK);
- okButton.addActionListener(this);
- JButton cancelButton = new JButton(translate("button.cancel"));
- cancelButton.setActionCommand(ACTION_CANCEL);
- cancelButton.addActionListener(this);
- panButtons.add(okButton);
- panButtons.add(cancelButton);
- JPanel panField = new JPanel(new FlowLayout());
- searchField.setPreferredSize(new Dimension(250, searchField.getPreferredSize().height));
- panField.add(new JLabel(translate("label.searchtext")));
- panField.add(searchField);
- cnt.add(panField);
-
- JPanel checkPanel = new JPanel(new FlowLayout());
- checkPanel.add(ignoreCaseCheckBox);
- checkPanel.add(regexpCheckBox);
- cnt.add(checkPanel);
-
- ButtonGroup group = new ButtonGroup();
- group.add(searchInASRadioButton);
- group.add(searchInTextsRadioButton);
-
- JPanel rbPanel = new JPanel(new FlowLayout());
- searchInASRadioButton.setSelected(true);
- searchInTextsRadioButton.setSelected(false);
- rbPanel.add(searchInASRadioButton);
- rbPanel.add(searchInTextsRadioButton);
- cnt.add(rbPanel);
-
- cnt.add(panButtons);
- getRootPane().setDefaultButton(okButton);
- View.centerScreen(this);
- //View.setWindowIcon(this);
- setIconImage(View.loadImage("search16"));
- setTitle(translate("dialog.title"));
- setModalityType(ModalityType.APPLICATION_MODAL);
- pack();
- java.util.List images = new ArrayList<>();
- images.add(View.loadImage("search16"));
- images.add(View.loadImage("search32"));
- setIconImages(images);
- }
-
- @Override
- public void setVisible(boolean b) {
- if (b) {
- result = false;
- searchField.requestFocusInWindow();
- }
- super.setVisible(b);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand() == ACTION_OK) {
- if (regexpCheckBox.isSelected()) {
- try {
- Pattern pat = Pattern.compile(searchField.getText());
- } catch (PatternSyntaxException ex) {
- View.showMessageDialog(null, translate("error.invalidregexp"), translate("error"), JOptionPane.ERROR_MESSAGE);
- return;
- }
- }
- result = true;
- } else {
- result = false;
- }
- setVisible(false);
- }
-}
+/*
+ * 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 java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Image;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class SearchDialog extends AppDialog implements ActionListener {
+
+ static final String ACTION_OK = "OK";
+ static final String ACTION_CANCEL = "CANCEL";
+
+ public JTextField searchField = new MyTextField();
+ public JCheckBox ignoreCaseCheckBox = new JCheckBox(translate("checkbox.ignorecase"));
+ public JCheckBox regexpCheckBox = new JCheckBox(translate("checkbox.regexp"));
+ public JRadioButton searchInASRadioButton = new JRadioButton(translate("checkbox.searchAS"));
+ public JRadioButton searchInTextsRadioButton = new JRadioButton(translate("checkbox.searchText"));
+ public boolean result = false;
+
+ public SearchDialog(Window owner) {
+ super(owner);
+ setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+ Container cnt = getContentPane();
+ setSize(400, 150);
+ cnt.setLayout(new BoxLayout(cnt, BoxLayout.PAGE_AXIS));
+ JPanel panButtons = new JPanel(new FlowLayout());
+ JButton okButton = new JButton(translate("button.ok"));
+ okButton.setActionCommand(ACTION_OK);
+ okButton.addActionListener(this);
+ JButton cancelButton = new JButton(translate("button.cancel"));
+ cancelButton.setActionCommand(ACTION_CANCEL);
+ cancelButton.addActionListener(this);
+ panButtons.add(okButton);
+ panButtons.add(cancelButton);
+ JPanel panField = new JPanel(new FlowLayout());
+ searchField.setPreferredSize(new Dimension(250, searchField.getPreferredSize().height));
+ panField.add(new JLabel(translate("label.searchtext")));
+ panField.add(searchField);
+ cnt.add(panField);
+
+ JPanel checkPanel = new JPanel(new FlowLayout());
+ checkPanel.add(ignoreCaseCheckBox);
+ checkPanel.add(regexpCheckBox);
+ cnt.add(checkPanel);
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(searchInASRadioButton);
+ group.add(searchInTextsRadioButton);
+
+ JPanel rbPanel = new JPanel(new FlowLayout());
+ searchInASRadioButton.setSelected(true);
+ searchInTextsRadioButton.setSelected(false);
+ rbPanel.add(searchInASRadioButton);
+ rbPanel.add(searchInTextsRadioButton);
+ cnt.add(rbPanel);
+
+ cnt.add(panButtons);
+ getRootPane().setDefaultButton(okButton);
+ View.centerScreen(this);
+ //View.setWindowIcon(this);
+ setIconImage(View.loadImage("search16"));
+ setTitle(translate("dialog.title"));
+ setModalityType(ModalityType.APPLICATION_MODAL);
+ pack();
+ List images = new ArrayList<>();
+ images.add(View.loadImage("search16"));
+ images.add(View.loadImage("search32"));
+ setIconImages(images);
+ }
+
+ @Override
+ public void setVisible(boolean b) {
+ if (b) {
+ result = false;
+ searchField.requestFocusInWindow();
+ }
+ super.setVisible(b);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand() == ACTION_OK) {
+ if (regexpCheckBox.isSelected()) {
+ try {
+ Pattern pat = Pattern.compile(searchField.getText());
+ } catch (PatternSyntaxException ex) {
+ View.showMessageDialog(null, translate("error.invalidregexp"), translate("error"), JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ }
+ result = true;
+ } else {
+ result = false;
+ }
+ setVisible(false);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java
index 3df20b3bf..52323a5d3 100644
--- a/src/com/jpexs/decompiler/flash/gui/View.java
+++ b/src/com/jpexs/decompiler/flash/gui/View.java
@@ -17,9 +17,11 @@
package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.configuration.ConfigurationItem;
+import com.jpexs.helpers.Helper;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
@@ -35,6 +37,9 @@ import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
@@ -233,7 +238,7 @@ public class View {
* @return loaded Image
*/
public static BufferedImage loadImage(String name) {
- java.net.URL imageURL = View.class.getResource("/com/jpexs/decompiler/flash/gui/graphics/" + name + ".png");
+ URL imageURL = View.class.getResource("/com/jpexs/decompiler/flash/gui/graphics/" + name + ".png");
try {
return ImageIO.read(imageURL);
} catch (IOException ex) {
@@ -247,7 +252,7 @@ public class View {
* @param f Frame to set icon in
*/
public static void setWindowIcon(Window f) {
- java.util.List images = new ArrayList<>();
+ List images = new ArrayList<>();
images.add(loadImage("icon16"));
images.add(loadImage("icon32"));
images.add(loadImage("icon48"));
@@ -519,4 +524,22 @@ public class View {
JMenuItem findUsagesMenu = new JMenuItem(a);
pmenu.add(findUsagesMenu);
}
+
+ public static boolean navigateUrl(String url) {
+ if (Desktop.isDesktopSupported()) {
+ Desktop desktop = Desktop.getDesktop();
+ if (desktop.isSupported(Desktop.Action.BROWSE)) {
+ try {
+ URI uri = new URI(url);
+ desktop.browse(uri);
+ return true;
+ } catch (URISyntaxException | IOException ex) {
+ Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+
+ return false;
+ }
}
+
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
index 6720ff4f7..eee52ffbc 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java
@@ -85,7 +85,6 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@@ -758,19 +757,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se
if (swc == null) {
if (View.showConfirmDialog(this, AppStrings.translate("message.action.playerglobal.needed").replace("%adobehomepage%", adobePage), AppStrings.translate("message.action.playerglobal.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.OK_OPTION) {
- java.awt.Desktop desktop = null;
- if (java.awt.Desktop.isDesktopSupported()) {
- desktop = java.awt.Desktop.getDesktop();
- if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
- try {
- java.net.URI uri = new java.net.URI(adobePage);
- desktop.browse(uri);
- } catch (URISyntaxException | IOException ex) {
- }
- } else {
- desktop = null;
- }
- }
+ View.navigateUrl(adobePage);
int ret = 0;
do {
diff --git a/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java b/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java
index 55ea4a62a..9e70a375b 100644
--- a/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java
+++ b/src/com/jpexs/decompiler/flash/gui/abc/IconListRenderer.java
@@ -1,72 +1,73 @@
-/*
- * 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.gui.View;
-import java.awt.Component;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JList;
-
-public class IconListRenderer extends DefaultListCellRenderer {
-
- private final Icon constIcon;
- private final Icon functionIcon;
- private final Icon variableIcon;
-
- private Icon loadIcon(String path) {
- ClassLoader cldr = this.getClass().getClassLoader();
- java.net.URL imageURL = cldr.getResource(path);
- return new ImageIcon(imageURL);
- }
-
- public IconListRenderer() {
- constIcon = View.getIcon("constant");
- functionIcon = View.getIcon("function");
- variableIcon = View.getIcon("variable");
- }
-
- @Override
- public Component getListCellRendererComponent(
- JList list, Object value, int index,
- boolean isSelected, boolean cellHasFocus) {
-
- // Get the renderer component from parent class
- JLabel label
- = (JLabel) super.getListCellRendererComponent(list,
- value, index, isSelected, cellHasFocus);
-
- // Get icon to use for the list item value
- TraitsListItem tli = (TraitsListItem) value;
-
- if (tli.getType() == TraitsListItem.Type.CONST) {
- label.setIcon(constIcon);
- }
- if (tli.getType() == TraitsListItem.Type.VAR) {
- label.setIcon(variableIcon);
- }
- if (tli.getType() == TraitsListItem.Type.METHOD) {
- label.setIcon(functionIcon);
- }
- if (tli.getType() == TraitsListItem.Type.INITIALIZER) {
- label.setIcon(functionIcon);
- }
- return label;
- }
-}
+/*
+ * 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.gui.View;
+import java.awt.Component;
+import java.net.URL;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+
+public class IconListRenderer extends DefaultListCellRenderer {
+
+ private final Icon constIcon;
+ private final Icon functionIcon;
+ private final Icon variableIcon;
+
+ private Icon loadIcon(String path) {
+ ClassLoader cldr = this.getClass().getClassLoader();
+ URL imageURL = cldr.getResource(path);
+ return new ImageIcon(imageURL);
+ }
+
+ public IconListRenderer() {
+ constIcon = View.getIcon("constant");
+ functionIcon = View.getIcon("function");
+ variableIcon = View.getIcon("variable");
+ }
+
+ @Override
+ public Component getListCellRendererComponent(
+ JList list, Object value, int index,
+ boolean isSelected, boolean cellHasFocus) {
+
+ // Get the renderer component from parent class
+ JLabel label
+ = (JLabel) super.getListCellRendererComponent(list,
+ value, index, isSelected, cellHasFocus);
+
+ // Get icon to use for the list item value
+ TraitsListItem tli = (TraitsListItem) value;
+
+ if (tli.getType() == TraitsListItem.Type.CONST) {
+ label.setIcon(constIcon);
+ }
+ if (tli.getType() == TraitsListItem.Type.VAR) {
+ label.setIcon(variableIcon);
+ }
+ if (tli.getType() == TraitsListItem.Type.METHOD) {
+ label.setIcon(functionIcon);
+ }
+ if (tli.getType() == TraitsListItem.Type.INITIALIZER) {
+ label.setIcon(functionIcon);
+ }
+ return label;
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
index 5d1305b17..a3439c8a0 100644
--- a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
+++ b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java
@@ -43,6 +43,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BoxLayout;
@@ -182,7 +183,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
setVisible(false);
}
});
- java.util.List images = new ArrayList<>();
+ List images = new ArrayList<>();
images.add(View.loadImage("proxy16"));
images.add(View.loadImage("proxy32"));
setIconImages(images);
@@ -271,7 +272,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
started = false;
return;
}
- java.util.List catchedContentTypes = new ArrayList<>();
+ List catchedContentTypes = new ArrayList<>();
catchedContentTypes.add("application/x-shockwave-flash");
catchedContentTypes.add("application/x-javascript");
catchedContentTypes.add("application/javascript");
diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineFrame.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineFrame.java
index 4d5a45535..538b93b79 100644
--- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineFrame.java
+++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineFrame.java
@@ -1,49 +1,50 @@
-/*
- * 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.timeline;
-
-import com.jpexs.decompiler.flash.gui.AppFrame;
-import com.jpexs.decompiler.flash.gui.View;
-import com.jpexs.decompiler.flash.timeline.Timelined;
-import java.awt.BorderLayout;
-import java.awt.Container;
-import java.awt.Image;
-import java.util.ArrayList;
-
-/**
- *
- * @author JPEXS
- */
-public class TimelineFrame extends AppFrame {
-
- public TimelinePanel timeline;
-
- public TimelineFrame(Timelined timelined) {
- setSize(800, 600);
- View.setWindowIcon(this);
- View.centerScreen(this);
- setTitle(translate("dialog.title"));
- Container cnt = getContentPane();
- cnt.setLayout(new BorderLayout());
- cnt.add(timeline = new TimelinePanel(timelined), BorderLayout.CENTER);
-
- java.util.List images = new ArrayList<>();
- images.add(View.loadImage("timeline16"));
- images.add(View.loadImage("timeline32"));
- setIconImages(images);
- }
-}
+/*
+ * 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.timeline;
+
+import com.jpexs.decompiler.flash.gui.AppFrame;
+import com.jpexs.decompiler.flash.gui.View;
+import com.jpexs.decompiler.flash.timeline.Timelined;
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Image;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class TimelineFrame extends AppFrame {
+
+ public TimelinePanel timeline;
+
+ public TimelineFrame(Timelined timelined) {
+ setSize(800, 600);
+ View.setWindowIcon(this);
+ View.centerScreen(this);
+ setTitle(translate("dialog.title"));
+ Container cnt = getContentPane();
+ cnt.setLayout(new BorderLayout());
+ cnt.add(timeline = new TimelinePanel(timelined), BorderLayout.CENTER);
+
+ List images = new ArrayList<>();
+ images.add(View.loadImage("timeline16"));
+ images.add(View.loadImage("timeline32"));
+ setIconImages(images);
+ }
+}