home *** CD-ROM | disk | FTP | other *** search
- package sun.rmi.rmic;
-
- import java.awt.Button;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.Label;
- import java.awt.Menu;
- import java.awt.MenuBar;
- import java.awt.MenuItem;
- import java.awt.TextArea;
- import java.awt.TextField;
- import java.awt.Window;
- import java.io.BufferedInputStream;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.text.MessageFormat;
- import java.util.MissingResourceException;
- import java.util.Properties;
- import java.util.ResourceBundle;
-
- // $FF: renamed from: sun.rmi.rmic.UI
- class class_0 extends Frame implements Runnable {
- Main main;
- Main subcompile;
- // $FF: renamed from: gb java.awt.GridBagLayout
- GridBagLayout field_0;
- TextField classname_t;
- Button compile_b;
- Button stop_b;
- TextArea errors_t;
- Label footer_l;
- MenuBar menu_mb;
- Menu file_m;
- MenuItem exit_i;
- String[] args;
- Thread thread;
- private static ResourceBundle resources;
-
- public class_0(Main var1) {
- this.main = var1;
- String var2 = System.getProperty("java.home");
- String var3 = System.getProperty("rmi.home");
- if (var3 == null || var3.length() == 0) {
- var3 = var2;
- }
-
- try {
- resources = ResourceBundle.getBundle("sun.tools.javac.resources.javac");
- } catch (MissingResourceException var4) {
- throw new Error("Fatal: Resource for javac is missing");
- }
-
- pushPropFile(var3, "rmic.properties");
- ((Frame)this).setTitle(I18N("rmi.stub.compiler"));
- }
-
- public void init() {
- this.file_m = new Menu(I18N("File"));
- this.file_m.add(this.exit_i = new MenuItem(I18N("Exit")));
- this.menu_mb = new MenuBar();
- this.menu_mb.add(this.file_m);
- this.field_0 = new GridBagLayout();
- ((Container)this).setLayout(this.field_0);
- GridBagConstraints var1 = new GridBagConstraints();
- var1.fill = 1;
- Label var2 = new Label(I18N("full.class.name"));
- var2.setAlignment(0);
- this.field_0.setConstraints(var2, var1);
- ((Container)this).add(var2);
- this.classname_t = new TextField(20);
- var1.gridwidth = 1;
- var1.weightx = (double)1.0F;
- this.field_0.setConstraints(this.classname_t, var1);
- ((Container)this).add(this.classname_t);
- this.compile_b = new Button(I18N("compile"));
- var1.gridwidth = 0;
- var1.weightx = (double)0.0F;
- this.field_0.setConstraints(this.compile_b, var1);
- ((Container)this).add(this.compile_b);
- this.stop_b = new Button(I18N("stop"));
- Label var3 = new Label(I18N("errors"));
- var3.setAlignment(0);
- var1.gridwidth = 0;
- this.field_0.setConstraints(var3, var1);
- ((Container)this).add(var3);
- this.errors_t = new TextArea("", 4, 60);
- this.errors_t.setEditable(false);
- this.errors_t.disable();
- var1.gridx = 0;
- var1.gridwidth = 0;
- var1.weighty = (double)1.0F;
- this.field_0.setConstraints(this.errors_t, var1);
- ((Container)this).add(this.errors_t);
- this.footer_l = new Label();
- var1.gridwidth = 0;
- var1.weighty = (double)0.0F;
- this.field_0.setConstraints(this.footer_l, var1);
- ((Container)this).add(this.footer_l);
- ((Container)this).validate();
- ((Window)this).pack();
- ((Window)this).show();
- }
-
- public void start() {
- }
-
- public boolean action(Event var1, Object var2) {
- if (var1.target == this.classname_t) {
- this.compile((String)var1.arg);
- return true;
- } else if (var1.target == this.compile_b) {
- this.compile(this.classname_t.getText());
- return true;
- } else if (var1.target == this.stop_b) {
- this.stop();
- return true;
- } else {
- if (var1.target == this.exit_i) {
- this.exit(0);
- }
-
- return false;
- }
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 201) {
- this.exit(0);
- }
-
- return super.handleEvent(var1);
- }
-
- void compile(String var1) {
- this.footer_l.setText("");
- this.errors_t.setText("");
- if (!var1.equals("")) {
- this.args = new String[1];
- this.args[0] = var1.trim();
- this.subcompile = new Main(new TextAreaOutput(this.errors_t), "rmic");
- this.subcompile.status = false;
- if (this.subcompile.parseArgs(this.args)) {
- this.compile_b.disable();
- this.stop_b.enable();
- this.thread = new Thread(this.subcompile, "rmic");
- this.thread.start();
- (new Thread(this, "rmi-done?")).start();
- }
- }
- }
-
- void stop() {
- this.compile_b.enable();
- this.stop_b.disable();
- if (this.thread != null) {
- this.thread.stop();
- this.thread = null;
- }
-
- }
-
- public void run() {
- while(true) {
- try {
- this.thread.join();
- this.compile_b.enable();
- this.stop_b.disable();
- } catch (InterruptedException var1) {
- continue;
- }
-
- this.footer_l.setText(I18N(this.subcompile.status ? "compile.done" : "compile.failed"));
- return;
- }
- }
-
- private static String getProperty(String var0) {
- String var1;
- try {
- var1 = resources.getString(var0);
- } catch (MissingResourceException var2) {
- var1 = System.getProperty(var0);
- }
-
- return var1;
- }
-
- public static String I18N(String var0) {
- String var1 = getProperty(var0);
- if (var1 == null) {
- var1 = "No message text for " + var0;
- }
-
- return var1;
- }
-
- public static String I18N(String var0, String var1) {
- return I18N(var0, var1, (String)null);
- }
-
- public static String I18N(String var0, String var1, String var2) {
- Object[] var3 = new Object[]{var1, var2};
-
- for(int var4 = 0; var4 < var3.length; ++var4) {
- if (var3[var4] != null & !(var3[var4] instanceof String)) {
- var3[var4] = var3[var4].toString();
- }
- }
-
- String var5 = getProperty(var0);
- if (var5 == null) {
- return "No message text for " + var0;
- } else {
- return MessageFormat.format(var5, var3);
- }
- }
-
- static void pushPropFile(String var0, String var1) {
- String var2 = var0 + System.getProperty("file.separator") + "lib" + System.getProperty("file.separator") + var1;
-
- try {
- Properties var3 = new Properties(System.getProperties());
- BufferedInputStream var4 = new BufferedInputStream(new FileInputStream(var2));
- var3.load(var4);
- ((InputStream)var4).close();
- System.setProperties(var3);
- } catch (IOException var5) {
- System.err.println("failed to read properties file: " + var2);
- }
- }
-
- void exit(int var1) {
- System.exit(var1);
- }
- }
-