Revision 6802 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/dialogs/DlgFieldManager.java

View differences:

DlgFieldManager.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.dialogs;
42 42

  
43
import java.awt.Component;
43 44
import java.awt.event.ActionListener;
44 45
import java.sql.Types;
45 46
import java.text.ParseException;
......
424 425
					okAction = new java.awt.event.ActionListener() {
425 426
						public void actionPerformed(java.awt.event.ActionEvent e){
426 427
							try {
427
								FieldDescription fld = panelNewField.getFieldDescription();							
428
								FieldDescription fld = panelNewField.getFieldDescription();
429
								if (edAdapter.getRecordset().getFieldIndexByName(fld.getFieldAlias()) != -1)
430
								{
431
									JOptionPane.showMessageDialog(
432
											null,
433
											PluginServices.getText(this, "field_already_exists"));
434
									return;
435
								}
428 436
								edAdapter.addField(fld);
429 437
								jTableFields.revalidate();
430 438
								PluginServices.getMDIManager().closeView(panelNewField);								
......
432 440
								NotificationManager.addError(e1);
433 441
							} catch (ParseException e2) {
434 442
								NotificationManager.addError(e2);
443
							} catch (DriverLoadException e3) {
444
								NotificationManager.addError(e3);
445
							} catch (DriverException e3) {
446
								NotificationManager.addError(e3);
435 447
							}
436 448

  
437 449
							
......
502 514
						String fieldName = (String) tm.getValueAt(selecteds[i],0);
503 515
						try {
504 516
							String newName = JOptionPane.showInputDialog(
505
									(JComponent) PluginServices.getMDIManager().getActiveView(), 
517
									(Component) PluginServices.getMDIManager().getActiveView(), 
506 518
									PluginServices.getText(this, "please_insert_new_field_name"),
507 519
									fieldName
508 520
									);
509 521
							if (newName == null) return;
522
							if (edAdapter.getRecordset().getFieldIndexByName(newName) != -1)
523
							{
524
								JOptionPane.showMessageDialog(
525
										null,
526
										PluginServices.getText(this, "field_already_exists"));
527
								return;
528
							}
529
							
510 530

  
511 531
							edAdapter.renameField(fieldName, newName);
512 532
						} catch (EditionException e1) {
513 533
							// TODO Auto-generated catch block
514 534
							e1.printStackTrace();
535
						} catch (DriverLoadException e1) {
536
							// TODO Auto-generated catch block
537
							e1.printStackTrace();
538
						} catch (DriverException e1) {
539
							// TODO Auto-generated catch block
540
							e1.printStackTrace();
515 541
						}
516 542
					}
517 543
					jTableFields.repaint();

Also available in: Unified diff