/*
 * Created on 2004-11-15
 *
 * Part of the Symbian development plug-in for Eclipse
 * Copyright (C) Mikołaj Zalewski, 2004
 */
package pl.zalewski.mikolaj.symbdev.widgets;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

import pl.zalewski.mikolaj.symbdev.SymbdevPlugin;
import pl.zalewski.mikolaj.symbdev.ui.internal.widgets.LanguagesDlgMainPane;

/**
 * A dialog where you can select one or more languages
 * 
 * @author mikolaj
 */
public class ChooseLanguageDialog extends Dialog {

	/**
	 * Constructs the dialog
	 * @param parentShell Parent shell
	 * @param allowMany Allow choosing more than one language
	 */
    public ChooseLanguageDialog(Shell parentShell, boolean allowMany) {
        super(parentShell);
        fAllowMany=allowMany;
    }
    
    /**
     * @return The codes of the languages selected by the user
     */
    public String[] getResult()
    {
       return fResult; 
    }

	protected Control createDialogArea(Composite parent)
	{
	    fPane=new LanguagesDlgMainPane(parent, fAllowMany);
	    return fPane;
	} 
	
	protected void configureShell(Shell shell) {
	  	super.configureShell(shell);
 		shell.setText(SymbdevPlugin.MESSAGE_TITLE);
	}
	
	protected void okPressed() {
	    String output=fPane.fCodes.getText();
	    fResult=output.split("\\s+");
		super.okPressed();
	}
	
	LanguagesDlgMainPane fPane;
	String[] fResult;
	boolean fAllowMany;
}
