package com.thedeanda.ajaxproxy.ui.proxy;

import java.awt.Component;

import javax.swing.JOptionPane;

import com.thedeanda.ajaxproxy.model.config.ProxyConfig;

public class ProxyEditorDialog {

	private static ProxyConfig showDialog(ProxyConfig value, String title, Component parent) {
		ProxyEditorPanel panel = new ProxyEditorPanel();
		panel.setValue(value);

		String[] options = new String[] { "OK", "Cancel" };
		int option = JOptionPane.showOptionDialog(null, panel, title, JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE,
				null, options, options[1]);

		ProxyConfig result = null;
		if (option == 0) {
			result = panel.getResult();
		}

		return result;
	}

	public static ProxyConfig showEditDialog(ProxyConfig config, Component parent) {
		ProxyConfig result = showDialog(config, "Edit Proxy", parent);

		return result;
	}

}

@@ -557,9 +557,9 @@
 ons%5B
-1
+0
 %5D);%0A
@@ -835,10 +835,176 @@
 lt;%0A%09%7D%0A%0A
+%09public static ProxyConfig showAddDialog(ProxyConfig config, Component parent) %7B%0A%09%09ProxyConfig result = showDialog(config, %22Add Proxy%22, parent);%0A%0A%09%09return result;%0A%09%7D%0A
 %7D%0A

fix default (enter) action