Some serious cleanup on manifests, plugin.xml, build.properties and plugin.properties...
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / BasicThreePartURLSetupControl.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 BasicThreePartURLSetupControl extends URLSetupControl {
20         
21         public BasicThreePartURLSetupControl(Composite parent, JDBCDriver driver) {
22                 super(parent, driver);
23         }
24
25         protected void createPart(Composite parent) {
26                 
27                 GridLayout layout = new GridLayout();
28                 layout.numColumns = 2;
29                 parent.setLayout(layout);
30                 
31                 Label label = new Label(parent, SWT.NONE);
32                 label.setText(Messages.getString(URLSetupControl.class, "hostname"));
33                 
34                 Text hostNameText = new Text(parent, SWT.BORDER | SWT.SINGLE);
35                 hostNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
36                 hostNameText.setText(getProperty("hostname"));
37
38                 label = new Label(parent, SWT.NONE);
39                 label.setText(Messages.getString(URLSetupControl.class, "port"));
40                 
41                 Text portText = new Text(parent, SWT.BORDER | SWT.SINGLE);
42                 portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
43                 portText.setText(getProperty("port"));
44
45                 label = new Label(parent, SWT.NONE);
46                 label.setText(Messages.getString(URLSetupControl.class, "dbname"));
47                 
48                 Text databaseNameText = new Text(parent, SWT.BORDER | SWT.SINGLE);
49                 databaseNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
50                 databaseNameText.setText(getProperty("dbname"));
51                 label = new Label(parent, SWT.NONE);
52                 label.setText(Messages.getString(URLSetupControl.class, "url"));
53                 
54                 final Text urlText = new Text(parent, SWT.BORDER | SWT.SINGLE);
55                 urlText.setEditable(false);
56                 urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
57                 urlText.setText(getConnectionURL());
58
59                 hostNameText.addModifyListener(new ModifyListener() {
60                         public void modifyText(ModifyEvent event) {
61                                 putProperty("hostname", ((Text) event.getSource()).getText());
62                                 urlText.setText(getConnectionURL());
63                         }
64                 });
65
66                 portText.addModifyListener(new ModifyListener() {
67                         public void modifyText(ModifyEvent event) {
68                                 putProperty("port", ((Text) event.getSource()).getText());
69                                 urlText.setText(getConnectionURL());
70                         }
71                 });
72
73                 databaseNameText.addModifyListener(new ModifyListener() {
74                         public void modifyText(ModifyEvent event) {
75                                 putProperty("dbname", ((Text) event.getSource()).getText());
76                                 urlText.setText(getConnectionURL());
77                         }
78                 });
79         }
80 }