3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
.handler
;
12 import java
.util
.List
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.core
.commands
.ExecutionEvent
;
16 import org
.eclipse
.core
.commands
.operations
.AbstractOperation
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
18 import org
.eclipse
.core
.runtime
.Status
;
19 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
20 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
22 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
23 import eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
.PolytomousKeyViewLabels
;
24 import eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
.operation
.RemotingDeletePolytomousKeyOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.RemotingCdmHandler
;
26 import eu
.etaxonomy
.taxeditor
.util
.OperationsUtil
;
33 public class RemotingDeletePolytomousKeyHandler
extends RemotingCdmHandler
{
35 List
<UUID
> keysToDelete
;
39 public RemotingDeletePolytomousKeyHandler() {
40 super(PolytomousKeyViewLabels
.DELETE_POLYTOMOUS_KEY_LABEL
);
44 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
47 public IStatus
allowOperations(ExecutionEvent event
) {
48 IStructuredSelection selection
= (IStructuredSelection
) HandlerUtil
.getCurrentSelection(event
);
50 keysToDelete
= OperationsUtil
.convertToUuidList(selection
.toList());
52 if(keysToDelete
.isEmpty()){
53 return Status
.CANCEL_STATUS
;
56 boolean confirmation
= MessagingUtils
.confirmDialog("Confirm deletaion", "Do you want to delete the selected key" + (keysToDelete
.size() == 1 ?
"" : "s") + "?");
59 return Status
.CANCEL_STATUS
;
61 return Status
.OK_STATUS
;
65 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
68 public AbstractOperation
prepareOperation(ExecutionEvent event
) {
69 return new RemotingDeletePolytomousKeyOperation(event
.getTrigger(),
75 * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
78 public void onComplete() {
79 // TODO Auto-generated method stub