1 package com.quantum.wizards.sql;
3 import com.quantum.sql.parser.DropEntityStatement;
4 import com.quantum.wizards.PropertyChangeWizardPage;
6 import org.eclipse.swt.SWT;
7 import org.eclipse.swt.events.SelectionAdapter;
8 import org.eclipse.swt.events.SelectionEvent;
9 import org.eclipse.swt.layout.GridData;
10 import org.eclipse.swt.layout.GridLayout;
11 import org.eclipse.swt.widgets.Combo;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Label;
14 import org.eclipse.swt.widgets.Text;
20 public class DropEntityWizardPage extends PropertyChangeWizardPage {
22 private final DropEntityStatement dropEntityStatement;
27 public DropEntityWizardPage(String pageName, DropEntityStatement dropEntityStatement) {
29 this.dropEntityStatement = dropEntityStatement;
30 setTitle("Drop Parameters");
31 setDescription("Choose your drop parameters");
35 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
37 public void createControl(Composite parent) {
38 Composite composite = new Composite(parent, SWT.NONE);
39 composite.setLayout(new GridLayout(2, false));
40 composite.setLayoutData(new GridData(GridData.FILL_BOTH));
42 Label label = new Label(composite, SWT.NONE);
43 label.setText("Entity:");
45 Text text = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
46 text.setText(this.dropEntityStatement.getTableName());
47 text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
49 label = new Label(composite, SWT.NONE);
50 label.setText("How to handle dependent entities:");
52 final Combo combo = new Combo(composite, SWT.READ_ONLY);
53 combo.setItems(new String[] { "", "CASCADE", "RESTRICT" });
55 combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
57 combo.addSelectionListener(new SelectionAdapter() {
58 public void widgetSelected(SelectionEvent event) {
59 String rule = combo.getItem(combo.getSelectionIndex());
60 dropEntityStatement.setDependentRule(rule);
62 firePropertyChange("sqlStatement", null, dropEntityStatement.toString());
66 setControl(composite);