|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007, 2008 Sybase, Inc. |
| 3 |
* |
| 4 |
* All rights reserved. This program and the accompanying materials are made |
| 5 |
* available under the terms of the Eclipse Public License v1.0 which |
| 6 |
* accompanies this distribution, and is available at |
| 7 |
* http://www.eclipse.org/legal/epl-v10.html |
| 8 |
* |
| 9 |
* Contributors: Brian Fitzpatrick - initial API and implementation |
| 10 |
* IBM Corporation - refactored plug-in |
| 11 |
******************************************************************************/ |
| 12 |
package org.eclipse.datatools.enablement.hsqldb.ui.wizard; |
| 13 |
|
| 14 |
import java.io.File; |
| 15 |
import java.util.ArrayList; |
| 16 |
import java.util.List; |
| 17 |
import java.util.StringTokenizer; |
| 18 |
|
| 19 |
import javax.swing.event.ChangeEvent; |
| 20 |
import javax.swing.event.ChangeListener; |
| 21 |
|
| 22 |
import org.eclipse.core.runtime.Path; |
| 23 |
import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants; |
| 24 |
import org.eclipse.datatools.connectivity.drivers.DriverInstance; |
| 25 |
import org.eclipse.datatools.connectivity.internal.ui.DelimitedStringList; |
| 26 |
import org.eclipse.datatools.connectivity.internal.ui.DriverListCombo; |
| 27 |
import org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage; |
| 28 |
import org.eclipse.datatools.enablement.hsqldb.ui.IHSQLDBConnectionProfileConstants; |
| 29 |
import org.eclipse.datatools.enablement.hsqldb.ui.Messages; |
| 30 |
import org.eclipse.swt.SWT; |
| 31 |
import org.eclipse.swt.events.ModifyEvent; |
| 32 |
import org.eclipse.swt.events.ModifyListener; |
| 33 |
import org.eclipse.swt.events.SelectionEvent; |
| 34 |
import org.eclipse.swt.events.SelectionListener; |
| 35 |
import org.eclipse.swt.layout.GridData; |
| 36 |
import org.eclipse.swt.layout.GridLayout; |
| 37 |
import org.eclipse.swt.widgets.Button; |
| 38 |
import org.eclipse.swt.widgets.Composite; |
| 39 |
import org.eclipse.swt.widgets.Control; |
| 40 |
import org.eclipse.swt.widgets.DirectoryDialog; |
| 41 |
import org.eclipse.swt.widgets.Label; |
| 42 |
import org.eclipse.swt.widgets.Text; |
| 43 |
|
| 44 |
/** |
| 45 |
* This class gathers the properties for the HSQLDB connection profile. |
| 46 |
* |
| 47 |
* @author brianf |
| 48 |
*/ |
| 49 |
public class HSQLDBProfileDetailsWizardPage extends ConnectionProfileDetailsPage { |
| 50 |
|
| 51 |
// ui pieces |
| 52 |
private Text mDatabaseNameText; |
| 53 |
|
| 54 |
private Text mURLText; |
| 55 |
|
| 56 |
private Text mDBUIDText; |
| 57 |
|
| 58 |
private Text mDBPWDText; |
| 59 |
|
| 60 |
private Button mSaveDBPWDCheckbox; |
| 61 |
|
| 62 |
private DelimitedStringList mDBConnProps; |
| 63 |
|
| 64 |
final DriverListCombo combo = new DriverListCombo(); |
| 65 |
|
| 66 |
private Text mDBFilePathText; |
| 67 |
|
| 68 |
private Button mBrowseFilePathButton; |
| 69 |
|
| 70 |
// stashed driver instance |
| 71 |
private DriverInstance mDriverInstance; |
| 72 |
|
| 73 |
private String mDriverCategory; |
| 74 |
|
| 75 |
/** |
| 76 |
* Constructor |
| 77 |
* |
| 78 |
* @param pageName |
| 79 |
*/ |
| 80 |
public HSQLDBProfileDetailsWizardPage(String pageName) { |
| 81 |
super(pageName); |
| 82 |
setTitle(Messages.getString( |
| 83 |
"HSQLDBProfileDetailsWizardPage.title")); //$NON-NLS-1$ |
| 84 |
setDescription(Messages.getString( |
| 85 |
"HSQLDBProfileDetailsWizardPage.msg")); //$NON-NLS-1$ |
| 86 |
setDriverCategory(IHSQLDBConnectionProfileConstants.HSQLDB_CATEGORY_ID); |
| 87 |
} |
| 88 |
|
| 89 |
/* |
| 90 |
* (non-Javadoc) |
| 91 |
* |
| 92 |
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) |
| 93 |
*/ |
| 94 |
public void createCustomControl(Composite parent) { |
| 95 |
Composite content = new Composite(parent, SWT.NULL); |
| 96 |
GridLayout layout = new GridLayout(2, false); |
| 97 |
content.setLayout(layout); |
| 98 |
|
| 99 |
// set up the drivers combo |
| 100 |
this.combo.setLabelText(Messages.getString( |
| 101 |
"HSQLDBProfileDetailsWizardPage.driverCombo.label")); //$NON-NLS-1$ |
| 102 |
this.combo.setCategory(getDriverCategory()); |
| 103 |
this.combo.setNullDriverIsValid(false); |
| 104 |
this.combo.createContents(content); |
| 105 |
if (this.combo.getErrorMessage() != null) { |
| 106 |
setErrorMessage(this.combo.getErrorMessage()); |
| 107 |
} |
| 108 |
|
| 109 |
// set up the fields |
| 110 |
this.mDatabaseNameText = (Text) createLabelTextPair( |
| 111 |
content, |
| 112 |
Messages.getString( |
| 113 |
"HSQLDBProfileDetailsWizardPage.databaseName.label"), //$NON-NLS-1$ |
| 114 |
this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); |
| 115 |
|
| 116 |
Label label = new Label(content, SWT.NULL); |
| 117 |
label.setLayoutData(new GridData()); |
| 118 |
label.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.0")); //$NON-NLS-1$ |
| 119 |
|
| 120 |
Composite textAndBrowseComposite = new Composite(content, SWT.NULL); |
| 121 |
GridLayout subCompositeLayout = new GridLayout(2, false); |
| 122 |
subCompositeLayout.marginLeft = -5; |
| 123 |
subCompositeLayout.marginRight = -5; |
| 124 |
subCompositeLayout.marginTop = -5; |
| 125 |
subCompositeLayout.marginBottom = -5; |
| 126 |
textAndBrowseComposite.setLayout(subCompositeLayout); |
| 127 |
textAndBrowseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 128 |
this.mDBFilePathText = new Text(textAndBrowseComposite, SWT.BORDER); |
| 129 |
this.mDBFilePathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 130 |
this.mBrowseFilePathButton = new Button(textAndBrowseComposite, SWT.PUSH); |
| 131 |
this.mBrowseFilePathButton.setText(Messages.getString("HSQLDBProfileDetailsWizardPage.1")); //$NON-NLS-1$ |
| 132 |
this.mBrowseFilePathButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); |
| 133 |
|
| 134 |
this.mDBUIDText = (Text) createLabelTextPair(content, Messages.getString( |
| 135 |
"HSQLDBProfileDetailsWizardPage.userName.label"), //$NON-NLS-1$ |
| 136 |
this.mDBUIDText, SWT.BORDER, GridData.FILL_HORIZONTAL); |
| 137 |
|
| 138 |
this.mDBPWDText = (Text) createLabelTextPair(content, Messages.getString( |
| 139 |
"HSQLDBProfileDetailsWizardPage.password.label"), //$NON-NLS-1$ |
| 140 |
this.mDBPWDText, SWT.BORDER | SWT.PASSWORD, GridData.FILL_HORIZONTAL); |
| 141 |
|
| 142 |
this.mURLText = (Text) createLabelTextPair(content, Messages.getString( |
| 143 |
"HSQLDBProfileDetailsWizardPage.url.label"), //$NON-NLS-1$ |
| 144 |
this.mURLText, SWT.BORDER, GridData.FILL_HORIZONTAL); |
| 145 |
|
| 146 |
this.mSaveDBPWDCheckbox = new Button(content, SWT.CHECK); |
| 147 |
this.mSaveDBPWDCheckbox.setText(Messages.getString( |
| 148 |
"HSQLDBProfileDetailsWizardPage.persistpassword.label")); //$NON-NLS-1$ |
| 149 |
this.mSaveDBPWDCheckbox.setLayoutData(new GridData(GridData.BEGINNING, |
| 150 |
GridData.CENTER, true, false, 2, 1)); |
| 151 |
|
| 152 |
// spacer |
| 153 |
Composite spacer = new Composite(content, SWT.NULL); |
| 154 |
GridData gdata = new GridData(GridData.FILL_HORIZONTAL); |
| 155 |
gdata.horizontalSpan = 2; |
| 156 |
gdata.heightHint = 20; |
| 157 |
spacer.setLayoutData(gdata); |
| 158 |
|
| 159 |
// followed by the optional properties |
| 160 |
label = new Label(content, SWT.NULL); |
| 161 |
gdata = new GridData(GridData.FILL_HORIZONTAL); |
| 162 |
gdata.horizontalSpan = 2; |
| 163 |
label.setLayoutData(gdata); |
| 164 |
label.setText(Messages.getString( |
| 165 |
"HSQLDBProfileDetailsWizardPage.optionalProps.label")); //$NON-NLS-1$ |
| 166 |
|
| 167 |
this.mDBConnProps = new DelimitedStringList(content, SWT.NONE); |
| 168 |
gdata = new GridData(GridData.FILL_HORIZONTAL); |
| 169 |
gdata.horizontalSpan = 2; |
| 170 |
this.mDBConnProps.setLayoutData(gdata); |
| 171 |
|
| 172 |
// // now set up the initial instance |
| 173 |
// if (this.mDriverInstance == null) |
| 174 |
// this.mDriverInstance = this.combo.getSelectedDriverInstance(); |
| 175 |
|
| 176 |
this.mDBConnProps.addChangeListener(new ChangeListener() { |
| 177 |
|
| 178 |
public void stateChanged(ChangeEvent arg0) { |
| 179 |
setErrorMessage(null); |
| 180 |
if (HSQLDBProfileDetailsWizardPage.this.mDBConnProps.getWarning() != null) { |
| 181 |
setErrorMessage(HSQLDBProfileDetailsWizardPage.this.mDBConnProps |
| 182 |
.getWarning()); |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
}); |
| 187 |
|
| 188 |
// add a change listener to the combo box so |
| 189 |
// we know when a new driver has been selected |
| 190 |
this.combo.addChangeListener(new ChangeListener() { |
| 191 |
|
| 192 |
public void stateChanged(ChangeEvent arg0) { |
| 193 |
HSQLDBProfileDetailsWizardPage.this.mDriverInstance = HSQLDBProfileDetailsWizardPage.this.combo |
| 194 |
.getSelectedDriverInstance(); |
| 195 |
setErrorMessage(null); |
| 196 |
if (HSQLDBProfileDetailsWizardPage.this.combo.getErrorMessage() != null) { |
| 197 |
setErrorMessage(HSQLDBProfileDetailsWizardPage.this.combo |
| 198 |
.getErrorMessage()); |
| 199 |
} |
| 200 |
HSQLDBProfileDetailsWizardPage.this.mDatabaseNameText |
| 201 |
.setText(getDriverDatabaseName()); |
| 202 |
|
| 203 |
HSQLDBProfileDetailsWizardPage.this.mURLText |
| 204 |
.setText(getDriverURL()); |
| 205 |
HSQLDBProfileDetailsWizardPage.this.updatePropsFromURL(); |
| 206 |
|
| 207 |
String username = HSQLDBProfileDetailsWizardPage.this |
| 208 |
.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.USERNAME_PROP_ID); |
| 209 |
if (username == null || username.trim().length() == 0) |
| 210 |
username = new String(); |
| 211 |
HSQLDBProfileDetailsWizardPage.this.mDBUIDText.setText(username); |
| 212 |
|
| 213 |
String password = HSQLDBProfileDetailsWizardPage.this |
| 214 |
.getPropertyFromDriverInstance(IDBDriverDefinitionConstants.PASSWORD_PROP_ID); |
| 215 |
if (password == null || password.trim().length() == 0) |
| 216 |
password = new String(); |
| 217 |
HSQLDBProfileDetailsWizardPage.this.mDBPWDText.setText(password); |
| 218 |
|
| 219 |
setPageComplete(isValid()); |
| 220 |
} |
| 221 |
|
| 222 |
}); |
| 223 |
|
| 224 |
this.mDBFilePathText.addModifyListener(new ModifyListener() { |
| 225 |
public void modifyText(ModifyEvent e) { |
| 226 |
HSQLDBProfileDetailsWizardPage.this.updateURLFromProps(); |
| 227 |
} |
| 228 |
}); |
| 229 |
this.mBrowseFilePathButton.addSelectionListener( new SelectionListener() { |
| 230 |
|
| 231 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 232 |
HSQLDBProfileDetailsWizardPage.this.browseForDBFolder(); |
| 233 |
} |
| 234 |
|
| 235 |
public void widgetSelected(SelectionEvent e) { |
| 236 |
HSQLDBProfileDetailsWizardPage.this.browseForDBFolder(); |
| 237 |
} |
| 238 |
}); |
| 239 |
|
| 240 |
this.combo.selectFirstItem(); |
| 241 |
// now set up the initial instance |
| 242 |
if (this.mDriverInstance == null) |
| 243 |
this.mDriverInstance = this.combo.getSelectedDriverInstance(); |
| 244 |
if (this.mDriverInstance != null) { |
| 245 |
this.mURLText.setText(getDriverURL()); |
| 246 |
} |
| 247 |
this.mURLText.setEnabled(false); |
| 248 |
|
| 249 |
} |
| 250 |
|
| 251 |
/** |
| 252 |
* Browse for the database folder |
| 253 |
*/ |
| 254 |
private void browseForDBFolder() { |
| 255 |
DirectoryDialog dialog = new DirectoryDialog(getShell()); |
| 256 |
dialog.setText(Messages |
| 257 |
.getString("HSQLDBProfileDetailsWizardPage.FileDialog.title.filebrowse")); //$NON-NLS-1$ |
| 258 |
dialog.setMessage(Messages |
| 259 |
.getString("HSQLDBProfileDetailsWizardPage.FileDialog.msg.filebrowse")); //$NON-NLS-1$ |
| 260 |
|
| 261 |
String dirName = mDBFilePathText.getText(); |
| 262 |
|
| 263 |
File path = new File(dirName); |
| 264 |
if (path.exists()) { |
| 265 |
dialog.setFilterPath(new Path(dirName).toOSString()); |
| 266 |
} |
| 267 |
|
| 268 |
String selectedDirectory = dialog.open(); |
| 269 |
if (selectedDirectory != null) { |
| 270 |
this.mDBFilePathText.setText(selectedDirectory); |
| 271 |
} |
| 272 |
} |
| 273 |
|
| 274 |
/** |
| 275 |
* Update the UI components from the URL |
| 276 |
*/ |
| 277 |
private void updatePropsFromURL() { |
| 278 |
if (this.mDBFilePathText != null && this.mURLText != null) { |
| 279 |
String url = this.mURLText.getText(); |
| 280 |
String[] chunks = parseString(url, ";"); //$NON-NLS-1$ |
| 281 |
if (chunks.length > 0) { |
| 282 |
String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ |
| 283 |
if (chunks2.length > 2) { |
| 284 |
String filepath = chunks2[2]; |
| 285 |
if (chunks2.length > 3) { |
| 286 |
filepath = filepath + ":" + chunks2[3]; //$NON-NLS-1$ |
| 287 |
} |
| 288 |
this.mDBFilePathText.setText(filepath); |
| 289 |
} |
| 290 |
} |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
/** |
| 295 |
* Update the URL from the UI components |
| 296 |
*/ |
| 297 |
private void updateURLFromProps() { |
| 298 |
if (this.mDBFilePathText != null && this.mURLText != null) { |
| 299 |
String url = this.mURLText.getText(); |
| 300 |
String filePath = this.mDBFilePathText.getText(); |
| 301 |
//jdbc:derby:C:\DerbyDatabases\MyDB;create=true |
| 302 |
String[] chunks = parseString(url, ";"); //$NON-NLS-1$ |
| 303 |
if (chunks.length > 0) { |
| 304 |
String[] chunks2 = parseString(chunks[0], ":"); //$NON-NLS-1$ |
| 305 |
if (chunks2.length > 2) { |
| 306 |
url = chunks2[0] + ":" + chunks2[1] + ":" + filePath; //$NON-NLS-1$ //$NON-NLS-2$ |
| 307 |
this.mURLText.setText(url); |
| 308 |
} |
| 309 |
} |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
/** |
| 314 |
* Parse a string into a string array based on a token |
| 315 |
* @param str_list |
| 316 |
* @param token |
| 317 |
* @return |
| 318 |
*/ |
| 319 |
private String[] parseString(String str_list, String token) { |
| 320 |
StringTokenizer tk = new StringTokenizer(str_list, token); |
| 321 |
String[] pieces = new String[tk.countTokens()]; |
| 322 |
int index = 0; |
| 323 |
while (tk.hasMoreTokens()) |
| 324 |
pieces[index++] = tk.nextToken(); |
| 325 |
return pieces; |
| 326 |
} |
| 327 |
|
| 328 |
/** |
| 329 |
* @param propertyID |
| 330 |
* @return |
| 331 |
*/ |
| 332 |
private String getPropertyFromDriverInstance(String propertyID) { |
| 333 |
String returnStr = new String(); |
| 334 |
if (this.mDriverInstance != null |
| 335 |
&& this.mDriverInstance.getProperty(propertyID) != null) { |
| 336 |
returnStr = this.mDriverInstance.getProperty(propertyID); |
| 337 |
} |
| 338 |
return returnStr; |
| 339 |
} |
| 340 |
|
| 341 |
/** |
| 342 |
* Get the sample URL from the driver instance. |
| 343 |
* |
| 344 |
* @return |
| 345 |
*/ |
| 346 |
public String getDriverURL() { |
| 347 |
if (this.mDriverInstance != null |
| 348 |
&& this.mDriverInstance |
| 349 |
.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID) != null) |
| 350 |
return this.mDriverInstance |
| 351 |
.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID); |
| 352 |
return new String(); |
| 353 |
} |
| 354 |
|
| 355 |
/** |
| 356 |
* Get the sample database name from the driver instance. |
| 357 |
* |
| 358 |
* @return |
| 359 |
*/ |
| 360 |
public String getDriverDatabaseName() { |
| 361 |
if (this.mDriverInstance != null |
| 362 |
&& this.mDriverInstance |
| 363 |
.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID) != null) |
| 364 |
return this.mDriverInstance |
| 365 |
.getProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID); |
| 366 |
return new String(); |
| 367 |
} |
| 368 |
|
| 369 |
/** |
| 370 |
* Get the vendor |
| 371 |
* |
| 372 |
* @return |
| 373 |
*/ |
| 374 |
public String getVendor() { |
| 375 |
String vendor = ""; //$NON-NLS-1$ |
| 376 |
if (this.mDriverInstance != null) { |
| 377 |
vendor = this.mDriverInstance |
| 378 |
.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID); |
| 379 |
} |
| 380 |
return vendor; |
| 381 |
} |
| 382 |
|
| 383 |
/** |
| 384 |
* Get the version |
| 385 |
* |
| 386 |
* @return |
| 387 |
*/ |
| 388 |
public String getVersion() { |
| 389 |
String version = ""; //$NON-NLS-1$ |
| 390 |
if (this.mDriverInstance != null) { |
| 391 |
version = this.mDriverInstance |
| 392 |
.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID); |
| 393 |
} |
| 394 |
return version; |
| 395 |
} |
| 396 |
|
| 397 |
/** |
| 398 |
* Get the driver class |
| 399 |
* |
| 400 |
* @return |
| 401 |
*/ |
| 402 |
public String getDriverClass() { |
| 403 |
String driverClass = ""; //$NON-NLS-1$ |
| 404 |
if (this.mDriverInstance != null) { |
| 405 |
driverClass = this.mDriverInstance |
| 406 |
.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID); |
| 407 |
} |
| 408 |
return driverClass; |
| 409 |
} |
| 410 |
|
| 411 |
/** |
| 412 |
* Get the user name |
| 413 |
* |
| 414 |
* @return |
| 415 |
*/ |
| 416 |
public String getDBUID() { |
| 417 |
return this.mDBUIDText.getText(); |
| 418 |
} |
| 419 |
|
| 420 |
/** |
| 421 |
* Get the password |
| 422 |
* |
| 423 |
* @return |
| 424 |
*/ |
| 425 |
public String getDBPWD() { |
| 426 |
return this.mDBPWDText.getText(); |
| 427 |
} |
| 428 |
|
| 429 |
/** |
| 430 |
* Get the password |
| 431 |
* |
| 432 |
* @return |
| 433 |
*/ |
| 434 |
public boolean getSaveDBPWD() { |
| 435 |
return this.mSaveDBPWDCheckbox.getSelection(); |
| 436 |
} |
| 437 |
|
| 438 |
/** |
| 439 |
* Get the optional connection properties |
| 440 |
* |
| 441 |
* @return |
| 442 |
*/ |
| 443 |
public String getDBConnProps() { |
| 444 |
return this.mDBConnProps.getSelection(); |
| 445 |
} |
| 446 |
|
| 447 |
/** |
| 448 |
* Get the database name |
| 449 |
* |
| 450 |
* @return |
| 451 |
*/ |
| 452 |
public String getDatabaseName() { |
| 453 |
return this.mDatabaseNameText.getText(); |
| 454 |
} |
| 455 |
|
| 456 |
/** |
| 457 |
* Get the URL for the CP |
| 458 |
* |
| 459 |
* @return |
| 460 |
*/ |
| 461 |
public String getURL() { |
| 462 |
return this.mURLText.getText(); |
| 463 |
} |
| 464 |
|
| 465 |
/** |
| 466 |
* Get the driver ID |
| 467 |
* |
| 468 |
* @return |
| 469 |
*/ |
| 470 |
public String getDriverID() { |
| 471 |
return this.mDriverInstance.getId(); |
| 472 |
} |
| 473 |
|
| 474 |
/* |
| 475 |
* Create a label and a text box side by side. |
| 476 |
*/ |
| 477 |
private Control createLabelTextPair(Composite parent, String labelText, |
| 478 |
Control ctl, int style, int gData) { |
| 479 |
Label label = new Label(parent, SWT.NULL); |
| 480 |
label.setLayoutData(new GridData()); |
| 481 |
label.setText(labelText); |
| 482 |
|
| 483 |
ctl = new Text(parent, style); |
| 484 |
ctl.setLayoutData(new GridData(gData)); |
| 485 |
|
| 486 |
return ctl; |
| 487 |
} |
| 488 |
|
| 489 |
/* |
| 490 |
* (non-Javadoc) |
| 491 |
* |
| 492 |
* @see com.sybase.suade.common.ui.wizards.ISummaryDataSource#getSummaryData() |
| 493 |
*/ |
| 494 |
public List getSummaryData() { |
| 495 |
List data = new ArrayList(); |
| 496 |
|
| 497 |
data |
| 498 |
.add(new String[] { |
| 499 |
Messages.getString( |
| 500 |
"HSQLDBProfileDetailsWizardPage.summary.driverName.label"), //$NON-NLS-1$ |
| 501 |
mDriverInstance.getName() }); |
| 502 |
|
| 503 |
data |
| 504 |
.add(new String[] { |
| 505 |
Messages.getString( |
| 506 |
"HSQLDBProfileDetailsWizardPage.summary.connProps.label"), //$NON-NLS-1$ |
| 507 |
getDBConnProps() }); |
| 508 |
|
| 509 |
data |
| 510 |
.add(new String[] { |
| 511 |
Messages.getString( |
| 512 |
"HSQLDBProfileDetailsWizardPage.summary.userName.label"), //$NON-NLS-1$ |
| 513 |
getDBUID() }); |
| 514 |
|
| 515 |
StringBuffer pwdMask = new StringBuffer(); |
| 516 |
if (getDBPWD() != null && getDBPWD().length() > 0) { |
| 517 |
for (int i = 0, count = getDBPWD().length(); i < count; ++i) { |
| 518 |
pwdMask = pwdMask.append('*'); |
| 519 |
} |
| 520 |
} |
| 521 |
|
| 522 |
data |
| 523 |
.add(new String[] { |
| 524 |
Messages.getString( |
| 525 |
"HSQLDBProfileDetailsWizardPage.summary.password.label"), //$NON-NLS-1$ |
| 526 |
pwdMask.toString() }); |
| 527 |
|
| 528 |
data.add(new String[] { |
| 529 |
Messages.getString( |
| 530 |
"HSQLDBProfileDetailsWizardPage.summary.url.label"), //$NON-NLS-1$ |
| 531 |
getURL() }); |
| 532 |
|
| 533 |
return data; |
| 534 |
} |
| 535 |
|
| 536 |
private boolean isValid() { |
| 537 |
if (getErrorMessage() != null) { |
| 538 |
setPageComplete(false); |
| 539 |
return false; |
| 540 |
} |
| 541 |
|
| 542 |
return true; |
| 543 |
} |
| 544 |
|
| 545 |
/* |
| 546 |
* (non-Javadoc) |
| 547 |
* |
| 548 |
* @see org.eclipse.jface.dialogs.DialogPage#setErrorMessage(java.lang.String) |
| 549 |
*/ |
| 550 |
public void setErrorMessage(String newMessage) { |
| 551 |
super.setErrorMessage(newMessage); |
| 552 |
isValid(); |
| 553 |
} |
| 554 |
|
| 555 |
|
| 556 |
/** |
| 557 |
* @return |
| 558 |
*/ |
| 559 |
public String getDriverCategory() { |
| 560 |
return mDriverCategory; |
| 561 |
} |
| 562 |
|
| 563 |
|
| 564 |
/** |
| 565 |
* Sets the driver category that should be used for displaying available |
| 566 |
* driver defnitions. |
| 567 |
* |
| 568 |
* @param driverCategory |
| 569 |
*/ |
| 570 |
public void setDriverCategory(String driverCategory) { |
| 571 |
mDriverCategory = driverCategory; |
| 572 |
if (combo != null) { |
| 573 |
combo.setCategory(mDriverCategory); |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
} |