Project

General

Profile

« Previous | Next » 

Revision 4ae1033f

Added by Patrick Plitzner over 6 years ago

ref #6595 Fix "move synonym to another taxon" handler

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java
4 4
import java.util.List;
5 5
import java.util.UUID;
6 6

  
7
import javax.inject.Inject;
7 8
import javax.inject.Named;
8 9

  
9 10
import org.apache.log4j.Logger;
10 11
import org.eclipse.e4.core.di.annotations.CanExecute;
11 12
import org.eclipse.e4.core.di.annotations.Execute;
12 13
import org.eclipse.e4.ui.di.UISynchronize;
14
import org.eclipse.e4.ui.model.application.MApplication;
13 15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
14 16
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
15 17
import org.eclipse.e4.ui.services.IServiceConstants;
18
import org.eclipse.e4.ui.workbench.modeling.EModelService;
19
import org.eclipse.e4.ui.workbench.modeling.EPartService;
16 20
import org.eclipse.jface.viewers.IStructuredSelection;
17 21
import org.eclipse.swt.widgets.Shell;
18 22

  
......
37 41

  
38 42
	private TaxonNameEditorE4 editor;
39 43

  
44
    private TaxonNode newParentNode;
45

  
46
    private EPartService partService;
47

  
48
    @Inject
49
    private EModelService modelService;
50

  
51
    @Inject
52
    private MApplication application;
53

  
40 54
	@Execute
41 55
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
42 56
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
43
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
57
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, EPartService partService,
44 58
            UISynchronize sync) {
45 59

  
60
	    this.partService = partService;
61

  
46 62
        editor = (TaxonNameEditorE4) activePart.getObject();
47 63

  
48 64
        TaxonEditorInputE4 input = editor.getEditorInput();
......
63 79
		excludeTaxa.add(oldParent.getUuid());
64 80

  
65 81

  
66
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa,  input.getTaxonNode(), input.getTaxonNode().getClassification());
82
		newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa,  input.getTaxonNode(), input.getTaxonNode().getClassification());
67 83

  
68 84
		if(newParentNode!=null){
69 85
		   MoveSynonymToAnotherAcceptedTaxonOperationE4 operation = new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
70
		            synonym.getUuid(), newParentNode.getTaxon(), editor, editor);
86
		            synonym.getUuid(), newParentNode.getTaxon(), this, editor);
71 87

  
72 88
		    AbstractUtility.executeOperation(operation, sync);
73 89
		}
......
94 110

  
95 111
	@Override
96 112
	public boolean onComplete() {
97
		return false;
113
	    EditorUtil.openTaxonNodeE4(newParentNode.getUuid(), modelService, partService, application);
114
		return true;
98 115
	}
99 116

  
100 117
}

Also available in: Unified diff