package madcow.magic.ui.application;
import madcow.magic.database.core.Database;
import madcow.magic.database.set.Set;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MagicNewSetDialog extends Dialog {
protected Set result;
protected Shell shell;
protected Database db;
/**
* Create the dialog.
* @param parent
* @param style
*/
public MagicNewSetDialog(Shell parent, int style) {
super(parent, style);
setText("SWT Dialog");
}
/**
* Open the dialog.
* @return the result
*/
public Set open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
}
/**
* Create contents of the dialog.
*/
private void createContents() {
shell = new Shell(getParent(), getStyle());
shell.setSize(450, 300);
shell.setText(getText());
}
}