Révision 2577
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/ComputePartition.java (revision 2577) | ||
---|---|---|
64 | 64 |
public class ComputePartition extends BaseAbstractHandler { |
65 | 65 |
|
66 | 66 |
|
67 |
|
|
68 |
protected Partition partition; |
|
69 |
|
|
70 |
|
|
67 | 71 |
/* |
68 | 72 |
* (non-Javadoc) |
69 | 73 |
* @see |
... | ... | |
155 | 159 |
JobsTimer.start(); |
156 | 160 |
monitor.beginTask(NLS.bind(TXMUIMessages.creatingANewPartitionWithP0, corpus.getName()), 100); |
157 | 161 |
|
158 |
final Partition partition = d.getPartition();
|
|
162 |
partition = d.getPartition(); |
|
159 | 163 |
if (partition == null) { |
160 | 164 |
monitor.done(); |
161 | 165 |
Log.warning(TXMUIMessages.errorColonThePartitionWasNotCreated); |
162 | 166 |
return Status.CANCEL_STATUS; |
163 | 167 |
} |
164 |
try { |
|
165 |
partition.compute(monitor); |
|
166 |
|
|
167 |
// ensure the partition viability |
|
168 |
if (partition.getPartsCount() == 0) { |
|
169 |
Log.warning(TXMUIMessages.errorColonThePartitionCreatedHasNoPart); |
|
170 |
return Status.CANCEL_STATUS; |
|
168 |
partition.compute(monitor); |
|
169 |
|
|
170 |
// ensure the partition viability |
|
171 |
if (partition.getPartsCount() == 0) { |
|
172 |
Log.warning(TXMUIMessages.errorColonThePartitionCreatedHasNoPart); |
|
173 |
return Status.CANCEL_STATUS; |
|
174 |
} |
|
175 |
ArrayList<Part> emptyParts = new ArrayList<>(); |
|
176 |
for (Part p : partition.getParts()) { |
|
177 |
if (p.getNMatch() == 0) { |
|
178 |
emptyParts.add(p); |
|
171 | 179 |
} |
172 |
ArrayList<Part> emptyParts = new ArrayList<>(); |
|
173 |
for (Part p : partition.getParts()) { |
|
174 |
if (p.getNMatch() == 0) { |
|
175 |
emptyParts.add(p); |
|
176 |
} |
|
177 |
} |
|
178 |
if (emptyParts.size() == partition.getPartsCount()) { |
|
179 |
Log.warning(NLS.bind("Error: all parts {0} are all empty.", partition.getPartsCount())); |
|
180 |
return Status.CANCEL_STATUS; |
|
181 |
} |
|
182 |
else if (emptyParts.size() != 0) { |
|
183 |
Log.warning(NLS.bind("Warning: some parts are empty: {0}", emptyParts)); |
|
184 |
} |
|
185 | 180 |
} |
186 |
catch (Exception e) {
|
|
187 |
Log.printStackTrace(e);
|
|
181 |
if (emptyParts.size() == partition.getPartsCount()) {
|
|
182 |
Log.warning(NLS.bind("Error: all parts {0} are all empty.", partition.getPartsCount()));
|
|
188 | 183 |
return Status.CANCEL_STATUS; |
189 | 184 |
} |
185 |
else if (emptyParts.size() != 0) { |
|
186 |
Log.warning(NLS.bind("Warning: some parts are empty: {0}", emptyParts)); |
|
187 |
} |
|
190 | 188 |
monitor.worked(95); |
191 | 189 |
|
192 | 190 |
monitor.subTask(TXMUIMessages.refreshingCorpora); |
... | ... | |
200 | 198 |
}); |
201 | 199 |
monitor.worked(100); |
202 | 200 |
} |
203 |
catch (ThreadDeath td) { |
|
201 |
// for user direct canceling |
|
202 |
catch (ThreadDeath | InterruptedException e) { |
|
203 |
partition.delete(); |
|
204 | 204 |
return Status.CANCEL_STATUS; |
205 | 205 |
} |
206 |
catch (Exception e) { |
|
207 |
partition.delete(); |
|
208 |
Log.printStackTrace(e); |
|
209 |
return Status.CANCEL_STATUS; |
|
210 |
} |
|
206 | 211 |
finally { |
207 | 212 |
monitor.done(); |
208 | 213 |
JobsTimer.stopAndPrint(); |
Formats disponibles : Unified diff