Project

General

Profile

Download (2.01 KB) Statistics
| Branch: | Tag: | Revision:
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
*/
9

    
10
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler;
11

    
12
import java.util.List;
13

    
14
import org.eclipse.core.commands.AbstractHandler;
15
import org.eclipse.core.commands.ExecutionEvent;
16
import org.eclipse.core.commands.ExecutionException;
17
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.ui.handlers.HandlerUtil;
19

    
20
import eu.etaxonomy.cdm.model.description.PolytomousKey;
21
import eu.etaxonomy.taxeditor.model.MessagingUtils;
22
import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4;
23

    
24
/**
25
 * @author n.hoffmann
26
 * @created Dec 3, 2010
27
 * @version 1.0
28
 */
29
public class DeleteHandler extends AbstractHandler {
30

    
31
    /* (non-Javadoc)
32
	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
33
	 */
34
	@Override
35
	public Object execute(ExecutionEvent event) throws ExecutionException {
36
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
37

    
38
		List<PolytomousKey> keys = selection.toList();
39

    
40
		if(keys.isEmpty()){
41
			return null;
42
		}
43

    
44
		boolean confirmation = MessagingUtils.confirmDialog(RemotingDeletePolytomousKeyHandlerE4.CONFIRM, RemotingDeletePolytomousKeyHandlerE4.CONFIRM_MESSAGE);
45

    
46
		if(confirmation){
47

    
48
//			for(PolytomousKey key : keys){
49
//				try {
50
//				    PolytomousKeyViewPart pkvp = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
51
//					AbstractPostOperation operation = new DeleteOperation(
52
//							event.getCommand().getName(),
53
//							NavigationUtil.getUndoContext(), key,
54
//							pkvp,
55
//							pkvp,
56
//							pkvp);
57
//					NavigationUtil.executeOperation(operation);
58
//				} catch (NotDefinedException e) {
59
//					MessagingUtils.error(getClass(), e);
60
//				}
61
//			}
62
		}
63

    
64
		return null;
65
	}
66

    
67
}
(1-1/8)