Hi,

I committed this patch to clean up the message handling in the appletviewer tool. The patch also removes some unused classes.

Tom

2006-10-18  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

        * resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
        Rename file...
        * resource/gnu/classpath/tools/appletviewer/messages.properties:
        New file.
        * 
resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
        Remove file.
        * tools/gnu/classpath/tools/appletviewer/AppletWarning.java:
        Remove file.
        * tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/Messages.java: New file.
        * tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java:
        Retrieve user-visible strings through Messages.getString.
        * tools/gnu/classpath/tools/appletviewer/Main.java: Likewise.
        * tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java:
        Likewise.
        * tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java:
        Likewise.
Index: resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties
===================================================================
RCS file: resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties
diff -N resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties
--- resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties	9 May 2006 23:55:59 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,70 +0,0 @@
-# MessagesBundle.properties -- English language messages
-# Copyright (C) 2004, 2006  Free Software Foundation, Inc.
-#
-# This file is part of GNU Classpath.
-#
-# GNU Classpath 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.
-#
-# GNU Classpath 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 GNU Classpath; 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.
-
-gcjwebplugin.code_description=specify the code attribute
-gcjwebplugin.codebase_description=specify the codebase attribute
-gcjwebplugin.archive_description=specify the archive attribute
-gcjwebplugin.width_description=specify the width attribute
-gcjwebplugin.height_description=specify the height attribute
-gcjwebplugin.param_description=specify the parameter arguments
-gcjwebplugin.plugin_description=enable plugin mode
-gcjwebplugin.verbose_description=enable verbose mode
-gcjwebplugin.debug_description=enable debugging mode (not implemented)
-gcjwebplugin.encoding_description=specify the HTML character encoding
-
-gcjwebplugin.no_input_files=appletviewer: no input files
-
-gcjwebplugin.menu_title=Applet
-gcjwebplugin.menu_reload=Reload
-gcjwebplugin.menu_restart=Restart
-gcjwebplugin.menu_start=Start
-gcjwebplugin.menu_stop=Stop
-gcjwebplugin.menu_clone=Clone ...
-gcjwebplugin.menu_quit=Quit
-gcjwebplugin.menu_close=Close
-gcjwebplugin.menu_tag=Tag ...
-gcjwebplugin.menu_info=Info ...
-gcjwebplugin.menu_edit=Edit
-gcjwebplugin.menu_encoding=Character Encoding
-gcjwebplugin.menu_print=Print ...
-gcjwebplugin.menu_properties=Properties ...
-gcjwebplugin.menu_cancel=Cancel
-gcjwebplugin.menu_save=Save ...
-
-gcjwebplugin.console_title=GCJ web plugin console
-gcjwebplugin.console_clear=Clear
-gcjwebplugin.console_hide=Hide
Index: resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties
===================================================================
RCS file: resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties
diff -N resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties
--- resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties	9 May 2006 14:04:25 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-# MessagesBundle_de.properties -- German language messages
-# Copyright (C) 2004, 2006  Free Software Foundation, Inc.
-#
-# This file is part of GNU Classpath.
-#
-# GNU Classpath 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.
-#
-# GNU Classpath 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 GNU Classpath; 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.
-
-# FIXME: rewrite this:
-gcjwebplugin.help.0=Syntax: appletviewer [Optionen] <Dateiname>.class | <Dateiname>.html... | URL...
-gcjwebplugin.help.1=Optionen:
-gcjwebplugin.help.2=  --help                                Diese Hilfe anzeigen and beenden
-gcjwebplugin.help.3=  --version                             Version anzeigen und beenden
-gcjwebplugin.help.4=  --code=<Klassenname>[.class]          Applet mit Klassen- oder Dateiname ausführen
-gcjwebplugin.help.5=  --codebase=<Verzeichnis>              Applet-Codebasis setzen
-gcjwebplugin.help.6=  --archive=<Dateiname>.jar[,...]       Archive zum Klassenlader hinzufügen
-gcjwebplugin.help.7=  --param=<Name>,<Wert>                 Parameter an Applet übergeben
-gcjwebplugin.help.8=  --width=<Breite>                      Setze Breite des Appletfensters
-gcjwebplugin.help.9=  --height=<Höhe>                       Setze Höhe des Appletfensters
-gcjwebplugin.help.10=  --plugin=<Eingabepipe>,<Ausgabepipe>  Pluginmodus einschalten
-gcjwebplugin.help.11=  -debug                                Starten des Applet-Viewers im Java-Debugger (nicht implementiert)
-gcjwebplugin.help.12=  -encoding <Codierung>                 Angabe der von HTML-Dateien verwendeten Zeichencodierung
-gcjwebplugin.help.13=  -J<Laufzeit-Flag>                     Übergeben des Arguments an den Java-Interpreter
-
-gcjwebplugin.no_input_files=appletviewer: keine Dateien angegeben
-
-gcjwebplugin.menu_title=Applet
-gcjwebplugin.menu_reload=Neu laden
-gcjwebplugin.menu_restart=Neu starten
-gcjwebplugin.menu_start=Start
-gcjwebplugin.menu_stop=Stop
-gcjwebplugin.menu_clone=Klonen ...
-gcjwebplugin.menu_quit=Beenden
-gcjwebplugin.menu_tag=Tag ...
-gcjwebplugin.menu_info=Informationen ...
-gcjwebplugin.menu_edit=Bearbeiten
-gcjwebplugin.menu_encoding=Zeichenkodierung
-gcjwebplugin.menu_print=Drucken ...
-gcjwebplugin.menu_properties=Eigenschaften ...
-gcjwebplugin.menu_close=Schließen
-gcjwebplugin.menu_cancel=Abbrechen
-gcjwebplugin.menu_save=Speichern unter ...
-
-gcjwebplugin.console_title=GCJ web plugin Konsole
-gcjwebplugin.console_clear=Löschen
-gcjwebplugin.console_hide=Schließen
Index: resource/gnu/classpath/tools/appletviewer/messages.properties
===================================================================
RCS file: resource/gnu/classpath/tools/appletviewer/messages.properties
diff -N resource/gnu/classpath/tools/appletviewer/messages.properties
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ resource/gnu/classpath/tools/appletviewer/messages.properties	18 Oct 2006 20:40:45 -0000
@@ -0,0 +1,102 @@
+# messages.properties -- English language messages
+# Copyright (C) 2004, 2006  Free Software Foundation, Inc.
+#
+# This file is part of GNU Classpath.
+#
+# GNU Classpath 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.
+#
+# GNU Classpath 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 GNU Classpath; 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.
+
+Main.ErrorApplet=An error occurred while loading this applet.
+Main.Usage=Usage: appletviewer [OPTION] -code CODE | URL...
+Main.AppletTagOptions=Applet tag options
+Main.CodeDescription=specify the code attribute
+Main.CodeArgument=CODE
+Main.CodebaseDescription=specify the codebase attribute
+Main.CodebaseArgument=CODEBASE
+Main.ArchiveDescription=specify the archive attribute
+Main.ArchiveArgument=ARCHIVE
+Main.WidthDescription=specify the width attribute
+Main.WidthArgument=WIDTH
+Main.HeightDescription=specify the height attribute
+Main.HeightArgument=HEIGHT
+Main.ParamDescription=specify the parameter arguments
+Main.ParamArgument=NAME,VALUE
+Main.PluginOption=Plugin option
+Main.PluginDescription=enable plugin mode
+Main.PluginArgument=INPUT,OUTPUT
+Main.DebuggingOption=Debugging option
+Main.VerboseDescription=enable verbose mode
+Main.CompatibilityOptions=Compatibility options
+Main.DebugDescription=enable debugging mode (not implemented)
+Main.EncodingDescription=specify the HTML character encoding
+Main.EncodingArgument=CHARSET
+Main.SecurityWarning=WARNING: CURRENTLY GAPPLETVIEWER RUNS WITH NO\
+ SECURITY MANAGER.\n\
+THIS MEANS THAT APPLETS YOU LOAD CAN DO ANYTHING A JAVA APPLICATION\n\
+THAT YOU DOWNLOAD AND RUN CAN DO.  BE *VERY* CAREFUL WHICH APPLETS YOU RUN.\n\
+DO NOT USE GAPPLETVIEWER ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANT\
+ DATA.\n\
+THIS DATA CAN BE DESTROYED OR STOLEN IF YOU LOAD A MALICIOUS APPLET.
+Main.ContinuationPrompt=[press 'c' or 'C' to continue or anything else to quit]
+Main.NoInputFiles=appletviewer: no input files
+Main.RawArguments=Raw arguments:
+
+PluginAppletViewer.AppletViewerWrote=PIPE: applet viewer wrote:
+PluginAppletViewer.AppletViewerRead=PIPE: applet viewer read:
+PluginAppletViewer.AppletViewerExiting=appletviewer: exiting plugin applet\
+ viewer
+
+StandaloneAppletContext.ShowDocumentError=showDocument is not implemented in\
+ standalone mode
+
+StandaloneAppletViewer.ParsedAppletTags=Parsed applet tags:
+StandaloneAppletViewer.Tag=tag
+StandaloneAppletViewer.CodeOptionError=appletviewer: option '--code' requires\
+ a class filename
+
+StandaloneAppletWindow.MenuTitle=Applet
+StandaloneAppletWindow.MenuReload=Reload
+StandaloneAppletWindow.MenuRestart=Restart
+StandaloneAppletWindow.MenuStart=Start
+StandaloneAppletWindow.MenuStop=Stop
+StandaloneAppletWindow.MenuClone=Clone ...
+StandaloneAppletWindow.MenuQuit=Quit
+StandaloneAppletWindow.MenuClose=Close
+StandaloneAppletWindow.MenuTag=Tag ...
+StandaloneAppletWindow.MenuInfo=Info ...
+StandaloneAppletWindow.MenuEdit=Edit
+StandaloneAppletWindow.MenuEncoding=Character Encoding
+StandaloneAppletWindow.MenuPrint=Print ...
+StandaloneAppletWindow.MenuProperties=Properties ...
+StandaloneAppletWindow.MenuCancel=Cancel
+StandaloneAppletWindow.MenuSave=Save ...
+StandaloneAppletWindow.WindowTitle=GNU Classpath Applet Viewer:
Index: tools/gnu/classpath/tools/appletviewer/AppletWarning.java
===================================================================
RCS file: tools/gnu/classpath/tools/appletviewer/AppletWarning.java
diff -N tools/gnu/classpath/tools/appletviewer/AppletWarning.java
--- tools/gnu/classpath/tools/appletviewer/AppletWarning.java	8 May 2006 20:36:46 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-/* AppletWarning -- a security warning message display dialog
-   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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.
-
-GNU Classpath 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 GNU Classpath; 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 gnu.classpath.tools.appletviewer;
-
-import javax.swing.JOptionPane;
-
-/**
- * @author Michael Koch ([EMAIL PROTECTED])
- */
-public class AppletWarning
-{
-  private static String TITLE = "WARNING";
-  private static boolean showWarning = false;
-
-  private static String MESSAGE =
-    "The current version of this applet plugin does not provide\n" +
-    "a security manager capable of handling Java (tm) applets. Applets\n" +
-    "have UNRESTRICTED access to your computer. This means they can do\n" +
-    "anything you can do, like deleting all your important data.\n\n" +
-    "Continue ?";
-  
-  public static int show()
-  {
-    if (showWarning)
-      return JOptionPane.showConfirmDialog(null, MESSAGE, TITLE,
-                                           JOptionPane.YES_NO_OPTION,
-                                           JOptionPane.WARNING_MESSAGE);
-    else
-      return JOptionPane.YES_OPTION;
-  }
-}
Index: tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java,v
retrieving revision 1.1
diff -u -r1.1 CommonAppletStub.java
--- tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/CommonAppletStub.java	18 Oct 2006 20:40:45 -0000
@@ -98,7 +98,8 @@
       }
     catch (MalformedURLException e)
       {
-        throw new RuntimeException("unknown codebase");
+        throw new RuntimeException("Attempted to create"
+                                   + " invalid codebase URL.", e);
       }
   }
 
Index: tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java
===================================================================
RCS file: tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java
diff -N tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java
--- tools/gnu/classpath/tools/appletviewer/ConsoleDialog.java	8 May 2006 20:36:46 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,175 +0,0 @@
-/* ConsoleDialog -- a console dialog for applets
-   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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.
-
-GNU Classpath 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 GNU Classpath; 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 gnu.classpath.tools.appletviewer;
-
-import java.awt.BorderLayout;
-import java.awt.Button;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.Panel;
-import java.awt.TextArea;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-
-/**
- * This class is a little dialog showing standard output and standard error output.
- *
- * @author Michael Koch ([EMAIL PROTECTED])
- */
-public class ConsoleDialog extends Frame
-  implements ActionListener
-{
-  static class InternalOutputStream extends OutputStream
-  {
-    private ConsoleDialog console;
-
-    public InternalOutputStream(ConsoleDialog console)
-    {
-      super();
-      this.console = console;
-    }
-
-    public void write(int data) throws IOException
-    {
-      console.print(String.valueOf((char) data));
-    }
-  }
-
-  private TextArea textArea;
-  private Button buttonClear;
-  private Button buttonHide;
-  private PrintStream printStream;
-
-  /**
-   * Creates a console dialog object.
-   */
-  public ConsoleDialog()
-  {
-    super(Main.messages.getString("gcjwebplugin.console_title"));
-
-    setSize(400, 200);
-    setLayout(new BorderLayout());
-    addWindowListener(new WindowAdapter()
-        {
-	  public void windowClosing(WindowEvent event)
-	  {
-	    hide();
-	  }
-        });
-
-    textArea = new TextArea();
-    textArea.setEditable(false);
-    add(textArea);
-
-    Panel panel = new Panel();
-    panel.setLayout(new FlowLayout());
-    add(panel, BorderLayout.SOUTH);
-
-    buttonClear = new Button(Main.messages.getString("gcjwebplugin.console_clear"));
-    buttonClear.addActionListener(this);
-    panel.add(buttonClear);
-
-    buttonHide = new Button(Main.messages.getString("gcjwebplugin.console_hide"));
-    buttonHide.addActionListener(this);
-    panel.add(buttonHide);
-
-    printStream = new PrintStream(new InternalOutputStream(this));
-    clearTextArea();
-  }
-
-  /**
-   * Clears the content of the textarea and inserts the initial text.
-   */
-  public void clearTextArea()
-  {
-    textArea.setText("");
-    
-    println("java.vm.version: " + System.getProperty("java.vm.version"));
-    println("java.vm.vendor: " + System.getProperty("java.vm.vendor"));
-  }
-
-  /**
-   * Print a message into the console dialog.
-   *
-   * @param message the message to print.
-   */
-  public void print(String message)
-  {
-    textArea.append(message);
-  }
-
-  /**
-   * Print a line into the console dialog.
-   *
-   * @param message the line to print.
-   */
-  public void println(String message)
-  {
-    print(message + "\n");
-  }
-
-  /**
-   * Perform actions on button clicks inside the console dialog.
-   *
-   * @param event the event.
-   */
-  public void actionPerformed(ActionEvent event)
-  {
-    if (event.getSource() == buttonHide)
-      hide(); // Hide console window.
-    else if (event.getSource() == buttonClear)
-      clearTextArea(); // Clear text area and insert standard messages.
-  }
-
-  /**
-   * Returns a <code>PrintStream</code> object that prints into the
-   * console dialog.
-   *
-   * @return the <code>PrintStream</code> object.
-   */
-  public PrintStream getPrintStream()
-  {
-    return printStream;
-  }
-}
Index: tools/gnu/classpath/tools/appletviewer/Main.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/Main.java,v
retrieving revision 1.6
diff -u -r1.6 Main.java
--- tools/gnu/classpath/tools/appletviewer/Main.java	22 Sep 2006 01:01:26 -0000	1.6
+++ tools/gnu/classpath/tools/appletviewer/Main.java	18 Oct 2006 20:40:45 -0000
@@ -60,12 +60,6 @@
 
 class Main
 {
-  /**
-   * The localized strings are kept in a separate file.
-   */
-  public static final ResourceBundle messages = ResourceBundle.getBundle
-    ("gnu.classpath.tools.appletviewer.MessagesBundle");
-
   private static HashMap classLoaderCache = new HashMap();
   
   private static ClassLoader getClassLoader(URL codebase, ArrayList archives)
@@ -110,7 +104,7 @@
       }
 
     if (applet == null)
-      applet = new ErrorApplet("Error loading applet");
+      applet = new ErrorApplet(Messages.getString ("Main.ErrorApplet"));
 
     return applet;
   }
@@ -127,68 +121,72 @@
   public static void main(String[] args) throws IOException
   {
     parser = new ClasspathToolParser("appletviewer", true);
-    parser.setHeader("usage: appletviewer [OPTION] -code CODE | URL...");
+    parser.setHeader(Messages.getString("Main.Usage"));
 
-    OptionGroup attributeGroup = new OptionGroup("Applet tag options");
+    OptionGroup attributeGroup
+      = new OptionGroup(Messages.getString("Main.AppletTagOptions"));
 
-    attributeGroup.add(new Option("code", Main.messages.getString
-                                  ("gcjwebplugin.code_description"),
-                                  "CODE")
+    attributeGroup.add(new Option("code",
+                                  Messages.getString("Main.CodeDescription"),
+                                  Messages.getString("Main.CodeArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           code = argument;
         }
       });
-    attributeGroup.add(new Option("codebase", Main.messages.getString
-                                  ("gcjwebplugin.codebase_description"),
-                                  "CODEBASE")
+    attributeGroup.add
+      (new Option("codebase",
+                  Messages.getString("Main.CodebaseDescription"),
+                  Messages.getString("Main.CodebaseArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           codebase = argument;
         }
       });
-    attributeGroup.add(new Option("archive", Main.messages.getString
-                                  ("gcjwebplugin.archive_description"),
-                                  "ARCHIVE")
+    attributeGroup.add
+      (new Option("archive",
+                  Messages.getString("Main.ArchiveDescription"),
+                  Messages.getString("Main.ArchiveArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           archive = argument;
         }
       });
-    attributeGroup.add(new Option("width", Main.messages.getString
-                                  ("gcjwebplugin.width_description"),
-                                  "WIDTH")
+    attributeGroup.add(new Option("width",
+                                  Messages.getString("Main.WidthDescription"),
+                                  Messages.getString("Main.WidthArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           dimensions.width = Integer.parseInt(argument);
         }
       });
-    attributeGroup.add(new Option("height", Main.messages.getString
-                                  ("gcjwebplugin.height_description"),
-                                  "HEIGHT")
+    attributeGroup.add(new Option("height",
+                                  Messages.getString("Main.HeightDescription"),
+                                  Messages.getString("Main.HeightArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           dimensions.height = Integer.parseInt(argument);
         }
       });
-    attributeGroup.add(new Option("param", Main.messages.getString
-                                  ("gcjwebplugin.param_description"),
-                                  "NAME,VALUE")
+    attributeGroup.add(new Option("param",
+                                  Messages.getString("Main.ParamDescription"),
+                                  Messages.getString("Main.ParamArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
           parameters.add(argument);
         }
       });
-    OptionGroup pluginGroup = new OptionGroup("Plugin option");
-    pluginGroup.add(new Option("plugin", Main.messages.getString
-                               ("gcjwebplugin.plugin_description"),
-                               "INPUT,OUTPUT")
+    OptionGroup pluginGroup
+      = new OptionGroup(Messages.getString("Main.PluginOption"));
+    pluginGroup.add(new Option("plugin",
+                               Messages.getString("Main.PluginDescription"),
+                               Messages.getString("Main.PluginArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
@@ -198,29 +196,34 @@
           pipeOutName = argument.substring(comma + 1);
         }
       });
-    OptionGroup debuggingGroup = new OptionGroup("Debugging option");
-    debuggingGroup.add(new Option("verbose", Main.messages.getString
-                                  ("gcjwebplugin.verbose_description"),
-                                  (String) null)
+    OptionGroup debuggingGroup
+      = new OptionGroup(Messages.getString("Main.DebuggingOption"));
+    debuggingGroup.add
+      (new Option("verbose",
+                  Messages.getString("Main.VerboseDescription"),
+                  (String) null)
       {
         public void parsed(String argument) throws OptionException
         {
           verbose = true;
         }
       });
-    OptionGroup compatibilityGroup = new OptionGroup("Compatibility options");
-    compatibilityGroup.add(new Option("debug", Main.messages.getString
-                                      ("gcjwebplugin.debug_description"),
-                                      (String) null)
+    OptionGroup compatibilityGroup
+      = new OptionGroup(Messages.getString("Main.CompatibilityOptions"));
+    compatibilityGroup.add
+      (new Option("debug",
+                  Messages.getString("Main.DebugDescription"),
+                  (String) null)
       {
         public void parsed(String argument) throws OptionException
         {
           // Currently ignored.
         }
       });
-    compatibilityGroup.add(new Option("encoding", Main.messages.getString
-                                      ("gcjwebplugin.encoding_description"),
-                                      "CHARSET")
+    compatibilityGroup.add
+      (new Option("encoding",
+                  Messages.getString("Main.EncodingDescription"),
+                  Messages.getString("Main.EncodingArgument"))
       {
         public void parsed(String argument) throws OptionException
         {
@@ -263,15 +266,12 @@
     else
       {
         // Warn user about missing security manager.
-        System.err.println("WARNING: CURRENTLY GAPPLETVIEWER RUNS WITH NO SECURITY MANAGER.\n\n"
-                           + "THIS MEANS THAT APPLETS YOU LOAD CAN DO ANYTHING A JAVA APPLICATION\n"
-                           + "THAT YOU DOWNLOAD AND RUN CAN DO.  BE *VERY* CAREFUL WHICH APPLETS YOU RUN.\n"
-                           + "DO NOT USE GAPPLETVIEWER ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANT DATA.\n"
-                           + "THIS DATA CAN BE DESTROYED OR STOLEN IF YOU LOAD A MALICIOUS APPLET.\n");
+        System.err.println(Messages.getString("Main.SecurityWarning") + "\n");
 
-        System.err.println("[press 'c' or 'C' to continue or anything else to quit]");
+        System.err.println(Messages.getString("Main.ContinuationPrompt"));
 
-        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+        BufferedReader stdin
+          = new BufferedReader(new InputStreamReader(System.in));
         String response = null;
 
         try
@@ -280,8 +280,8 @@
           }
         catch (IOException e)
           {
-            System.err.println("failed to read response to warning message: " + e);
-            System.exit(1);
+            throw new RuntimeException("Failed to read response"
+                                       + " to continuation prompt.", e);
           }
 
         if (!(response.equals("c") || response.equals("C")))
@@ -295,7 +295,7 @@
             // arguments so we have nothing to work with.
             if (args.length == 0)
               {
-                System.err.println(Main.messages.getString("gcjwebplugin.no_input_files"));
+                System.err.println(Messages.getString("Main.NoInputFiles"));
                 System.exit(1);
               }
             // Create a standalone appletviewer from a list of URLs.
@@ -305,7 +305,8 @@
           {
             // Create a standalone appletviewer from the --code
             // option.
-            new StandaloneAppletViewer(code, codebase, archive, parameters, dimensions);
+            new StandaloneAppletViewer(code, codebase, archive,
+                                       parameters, dimensions);
           }
       }
   }
@@ -314,7 +315,7 @@
   {
     if (verbose)
       {
-        System.out.println("raw arguments:");
+        System.out.println(Messages.getString("Main.RawArguments"));
 
         for (int i = 0; i < args.length; i++)
           System.out.println(" " + args[i]);
Index: tools/gnu/classpath/tools/appletviewer/Messages.java
===================================================================
RCS file: tools/gnu/classpath/tools/appletviewer/Messages.java
diff -N tools/gnu/classpath/tools/appletviewer/Messages.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tools/gnu/classpath/tools/appletviewer/Messages.java	18 Oct 2006 20:40:45 -0000
@@ -0,0 +1,67 @@
+/* Messages.java -- localization support for appletviewer
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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.
+
+ GNU Classpath 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 GNU Classpath; 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 gnu.classpath.tools.appletviewer;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages
+{
+  private static final String BUNDLE_NAME
+    = "gnu.classpath.tools.appletviewer.messages"; //$NON-NLS-1$
+
+  private static final ResourceBundle RESOURCE_BUNDLE
+    = ResourceBundle.getBundle(BUNDLE_NAME);
+
+  private Messages()
+  {
+  }
+
+  public static String getString(String key)
+  {
+    try
+      {
+        return RESOURCE_BUNDLE.getString(key);
+      }
+    catch (MissingResourceException e)
+      {
+        return '!' + key + '!';
+      }
+  }
+}
Index: tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java,v
retrieving revision 1.1
diff -u -r1.1 PluginAppletContext.java
--- tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/PluginAppletContext.java	18 Oct 2006 20:40:45 -0000
@@ -54,7 +54,7 @@
       }
     catch(IOException e)
       {
-        System.err.println("showDocument failed: " + e);
+        throw new RuntimeException("showDocument failed.", e);
       }
   }
 
@@ -66,7 +66,7 @@
       }
     catch(IOException e)
       {
-        System.err.println("showDocument failed: " + e);
+        throw new RuntimeException("showStatus failed.", e);
       }
   }
 }
Index: tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java,v
retrieving revision 1.1
diff -u -r1.1 PluginAppletViewer.java
--- tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/PluginAppletViewer.java	18 Oct 2006 20:40:45 -0000
@@ -141,7 +141,9 @@
     pluginOutputStream.newLine();
     pluginOutputStream.flush();
 
-    System.err.println("  PIPE: applet viewer wrote: " + message);
+    System.err.println
+      ("  " + Messages.getString("PluginAppletViewer.AppletViewerWrote")
+       + message);
   }
 
   /**
@@ -155,7 +157,9 @@
   {
     String message = pluginInputStream.readLine();
 
-    System.err.println("  PIPE: applet viewer read: " + message);
+    System.err.println
+      ("  " + Messages.getString("PluginAppletViewer.AppletViewerRead")
+       + message);
 
     if (message == null || message.equals("shutdown"))
       {
@@ -163,7 +167,9 @@
 	pluginInputStream.close();
 	pluginOutputStream.close();
 
-	System.err.println("appletviewer: exiting plugin applet viewer");
+	System.err.println
+          (Messages.getString("PluginAppletViewer.AppletViewerExiting"));
+
 	System.exit(0);
       }
 
Index: tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java,v
retrieving revision 1.1
diff -u -r1.1 PluginAppletWindow.java
--- tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java	18 Oct 2006 20:40:45 -0000
@@ -428,10 +428,6 @@
         if (contexts.get(tag.getCodeBase()) == null)
           contexts.put(tag.getCodeBase(), new PluginAppletContext());
 
-        int result = AppletWarning.show();
-        if (result == JOptionPane.NO_OPTION)
-          return;
-
         add(applet);
 
         AppletContext context = (AppletContext) contexts.get(tag.getCodeBase());
Index: tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java,v
retrieving revision 1.1
diff -u -r1.1 StandaloneAppletContext.java
--- tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/StandaloneAppletContext.java	18 Oct 2006 20:40:45 -0000
@@ -58,7 +58,8 @@
 
   public void showDocument(URL url, String target)
   {
-    System.err.println("showDocument is not implemented in standalone mode");
+    System.err.println
+      (Messages.getString("StandaloneAppletContext.ShowDocumentError"));
   }
 
   // In standalone mode, there are potentially several windows, each
Index: tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java,v
retrieving revision 1.1
diff -u -r1.1 StandaloneAppletViewer.java
--- tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java	8 May 2006 20:36:46 -0000	1.1
+++ tools/gnu/classpath/tools/appletviewer/StandaloneAppletViewer.java	18 Oct 2006 20:40:45 -0000
@@ -79,7 +79,8 @@
     {
       if (!(code.equals("") || code.endsWith(".class")))
         {
-          System.err.println("appletviewer: option '--code' requires a class filename");
+          System.err.println
+            (Messages.getString("StandaloneAppletViewer.CodeOptionError"));
           System.exit(1);
         }
       
@@ -118,13 +119,16 @@
   {
     if (verbose)
       {
-        System.out.println("parsed applet tags:");
+        System.out.println
+          (Messages.getString("StandaloneAppletViewer.ParsedAppletTags"));
 
         for (int i = 0; i < appletTags.size(); i++)
           {
             AppletTag tag = (AppletTag) appletTags.get(i);
 
-            System.out.println(" tag " + i + ":");
+            System.out.println
+              (" " + Messages.getString("StandaloneAppletViewer.Tag")
+               + " " + i + ":");
             System.out.println(tag);
           }
       }
Index: tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java,v
retrieving revision 1.2
diff -u -r1.2 StandaloneAppletWindow.java
--- tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java	12 Jun 2006 18:58:31 -0000	1.2
+++ tools/gnu/classpath/tools/appletviewer/StandaloneAppletWindow.java	18 Oct 2006 20:40:45 -0000
@@ -128,57 +128,57 @@
     addHierarchyListener(this);
     addHierarchyBoundsListener(this);
     
-    restartItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_restart"));
+    restartItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuRestart"));
     restartItem.setEnabled(false);
     restartItem.addActionListener(this);
-    reloadItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_reload"));
+    reloadItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuReload"));
     reloadItem.setEnabled(false);
     reloadItem.addActionListener(this);
-    cancelItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_cancel"));
+    cancelItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuCancel"));
     cancelItem.setEnabled(false);
     cancelItem.addActionListener(this);
-    saveItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_save"));
+    saveItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuSave"));
     saveItem.setEnabled(false);
     saveItem.addActionListener(this);
-    startItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_start"));
+    startItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuStart"));
     startItem.setEnabled(false);
     startItem.addActionListener(this);
-    cloneItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_clone"));
+    cloneItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuClone"));
     cloneItem.setEnabled(false);
     cloneItem.addActionListener(this);
-    closeItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_close"));
+    closeItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuClose"));
     closeItem.setEnabled(false);
     closeItem.addActionListener(this);
     tagItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_tag"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuTag"));
     tagItem.setEnabled(false);
     tagItem.addActionListener(this);
     infoItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_info"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuInfo"));
     infoItem.setEnabled(false);
     infoItem.addActionListener(this);
     editItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_edit"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuEdit"));
     editItem.setEnabled(false);
     editItem.addActionListener(this);
     editItem.setEnabled(false);
     encodingItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_encoding"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuEncoding"));
     encodingItem.setEnabled(false);
     encodingItem.addActionListener(this);
     printItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_print"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuPrint"));
     printItem.setEnabled(false);
     printItem.addActionListener(this);
     propertiesItem =
-      new MenuItem(Main.messages.getString("gcjwebplugin.menu_properties"));
+      new MenuItem(Messages.getString("StandaloneAppletWindow.MenuProperties"));
     propertiesItem.setEnabled(false);
     propertiesItem.addActionListener(this);
-    quitItem = new MenuItem(Main.messages.getString("gcjwebplugin.menu_quit"));
+    quitItem = new MenuItem(Messages.getString("StandaloneAppletWindow.MenuQuit"));
     quitItem.addActionListener(this);
 
     MenuBar menuBar = new MenuBar();
-    Menu menuApplet = new Menu(Main.messages.getString("gcjwebplugin.menu_title"));
+    Menu menuApplet = new Menu(Messages.getString("StandaloneAppletWindow.MenuTitle"));
     menuBar.add(menuApplet);
     menuApplet.add(restartItem);
     menuApplet.add(reloadItem);
@@ -199,7 +199,8 @@
     menuApplet.add(closeItem);
     menuApplet.add(quitItem);
     setMenuBar(menuBar);
-    setTitle("GNU Classpath Applet Viewer: " + tag.code);
+    setTitle(Messages.getString("StandaloneAppletWindow.WindowTitle")
+             + " " + tag.code);
 
     AppletContext context = (AppletContext) contexts.get(tag.codebase);
     ((StandaloneAppletContext) context).addApplet(applet);

Reply via email to