1
|
|
2
|
package eu.etaxonomy.taxeditor.editor.workingSet.handler;
|
3
|
|
4
|
import javax.inject.Named;
|
5
|
|
6
|
import org.eclipse.e4.core.di.annotations.Execute;
|
7
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
8
|
import org.eclipse.e4.ui.services.IServiceConstants;
|
9
|
|
10
|
import eu.etaxonomy.cdm.api.service.IWorkingSetService;
|
11
|
import eu.etaxonomy.cdm.model.description.WorkingSet;
|
12
|
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
|
13
|
import eu.etaxonomy.taxeditor.editor.workingSet.WorkingSetNavigator;
|
14
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
15
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
16
|
|
17
|
public class DeleteWorkingSetHandler {
|
18
|
|
19
|
@Execute
|
20
|
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
|
21
|
@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
|
22
|
boolean confirm = MessagingUtils.confirmDialog("Confirm delete", "Do you really want to delete the working set?");
|
23
|
if(confirm && selection instanceof UuidAndTitleCache){
|
24
|
IWorkingSetService workingSetService = CdmStore.getService(IWorkingSetService.class);
|
25
|
workingSetService.delete(((UuidAndTitleCache) selection).getUuid());
|
26
|
WorkingSetNavigator navigator = (WorkingSetNavigator) activePart.getObject();
|
27
|
navigator.removeWorkingSet((UuidAndTitleCache<WorkingSet>) selection);
|
28
|
navigator.getConversationHolder().commit();
|
29
|
}
|
30
|
}
|
31
|
|
32
|
}
|