package org.apache.harmony.tools.serialver;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import org.apache.harmony.tools.ClassProvider;

public class ShowGui extends JFrame {

	private static final long serialVersionUID = 679244276103498687L;

	ClassProvider classProvider;
	JButton showButton;
	JLabel classNameLabel;
	JLabel serialVersionLabel;
	JLabel statusBarLabel;
	JTextField classNameField;
	JTextField serialVersionField;

	public ShowGui(ClassProvider cp) {
		super("Serial Version Inspector");
		this.classProvider = cp;
		initComponents();
	}

	public void initComponents() {		
		// Layout
		setLayout(new FlowLayout());

		// Initializaton
		classNameLabel = new JLabel("Full Class Name:");
		add(classNameLabel);

		classNameField = new JTextField(32);
		add(classNameField);

		showButton = new JButton("Show");
		add(showButton);

		serialVersionLabel = new JLabel("Serial Version:");
		add(serialVersionLabel);

		serialVersionField = new JTextField(38);
		serialVersionField.setEditable(false);
		add(serialVersionField);

		statusBarLabel = new JLabel("");
		add(statusBarLabel);

		// Handlers
		ActionListener al = new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				actionPerfomed(evt);
			}
		};

		classNameField.addActionListener(al);
		showButton.addActionListener(al);
	}

	public void actionPerfomed(ActionEvent evt) {
		String targetClass = classNameField.getText();

		// Load the class.
		try {
			Clazz clazz = new Clazz(classProvider, targetClass);

			// Let's check if the class has any 'annoiance'
			if (!Main.isSerializable(clazz)) {
				statusBarLabel.setText("Class " + clazz.getName()
						+ " is not Serializable.");
			} else {
				// Calculating suid with static class from the tool
				long hash = Main.calculeSUID(clazz);
				serialVersionField.setText("    static final long serialVersionUID = "
						+ hash + "L;");
				statusBarLabel.setText("");
			}
		} catch (ClassNotFoundException e) { // Class Not Found
			serialVersionField.setText("");
			statusBarLabel.setText("Class " + targetClass + " not fond.");
		}
	}
}

@@ -1583,24 +1583,265 @@
 getText();%0A%0A
+                if (targetClass.length() == 0) %7B%0A                    // No string was entered%0A                    statusBarLabel.setText(%22%22);%0A                    serialVersionField.setText(%22%22);%0A                    return;%0A                %7D%0A%0A
 %09%09// Load th
@@ -2486,16 +2486,17 @@
 %22 not fo
+u
 nd.%22);%0A%09

Fix minor spelling mistake and add check for the case where nothing is entered for class name.