Project

General

Profile

« Previous | Next » 

Revision aafe36c5

Added by Katja Luther about 8 years ago

don't allow delete a taxon used in a classification

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
130 130
						if (object != null){
131 131
							NameDeletionConfigurator config = new NameDeletionConfigurator();
132 132

  
133
							DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion",  null,  "Do you really want to delete the name", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
133
							DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion",  null,  "Do you really want to delete the name?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
134 134
							int result_dialog= dialog.open();
135 135
							if (result_dialog == 1){
136 136
								return null;
......
142 142
						ITaxonService service = controller.getTaxonService();
143 143
						if (object != null){
144 144
							if (object instanceof Taxon){
145
								TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
145
							    TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
146 146
								config.setDeleteInAllClassifications(true);
147
								DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion",  null,  "Do you really want to delete the taxon", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
148
								int result_dialog= dialog.open();
149
								if (result_dialog == 1){
150
									return null;
147
								DeleteConfiguratorDialog dialog;
148
								if (((Taxon)object).getTaxonNodes().isEmpty()){
149
								    dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion",  null,  "Do you really want to delete the taxon?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
150
								    int result_dialog= dialog.open();
151
	                                if (result_dialog == 1){
152
	                                    return null;
153
	                                }
154
	                                result = service.deleteTaxon(((TaxonBase) object).getUuid(), config, null);
155
	                                errorMessage = "The taxon ";
156
								} else{
157
								    MessagingUtils.messageDialog("Delete not possible", getClass(), "The taxon can not be deleted in bulk editor. It is used in a classification.", null);
158
								    return null;
151 159
								}
152
								result = service.deleteTaxon(((TaxonBase) object).getUuid(), config, null);
153
								errorMessage = "The taxon ";
160

  
154 161
							}else{
155 162
								SynonymDeletionConfigurator config = new SynonymDeletionConfigurator();
156 163

  

Also available in: Unified diff