Project

General

Profile

« Previous | Next » 

Revision 361694e2

Added by Katja Luther over 3 years ago

fix #9166: avoid class cast exception while editing namedescriptions in taxon bulk editor

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
242 242
            if (element instanceof DescriptionBase){
243 243
                if (element instanceof TaxonNameDescription){
244 244
                    TaxonName changedName = ((TaxonNameDescription)element).getTaxonName();
245
                    getEditorInput().addSaveCandidate(changedName);
245
                    if (getEditorInput() instanceof TaxonEditorInput){
246
                        IStructuredSelection sel = getSelection();
247
                        Object firstElement = sel.getFirstElement();
248
                        if (firstElement instanceof TaxonBase){
249
                            getEditorInput().addSaveCandidate((TaxonBase)firstElement);
250
                        }
251
                    }else{
252
                        getEditorInput().addSaveCandidate(changedName);
253
                    }
254

  
246 255
                    input.replaceInModel(changedName);
247 256
                }else if (element instanceof TaxonDescription){
248 257
                    Taxon changedTaxon = ((TaxonDescription)element).getTaxon();
......
252 261
            }else if (element instanceof DescriptionElementBase){
253 262
                if (((DescriptionElementBase)element).getInDescription() instanceof TaxonNameDescription){
254 263
                    TaxonName changedName = ((TaxonNameDescription)((DescriptionElementBase)element).getInDescription()).getTaxonName();
255
                    getEditorInput().addSaveCandidate(changedName);
264
                    //check whether the bulk editor is taxon or name bulk editor
265
                    if (getEditorInput() instanceof TaxonEditorInput){
266
                        IStructuredSelection sel = getSelection();
267
                        Object firstElement = sel.getFirstElement();
268
                        if (firstElement instanceof TaxonBase){
269
                            getEditorInput().addSaveCandidate((TaxonBase)firstElement);
270
                        }
271
                    }else{
272
                        getEditorInput().addSaveCandidate(changedName);
273
                    }
256 274
                    input.replaceInModel(changedName);
257 275
                }else if (((DescriptionElementBase)element).getInDescription() instanceof TaxonDescription){
258 276
                    Taxon changedTaxon = ((TaxonDescription)((DescriptionElementBase)element).getInDescription()).getTaxon();

Also available in: Unified diff