import java.util.List;
import java.util.UUID;
+import javax.inject.Inject;
import javax.inject.Named;
import org.apache.log4j.Logger;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
private TaxonNameEditorE4 editor;
+ private TaxonNode newParentNode;
+
+ private EPartService partService;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private MApplication application;
+
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
- @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, EPartService partService,
UISynchronize sync) {
+ this.partService = partService;
+
editor = (TaxonNameEditorE4) activePart.getObject();
TaxonEditorInputE4 input = editor.getEditorInput();
excludeTaxa.add(oldParent.getUuid());
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, input.getTaxonNode(), input.getTaxonNode().getClassification());
+ newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, input.getTaxonNode(), input.getTaxonNode().getClassification());
if(newParentNode!=null){
MoveSynonymToAnotherAcceptedTaxonOperationE4 operation = new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
- synonym.getUuid(), newParentNode.getTaxon(), editor, editor);
+ synonym.getUuid(), newParentNode.getTaxon(), this, editor);
AbstractUtility.executeOperation(operation, sync);
}
@Override
public boolean onComplete() {
- return false;
+ EditorUtil.openTaxonNodeE4(newParentNode.getUuid(), modelService, partService, application);
+ return true;
}
}