Project

General

Profile

« Previous | Next » 

Revision 360b73f0

Added by Patrick Plitzner over 6 years ago

ref #6908 Migrate polytomous key list editor handlers

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingDeletePolytomousKeyHandlerE4.java
15 15
import org.eclipse.core.commands.operations.AbstractOperation;
16 16
import org.eclipse.core.runtime.IStatus;
17 17
import org.eclipse.core.runtime.Status;
18
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
18 20
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.swt.widgets.Shell;
19 22
import org.eclipse.ui.IEditorInput;
20 23
import org.eclipse.ui.IEditorReference;
21 24
import org.eclipse.ui.IWorkbenchPage;
......
26 29
import eu.etaxonomy.taxeditor.model.MessagingUtils;
27 30
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
28 31
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
29
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
32
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
33
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
30 34
import eu.etaxonomy.taxeditor.util.OperationsUtil;
31 35

  
32 36
/**
......
34 38
 * @date 25 Jun 2015
35 39
 *
36 40
 */
37
public class RemotingDeletePolytomousKeyHandlerE4 extends RemotingCdmHandler {
41
public class RemotingDeletePolytomousKeyHandlerE4 extends RemotingCdmHandlerE4 {
38 42

  
39 43
    List<UUID> keysToDelete;
40
    /**
41
     * @param label
42
     */
44
    public static final String CONFIRM = Messages.DeleteHandler_CONFIRM;
45
    public static final String CONFIRM_MESSAGE = Messages.DeleteHandler_CONFIRM_MESSAGE;
46

  
43 47
    public RemotingDeletePolytomousKeyHandlerE4() {
44 48
        super(PolytomousKeyViewLabels.DELETE_POLYTOMOUS_KEY_LABEL);
45 49
    }
46 50

  
47
    /* (non-Javadoc)
48
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
49
     */
50 51
    @Override
51
    public IStatus allowOperations(ExecutionEvent event) {
52
        IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
52
    public IStatus allowOperations(IStructuredSelection selection, Shell shell, MPart activePart,
53
            MHandledMenuItem menuItem) {
53 54

  
54 55
        keysToDelete = OperationsUtil.convertToUuidList(selection.toList());
55 56

  
......
57 58
           return Status.CANCEL_STATUS;
58 59
        }
59 60

  
60
        boolean confirmation = MessagingUtils.confirmDialog(DeleteHandler.CONFIRM, DeleteHandler.CONFIRM_MESSAGE);
61
        boolean confirmation = MessagingUtils.confirmDialog(CONFIRM, CONFIRM_MESSAGE);
61 62

  
62 63
        if(!confirmation) {
63 64
            return Status.CANCEL_STATUS;
64 65
        }
65
        closeObsoleteEditor(event);
66
        //FIXME E4 migrate
67
//        closeObsoleteEditor(event);
66 68
        return Status.OK_STATUS;
67 69
    }
68 70

  
69
    /* (non-Javadoc)
70
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
71
     */
72 71
    @Override
73
    public AbstractOperation prepareOperation(ExecutionEvent event) {
74
        return new RemotingDeletePolytomousKeyOperation(event.getTrigger(),
72
    public AbstractOperation prepareOperation(IStructuredSelection selection, Shell shell, MPart activePart,
73
            MHandledMenuItem menuItem) {
74
        return new RemotingDeletePolytomousKeyOperation(getTrigger(),
75 75
                false,
76 76
                keysToDelete);
77 77
    }
78 78

  
79
    /* (non-Javadoc)
80
     * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
81
     */
82 79
    @Override
83 80
    public void onComplete() {
84
        // TODO Auto-generated method stub
85

  
86 81
    }
82

  
87 83
    protected boolean closeObsoleteEditor(ExecutionEvent event){
88 84
        boolean result = true;
89 85
        IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
......
107 103
        return result;
108 104
    }
109 105

  
106
    /**
107
     * {@inheritDoc}
108
     */
109
    @Override
110
    protected Object getTrigger() {
111
        return this;
112
    }
110 113
}

Also available in: Unified diff