Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 240433 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/datatools/connectivity/internal/ui/dialogs/DriverDialog.java (-5 / +15 lines)
Lines 135-140 Link Here
135
135
136
		public void stateChanged(ChangeEvent arg0) {
136
		public void stateChanged(ChangeEvent arg0) {
137
			boolean flag = isValid(true);
137
			boolean flag = isValid(true);
138
			validateName();
138
			if (DriverDialog.this.mOKButton != null && !DriverDialog.this.mOKButton.isDisposed())
139
			if (DriverDialog.this.mOKButton != null && !DriverDialog.this.mOKButton.isDisposed())
139
				DriverDialog.this.mOKButton.setEnabled(flag);			
140
				DriverDialog.this.mOKButton.setEnabled(flag);			
140
		}
141
		}
Lines 848-858 Link Here
848
						throw e;
849
						throw e;
849
				}
850
				}
850
851
851
			if (this.mOKButton != null)
852
			if (this.mOKButton != null && !this.mOKButton.isDisposed())
852
				this.mOKButton.setEnabled(flag);
853
				this.mOKButton.setEnabled(flag);
853
		}
854
		}
854
		else {
855
		else {
855
			if (this.mOKButton != null)
856
			if (this.mOKButton != null && !this.mOKButton.isDisposed())
856
				this.mOKButton.setEnabled(false);
857
				this.mOKButton.setEnabled(false);
857
			return false;
858
			return false;
858
		}
859
		}
Lines 1015-1021 Link Here
1015
				// creating new driver, name matches existing driver
1016
				// creating new driver, name matches existing driver
1016
				String errorMessage = DriverMgmtMessages
1017
				String errorMessage = DriverMgmtMessages
1017
					.getString("NewDriverDialog.driverExistsWithName"); //$NON-NLS-1$
1018
					.getString("NewDriverDialog.driverExistsWithName"); //$NON-NLS-1$
1018
				this.setErrorMessage(errorMessage);
1019
				try {
1020
					this.setErrorMessage(errorMessage);
1021
				} catch (SWTException swt_e) {
1022
					// just in case the message widget is disposed, since we can't grab
1023
					// it directly
1024
				}
1019
				return;
1025
				return;
1020
			}
1026
			}
1021
			else {
1027
			else {
Lines 1056-1062 Link Here
1056
			isOk = isValid(true);
1062
			isOk = isValid(true);
1057
		}
1063
		}
1058
1064
1059
		if (this.mOKButton != null)
1065
		if (this.mOKButton != null && !this.mOKButton.isDisposed())
1060
			this.mOKButton.setEnabled(isOk);
1066
			this.mOKButton.setEnabled(isOk);
1061
	}
1067
	}
1062
1068
Lines 1376-1385 Link Here
1376
		
1382
		
1377
		String propIdPrefix = DriverMgmtMessages
1383
		String propIdPrefix = DriverMgmtMessages
1378
			.getString("EditDriverDialog.text.id_prefix"); //$NON-NLS-1$
1384
			.getString("EditDriverDialog.text.id_prefix"); //$NON-NLS-1$
1379
		String propId = propIdPrefix + this.mDriverName;
1385
		String propId = propIdPrefix + this.descriptor.getId() + "." + this.mDriverName; //$NON-NLS-1$
1386
//		String propId = propIdPrefix + this.mDriverName;
1380
		if (this.mPropertySet == null) {
1387
		if (this.mPropertySet == null) {
1381
			this.mPropertySet = new PropertySetImpl(propId, this.mDriverName);
1388
			this.mPropertySet = new PropertySetImpl(propId, this.mDriverName);
1382
		}
1389
		}
1390
		else {
1391
			this.mPropertySet.setID(propId);
1392
		}
1383
		this.mPropertySet.setName(this.mDriverName);
1393
		this.mPropertySet.setName(this.mDriverName);
1384
		Properties props = new Properties();
1394
		Properties props = new Properties();
1385
		props
1395
		props
(-)src/org/eclipse/datatools/connectivity/drivers/DriverManager.java (-1 / +1 lines)
Lines 348-354 Link Here
348
			pset.setName(name);
348
			pset.setName(name);
349
		String prefix = DriverMgmtMessages
349
		String prefix = DriverMgmtMessages
350
				.getString("NewDriverDialog.text.id_prefix"); //$NON-NLS-1$
350
				.getString("NewDriverDialog.text.id_prefix"); //$NON-NLS-1$
351
		String id = prefix + name;
351
		String id = prefix + templateID + "." + name; //$NON-NLS-1$
352
		pset.setID(id);
352
		pset.setID(id);
353
		Properties props = pset.getBaseProperties();
353
		Properties props = pset.getBaseProperties();
354
		if (jarList != null)
354
		if (jarList != null)
(-)src/org/eclipse/datatools/connectivity/internal/ConnectionProfileMgmt.java (-5 / +19 lines)
Lines 624-638 Link Here
624
					Properties props = keysElementsToProperties((Element) extNode);
624
					Properties props = keysElementsToProperties((Element) extNode);
625
					String driverName = props.getProperty(DRIVERNAMEATTR);
625
					String driverName = props.getProperty(DRIVERNAMEATTR);
626
					String driverTypeID = props.getProperty(DRIVERTYPEIDATTR);
626
					String driverTypeID = props.getProperty(DRIVERTYPEIDATTR);
627
					String driverID = "";
627
					
628
					
628
					if (DriverManager.getInstance().getDriverInstanceByName(driverName) != null) {
629
					// Bug 240433 - brianf
630
					// Issue with importing 2 profiles with same driver ID but from different exports
631
					boolean existingDriverHasName = false;
632
					DriverInstance testDI = DriverManager.getInstance().getDriverInstanceByName(driverName);
633
					if (testDI != null) {
629
						// we found the driver, so we're ok to continue
634
						// we found the driver, so we're ok to continue
635
						if (testDI.getTemplate().getId().equalsIgnoreCase(driverTypeID)) {
636
							// the driver with the same name happens to have the same template ID, so we should be ok
637
							existingDriverHasName = true;
638
						}
630
					}
639
					}
631
					else {
640
					if (testDI == null || (testDI != null && !existingDriverHasName)) {
632
						DriverInstance di = DriverManager.getInstance().createNewDriverInstance(driverTypeID, driverName, new String());
641
						DriverInstance di = DriverManager.getInstance().createNewDriverInstance(driverTypeID, driverName, new String());
633
						if (di != null) {
642
						if (di != null) {
634
							String driverID = di.getId();
643
							driverID = di.getId();
635
							cp.getBaseProperties().setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, driverID);
644
							
645
							Properties baseProps = cp.getBaseProperties();
646
							baseProps.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, driverID);
647
							cp.setBaseProperties(baseProps);
636
							
648
							
637
							// This section is to fix BZ 213258 -- brianf
649
							// This section is to fix BZ 213258 -- brianf
638
							String jarList = 
650
							String jarList = 
Lines 799-805 Link Here
799
					
811
					
800
					Properties props = keysToProperties(elem);
812
					Properties props = keysToProperties(elem);
801
					try {
813
					try {
802
						props = ((ConnectionProfileProvider) cp.getProvider())
814
						if (((ConnectionProfileProvider) cp.getProvider())
815
								.getPropertiesPersistenceHook() != null)
816
							props = ((ConnectionProfileProvider) cp.getProvider())
803
								.getPropertiesPersistenceHook()
817
								.getPropertiesPersistenceHook()
804
								.populateTransientProperties(props);
818
								.populateTransientProperties(props);
805
					}
819
					}

Return to bug 240433