fixed additional catches block bug
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / BasicOnePartURLSetupControl.java
1 package com.quantum.wizards;
2
3 import com.quantum.Messages;
4 import com.quantum.model.JDBCDriver;
5
6 import org.eclipse.swt.SWT;
7 import org.eclipse.swt.events.ModifyEvent;
8 import org.eclipse.swt.events.ModifyListener;
9 import org.eclipse.swt.layout.GridData;
10 import org.eclipse.swt.layout.GridLayout;
11 import org.eclipse.swt.widgets.Composite;
12 import org.eclipse.swt.widgets.Label;
13 import org.eclipse.swt.widgets.Text;
14
15
16 /**
17  * @author BC
18  */
19 public class BasicOnePartURLSetupControl extends URLSetupControl {
20         
21         private final String propertyName;
22
23         public BasicOnePartURLSetupControl(Composite parent, JDBCDriver driver, String propertyName) {
24                 super(parent, driver);
25                 this.propertyName = propertyName;
26         }
27
28         protected void createPart(Composite parent) {
29                 
30                 GridLayout layout = new GridLayout();
31                 layout.numColumns = 2;
32                 parent.setLayout(layout);
33                 
34                 Label label = new Label(parent, SWT.NONE);
35                 label.setText(Messages.getString(URLSetupControl.class, this.propertyName));
36                 
37                 Text databaseNameText = new Text(parent, SWT.BORDER | SWT.SINGLE);
38                 databaseNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
39                 databaseNameText.setText(getProperty(this.propertyName));
40                 label = new Label(parent, SWT.NONE);
41                 label.setText(Messages.getString(URLSetupControl.class, "url"));
42                 
43                 final Text urlText = new Text(parent, SWT.BORDER | SWT.SINGLE);
44                 urlText.setEditable(false);
45                 urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
46                 urlText.setText(getConnectionURL());
47
48                 databaseNameText.addModifyListener(new ModifyListener() {
49                         public void modifyText(ModifyEvent event) {
50                                 putProperty(
51                                                 BasicOnePartURLSetupControl.this.propertyName, 
52                                                 ((Text) event.getSource()).getText());
53                                 urlText.setText(getConnectionURL());
54                         }
55                 });
56         }
57 }