Project

General

Profile

« Previous | Next » 

Revision e82d1be9

Added by Andreas Müller almost 3 years ago

cleanup

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/handler/DeleteDescriptiveDataSetHandler.java
1

  
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
2 9
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.handler;
3 10

  
4 11
import java.util.Iterator;
......
29 36
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
30 37
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
31 38
import eu.etaxonomy.taxeditor.model.MessagingUtils;
39
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
32 40
import eu.etaxonomy.taxeditor.store.CdmStore;
33 41
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
34 42

  
......
44 52
	    this.partService = partService;
45 53
	    Object object = activePart.getObject();
46 54
	    if(!selection.isEmpty()  && object instanceof DescriptiveDataSetNavigator){
47
	        Iterator iterator = selection.iterator();
55
	        Iterator<?> iterator = selection.iterator();
48 56
	        while(iterator.hasNext()){
49 57
	            Object next = iterator.next();
50 58
	            if(next instanceof DescriptiveDataSet){
......
53 61
	                if (!DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteDescriptiveDataSetHandler_DELETE_TITLE,  Messages.DeleteDescriptiveDataSetHandler_DELETE_MESSAGE)){
54 62
	                    return;
55 63
	                }
56
//	                    IDescriptiveDataSetService descriptiveDataSetService = CdmStore.getService(IDescriptiveDataSetService.class);
57
//	                    descriptiveDataSetService.delete(((DescriptiveDataSet) next).getUuid());
58
	                    deleteDescriptiveDataSet(((DescriptiveDataSet) next).getUuid(), deleteConfig);
59
	                    DescriptiveDataSetNavigator navigator = (DescriptiveDataSetNavigator) object;
60
	                    navigator.removeDescriptiveDataSet((DescriptiveDataSet) next);
61
	                    navigator.getConversationHolder().commit();
62
	                    navigator.getSelService().setSelection(null);
63

  
64
	                }
65
	                else{
66
	                    MessagingUtils.errorDialog(Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_TITLE, DeleteDescriptiveDataSetHandler.class, Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_MESSAGE, TaxeditorEditorPlugin.PLUGIN_ID, null, false);
67
	                    return;
68
	                }
64
//	                IDescriptiveDataSetService descriptiveDataSetService = CdmStore.getService(IDescriptiveDataSetService.class);
65
//	                descriptiveDataSetService.delete(((DescriptiveDataSet) next).getUuid());
66
                    deleteDescriptiveDataSet(((DescriptiveDataSet) next).getUuid(), deleteConfig);
67
                    DescriptiveDataSetNavigator navigator = (DescriptiveDataSetNavigator) object;
68
                    navigator.removeDescriptiveDataSet((DescriptiveDataSet) next);
69
                    navigator.getConversationHolder().commit();
70
                    navigator.getSelService().setSelection(null);
71
                }else{
72
                    MessagingUtils.errorDialog(Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_TITLE, DeleteDescriptiveDataSetHandler.class, Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_MESSAGE, TaxeditorEditorPlugin.PLUGIN_ID, null, false);
73
                    return;
74
                }
69 75
	        }
70 76
	    }
71 77
	}
......
85 91
                                monitorUuid,
86 92
                                50,
87 93
                                null,
88
                                (List)null,
94
                                (List<IFeedbackGenerator>)null,
89 95
                                subMonitor);
90 96
                Object resultObject = remotingMonitor.getResult();
91 97
                if(resultObject instanceof Exception){
......
100 106
                                        .stream().map(ex->ex.toString())
101 107
                                        .collect(Collectors.joining("\n"))));
102 108
                    }
103

  
104

  
105 109
                }
106 110
            } catch (InterruptedException e) {
107 111
                return;
......
111 115

  
112 116
        job.schedule();
113 117
    }
114

  
115

  
116

  
117

  
118 118
}

Also available in: Unified diff