1 |
cfcb0ce6
|
n.hoffmann
|
/**
|
2 |
42c4238c
|
Cherian Mathew
|
*
|
3 |
cfcb0ce6
|
n.hoffmann
|
*/
|
4 |
|
|
package eu.etaxonomy.taxeditor.model;
|
5 |
|
|
|
6 |
cc7c531b
|
Cherian Mathew
|
import java.io.Serializable;
|
7 |
|
|
|
8 |
143e2f91
|
n.hoffmann
|
import org.eclipse.core.runtime.IProgressMonitor;
|
9 |
|
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
10 |
|
|
|
11 |
27b59ab1
|
n.hoffmann
|
import eu.etaxonomy.taxeditor.store.StoreUtil;
|
12 |
cfcb0ce6
|
n.hoffmann
|
|
13 |
|
|
/**
|
14 |
3be6ef3e
|
n.hoffmann
|
* <p>CdmProgressMonitorAdapter class.</p>
|
15 |
|
|
*
|
16 |
cfcb0ce6
|
n.hoffmann
|
* @author n.hoffmann
|
17 |
|
|
* @created Sep 17, 2010
|
18 |
|
|
* @version 1.0
|
19 |
|
|
*/
|
20 |
6a2d7a17
|
Katja Luther
|
public class CdmProgressMonitorAdapter implements eu.etaxonomy.cdm.common.monitor.IProgressMonitor, Serializable {
|
21 |
42c4238c
|
Cherian Mathew
|
|
22 |
143e2f91
|
n.hoffmann
|
private IProgressMonitor progressMonitor;
|
23 |
cfcb0ce6
|
n.hoffmann
|
|
24 |
143e2f91
|
n.hoffmann
|
private CdmProgressMonitorAdapter (IProgressMonitor monitor){
|
25 |
|
|
if(monitor == null){
|
26 |
|
|
monitor = new NullProgressMonitor();
|
27 |
|
|
}
|
28 |
42c4238c
|
Cherian Mathew
|
|
29 |
27b59ab1
|
n.hoffmann
|
this.progressMonitor = monitor;
|
30 |
|
|
}
|
31 |
42c4238c
|
Cherian Mathew
|
|
32 |
3be6ef3e
|
n.hoffmann
|
/**
|
33 |
|
|
* <p>CreateMonitor</p>
|
34 |
|
|
*
|
35 |
|
|
* @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
|
36 |
|
|
* @return a {@link eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter} object.
|
37 |
|
|
*/
|
38 |
143e2f91
|
n.hoffmann
|
public static CdmProgressMonitorAdapter CreateMonitor (IProgressMonitor monitor){
|
39 |
27b59ab1
|
n.hoffmann
|
return new CdmProgressMonitorAdapter(monitor);
|
40 |
|
|
}
|
41 |
42c4238c
|
Cherian Mathew
|
|
42 |
3be6ef3e
|
n.hoffmann
|
/**
|
43 |
|
|
* <p>CreateSubMonitor</p>
|
44 |
|
|
*
|
45 |
|
|
* @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
|
46 |
|
|
* @param ticks a int.
|
47 |
|
|
* @return a {@link eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter} object.
|
48 |
|
|
*/
|
49 |
143e2f91
|
n.hoffmann
|
public static CdmProgressMonitorAdapter CreateSubMonitor (IProgressMonitor monitor, int ticks) {
|
50 |
|
|
IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, ticks);
|
51 |
27b59ab1
|
n.hoffmann
|
return new CdmProgressMonitorAdapter(subMonitor);
|
52 |
cfcb0ce6
|
n.hoffmann
|
}
|
53 |
42c4238c
|
Cherian Mathew
|
|
54 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
55 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
56 |
|
|
public void beginTask(String name, int totalWork) {
|
57 |
|
|
progressMonitor.beginTask(name, totalWork);
|
58 |
|
|
}
|
59 |
|
|
|
60 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
61 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
62 |
|
|
public void done() {
|
63 |
|
|
progressMonitor.done();
|
64 |
|
|
}
|
65 |
|
|
|
66 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
67 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
68 |
|
|
public boolean isCanceled() {
|
69 |
|
|
return progressMonitor.isCanceled();
|
70 |
|
|
}
|
71 |
|
|
|
72 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
73 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
74 |
|
|
public void setCanceled(boolean value) {
|
75 |
|
|
progressMonitor.setCanceled(value);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
79 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
80 |
|
|
public void setTaskName(String name) {
|
81 |
|
|
progressMonitor.setTaskName(name);
|
82 |
|
|
}
|
83 |
|
|
|
84 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
85 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
86 |
|
|
public void subTask(String name) {
|
87 |
|
|
progressMonitor.subTask(name);
|
88 |
|
|
}
|
89 |
|
|
|
90 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
91 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
92 |
|
|
public void worked(int work) {
|
93 |
|
|
progressMonitor.worked(work);
|
94 |
|
|
}
|
95 |
|
|
|
96 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
97 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
98 |
|
|
public void warning(String message) {
|
99 |
41e2f693
|
Cherian Mathew
|
MessagingUtils.warn(this.getClass(), message);
|
100 |
cfcb0ce6
|
n.hoffmann
|
}
|
101 |
|
|
|
102 |
3be6ef3e
|
n.hoffmann
|
/** {@inheritDoc} */
|
103 |
cfcb0ce6
|
n.hoffmann
|
@Override
|
104 |
|
|
public void warning(String message, Throwable throwable) {
|
105 |
41e2f693
|
Cherian Mathew
|
MessagingUtils.error(this.getClass(), message, throwable);
|
106 |
cfcb0ce6
|
n.hoffmann
|
}
|
107 |
0af47024
|
n.hoffmann
|
|
108 |
|
|
@Override
|
109 |
|
|
public void internalWorked(double arg0) {
|
110 |
|
|
progressMonitor.internalWorked(arg0);
|
111 |
|
|
}
|
112 |
42c4238c
|
Cherian Mathew
|
|
113 |
cc7c531b
|
Cherian Mathew
|
/**
|
114 |
|
|
* {@inheritDoc}
|
115 |
|
|
*/
|
116 |
|
|
@Override
|
117 |
|
|
public Serializable getFeedback() {
|
118 |
|
|
return null;
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
/**
|
122 |
|
|
* {@inheritDoc}
|
123 |
|
|
*/
|
124 |
|
|
@Override
|
125 |
|
|
public boolean getIsWaitingForFeedback() {
|
126 |
|
|
return false;
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
/**
|
130 |
|
|
* {@inheritDoc}
|
131 |
|
|
*/
|
132 |
|
|
@Override
|
133 |
|
|
public void setFeedback(Serializable arg0) {
|
134 |
|
|
|
135 |
|
|
}
|
136 |
|
|
|
137 |
42c4238c
|
Cherian Mathew
|
/**
|
138 |
|
|
* {@inheritDoc}
|
139 |
|
|
*/
|
140 |
|
|
@Override
|
141 |
|
|
public void waitForFeedback() {
|
142 |
|
|
|
143 |
|
|
}
|
144 |
cc7c531b
|
Cherian Mathew
|
|
145 |
|
|
/**
|
146 |
|
|
* {@inheritDoc}
|
147 |
|
|
*/
|
148 |
|
|
@Override
|
149 |
|
|
public String getOwner() {
|
150 |
|
|
return null;
|
151 |
|
|
}
|
152 |
|
|
|
153 |
|
|
/**
|
154 |
|
|
* {@inheritDoc}
|
155 |
|
|
*/
|
156 |
|
|
@Override
|
157 |
|
|
public boolean hasFeedbackWaitTimedOut() {
|
158 |
|
|
return false;
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
/**
|
162 |
|
|
* {@inheritDoc}
|
163 |
|
|
*/
|
164 |
|
|
@Override
|
165 |
|
|
public void interrupt() {
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
}
|
169 |
|
|
|
170 |
|
|
/**
|
171 |
|
|
* {@inheritDoc}
|
172 |
|
|
*/
|
173 |
|
|
@Override
|
174 |
|
|
public void setOwner(String arg0) {
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
/**
|
180 |
|
|
* {@inheritDoc}
|
181 |
|
|
*/
|
182 |
|
|
@Override
|
183 |
|
|
public void waitForFeedback(long arg0) {
|
184 |
|
|
|
185 |
|
|
}
|
186 |
|
|
|
187 |
cfcb0ce6
|
n.hoffmann
|
}
|