1
|
/**
|
2
|
* Copyright (C) 2015 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
|
package eu.etaxonomy.taxeditor.navigation.navigator.operation;
|
10
|
|
11
|
import java.util.UUID;
|
12
|
|
13
|
import org.eclipse.core.runtime.IAdaptable;
|
14
|
import org.eclipse.core.runtime.IProgressMonitor;
|
15
|
import org.eclipse.swt.widgets.Display;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
|
18
|
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
|
19
|
import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
|
20
|
import eu.etaxonomy.cdm.api.service.UpdateResult;
|
21
|
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
|
22
|
import eu.etaxonomy.taxeditor.event.EventUtility;
|
23
|
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
|
24
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
25
|
import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
|
26
|
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
|
27
|
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
|
28
|
|
29
|
/**
|
30
|
*
|
31
|
* @author pplitzner
|
32
|
* @date 06.08.2018
|
33
|
*
|
34
|
*/
|
35
|
public class AggregateTaxonDescriptionsOperation extends RemotingCdmUpdateOperation implements IPostMoniteredOperationEnabled {
|
36
|
|
37
|
private UUID nodeUuid;
|
38
|
private UUID monitorUuid;
|
39
|
|
40
|
public AggregateTaxonDescriptionsOperation(Object source,
|
41
|
boolean async,
|
42
|
UUID nodeUuid) {
|
43
|
super("Aggregate taxon descriptions", Action.Update, source,async);
|
44
|
this.nodeUuid = nodeUuid;
|
45
|
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
|
50
|
runMoniteredOperation();
|
51
|
return updateResult;
|
52
|
}
|
53
|
|
54
|
public void runMoniteredOperation() {
|
55
|
monitorUuid = CdmApplicationState.getLongRunningTasksService().aggregateComputedTaxonDescriptions(nodeUuid);
|
56
|
|
57
|
Display.getDefault().asyncExec(new Runnable() {
|
58
|
@Override
|
59
|
public void run() {
|
60
|
AbstractUtility.executeMoniteredOperation("Move Taxon to new parent: ",
|
61
|
monitorUuid,
|
62
|
500,
|
63
|
false,
|
64
|
AggregateTaxonDescriptionsOperation.this,
|
65
|
null,
|
66
|
true);
|
67
|
}
|
68
|
});
|
69
|
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public void postOperation(IRemotingProgressMonitor monitor) {
|
74
|
monitor.done();
|
75
|
EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, true);
|
76
|
}
|
77
|
|
78
|
}
|