blob: b1577bc1eca87f13bd202718ce5ec45b8ee1cd65 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.wizard.ui.allinonedsl;
import java.util.TreeSet;
import org.eclipse.osbp.preferences.ProductConfiguration;
import org.eclipse.osbp.wizard.ui.AllInOneDSLsNewProjectWizard;
import org.eclipse.osbp.wizard.ui.basic.BasicNewProjectWizardPage;
import org.eclipse.osbp.wizard.ui.basic.CommonProjectWizardTranslator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
/**
* The Class AllInOneDSLsNewProjectDataSourcesPage.
* <br>
* Enables selecting data sources.
*/
public class AllInOneDSLsNewProjectDataSourcesPage extends BasicNewProjectWizardPage {
/** The general setting. */
private final boolean generalSetting;
/**
* Instantiates a new all in one DSLs new project data sources page.
*
* @param wizard the wizard
* @param pageName the page name
* @param generalSetting flag if only general setting is allowed
*/
public AllInOneDSLsNewProjectDataSourcesPage(final AllInOneDSLsNewProjectWizard wizard, String pageName, boolean generalSetting) {
super(wizard, pageName);
this.generalSetting = generalSetting;
}
@Override
protected final void createProjectNameGroup(Composite parent) {
final AllInOneDSLsNewProjectWizard wizard = (AllInOneDSLsNewProjectWizard) super.wizard;
int selected = 0;
int generalSelected = 0;
// new project label
Label dataSourceForGeneralLabel = new Label(projectGroup, SWT.NONE);
dataSourceForGeneralLabel.setText(wizard.translator.getDocumentation(this,"labelDataSourceForGeneral"));
// IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
dataSourceForGeneralLabel.setFont(parent.getFont());
// new project name entry field
wizard.dataSourceForGeneral = new Combo (projectGroup, SWT.READ_ONLY);
selected = 0;
for (String ds : new TreeSet<String>(ProductConfiguration.getDataSourceNames())) {
wizard.dataSourceForGeneral.add(ds);
if (ds.equals(wizard.projectInfo.getDataSourceForBusinessData())) {
generalSelected = wizard.dataSourceForGeneral.indexOf(ds);
}
}
wizard.dataSourceForGeneral.setLayoutData(data);
wizard.dataSourceForGeneral.setFont(parent.getFont());
dataSourceForGeneralLabel.setVisible(generalSetting);
wizard.dataSourceForGeneral.setVisible(generalSetting);
// new project label
Label dataSourceForAuthenticationLabel = new Label(projectGroup, SWT.NONE);
dataSourceForAuthenticationLabel.setText(wizard.translator.getDocumentation(this,"labelDataSourceForAuthentication"));
// IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
dataSourceForAuthenticationLabel.setFont(parent.getFont());
// new project name entry field
wizard.dataSourceForAuthentication = new Combo (projectGroup, SWT.READ_ONLY);
selected = 0;
for (String ds : new TreeSet<String>(ProductConfiguration.getDataSourceNames())) {
wizard.dataSourceForAuthentication.add(ds);
if (ds.equals(wizard.projectInfo.getDataSourceForAuthentication())) {
selected = wizard.dataSourceForAuthentication.indexOf(ds);
}
}
wizard.dataSourceForAuthentication.setLayoutData(data);
wizard.dataSourceForAuthentication.select(selected);
wizard.dataSourceForAuthentication.setFont(parent.getFont());
//persistenceUnit.setEditable(false);
//dataSourceForAuthentication.setText(projectInfo.getDataSourceForAuthentication());
dataSourceForAuthenticationLabel.setVisible(!generalSetting);
wizard.dataSourceForAuthentication.setVisible(!generalSetting);
// new project label
Label dataSourceForBLOBLabel = new Label(projectGroup, SWT.NONE);
dataSourceForBLOBLabel.setText(wizard.translator.getDocumentation(this,"labelDataSourceForBLOB"));
// IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
dataSourceForBLOBLabel.setFont(parent.getFont());
// new project name entry field
wizard.dataSourceForBLOB = new Combo (projectGroup, SWT.READ_ONLY);
selected = 0;
for (String ds : new TreeSet<String>(ProductConfiguration.getDataSourceNames())) {
wizard.dataSourceForBLOB.add(ds);
if (ds.equals(wizard.projectInfo.getDataSourceForBLOB())) {
selected = wizard.dataSourceForBLOB.indexOf(ds);
}
}
wizard.dataSourceForBLOB.setLayoutData(data);
wizard.dataSourceForBLOB.select(selected);
wizard.dataSourceForBLOB.setFont(parent.getFont());
//persistenceUnit.setEditable(false);
//dataSourceForAuthentication.setText(projectInfo.getDataSourceForAuthentication());
dataSourceForBLOBLabel.setVisible(!generalSetting);
wizard.dataSourceForBLOB.setVisible(!generalSetting);
// new project label
Label dataSourceForBPMLabel = new Label(projectGroup, SWT.NONE);
dataSourceForBPMLabel.setText(wizard.translator.getDocumentation(this,"labelDataSourceForBPM"));
// IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
dataSourceForBPMLabel.setFont(parent.getFont());
// new project name entry field
wizard.dataSourceForBPM = new Combo (projectGroup, SWT.READ_ONLY);
selected = 0;
for (String ds : new TreeSet<String>(ProductConfiguration.getDataSourceNames())) {
wizard.dataSourceForBPM.add(ds);
if (ds.equals(wizard.projectInfo.getDataSourceForBPM())) {
selected = wizard.dataSourceForBPM.indexOf(ds);
}
}
wizard.dataSourceForBPM.setLayoutData(data);
wizard.dataSourceForBPM.select(selected);
wizard.dataSourceForBPM.setFont(parent.getFont());
//persistenceUnit.setEditable(false);
//dataSourceForAuthentication.setText(projectInfo.getDataSourceForAuthentication());
dataSourceForBPMLabel.setVisible(!generalSetting);
wizard.dataSourceForBPM.setVisible(!generalSetting);
// new project label
Label dataSourceForBusinessDataLabel = new Label(projectGroup, SWT.NONE);
dataSourceForBusinessDataLabel.setText(wizard.translator.getDocumentation(this,"labelDataSourceForBusinessData"));
// IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
dataSourceForBusinessDataLabel.setFont(parent.getFont());
// new project name entry field
wizard.dataSourceForBusinessData = new Combo (projectGroup, SWT.READ_ONLY);
selected = 0;
for (String ds : new TreeSet<String>(ProductConfiguration.getDataSourceNames())) {
wizard.dataSourceForBusinessData.add(ds);
if (ds.equals(wizard.projectInfo.getDataSourceForBusinessData())) {
selected = wizard.dataSourceForBusinessData.indexOf(ds);
}
}
wizard.dataSourceForBusinessData.setLayoutData(data);
wizard.dataSourceForBusinessData.select(selected);
wizard.dataSourceForBusinessData.setFont(parent.getFont());
//persistenceUnit.setEditable(false);
//dataSourceForAuthentication.setText(projectInfo.getDataSourceForAuthentication());
dataSourceForBusinessDataLabel.setVisible(!generalSetting);
wizard.dataSourceForBusinessData.setVisible(!generalSetting);
if (generalSetting) {
// wizard.dataSourceForGeneral.addListener(SWT.Selection, new Listener() {
// @Override
// public void handleEvent(Event event) {
// int selected = wizard.dataSourceForGeneral.getSelectionIndex();
// wizard.dataSourceForAuthentication.select(selected);
// wizard.dataSourceForBLOB.select(selected);
// wizard.dataSourceForBPM.select(selected);
// wizard.dataSourceForBusinessData.select(selected);
// }
// });
wizard.dataSourceForGeneral.select(generalSelected);
}
}
}