shortened display text of variable proposal in content assist
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / InformixURLSetupControl.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 InformixURLSetupControl extends URLSetupControl {
20         
21         public InformixURLSetupControl(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
52                 label = new Label(parent, SWT.NONE);
53                 label.setText(Messages.getString(InformixURLSetupControl.class, "informixserver"));
54                 
55                 Text serverText = new Text(parent, SWT.BORDER | SWT.SINGLE);
56                 serverText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
57                 serverText.setText(getProperty("informixserver"));
58                 
59                 label = new Label(parent, SWT.NONE);
60                 label.setText(Messages.getString(URLSetupControl.class, "url"));
61                 
62                 final Text urlText = new Text(parent, SWT.BORDER | SWT.SINGLE);
63                 urlText.setEditable(false);
64                 urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
65                 urlText.setText(getConnectionURL());
66
67                 hostNameText.addModifyListener(new ModifyListener() {
68                         public void modifyText(ModifyEvent event) {
69                                 putProperty("hostname", ((Text) event.getSource()).getText());
70                                 urlText.setText(getConnectionURL());
71                         }
72                 });
73
74                 portText.addModifyListener(new ModifyListener() {
75                         public void modifyText(ModifyEvent event) {
76                                 putProperty("port", ((Text) event.getSource()).getText());
77                                 urlText.setText(getConnectionURL());
78                         }
79                 });
80
81                 databaseNameText.addModifyListener(new ModifyListener() {
82                         public void modifyText(ModifyEvent event) {
83                                 putProperty("dbname", ((Text) event.getSource()).getText());
84                                 urlText.setText(getConnectionURL());
85                         }
86                 });
87
88                 serverText.addModifyListener(new ModifyListener() {
89                         public void modifyText(ModifyEvent event) {
90                                 putProperty("informixserver", ((Text) event.getSource()).getText());
91                                 urlText.setText(getConnectionURL());
92                         }
93                 });
94         }
95 }