Code Generator for Eclipse Code
Brought to you by:
hotzst
changed | /plugin/src/ch/sahits/codegen/java/wizards/DBDefinitionPage.java |
--- a/plugin/src/ch/sahits/codegen/java/wizards/DBDefinitionPage.java +++ b/plugin/src/ch/sahits/codegen/java/wizards/DBDefinitionPage.java @@ -29,6 +29,8 @@ private String user=null; private Text txtPassword; private String passwd=null; + private Text txtName; + private String dbName=null; /** * Set the control up with the layout and the input fields @@ -44,6 +46,7 @@ layout.verticalSpacing = 9; createHost(container); createPort(container); + createName(container); createUser(container); createPassword(container); dialogChanged(); @@ -59,7 +62,7 @@ txtHost = new Text(container,SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); txtHost.setLayoutData(gd); - txtHost.setToolTipText("Input model the class is based on"); + txtHost.setToolTipText("Host for the database"); txtHost.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { host = txtHost.getText(); @@ -77,7 +80,7 @@ txtPort = new Text(container,SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); txtPort.setLayoutData(gd); - txtPort.setToolTipText("Input model the class is based on"); + txtPort.setToolTipText("Port for the database"); txtPort.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { port = txtPort.getText(); @@ -86,7 +89,7 @@ }); } /** - * Create the input fields for the port + * Create the input fields for the user * @param container */ private void createUser(Composite container) { @@ -95,7 +98,7 @@ txtUserName = new Text(container,SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); txtUserName.setLayoutData(gd); - txtUserName.setToolTipText("Input model the class is based on"); + txtUserName.setToolTipText("User for the database"); txtUserName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { user = txtUserName.getText(); @@ -104,7 +107,7 @@ }); } /** - * Create the input fields for the port + * Create the input fields for the password * @param container */ private void createPassword(Composite container) { @@ -113,10 +116,29 @@ txtPassword = new Text(container,SWT.BORDER | SWT.PASSWORD); GridData gd = new GridData(GridData.FILL_HORIZONTAL); txtPassword.setLayoutData(gd); - txtPassword.setToolTipText("Input model the class is based on"); + txtPassword.setToolTipText("Password for the database"); txtPassword.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { passwd = txtPassword.getText(); + dialogChanged(); + } + + }); + } + /** + * Create the input fields for the database name + * @param container + */ + private void createName(Composite container) { + Label label = new Label(container,SWT.NULL); + label.setText("Database name"); + txtName = new Text(container,SWT.BORDER | SWT.SINGLE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + txtName.setLayoutData(gd); + txtName.setToolTipText("Name of the database"); + txtName.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + dbName = txtName.getText(); dialogChanged(); } @@ -137,6 +159,9 @@ Integer.valueOf(port); } catch (NumberFormatException e) { updateStatus("The port must be numeric."); + } + if (dbName==null || dbName.trim().equals("")){ + updateStatus("The database name must be supplied."); } if (user==null || user.trim().equals("")){ updateStatus("The database user must be supplied."); @@ -227,5 +252,17 @@ setErrorMessage(message); setPageComplete(message == null); } + /** + * @return the dbName + */ + public String getDbName() { + return dbName; + } + /** + * @param dbName the dbName to set + */ + public void setDbName(String dbName) { + this.dbName = dbName; + } }