/hg/icedtea-web: Allowed itw-settings to be opened from viewer
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Oct 2 08:36:49 UTC 2018
changeset 2f0a9aa90a60 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=2f0a9aa90a60
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Oct 02 10:36:25 2018 +0200
Allowed itw-settings to be opened from viewer
* netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: used exit instead of dispose
* netx/net/sourceforge/jnlp/resources/Messages.properties: new string with key of ButLunchFullItwSettings
* netx/net/sourceforge/jnlp/runtime/Boot.java: get rid of exit, and only return from main method
* netx/net/sourceforge/jnlp/security/SecurityDialog.java: call too showSingleCertInfoDialog changed to Window
* netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java: added new button to launch ControlPanel main class
* netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java: used exit instead of dispose
* netx/net/sourceforge/swing/SwingUtils.java: (info) now accepts Window instead of JDialog
diffstat:
ChangeLog | 11 ++
netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java | 7 +-
netx/net/sourceforge/jnlp/resources/Messages.properties | 1 +
netx/net/sourceforge/jnlp/runtime/Boot.java | 55 +---------
netx/net/sourceforge/jnlp/security/SecurityDialog.java | 3 +-
netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java | 29 ++++-
netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java | 11 +-
netx/net/sourceforge/swing/SwingUtils.java | 3 +-
8 files changed, 54 insertions(+), 66 deletions(-)
diffs (315 lines):
diff -r 31043cd51d7f -r 2f0a9aa90a60 ChangeLog
--- a/ChangeLog Mon Oct 01 19:16:36 2018 +0200
+++ b/ChangeLog Tue Oct 02 10:36:25 2018 +0200
@@ -1,3 +1,14 @@
+2018-09-26 Jiri Vanek <jvanek at redhat.com>
+
+ Allowed itw-settings to be opened from viewer
+ * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: used exit instead of dispose
+ * netx/net/sourceforge/jnlp/resources/Messages.properties: new string with key of ButLunchFullItwSettings
+ * netx/net/sourceforge/jnlp/runtime/Boot.java: get rid of exit, and only return from main method
+ * netx/net/sourceforge/jnlp/security/SecurityDialog.java: call too showSingleCertInfoDialog changed to Window
+ * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java: added new button to launch ControlPanel main class
+ * netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java: used exit instead of dispose
+ * netx/net/sourceforge/swing/SwingUtils.java: (info) now accepts Window instead of JDialog
+
2018-10-01 Laurent Bourgès <bourges.laurent at gmail.com>
Fixed EDT hanging
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
--- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Tue Oct 02 10:36:25 2018 +0200
@@ -54,6 +54,7 @@
import net.sourceforge.jnlp.config.DeploymentConfiguration;
import net.sourceforge.jnlp.config.PathsAndFiles;
import net.sourceforge.jnlp.controlpanel.JVMPanel.JvmValidationResult;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.runtime.Translator;
import net.sourceforge.jnlp.security.viewer.CertificatePane;
import net.sourceforge.jnlp.util.ImageResources;
@@ -118,7 +119,7 @@
add(topPanel, BorderLayout.PAGE_START);
add(mainPanel, BorderLayout.CENTER);
add(buttonPanel, BorderLayout.PAGE_END);
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
pack();
}
@@ -184,7 +185,7 @@
if (validationResult!= JOptionPane.OK_OPTION){
return;
}
- ControlPanel.this.dispose();
+ JNLPRuntime.exit(0);
}
});
buttons.add(okButton);
@@ -211,7 +212,7 @@
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- ControlPanel.this.dispose();
+ JNLPRuntime.exit(0);
}
});
buttons.add(cancelButton);
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/resources/Messages.properties
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Oct 02 10:36:25 2018 +0200
@@ -13,6 +13,7 @@
ButCancel=\ Cancel\
ButClose=Close
ButAdvancedOptions=Advanced Options
+ButLunchFullItwSettings=Launch full settings
ButCopy=Copy to Clipboard
ButMoreInformation=More Information...
ButOk=OK
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/runtime/Boot.java
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java Tue Oct 02 10:36:25 2018 +0200
@@ -113,56 +113,11 @@
if (optionParser.hasOption(OptionsDefinitions.OPTIONS.VIEWER)) {
try {
- SwingUtils.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- CertificateViewer.showCertificateViewer();
- }
- });
+ CertificateViewer.main(null);
} catch (Exception e) {
OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e);
- }
- JNLPRuntime.exit(0);
- }
-
- if (optionParser.hasOption(OptionsDefinitions.OPTIONS.VERSION)) {
- OutputController.getLogger().printOutLn(nameAndVersion);
- JNLPRuntime.exit(0);
- }
-
- if (optionParser.hasOption(OptionsDefinitions.OPTIONS.LICENSE)) {
- OutputController.getLogger().printOutLn(miniLicense);
- JNLPRuntime.exit(0);
- }
-
- if (optionParser.hasOption(OptionsDefinitions.OPTIONS.HELP1)) {
- handleMessage();
- JNLPRuntime.exit(0);
- }
- List<String> properties = optionParser.getParams(OptionsDefinitions.OPTIONS.PROPERTY);
- if (properties != null) {
- for (String prop : properties) {
- try {
- PropertyDesc propDesc = PropertyDesc.fromString(prop);
- JNLPRuntime.getConfiguration().setProperty(propDesc.getKey(), propDesc.getValue());
- } catch (LaunchException ex) {
- OutputController.getLogger().log(ex);
- }
- }
- }
-
- if (optionParser.hasOption(OptionsDefinitions.OPTIONS.ABOUT)) {
- handleAbout();
- if (JNLPRuntime.isHeadless()) {
- JNLPRuntime.exit(0);
- } else {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception e) {
- OutputController.getLogger().log("Unable to set system look and feel");
- }
- OutputController.getLogger().printOutLn(R("BLaunchAbout"));
- AboutDialog.display(TextsProvider.JAVAWS);
+ } finally {
+ //no metter what happens, terminate
return;
}
}
@@ -192,7 +147,7 @@
if (optionParser.hasOption(OptionsDefinitions.OPTIONS.REDIRECT)) {
JNLPRuntime.setAllowRedirect(true);
}
-
+
//if it is browser go by ots own, otherwise procedd with normal ITW logic
if (optionParser.hasOption(OptionsDefinitions.OPTIONS.BROWSER)) {
String url = optionParser.getParam(OptionsDefinitions.OPTIONS.BROWSER);
@@ -240,7 +195,7 @@
static String fixJnlpProtocol(String param) {
//remove jnlp: for case like jnlp:https://some.app/file.jnlp
- if (param.matches("^jnlp[s]?:.*://.*")){
+ if (param.matches("^jnlp[s]?:.*://.*")) {
param = param.replaceFirst("^jnlp[s]?:", "");
}
//transalte jnlp://some.app/file.jnlp to http/https
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/security/SecurityDialog.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialog.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialog.java Tue Oct 02 10:36:25 2018 +0200
@@ -46,6 +46,7 @@
import java.security.cert.X509Certificate;
import javax.swing.JDialog;
+import java.awt.Window;
import net.sourceforge.swing.SwingUtils;
import net.sourceforge.jnlp.JNLPFile;
@@ -216,7 +217,7 @@
* @param parent the parent pane.
*/
public static void showSingleCertInfoDialog(X509Certificate c,
- JDialog parent) {
+ Window parent) {
SecurityDialog dialog = new SecurityDialog(DialogType.SINGLE_CERT_INFO, c);
dialog.getViwableDialog().setLocationRelativeTo(parent);
dialog.getViwableDialog().setModalityType(ModalityType.APPLICATION_MODAL);
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java Tue Oct 02 10:36:25 2018 +0200
@@ -59,7 +59,6 @@
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
-import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -69,9 +68,11 @@
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
+import java.awt.Window;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.DefaultTableModel;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.security.CertificateUtils;
import net.sourceforge.jnlp.security.KeyStores;
@@ -115,7 +116,7 @@
/** JComponents that should be disbled for system store */
private final List<JComponent> disableForSystem;
- private JDialog parent;
+ private Window parent;
private JComponent defaultFocusComponent = null;
/**
@@ -124,7 +125,7 @@
*/
private KeyStores.KeyStoreWithPath keyStore = null;
- public CertificatePane(JDialog parent) {
+ public CertificatePane(Window parent) {
super();
this.parent = parent;
@@ -246,6 +247,11 @@
closeButton.addActionListener(new CloseButtonListener());
defaultFocusComponent = closeButton;
closePanel.add(closeButton, BorderLayout.EAST);
+
+ JButton openAll = new JButton(R("ButLunchFullItwSettings"));
+ openAll.addActionListener(new FullSettingsButtonListener());
+ closePanel.add(openAll, BorderLayout.WEST);
+
main.add(closePanel, BorderLayout.SOUTH);
}
@@ -537,7 +543,22 @@
private class CloseButtonListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
- parent.dispose();
+ JNLPRuntime.exit(0);
+ }
+ }
+
+ private class FullSettingsButtonListener implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ net.sourceforge.jnlp.controlpanel.ControlPanel.main(new String[0]);
+ parent.dispose();
+ } catch (Exception ex) {
+ OutputController.getLogger().log(ex);
+ JOptionPane.showMessageDialog(parent, ex);
+
+ }
}
}
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java Tue Oct 02 10:36:25 2018 +0200
@@ -41,18 +41,17 @@
import java.awt.BorderLayout;
import java.awt.Container;
-import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
-import javax.swing.JDialog;
+import javax.swing.JFrame;
import net.sourceforge.jnlp.runtime.JNLPRuntime;
import net.sourceforge.jnlp.util.ImageResources;
import net.sourceforge.jnlp.util.ScreenFinder;
import net.sourceforge.swing.SwingUtils;
-public class CertificateViewer extends JDialog {
+public class CertificateViewer extends JFrame {
private boolean initialized = false;
private static final String dialogTitle = R("CVCertificateViewer");
@@ -60,7 +59,8 @@
CertificatePane panel;
public CertificateViewer() {
- super((Frame) null, dialogTitle, true);
+ super(dialogTitle);
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setName("CertificateViewer");
SwingUtils.info(this);
setIconImages(ImageResources.INSTANCE.getApplicationImages());
@@ -98,14 +98,13 @@
ScreenFinder.centerWindowsToCurrentScreen(this);
}
- public static void showCertificateViewer() {
+ private static void showCertificateViewer() {
JNLPRuntime.initialize(true);
CertificateViewer cv = new CertificateViewer();
cv.setResizable(true);
cv.centerDialog();
cv.setVisible(true);
- cv.dispose();
}
public static void main(String[] args) throws Exception {
diff -r 31043cd51d7f -r 2f0a9aa90a60 netx/net/sourceforge/swing/SwingUtils.java
--- a/netx/net/sourceforge/swing/SwingUtils.java Mon Oct 01 19:16:36 2018 +0200
+++ b/netx/net/sourceforge/swing/SwingUtils.java Tue Oct 02 10:36:25 2018 +0200
@@ -47,7 +47,6 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import javax.swing.JDialog;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import net.sourceforge.jnlp.runtime.Translator;
@@ -80,7 +79,7 @@
new Throwable().printStackTrace();
}
- public static void info(final JDialog dialog) {
+ public static void info(final Window dialog) {
if (INFO_DIALOG) {
trace("Dialog[" + dialog.getName() + "]"
+ " in TG [" + Thread.currentThread().getThreadGroup() + "]");
More information about the distro-pkg-dev
mailing list