Project

General

Profile

« Previous | Next » 

Revision 0ee41c8b

Added by Katja Luther almost 4 years ago

ref #8753: set selection to null after deleting descriptiveDataSet

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/DescriptiveDataSetEditor.java
69 69
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
70 70
import eu.etaxonomy.cdm.persistence.dto.TermDto;
71 71
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
72
import eu.etaxonomy.taxeditor.editor.IDescriptiveDataSetEditor;
72 73
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
73 74
import eu.etaxonomy.taxeditor.event.EventUtility;
74 75
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
......
89 90
 *
90 91
 */
91 92
public class DescriptiveDataSetEditor implements IE4SavablePart, IConversationEnabled, ICdmEntitySessionEnabled,
92
IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable {
93
IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable, IDescriptiveDataSetEditor {
93 94

  
94 95
    private DescriptiveDataSetComposite composite;
95 96

  
......
342 343
            cdmEntitySession = null;
343 344
        }
344 345
        dirty.setDirty(false);
346
        selectionService.setSelection(null);
345 347
    }
346 348

  
347 349
    @Focus
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/DescriptiveDataSetNavigator.java
201 201
        return conversation;
202 202
    }
203 203

  
204
    public ESelectionService getSelService() {
205
        return selService;
206
    }
207

  
204 208
    /** {@inheritDoc} */
205 209
    @PreDestroy
206 210
    public void dispose() {
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/handler/DeleteDescriptiveDataSetHandler.java
15 15
import org.eclipse.e4.core.di.annotations.Execute;
16 16
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
17 17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.e4.ui.workbench.modeling.EPartService;
18 19
import org.eclipse.jface.viewers.IStructuredSelection;
19 20

  
20 21
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
21 22
import eu.etaxonomy.cdm.api.service.UpdateResult;
22 23
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
23 24
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
25
import eu.etaxonomy.taxeditor.editor.EditorUtil;
24 26
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.DescriptiveDataSetNavigator;
25 27
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
26 28
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
......
28 30
import eu.etaxonomy.taxeditor.store.CdmStore;
29 31

  
30 32
public class DeleteDescriptiveDataSetHandler {
33
    protected EPartService partService;
31 34

  
32
	@Execute
35
    @Execute
33 36
	public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
34
	        @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
37
	        @Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
35 38
	    boolean confirm = MessagingUtils.confirmDialog(Messages.DeleteDescriptiveDataSetHandler_DELETE_TITLE, Messages.DeleteDescriptiveDataSetHandler_DELETE_MESSAGE);
39
	    this.partService = partService;
36 40
	    Object object = activePart.getObject();
37 41
	    if(!selection.isEmpty() && confirm && object instanceof DescriptiveDataSetNavigator){
38 42
	        Iterator iterator = selection.iterator();
......
45 49
	                    DescriptiveDataSetNavigator navigator = (DescriptiveDataSetNavigator) object;
46 50
	                    navigator.removeDescriptiveDataSet((DescriptiveDataSet) next);
47 51
	                    navigator.getConversationHolder().commit();
52
	                    navigator.getSelService().setSelection(null);
53

  
48 54
	                }
49 55
	                else{
50 56
	                    MessagingUtils.errorDialog(Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_TITLE, DeleteDescriptiveDataSetHandler.class, Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_MESSAGE, TaxeditorEditorPlugin.PLUGIN_ID, null, false);
......
55 61
	}
56 62

  
57 63
	private void deleteDescriptiveDataSet(UUID descriptiveDataSetUuid){
64
	    EditorUtil.closeObsoleteDescriptiveDatasetEditor(descriptiveDataSetUuid, partService);
58 65
        UUID monitorUuid =  CdmApplicationState.getLongRunningTasksService().deleteDescriptiveDataset(descriptiveDataSetUuid);
59 66

  
60 67
        String jobLabel = "Delete descriptive dataset";
......
83 90
                                        .collect(Collectors.joining("\n"))));
84 91
                    }
85 92

  
93

  
86 94
                }
87 95
            } catch (InterruptedException e) {
88 96
                return;
......
94 102
    }
95 103

  
96 104

  
105

  
106

  
97 107
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
104 104
	            showEmptyPage();
105 105
	            return;
106 106
	        }
107

  
107 108
	        else if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){
108 109
	            return;
109 110
	        }

Also available in: Unified diff