Merging code from trunk that fixes #774, this work was done by incastrix
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / sql / ShowSQLStatementWizardPage.java
1 package com.quantum.wizards.sql;
2
3 import org.eclipse.jface.resource.ImageDescriptor;
4 import org.eclipse.jface.wizard.WizardPage;
5 import org.eclipse.swt.SWT;
6 import org.eclipse.swt.layout.GridData;
7 import org.eclipse.swt.layout.GridLayout;
8 import org.eclipse.swt.widgets.Composite;
9 import org.eclipse.swt.widgets.Label;
10 import org.eclipse.swt.widgets.Text;
11
12 /**
13  * @author BC
14  */
15 public class ShowSQLStatementWizardPage extends WizardPage {
16
17         private Text text;
18         private String sqlStatement;
19         
20         /**
21          * @param pageName
22          * @param title
23          * @param titleImage
24          */
25         public ShowSQLStatementWizardPage(String pageName, String title,
26                         ImageDescriptor titleImage) {
27                 super(pageName, title, titleImage);
28         }
29         
30         /**
31          * @param pageName
32          */
33         protected ShowSQLStatementWizardPage(String pageName) {
34                 super(pageName);
35                 setTitle("Final SQL Statement");
36                 setDescription("Review the final SQL Statement before executing it");
37         }
38
39         public void createControl(Composite parent) {
40                 Composite composite = new Composite(parent, SWT.NONE);
41                 composite.setLayout(new GridLayout(1, false));
42                 composite.setLayoutData(new GridData(GridData.FILL_BOTH));
43                 
44                 Label label = new Label(composite, SWT.NONE);
45                 label.setText("SQL Statement");
46                 
47                 this.text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
48                 this.text.setText(this.sqlStatement == null ? "" : this.sqlStatement);
49                 this.text.setLayoutData(new GridData(GridData.FILL_BOTH));
50                 
51                 setControl(composite);
52         }
53         public String getSQLStatement() {
54                 return this.sqlStatement;
55         }
56         public void setSQLStatement(String sqlStatement) {
57                 this.sqlStatement = sqlStatement;
58                 if (this.text != null) {
59                         this.text.setText(this.sqlStatement == null ? "" : this.sqlStatement);
60                 }
61         }
62 }