* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
- DatabaseTypeEnum.MySQL,
- DatabaseTypeEnum.H2,
- DatabaseTypeEnum.PostgreSQL
+ DatabaseTypeEnum.MySQL,
+ DatabaseTypeEnum.H2,
+ DatabaseTypeEnum.PostgreSQL
private Text datasourceNameText;
private String dataSourceName;
private Combo databaseTypeCombo;
private Text datasourceNameText;
private String dataSourceName;
private Combo databaseTypeCombo;
private ICdmDataSource dataSource;
private WizardPage nextPage;
private CdmDataSourceCredentialsWizardPage credentialsWizardPage;
private ICdmDataSource dataSource;
private WizardPage nextPage;
private CdmDataSourceCredentialsWizardPage credentialsWizardPage;
*/
public CdmDataSourceTypeSelectionWizardPage(ICdmDataSource dataSource) {
super("DataSourceWizardPage");
*/
public CdmDataSourceTypeSelectionWizardPage(ICdmDataSource dataSource) {
super("DataSourceWizardPage");
composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
GridLayout datasourceLayout = new GridLayout();
datasourceLayout.numColumns = 2;
editDatasourceComposite.setLayout(datasourceLayout);
GridLayout datasourceLayout = new GridLayout();
datasourceLayout.numColumns = 2;
editDatasourceComposite.setLayout(datasourceLayout);
// Create label and input for dataSource name
Label datasourceNameLabel = new Label(editDatasourceComposite, SWT.NONE);
datasourceNameLabel.setText("Datasource Name:");
// Create label and input for dataSource name
Label datasourceNameLabel = new Label(editDatasourceComposite, SWT.NONE);
datasourceNameLabel.setText("Datasource Name:");
datasourceNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
datasourceNameText.addModifyListener(this);
datasourceNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
datasourceNameText.addModifyListener(this);
Label databaseTypeLabel = new Label(editDatasourceComposite, SWT.NONE);
databaseTypeLabel.setText("Database Type:");
databaseTypeCombo = new Combo(editDatasourceComposite, SWT.BORDER | SWT.READ_ONLY);
GridData comboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false);
databaseTypeCombo.setLayoutData(comboLayout);
Label databaseTypeLabel = new Label(editDatasourceComposite, SWT.NONE);
databaseTypeLabel.setText("Database Type:");
databaseTypeCombo = new Combo(editDatasourceComposite, SWT.BORDER | SWT.READ_ONLY);
GridData comboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false);
databaseTypeCombo.setLayoutData(comboLayout);
// Create listener to display database type-specific config options
databaseTypeCombo.addSelectionListener(new SelectionAdapter() {
// Create listener to display database type-specific config options
databaseTypeCombo.addSelectionListener(new SelectionAdapter() {
// Get database type at the selected index
DatabaseTypeEnum type = databaseTypes.get(databaseTypeCombo.getSelectionIndex());
// Get database type at the selected index
DatabaseTypeEnum type = databaseTypes.get(databaseTypeCombo.getSelectionIndex());
// Add types to the type drop-down and to the types collection
for (DatabaseTypeEnum type : supportedDatabaseTypes) {
databaseTypeCombo.add(type.getName());
databaseTypes.add(type);
}
}
// Add types to the type drop-down and to the types collection
for (DatabaseTypeEnum type : supportedDatabaseTypes) {
databaseTypeCombo.add(type.getName());
databaseTypes.add(type);
}
}
// add credentials wizard page according to selection
Wizard wizard = (Wizard) getWizard();
credentialsWizardPage = null;
// add credentials wizard page according to selection
Wizard wizard = (Wizard) getWizard();
credentialsWizardPage = null;
if(type == DatabaseTypeEnum.H2){
credentialsWizardPage = new CdmDataSourceH2WizardPage(dataSource,CdmDataSourceWizard.Mode.CREATE);
}
if(type == DatabaseTypeEnum.H2){
credentialsWizardPage = new CdmDataSourceH2WizardPage(dataSource,CdmDataSourceWizard.Mode.CREATE);
}
else if(type == DatabaseTypeEnum.PostgreSQL){
credentialsWizardPage = new CdmDataSourcePostgreSQLServerWizardPage(dataSource, CdmDataSourceWizard.Mode.CREATE);
}
else if(type == DatabaseTypeEnum.PostgreSQL){
credentialsWizardPage = new CdmDataSourcePostgreSQLServerWizardPage(dataSource, CdmDataSourceWizard.Mode.CREATE);
}
// else if(type == DatabaseTypeEnum.SqlServer2005){
// credentialsWizardPage = new CdmDataSourceSQLServerWizardPage(dataSource);
// }
// else if(type == DatabaseTypeEnum.SqlServer2005){
// credentialsWizardPage = new CdmDataSourceSQLServerWizardPage(dataSource);
// }
nextPage = (WizardPage) wizard.getPage(credentialsWizardPage.getName());
}else{
wizard.addPage(credentialsWizardPage);
nextPage = (WizardPage) wizard.getPage(credentialsWizardPage.getName());
}else{
wizard.addPage(credentialsWizardPage);
public void checkPageComplete() {
boolean complete = isDataBaseTypeSelected();
complete &= isDataSourceNameSet();
public void checkPageComplete() {
boolean complete = isDataBaseTypeSelected();
complete &= isDataSourceNameSet();