/hg/icedtea-web: Java console resurrected and connected to new l...
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Tue Nov 5 11:01:16 PST 2013
changeset dcd51951d507 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=dcd51951d507
author: Jiri Vanek <jvanek at redhat.com>
date: Tue Nov 05 20:07:27 2013 +0100
Java console resurrected and connected to new logging.
diffstat:
ChangeLog | 36 +-
NEWS | 1 +
netx/net/sourceforge/jnlp/config/Defaults.java | 4 +-
netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java | 38 +-
netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java | 8 +-
netx/net/sourceforge/jnlp/resources/Messages.properties | 18 +
netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java | 8 +-
netx/net/sourceforge/jnlp/splashscreen/parts/JEditorPaneBasedExceptionDialog.java | 32 +-
netx/net/sourceforge/jnlp/util/BasicExceptionDialog.java | 29 +
netx/net/sourceforge/jnlp/util/logging/JavaConsole.java | 384 ++++++++++
netx/net/sourceforge/jnlp/util/logging/LogConfig.java | 4 +
netx/net/sourceforge/jnlp/util/logging/OutputController.java | 36 +-
plugin/icedteanp/java/sun/applet/JavaConsole.java | 371 ---------
plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java | 6 +-
plugin/icedteanp/java/sun/applet/PluginMain.java | 12 +-
plugin/icedteanp/java/sun/applet/PluginStreamHandler.java | 32 +-
16 files changed, 594 insertions(+), 425 deletions(-)
diffs (truncated from 1351 to 500 lines):
diff -r b3a5748145ca -r dcd51951d507 ChangeLog
--- a/ChangeLog Tue Nov 05 13:26:59 2013 -0500
+++ b/ChangeLog Tue Nov 05 20:07:27 2013 +0100
@@ -1,3 +1,35 @@
+2013-11-05 Jiri Vanek <jvanek at redhat.com>
+
+ Java console resurrected and connected to new logging.
+ * NEWS: mentioned console for plugin and javaws
+ * Changelog: removed one wrong tab
+ * netx/net/sourceforge/jnlp/config/Defaults.java: added
+ DeploymentConfiguration.CONSOLE_SHOW_PLUGIN,
+ and DeploymentConfiguration.CONSOLE_SHOW_JAVAWS.
+ * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java:
+ added and javadoc-ed CONSOLE_SHOW_PLUGIN,CONSOLE_SHOW_JAVAWS, DISABLE,
+ SHOW, HIDE, KEY_CONSOLE_STARTUP_MODE.
+ * netx/net/sourceforge/jnlp/resources/Messages.properties: localized console
+ * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java : removed legacy STD*_FILE
+ * netx/net/sourceforge/jnlp/util/BasicExceptionDialog.java: Added button
+ to show console on demand. Added (getShowButton) method to share code with
+ * netx/net/sourceforge/jnlp/splashscreen/parts/JEditorPaneBasedExceptionDialog.java:
+ Added button to show console on demand and explaining line.
+ * netx/net/sourceforge/jnlp/util/logging/JavaConsole.java: moved from
+ plugin, and reworked. Especially get rid of perpetual loading of file.
+ Made singleton.
+ * netx/net/sourceforge/jnlp/util/logging/LogConfig.java: added (isLogToConsole)
+ returning (JavaConsole.isEnabled) status.
+ * netx/net/sourceforge/jnlp/util/logging/OutputController.java: added (Level.isError)
+ and (Level.isOutput) methods to determine original channel, and can log to console.
+ * plugin/icedteanp/java/sun/applet/JavaConsole.java: moved to netx
+ * plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java:
+ (streamhandler) made private with setter
+ * plugin/icedteanp/java/sun/applet/PluginMain.java : removed legacy STD*_FILE,
+ added set of classloaders information provider to console. (handlePluginMessage)
+ show and hide of console is checking it's status. (showConsole) and (hideConsole)
+ moved to JavaConsole.
+
2013-11-05 Andrew Azores <aazores at redhat.com>
* netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java:
@@ -10,7 +42,7 @@
* netx/net/sourceforge/jnlp/util/logging/OutputController.java: (getHeader)
added thread id and name to log header.
* plugin/icedteanp/IcedTeaPluginUtils.h: (PLUGIN_DEBUG) (PLUGIN_ERROR)
- headerrs generation code moved to macro (CREATE_HEADER0). Both
+ headers generation code moved to macro (CREATE_HEADER0). Both
headers now contains pthread_self and g_thread_self. Fixed indentation.
2013-11-01 Jiri Vanek <jvanek at redhat.com>
@@ -63,7 +95,7 @@
TEST(PLUGIN_DEBUG_ERROR_PROFILING_debug_on_headers_on)
TEST(PLUGIN_DEBUG_ERROR_PROFILING_debug_off_headers_on) (100x slower then
without headers)
-
+
2013-10-25 Jiri Vanek <jvanek at redhat.com>
all output messages redirected to PLUGIN_{DEBUG,ERROR} macros
diff -r b3a5748145ca -r dcd51951d507 NEWS
--- a/NEWS Tue Nov 05 13:26:59 2013 -0500
+++ b/NEWS Tue Nov 05 20:07:27 2013 +0100
@@ -12,6 +12,7 @@
* IcedTea-Web now using tagsoup as default (tagsoup dependence) sanitizer for input
* JDK older then 1.5 no longer supported
* IcedTea-Web is now following XDG .config and .cache specification(RH947647)
+* A console for debugging plugin and javaws
* Cache Viewer
- Can be closed by ESC key
- Enabling and disabling of operational buttons is handled properly
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/config/Defaults.java
--- a/netx/net/sourceforge/jnlp/config/Defaults.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/config/Defaults.java Tue Nov 05 20:07:27 2013 +0100
@@ -337,7 +337,9 @@
BasicValueValidators.getStringValidator(new String[] {
DeploymentConfiguration.CONSOLE_DISABLE,
DeploymentConfiguration.CONSOLE_HIDE,
- DeploymentConfiguration.CONSOLE_SHOW
+ DeploymentConfiguration.CONSOLE_SHOW,
+ DeploymentConfiguration.CONSOLE_SHOW_PLUGIN,
+ DeploymentConfiguration.CONSOLE_SHOW_JAVAWS
}),
DeploymentConfiguration.CONSOLE_HIDE
},
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Tue Nov 05 20:07:27 2013 +0100
@@ -64,14 +64,31 @@
public static final int JNLP_ASSOCIATION_ASK_USER = 2;
public static final int JNLP_ASSOCIATION_REPLACE_ASK = 3;
- /*
- * FIXME these should be moved into JavaConsole, but there is a strange
- * dependency in the build system. First all of netx is built. Then the
- * plugin is built. So we cannot refer to plugin code in here :(
+ /**
+ * when set to as value of KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode",
+ * then console is not visible by default, but may be shown
*/
public static final String CONSOLE_HIDE = "HIDE";
+ /**
+ * when set to as value of KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode",
+ * then console show for both javaws and plugin
+ */
public static final String CONSOLE_SHOW = "SHOW";
+ /**
+ * when set to as value of KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode",
+ * then console is not visible by default, nop data are passed to it (save memory and cpu) but can not be shown
+ */
public static final String CONSOLE_DISABLE = "DISABLE";
+ /**
+ * when set to as value of KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode",
+ * then console show for plugin
+ */
+ public static final String CONSOLE_SHOW_PLUGIN = "SHOW_PLUGIN_ONLY";
+ /**
+ * when set to as value of KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode",
+ * then console show for javaws
+ */
+ public static final String CONSOLE_SHOW_JAVAWS = "SHOW_JAVAWS_ONLY";
public static final String KEY_USER_CACHE_DIR = "deployment.user.cachedir";
public static final String KEY_USER_PERSISTENCE_CACHE_DIR = "deployment.user.pcachedir";
@@ -156,10 +173,19 @@
public static final String KEY_ENABLE_LOGGING_TOSTREAMS = "deployment.log.stdstreams";
public static final String KEY_ENABLE_LOGGING_TOSYSTEMLOG = "deployment.log.system";
- /*
- * Console
+ /**
+ * Console initial status.
+ * One of CONSOLE_* values
+ * See declaration above:
+ * CONSOLE_HIDE = "HIDE";
+ * CONSOLE_SHOW = "SHOW";
+ * CONSOLE_DISABLE = "DISABLE";
+ * CONSOLE_SHOW_PLUGIN = "SHOW_PLUGIN_ONLY";
+ * CONSOLE_SHOW_JAVAWS = "SHOW_JAVAWS_ONLY";
*/
public static final String KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode";
+
+
/*
* Desktop Integration
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java
--- a/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Tue Nov 05 20:07:27 2013 +0100
@@ -91,9 +91,11 @@
(Translator.R("DPEnableSyslogHint"))
};
- ComboItem[] javaConsoleItems = { new ComboItem(Translator.R("DPDisable"), "DISABLE"),
- new ComboItem(Translator.R("DPHide"), "HIDE"),
- new ComboItem(Translator.R("DPShow"), "SHOW"), };
+ ComboItem[] javaConsoleItems = { new ComboItem(Translator.R("DPDisable"), DeploymentConfiguration.CONSOLE_DISABLE),
+ new ComboItem(Translator.R("DPHide"), DeploymentConfiguration.CONSOLE_HIDE),
+ new ComboItem(Translator.R("DPShow"), DeploymentConfiguration.CONSOLE_SHOW),
+ new ComboItem(Translator.R("DPShowPluginOnly"), DeploymentConfiguration.CONSOLE_SHOW_PLUGIN),
+ new ComboItem(Translator.R("DPShowJavawsOnly"), DeploymentConfiguration.CONSOLE_SHOW_JAVAWS) };
JLabel consoleLabel = new JLabel(Translator.R("DPJavaConsole"));
JComboBox consoleComboBox = new JComboBox();
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/resources/Messages.properties
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Tue Nov 05 20:07:27 2013 +0100
@@ -415,7 +415,24 @@
DPDisable=Disable
DPHide=Hide on startup
DPShow=Show on startup
+DPShowPluginOnly=Show on plugin startup
+DPShowJavawsOnly=Show on javaws startup
DPJavaConsole=Java Console
+DPJavaConsoleDisabledHint=Java console is disabled. Use itweb-settings to configure it out of disabled to any show or hide value.
+
+#conole itself labels
+CONSOLErungc = Run GC
+CONSOLErunFinalizers = Run Finalizers
+CONSOLErunningFinalizers = Running finalization....
+CONSOLEmemoryInfo = Memory Info
+CONSOLEsystemProperties = System Properties
+CONSOLEclassLoaders = Available Classloaders
+CONSOLEthreadList = Thread List
+CONSOLEthread = Thread
+CONSOLEnoClassLoaders = No Classloader info exists in system
+CONSOLEmemoryMax = Max Memory
+CONSOLEmemoryTotal = Total Memory
+CONSOLEmemoryFree = Free Memory
# Control Panel - DesktopShortcutPanel
DSPNeverCreate=Never create
@@ -525,6 +542,7 @@
SPLASHmainL3 = No further information available, try to launch the browser from the command line and examine the output.
SPLASHcloseAndCopyShorter = Close and copy to clipboard
SPLASHmainL4 = The folloing exception has occured. For more information, try to launch the browser from the command line and examine the output.
+SPLASHmainL2 = Additional information may be available in the console or logs. Even more information is available if debugging is enabled.
SPLASHexWas = Exception was:
SPLASHcfl = Can't follow link to
SPLASHvendorsInfo = Information from vendor of your application
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Tue Nov 05 20:07:27 2013 +0100
@@ -67,8 +67,8 @@
import net.sourceforge.jnlp.security.VariableX509TrustManager;
import net.sourceforge.jnlp.services.XServiceManagerStub;
import net.sourceforge.jnlp.util.FileUtils;
+import net.sourceforge.jnlp.util.logging.JavaConsole;
import net.sourceforge.jnlp.util.logging.OutputController;
-import net.sourceforge.jnlp.util.TeeOutputStream;
import net.sourceforge.jnlp.util.logging.LogConfig;
import sun.net.www.protocol.jar.URLJarFile;
@@ -162,8 +162,7 @@
/** a lock which is held to indicate that an instance of netx is running */
private static FileLock fileLock;
- public static final String STDERR_FILE = "java.stderr";
- public static final String STDOUT_FILE = "java.stdout";
+
/**
@@ -196,6 +195,9 @@
try {
config.load();
config.copyTo(System.getProperties());
+ if (JavaConsole.canShowOnStartup(isApplication)) {
+ JavaConsole.getConsole().showConsoleLater();
+ }
} catch (ConfigurationException e) {
/* exit if there is a fatal exception loading the configuration */
if (isApplication) {
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/splashscreen/parts/JEditorPaneBasedExceptionDialog.java
--- a/netx/net/sourceforge/jnlp/splashscreen/parts/JEditorPaneBasedExceptionDialog.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/splashscreen/parts/JEditorPaneBasedExceptionDialog.java Tue Nov 05 20:07:27 2013 +0100
@@ -40,8 +40,6 @@
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.WindowEvent;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
@@ -65,6 +63,7 @@
import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.about.AboutDialog;
import net.sourceforge.jnlp.runtime.Translator;
+import net.sourceforge.jnlp.util.BasicExceptionDialog;
import net.sourceforge.jnlp.util.logging.OutputController;
public class JEditorPaneBasedExceptionDialog extends JDialog implements HyperlinkListener {
@@ -74,6 +73,7 @@
private JButton closeAndCopyButton;
private JButton homeButton;
private JButton aboutButton;
+ private JButton consoleButton;
private JEditorPane htmlErrorAndHelpPanel;
private JLabel exceptionLabel;
private JLabel iconLabel;
@@ -142,6 +142,7 @@
htmlErrorAndHelpPanel = new JEditorPane();
homeButton = new JButton();
aboutButton = new JButton();
+ consoleButton = BasicExceptionDialog.getShowButton(JEditorPaneBasedExceptionDialog.this);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
@@ -166,9 +167,27 @@
GroupLayout jPanel2Layout = new GroupLayout(topPanel);
topPanel.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
- jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(closeButton).addContainerGap().addComponent(aboutButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 314, Short.MAX_VALUE).addComponent(closeAndCopyButton).addContainerGap()));
+ jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(closeButton)
+ .addContainerGap()
+ .addComponent(aboutButton)
+ .addContainerGap()
+ .addComponent(consoleButton)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 314, Short.MAX_VALUE)
+ .addComponent(closeAndCopyButton)
+ .addContainerGap()));
jPanel2Layout.setVerticalGroup(
- jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addContainerGap(24, Short.MAX_VALUE).addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(closeButton).addComponent(aboutButton).addComponent(closeAndCopyButton)).addContainerGap()));
+ jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
+ .addContainerGap(24, Short.MAX_VALUE)
+ .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(closeButton)
+ .addComponent(aboutButton)
+ .addComponent(consoleButton)
+ .addComponent(closeAndCopyButton))
+ .addContainerGap()));
exceptionLabel.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
exceptionLabel.setHorizontalAlignment(SwingConstants.CENTER);
@@ -204,7 +223,7 @@
}
}
});
-
+
GroupLayout jPanel1Layout = new GroupLayout(mainPanel);
mainPanel.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -271,6 +290,9 @@
StringBuilder s = new StringBuilder("<html><body>");
String info = "<p>"
+ Translator.R(InfoItem.SPLASH + "mainL1", createLink())
+ + " </p> \n" +
+ "<p>"
+ + Translator.R(InfoItem.SPLASH + "mainL2", createLink())
+ " </p> \n";
String t = "<p>"
+ Translator.R(InfoItem.SPLASH + "mainL3")
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/util/BasicExceptionDialog.java
--- a/netx/net/sourceforge/jnlp/util/BasicExceptionDialog.java Tue Nov 05 13:26:59 2013 -0500
+++ b/netx/net/sourceforge/jnlp/util/BasicExceptionDialog.java Tue Nov 05 20:07:27 2013 +0100
@@ -41,6 +41,7 @@
import static net.sourceforge.jnlp.runtime.Translator.R;
import java.awt.BorderLayout;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -55,6 +56,8 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+import net.sourceforge.jnlp.runtime.Translator;
+import net.sourceforge.jnlp.util.logging.JavaConsole;
/**
* A dialog that displays some basic information about an exception
@@ -91,6 +94,10 @@
viewDetails.setActionCommand("show");
quickInfoPanel.add(viewDetails);
+ final JButton consoleButton = getShowButton(errorDialog);
+ consoleButton.setAlignmentY(JComponent.LEFT_ALIGNMENT);
+ quickInfoPanel.add(consoleButton);
+
JTextArea textArea = new JTextArea();
textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
textArea.setEditable(false);
@@ -120,4 +127,26 @@
errorDialog.setVisible(true);
errorDialog.dispose();
}
+
+ public static JButton getShowButton(final Component parent) {
+ JButton consoleButton = new JButton();
+ consoleButton.setText(R("DPJavaConsole"));
+ consoleButton.addActionListener(new java.awt.event.ActionListener() {
+
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ try {
+ JavaConsole.getConsole().showConsoleLater(true);
+ } catch (Exception ex) {
+ OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex);
+ JOptionPane.showConfirmDialog(parent, ex);
+ }
+ }
+ });
+ if (!JavaConsole.isEnabled()) {
+ consoleButton.setEnabled(false);
+ consoleButton.setToolTipText(R("DPJavaConsoleDisabledHint"));
+ }
+ return consoleButton;
+ }
}
diff -r b3a5748145ca -r dcd51951d507 netx/net/sourceforge/jnlp/util/logging/JavaConsole.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/util/logging/JavaConsole.java Tue Nov 05 20:07:27 2013 +0100
@@ -0,0 +1,384 @@
+/* JavaConsole -- A java console for the plugin
+Copyright (C) 2009, 2013 Red Hat
+
+This file is part of IcedTea.
+
+IcedTea 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 2, or (at your option)
+any later version.
+
+IcedTea 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 IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+package net.sourceforge.jnlp.util.logging;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.util.ImageResources;
+
+/**
+ * A simple Java console for IcedTeaPlugin and JavaWS
+ *
+ */
+public class JavaConsole {
+
+ public static interface ClassLoaderInfoProvider {
+
+ public Map<String, String> getLoaderInfo();
+ }
+ private static JavaConsole console;
+
+ public static JavaConsole getConsole() {
+ if (console == null) {
+ console = new JavaConsole();
+ }
+ return console;
+ }
+
+ public static boolean isEnabled() {
+ return isEnabled(JNLPRuntime.getConfiguration());
+ }
+
+ public static boolean isEnabled(DeploymentConfiguration config) {
+ return !DeploymentConfiguration.CONSOLE_DISABLE.equals(config.getProperty(DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE))
+ && !JNLPRuntime.isHeadless();
+ }
+
+ public static boolean canShowOnStartup(boolean isApplication) {
+ return canShowOnStartup(isApplication, JNLPRuntime.getConfiguration());
+ }
+
+ public static boolean canShowOnStartup(boolean isApplication, DeploymentConfiguration config) {
+ if (!isEnabled(config)) {
+ return false;
+ }
+ return DeploymentConfiguration.CONSOLE_SHOW.equals(config.getProperty(DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE))
+ || (DeploymentConfiguration.CONSOLE_SHOW_PLUGIN.equals(config.getProperty(DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE))
+ && !isApplication)
+ || (DeploymentConfiguration.CONSOLE_SHOW_JAVAWS.equals(config.getProperty(DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE))
+ && isApplication);
+ }
+ private JDialog consoleWindow;
+ private JTextArea stdErrText;
+ private JTextArea stdOutText;
+ private ClassLoaderInfoProvider classLoaderInfoProvider;
+
+ public JavaConsole() {
+ initialize();
+ }
+
+ /**
+ * Initialize the console
+ */
+ private void initialize() {
+
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception e) {
More information about the distro-pkg-dev
mailing list