Project

General

Profile

« Previous | Next » 

Revision 281f389b

Added by U-BGBM\k.luther over 8 years ago

error handling in deleteHandler/operation of navigator

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
125 125
					}else{
126 126
						if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
127 127
							return null;
128
						} 
128
						}
129 129
						config.setTaxonNodeConfig(configNodes);
130 130
					}
131 131
				}
......
146 146

  
147 147
			} catch (NotDefinedException e) {
148 148
				MessagingUtils.warn(getClass(), "Command name not set");
149
			} catch (Exception e){
150
			    MessagingUtils.error(getClass(), e);
149 151
			}
150 152
		} else{
151 153
			try{
......
161 163
				}
162 164
			}catch (NotDefinedException e) {
163 165
				MessagingUtils.warn(getClass(), "Command name not set");
164
			}
166
			} catch (Exception e){
167
                MessagingUtils.error(getClass(), e);
168
            }
165 169
		}
166 170
		return null;
167 171
	}
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java
29 29
import eu.etaxonomy.cdm.model.taxon.Classification;
30 30
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
31 31
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
32
import eu.etaxonomy.taxeditor.model.MessagingUtils;
32 33
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
33 34
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
34 35
import eu.etaxonomy.taxeditor.store.CdmStore;
......
107 108
				} else if (!result.getExceptions().isEmpty()){
108 109
					String separator = ", ";
109 110
				    String exceptionString = "";
111
				    int count = 1;
110 112
				    for (Exception exception : result.getExceptions()) {
111
			            exceptionString += exception.getLocalizedMessage()+separator;
113
				        exceptionString += exception.getLocalizedMessage();
114
				        if (count < result.getExceptions().size()){
115
				            exceptionString += separator;
116
				        }
112 117
			        }
113
					MessageDialog.openInformation(null, "Delete of the node was successful but the taxon could not be deleted.", exceptionString);
118
					MessagingUtils.informationDialog("Delete of the node was successful but the taxon could not be deleted.", exceptionString);
114 119
				}
115 120

  
116 121

  
......
124 129

  
125 130
				DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
126 131
				if (result.isError() && !result.getExceptions().isEmpty()){
127
					//TODO:Error message!
128
					MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
132
				    String separator = ", ";
133
                    String exceptionString = "";
134
                    for (Exception exception : result.getExceptions()) {
135
                        exceptionString += exception.getLocalizedMessage()+separator;
136
                    }
137
				    MessagingUtils.error(null, exceptionString, result.getExceptions().iterator().next());
129 138
				}
130 139

  
131 140
				/*}else{
......
139 148

  
140 149
				DeleteResult result =service.deleteTaxonNodes(treeNodes, config);
141 150
				if (result.isError() && !result.getExceptions().isEmpty()){
142
					//TODO:Error message!
143
					MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
151
				    String separator = ", ";
152
                    String exceptionString = "";
153
                    for (Exception exception : result.getExceptions()) {
154
                        exceptionString += exception.getLocalizedMessage()+separator;
155
                    }
156
                    MessagingUtils.error(null, exceptionString, result.getExceptions().iterator().next());
144 157
				}
145 158
			}
146 159

  

Also available in: Unified diff