Simplified parsing for double quoted strings
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / sql / DropEntityWizardPage.java
1 package com.quantum.wizards.sql;
2
3 import com.quantum.sql.parser.DropEntityStatement;
4 import com.quantum.wizards.PropertyChangeWizardPage;
5
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;
15
16
17 /**
18  * @author BC Holmes
19  */
20 public class DropEntityWizardPage extends PropertyChangeWizardPage {
21
22         private final DropEntityStatement dropEntityStatement;
23
24         /**
25          * @param pageName
26          */
27         public DropEntityWizardPage(String pageName, DropEntityStatement dropEntityStatement) {
28                 super(pageName);
29                 this.dropEntityStatement = dropEntityStatement;
30                 setTitle("Drop Parameters");
31                 setDescription("Choose your drop parameters");
32         }
33
34         /* (non-Javadoc)
35          * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
36          */
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));
41                 
42                 Label label = new Label(composite, SWT.NONE);
43                 label.setText("Entity:");
44                 
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));
48
49                 label = new Label(composite, SWT.NONE);
50                 label.setText("How to handle dependent entities:");
51                 
52                 final Combo combo = new Combo(composite, SWT.READ_ONLY);
53                 combo.setItems(new String[] { "", "CASCADE", "RESTRICT" });
54                 combo.select(0);
55                 combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
56                 
57                 combo.addSelectionListener(new SelectionAdapter() {
58                         public void widgetSelected(SelectionEvent event) {
59                                 String rule = combo.getItem(combo.getSelectionIndex());
60                                 dropEntityStatement.setDependentRule(rule);
61                                 
62                                 firePropertyChange("sqlStatement", null, dropEntityStatement.toString());
63                         }
64                 });
65                 
66                 setControl(composite);
67         }
68 }