<commit_before>/*******************************************************************************
 * Copyright (c) 2005-2015, <NAME>, MEDEVIT and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    <NAME> - initial implementation
 *    MEDEVIT <<EMAIL>> - re-implementation
 *******************************************************************************/

package ch.elexis.core.ui.wizards;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.PlatformUI;

import ch.elexis.core.constants.Preferences;
import ch.elexis.core.constants.StringConstants;
import ch.elexis.core.data.activator.CoreHub;
import ch.elexis.core.data.util.DBConnection;
import ch.elexis.core.data.util.DBConnection.DBType;
import ch.elexis.core.jdt.Nullable;
import ch.elexis.core.ui.UiDesk;
import ch.elexis.data.PersistentObject;
import ch.rgw.tools.JdbcLink;
import ch.rgw.tools.StringTool;

public class DBConnectWizard extends Wizard {
	private List<DBConnection> storedConnectionList;
	private DBConnection targetedConnection;
	private boolean restartAfterChange = false;
	
	private DBConnectWizardPage dbConnSelectionPage;
	private DBConnectWizardPage dbConnNewConnPage;

	public DBConnectWizard(){
		super();
		setWindowTitle(Messages.DBConnectWizard_connectDB);
		dbConnSelectionPage =
			new DBConnectSelectionConnectionWizardPage(Messages.DBConnectWizard_typeOfDB);
		dbConnNewConnPage = new DBConnectNewOrEditConnectionWizardPage();
		initStoredJDBCConnections();
		targetedConnection = getCurrentConnection();
	}
	
	@Override
	public void addPages(){
		addPage(dbConnSelectionPage);
		addPage(dbConnNewConnPage);
	}
	
	public List<DBConnection> getStoredConnectionList(){
		ArrayList<DBConnection> arrayList = new ArrayList<DBConnection>(storedConnectionList);
		arrayList.add(0, new DBConnection());
		return arrayList;
	}<commit_msg>[3811] NPE at DBConnectWizard<commit_after>/*******************************************************************************
 * Copyright (c) 2005-2015, <NAME>, MEDEVIT and Elexis
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    <NAME> - initial implementation
 *    MEDEVIT <<EMAIL>> - re-implementation
 *******************************************************************************/

package ch.elexis.core.ui.wizards;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.PlatformUI;

import ch.elexis.core.constants.Preferences;
import ch.elexis.core.constants.StringConstants;
import ch.elexis.core.data.activator.CoreHub;
import ch.elexis.core.data.util.DBConnection;
import ch.elexis.core.data.util.DBConnection.DBType;
import ch.elexis.core.jdt.Nullable;
import ch.elexis.core.ui.UiDesk;
import ch.elexis.data.PersistentObject;
import ch.rgw.tools.JdbcLink;
import ch.rgw.tools.StringTool;

public class DBConnectWizard extends Wizard {
	private List<DBConnection> storedConnectionList;
	private DBConnection targetedConnection;
	private boolean restartAfterChange = false;
	
	private DBConnectWizardPage dbConnSelectionPage;
	private DBConnectWizardPage dbConnNewConnPage;

	public DBConnectWizard(){
		super();
		setWindowTitle(Messages.DBConnectWizard_connectDB);
		dbConnSelectionPage =
			new DBConnectSelectionConnectionWizardPage(Messages.DBConnectWizard_typeOfDB);
		dbConnNewConnPage = new DBConnectNewOrEditConnectionWizardPage();
		initStoredJDBCConnections();
		targetedConnection = getCurrentConnection();
		if(targetedConnection==null && storedConnectionList.size()>0) {
			targetedConnection = storedConnectionList.get(0);
		} else {
			targetedConnection = new DBConnection();
		}
	}
	
	@Override
	public void addPages(){
		addPage(dbConnSelectionPage);
		addPage(dbConnNewConnPage);
	}
	
	public List<DBConnection> getStoredConnectionList(){
		ArrayList<DBConnection> arrayList = new ArrayList<DBConnection>(storedConnectionList);
		arrayList.add(0, new DBConnection());
		return arrayList;
	}
{'fraction_non_alphanumeric': 0.15897097625329815, 'fraction_numerical': 0.007036059806508356, 'mean_word_length': 6.25518341307815, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '829710', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1299, 'n_words': 273}