package org.jcryptool.core;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class LanguageChooser extends Dialog {
	public Label lblNewLabel;
	public Button btnEnglish;
	public Button btnGerman;
	protected String nl = "en";

	/**
	 * Create the dialog.
	 * @param parentShell
	 */
	public LanguageChooser(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite container = (Composite) super.createDialogArea(parent);
		container.setLayout(new GridLayout(1, false));
		
		
		lblNewLabel = new Label(container, SWT.NONE);
		lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
		lblNewLabel.setText("JCrypTool is only available in English and German; which language do you prefer?");
		
		btnEnglish = new Button(container, SWT.RADIO);
		btnEnglish.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				LanguageChooser.this.nl="en";
				LanguageChooser.this.updateDialog();
			}
		});
		btnEnglish.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		btnEnglish.setText("Restart JCrypTool in English");
		btnEnglish.setSelection(true);
		
		btnGerman = new Button(container, SWT.RADIO);
		btnGerman.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
		btnGerman.setText("Starte JCrypTool auf Deutsch");
		btnGerman.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				LanguageChooser.this.nl="de";
				LanguageChooser.this.updateDialog();
			}
		});

		return container;
	}

	protected void updateDialog() {
		// nothing to do for now; any state is valid...
	}

	/**
	 * Create contents of the button bar.
	 * @param parent
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent) {
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
//		createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
	}

	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(600, 300);
	}

}

@@ -709,16 +709,45 @@
  = %22en%22;
+%0A%09private Label lblNewLabel2;
 %0A%0A%09/**%0A%09
@@ -1116,16 +1116,59 @@
 se));%0A%09%09
+getShell().setText(%22Choose your Language%22);
 %0A%09%09%0A%09%09lb
@@ -1208,12 +1208,12 @@
 SWT.
-NONE
+WRAP
 );%0A%09
@@ -1260,12 +1260,12 @@
 SWT.
-LEFT
+FILL
 , SW
@@ -1335,13 +1335,8 @@
  is 
-only 
 avai
@@ -1341,16 +1341,21 @@
 ailable 
+only 
 in Engli
@@ -1371,11 +1371,11 @@
 rman
-; w
+. W
 hich
@@ -1398,19 +1398,438 @@
  prefer?
-%22);
+%5CnYou may change the Language later in 'Window -%3E Settings -%3E JCT General'.%22);%0A%0A%09%09lblNewLabel2 = new Label(container, SWT.WRAP);%0A%09%09lblNewLabel2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));%0A%09%09lblNewLabel2.setText(%22JCrypTool ist nur auf Englisch und Deutsch verf%C3%BCgbar. Welche Sprache m%C3%B6chten Sie nutzen? %5CnSie k%C3%B6nnen die Sprache sp%C3%A4ter %C3%A4ndern im Men%C3%BC 'Fenster -%3E Preferences -%3E JCT Allgemein'.%22);%0A%09%09
 %0A%09%09%0A%09%09bt
@@ -2190,11 +2190,9 @@
 xt(%22
-Res
+S
 tart
@@ -3067,29 +3067,33 @@
 false);%0A%09%7D%0A%0A
+//
 %09/**%0A
+//
 %09 * Return t
@@ -3123,21 +3123,25 @@
 dialog.%0A
+//
 %09 */%0A
+//
 %09@Overri
@@ -3135,32 +3135,34 @@
 */%0A//%09@Override%0A
+//
 %09protected Point
@@ -3181,16 +3181,18 @@
 ize() %7B%0A
+//
 %09%09return
@@ -3213,14 +3213,17 @@
 , 300);%0A
+//
 %09%7D%0A
+%09
 %0A%7D%0A

Reword language chooser and add German text.