Revision ac70dabe
Added by Andreas Müller almost 3 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.UUID; |
12 | 12 |
|
13 |
import javax.inject.Inject; |
|
14 |
|
|
15 | 13 |
import org.apache.log4j.Logger; |
16 | 14 |
import org.eclipse.core.runtime.IAdaptable; |
17 | 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 |
import org.eclipse.e4.ui.di.UISynchronize; |
|
19 | 16 |
import org.eclipse.e4.ui.model.application.MApplication; |
20 | 17 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
21 | 18 |
import org.eclipse.e4.ui.workbench.modeling.EModelService; |
... | ... | |
33 | 30 |
/** |
34 | 31 |
* @author k.luther |
35 | 32 |
* @date 10.02.2017 |
36 |
* |
|
37 | 33 |
*/ |
38 |
public class SetSecundumForSubtreeOperation extends UpdateSubtreeOperation implements IPostMoniteredOperationEnabled{ |
|
34 |
public class SetSecundumForSubtreeOperation |
|
35 |
extends UpdateSubtreeOperation |
|
36 |
implements IPostMoniteredOperationEnabled{ |
|
39 | 37 |
|
40 | 38 |
private final static String LABEL = Messages.SetSecundumForSubtreeOperation_CHANGE_SEC_OP; |
41 | 39 |
@SuppressWarnings("unused") |
42 | 40 |
private static final Logger logger = Logger.getLogger(SetSecundumForSubtreeOperation.class); |
43 | 41 |
|
44 |
@Inject |
|
45 |
private UISynchronize sync; |
|
46 |
|
|
47 |
|
|
48 | 42 |
public SetSecundumForSubtreeOperation(Object source, boolean async, UUID taxonNodeUuid, EPartService partService, |
49 | 43 |
MPart activePart, MApplication application, EModelService modelService, SecundumForSubtreeConfigurator config) { |
50 | 44 |
super(source, async, taxonNodeUuid, partService, activePart, application, modelService, config, LABEL); |
51 |
|
|
52 | 45 |
} |
53 | 46 |
|
54 | 47 |
@Override |
55 | 48 |
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception { |
56 | 49 |
EditorUtil.checkForChanges(null, partService); |
57 |
|
|
58 |
// runMoniteredOperation(); |
|
59 |
runMoniteredOperation(); |
|
60 |
// updateNameEditors(); |
|
61 |
// Job job = createJob(monitor); |
|
62 |
// // configure the job |
|
63 |
// job.setProperty(IProgressConstants.KEEP_PROPERTY, true); |
|
64 |
// job.setUser(true); |
|
65 |
// // schedule job |
|
66 |
// job.schedule(); |
|
67 |
|
|
68 |
return updateResult; |
|
69 |
|
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
|
|
74 |
// private Job createJob(IProgressMonitor monitor){ |
|
75 |
// Assert.isNotNull(config, "Configuration may not be null"); |
|
76 |
// |
|
77 |
// final Display display = Display.getDefault(); |
|
78 |
// |
|
79 |
// Job job = new Job(Messages.SetSecundumForSubtreeOperation_SET_SEC_TASK) { |
|
80 |
// @Override |
|
81 |
// protected IStatus run(IProgressMonitor monitor) { |
|
82 |
// if (config instanceof SecundumForSubtreeConfigurator){ |
|
83 |
// updateResult = taxonNodeService.setSecundumForSubtree((SecundumForSubtreeConfigurator)config); |
|
84 |
// }else{ |
|
85 |
// return Status.CANCEL_STATUS; |
|
86 |
// } |
|
87 |
// |
|
88 |
// return Status.OK_STATUS; |
|
89 |
// |
|
90 |
// } |
|
91 |
// }; |
|
92 |
// return job; |
|
93 |
// } |
|
94 |
|
|
95 |
|
|
96 |
public void runMoniteredOperation() { |
|
97 | 50 |
final UUID uuid = longRunningTaskService.monitLongRunningTask(config); |
98 |
Display.getDefault().asyncExec(new Runnable() { |
|
99 |
@Override |
|
100 |
public void run() { |
|
51 |
Display.getDefault().asyncExec(()->{ |
|
101 | 52 |
AbstractUtility.executeMoniteredOperation("Set Secundum Reference for Subtree", |
102 | 53 |
uuid, |
103 | 54 |
1000, |
104 |
false,
|
|
55 |
true,
|
|
105 | 56 |
SetSecundumForSubtreeOperation.this, |
106 | 57 |
null, |
107 | 58 |
true, false); |
108 |
|
|
109 |
} |
|
110 | 59 |
}); |
60 |
return updateResult; |
|
111 | 61 |
} |
112 | 62 |
|
113 | 63 |
@Override |
114 | 64 |
public void postOperation(IRemotingProgressMonitor monitor) { |
115 | 65 |
// TODO Auto-generated method stub |
116 | 66 |
} |
117 |
} |
|
67 |
} |
Also available in: Unified diff
cleanup and set cancelable to true SetXXXForSubtreeOperations