Révision 2565
| tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Substraction.java (revision 2565) | ||
|---|---|---|
| 59 | 59 |
* Command which creates a subcorpus from a Corpus @ author mdecorde. |
| 60 | 60 |
*/ |
| 61 | 61 |
public class Substraction extends AbstractHandler {
|
| 62 |
|
|
| 62 |
|
|
| 63 | 63 |
/** The selection. */ |
| 64 | 64 |
private IStructuredSelection selection; |
| 65 |
|
|
| 66 |
/* (non-Javadoc) |
|
| 65 |
|
|
| 66 |
/* |
|
| 67 |
* (non-Javadoc) |
|
| 67 | 68 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
| 68 | 69 |
*/ |
| 69 | 70 |
@Override |
| ... | ... | |
| 71 | 72 |
|
| 72 | 73 |
selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
| 73 | 74 |
if (selection == null) {
|
| 74 |
System.out.println(TXMUIMessages.noSelectionForColon+HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 75 |
System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 75 | 76 |
return null; |
| 76 | 77 |
} |
| 77 | 78 |
List list = selection.toList(); |
| 78 | 79 |
if (list.size() == 0) {
|
| 79 | 80 |
Log.info("No corpus selected");
|
| 80 | 81 |
return null; |
| 81 |
} else if (list.size() != 1) {
|
|
| 82 |
} |
|
| 83 |
else if (list.size() != 1) {
|
|
| 82 | 84 |
Log.info("Substraction need a selection of 1 corpus");
|
| 83 | 85 |
return null; |
| 84 | 86 |
} |
| 85 | 87 |
Object firstElement = list.get(0); |
| 86 |
// Object secondElement = list.get(1);
|
|
| 88 |
// Object secondElement = list.get(1);
|
|
| 87 | 89 |
|
| 88 | 90 |
if (!(firstElement instanceof CQPCorpus)) {
|
| 89 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon+firstElement);
|
|
| 91 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
|
|
| 90 | 92 |
return null; |
| 91 | 93 |
} |
| 92 | 94 |
|
| 93 |
// if (!(secondElement instanceof CQPCorpus)) {
|
|
| 94 |
// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
|
|
| 95 |
// return null;
|
|
| 96 |
// }
|
|
| 95 |
// if (!(secondElement instanceof CQPCorpus)) {
|
|
| 96 |
// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
|
|
| 97 |
// return null;
|
|
| 98 |
// }
|
|
| 97 | 99 |
|
| 98 | 100 |
final CQPCorpus corpus = (CQPCorpus) firstElement; |
| 99 |
corpus.compute(false); |
|
| 100 |
// final CQPCorpus corpus2 = (CQPCorpus) secondElement; |
|
| 101 |
// corpus2.compute(false); |
|
| 101 |
try {
|
|
| 102 |
corpus.compute(false); |
|
| 103 |
} |
|
| 104 |
catch (InterruptedException e2) {
|
|
| 105 |
// TODO Auto-generated catch block |
|
| 106 |
e2.printStackTrace(); |
|
| 107 |
} |
|
| 108 |
// final CQPCorpus corpus2 = (CQPCorpus) secondElement; |
|
| 109 |
// corpus2.compute(false); |
|
| 102 | 110 |
|
| 103 | 111 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
| 104 | 112 |
final SetOperationsDialog d = new SetOperationsDialog(shell, "MINUS", corpus); |
| ... | ... | |
| 106 | 114 |
if (code == Window.OK) {
|
| 107 | 115 |
JobHandler jobhandler = new JobHandler(NLS.bind( |
| 108 | 116 |
TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
|
| 117 |
|
|
| 109 | 118 |
@Override |
| 110 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 119 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 111 | 120 |
this.runInit(monitor); |
| 112 | 121 |
JobsTimer.start(); |
| 113 | 122 |
try {
|
| ... | ... | |
| 117 | 126 |
if (name.length() == 0) {
|
| 118 | 127 |
name = d.getDefaultName(); |
| 119 | 128 |
} |
| 120 |
|
|
| 129 |
|
|
| 121 | 130 |
AbstractCqiClient cqi = CQPSearchEngine.getCqiClient(); |
| 122 | 131 |
|
| 123 |
String cqpid = "S"+Subcorpus.getNextSubcorpusCounter();
|
|
| 132 |
String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
|
|
| 124 | 133 |
CQPCorpus[] order = d.getCorpusOrder(); |
| 125 | 134 |
order[1].compute(false); |
| 126 |
String query = cqpid+"=difference "+order[0].getQualifiedCqpId()+" "+order[1].getQualifiedCqpId()+";";
|
|
| 127 |
System.out.println("QUERY="+query);
|
|
| 135 |
String query = cqpid + "=difference " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
|
|
| 136 |
System.out.println("QUERY=" + query);
|
|
| 128 | 137 |
cqi.query(query); |
| 129 | 138 |
|
| 130 |
if (cqi.subCorpusSize(order[0].getMainCorpus()+":"+cqpid) == 0) {
|
|
| 139 |
if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
|
|
| 131 | 140 |
Log.info("The created subcorpus was empty. Aborting.");
|
| 132 | 141 |
return Status.CANCEL_STATUS; |
| 133 | 142 |
} |
| ... | ... | |
| 146 | 155 |
|
| 147 | 156 |
System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName())); |
| 148 | 157 |
monitor.worked(50); |
| 149 |
|
|
| 158 |
|
|
| 150 | 159 |
monitor.subTask(TXMUIMessages.refreshingCorpora); |
| 151 |
final Subcorpus subcorpus2 = subcorpus;
|
|
| 160 |
final Subcorpus subcorpus2 = subcorpus; |
|
| 152 | 161 |
syncExec(new Runnable() {
|
| 162 |
|
|
| 153 | 163 |
@Override |
| 154 | 164 |
public void run() {
|
| 155 | 165 |
CorporaView.refresh(); |
| 156 | 166 |
CorporaView.expand(subcorpus2.getParent()); |
| 157 | 167 |
} |
| 158 | 168 |
}); |
| 159 |
|
|
| 169 |
|
|
| 160 | 170 |
monitor.worked(100); |
| 161 |
} catch (ThreadDeath td) {
|
|
| 171 |
} |
|
| 172 |
catch (ThreadDeath td) {
|
|
| 162 | 173 |
return Status.CANCEL_STATUS; |
| 163 |
} catch (Exception e) {
|
|
| 174 |
} |
|
| 175 |
catch (Exception e) {
|
|
| 164 | 176 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 165 | 177 |
Log.severe(e.toString()); |
| 166 | 178 |
|
| 167 | 179 |
try {
|
| 168 | 180 |
System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError())); |
| 169 |
} catch (Exception e1) {
|
|
| 170 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon+e1); |
|
| 181 |
} |
|
| 182 |
catch (Exception e1) {
|
|
| 183 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1); |
|
| 171 | 184 |
org.txm.utils.logger.Log.printStackTrace(e1); |
| 172 | 185 |
} |
| 173 |
} finally {
|
|
| 186 |
} |
|
| 187 |
finally {
|
|
| 174 | 188 |
monitor.done(); |
| 175 | 189 |
JobsTimer.stopAndPrint(); |
| 176 |
}
|
|
| 190 |
} |
|
| 177 | 191 |
return Status.OK_STATUS; |
| 178 | 192 |
} |
| 179 | 193 |
}; |
| ... | ... | |
| 181 | 195 |
} |
| 182 | 196 |
return null; |
| 183 | 197 |
} |
| 184 |
} |
|
| 198 |
} |
|
| tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Intersection.java (revision 2565) | ||
|---|---|---|
| 96 | 96 |
// } |
| 97 | 97 |
|
| 98 | 98 |
final CQPCorpus corpus = (CQPCorpus) firstElement; |
| 99 |
corpus.compute(false); |
|
| 99 |
try {
|
|
| 100 |
corpus.compute(false); |
|
| 101 |
} |
|
| 102 |
catch (InterruptedException e2) {
|
|
| 103 |
// TODO Auto-generated catch block |
|
| 104 |
e2.printStackTrace(); |
|
| 105 |
} |
|
| 100 | 106 |
// final CQPCorpus corpus2 = (CQPCorpus) secondElement; |
| 101 | 107 |
// corpus2.compute(false); |
| 102 | 108 |
|
| tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/handlers/base/Union.java (revision 2565) | ||
|---|---|---|
| 59 | 59 |
* Command which creates a subcorpus from a Corpus @ author mdecorde. |
| 60 | 60 |
*/ |
| 61 | 61 |
public class Union extends AbstractHandler {
|
| 62 |
|
|
| 62 |
|
|
| 63 | 63 |
/** The selection. */ |
| 64 | 64 |
private IStructuredSelection selection; |
| 65 |
|
|
| 66 |
/* (non-Javadoc) |
|
| 65 |
|
|
| 66 |
/* |
|
| 67 |
* (non-Javadoc) |
|
| 67 | 68 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
| 68 | 69 |
*/ |
| 69 | 70 |
@Override |
| ... | ... | |
| 71 | 72 |
|
| 72 | 73 |
selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); |
| 73 | 74 |
if (selection == null) {
|
| 74 |
System.out.println(TXMUIMessages.noSelectionForColon+HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 75 |
System.out.println(TXMUIMessages.noSelectionForColon + HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor());
|
|
| 75 | 76 |
return null; |
| 76 | 77 |
} |
| 77 | 78 |
List list = selection.toList(); |
| 78 | 79 |
if (list.size() == 0) {
|
| 79 | 80 |
Log.info("No corpus selected");
|
| 80 | 81 |
return null; |
| 81 |
} else if (list.size() != 1) {
|
|
| 82 |
} |
|
| 83 |
else if (list.size() != 1) {
|
|
| 82 | 84 |
Log.info("Substraction need a selection of 1 corpus");
|
| 83 | 85 |
return null; |
| 84 | 86 |
} |
| 85 | 87 |
Object firstElement = list.get(0); |
| 86 |
// Object secondElement = list.get(1);
|
|
| 88 |
// Object secondElement = list.get(1);
|
|
| 87 | 89 |
|
| 88 | 90 |
if (!(firstElement instanceof CQPCorpus)) {
|
| 89 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon+firstElement);
|
|
| 91 |
System.out.println(TXMUIMessages.selectionIsNotACorpusColon + firstElement);
|
|
| 90 | 92 |
return null; |
| 91 | 93 |
} |
| 92 | 94 |
|
| 93 |
// if (!(secondElement instanceof CQPCorpus)) {
|
|
| 94 |
// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
|
|
| 95 |
// return null;
|
|
| 96 |
// }
|
|
| 95 |
// if (!(secondElement instanceof CQPCorpus)) {
|
|
| 96 |
// System.out.println(TXMUIMessages.selectionIsNotACorpusColon+secondElement);
|
|
| 97 |
// return null;
|
|
| 98 |
// }
|
|
| 97 | 99 |
|
| 98 | 100 |
final CQPCorpus corpus = (CQPCorpus) firstElement; |
| 99 |
corpus.compute(false); |
|
| 100 |
// final CQPCorpus corpus2 = (CQPCorpus) secondElement; |
|
| 101 |
// corpus2.compute(false); |
|
| 101 |
try {
|
|
| 102 |
corpus.compute(false); |
|
| 103 |
} |
|
| 104 |
catch (InterruptedException e2) {
|
|
| 105 |
// TODO Auto-generated catch block |
|
| 106 |
e2.printStackTrace(); |
|
| 107 |
} |
|
| 108 |
// final CQPCorpus corpus2 = (CQPCorpus) secondElement; |
|
| 109 |
// corpus2.compute(false); |
|
| 102 | 110 |
|
| 103 | 111 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
| 104 | 112 |
final SetOperationsDialog d = new SetOperationsDialog(shell, "UNION", corpus); |
| ... | ... | |
| 106 | 114 |
if (code == Window.OK) {
|
| 107 | 115 |
JobHandler jobhandler = new JobHandler(NLS.bind( |
| 108 | 116 |
TXMUIMessages.creatingASubcorpusOnP0, corpus.getName())) {
|
| 117 |
|
|
| 109 | 118 |
@Override |
| 110 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 119 |
protected IStatus run(IProgressMonitor monitor) {
|
|
| 111 | 120 |
this.runInit(monitor); |
| 112 | 121 |
JobsTimer.start(); |
| 113 | 122 |
try {
|
| ... | ... | |
| 117 | 126 |
if (name.length() == 0) {
|
| 118 | 127 |
name = d.getDefaultName(); |
| 119 | 128 |
} |
| 120 |
|
|
| 129 |
|
|
| 121 | 130 |
AbstractCqiClient cqi = CQPSearchEngine.getCqiClient(); |
| 122 | 131 |
|
| 123 |
String cqpid = "S"+Subcorpus.getNextSubcorpusCounter();
|
|
| 132 |
String cqpid = "S" + Subcorpus.getNextSubcorpusCounter();
|
|
| 124 | 133 |
CQPCorpus[] order = d.getCorpusOrder(); |
| 125 | 134 |
order[1].compute(false); |
| 126 |
String query = cqpid+"=join "+order[0].getQualifiedCqpId()+" "+order[1].getQualifiedCqpId()+";";
|
|
| 127 |
System.out.println("QUERY="+query);
|
|
| 135 |
String query = cqpid + "=join " + order[0].getQualifiedCqpId() + " " + order[1].getQualifiedCqpId() + ";";
|
|
| 136 |
System.out.println("QUERY=" + query);
|
|
| 128 | 137 |
cqi.query(query); |
| 129 | 138 |
|
| 130 |
if (cqi.subCorpusSize(order[0].getMainCorpus()+":"+cqpid) == 0) {
|
|
| 139 |
if (cqi.subCorpusSize(order[0].getMainCorpus() + ":" + cqpid) == 0) {
|
|
| 131 | 140 |
Log.info("The created subcorpus was empty. Aborting.");
|
| 132 | 141 |
return Status.CANCEL_STATUS; |
| 133 | 142 |
} |
| ... | ... | |
| 142 | 151 |
|
| 143 | 152 |
System.out.println(NLS.bind(TXMUIMessages.doneColonP0Created, subcorpus.getName())); |
| 144 | 153 |
monitor.worked(50); |
| 145 |
|
|
| 154 |
|
|
| 146 | 155 |
monitor.subTask(TXMUIMessages.refreshingCorpora); |
| 147 |
final Subcorpus subcorpus2 = subcorpus;
|
|
| 156 |
final Subcorpus subcorpus2 = subcorpus; |
|
| 148 | 157 |
syncExec(new Runnable() {
|
| 158 |
|
|
| 149 | 159 |
@Override |
| 150 | 160 |
public void run() {
|
| 151 | 161 |
CorporaView.refresh(); |
| 152 | 162 |
CorporaView.expand(subcorpus2.getParent()); |
| 153 | 163 |
} |
| 154 | 164 |
}); |
| 155 |
|
|
| 165 |
|
|
| 156 | 166 |
monitor.worked(100); |
| 157 |
} catch (ThreadDeath td) {
|
|
| 167 |
} |
|
| 168 |
catch (ThreadDeath td) {
|
|
| 158 | 169 |
return Status.CANCEL_STATUS; |
| 159 |
} catch (Exception e) {
|
|
| 170 |
} |
|
| 171 |
catch (Exception e) {
|
|
| 160 | 172 |
org.txm.utils.logger.Log.printStackTrace(e); |
| 161 | 173 |
Log.severe(e.toString()); |
| 162 | 174 |
|
| 163 | 175 |
try {
|
| 164 | 176 |
System.out.println(NLS.bind(CQPSearchEngineCoreMessages.lastCQPErrorColon, CQPSearchEngine.getCqiClient().getLastCQPError())); |
| 165 |
} catch (Exception e1) {
|
|
| 166 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon+e1); |
|
| 177 |
} |
|
| 178 |
catch (Exception e1) {
|
|
| 179 |
System.out.println(TXMUIMessages.failedToGetLastCQPErrorColon + e1); |
|
| 167 | 180 |
org.txm.utils.logger.Log.printStackTrace(e1); |
| 168 | 181 |
} |
| 169 |
} finally {
|
|
| 182 |
} |
|
| 183 |
finally {
|
|
| 170 | 184 |
monitor.done(); |
| 171 | 185 |
JobsTimer.stopAndPrint(); |
| 172 |
}
|
|
| 186 |
} |
|
| 173 | 187 |
return Status.OK_STATUS; |
| 174 | 188 |
} |
| 175 | 189 |
}; |
| ... | ... | |
| 177 | 191 |
} |
| 178 | 192 |
return null; |
| 179 | 193 |
} |
| 180 |
} |
|
| 194 |
} |
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 2565) | ||
|---|---|---|
| 344 | 344 |
// StatusLine.setMessage(((TXMResult)selectedItem).getComputingDoneMessage()); |
| 345 | 345 |
|
| 346 | 346 |
if (selectedItem instanceof MainCorpus) { // just for this result type, pre-compute to show the corpus size
|
| 347 |
((MainCorpus) selectedItem).compute(false); |
|
| 347 |
try {
|
|
| 348 |
((MainCorpus) selectedItem).compute(false); |
|
| 349 |
} |
|
| 350 |
catch (InterruptedException e1) {
|
|
| 351 |
// TODO Auto-generated catch block |
|
| 352 |
e1.printStackTrace(); |
|
| 353 |
} |
|
| 348 | 354 |
} |
| 349 | 355 |
|
| 350 | 356 |
StatusLine.setMessage(((TXMResult) selectedItem).getDetails()); |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 2565) | ||
|---|---|---|
| 75 | 75 |
import org.txm.rcp.messages.TXMUIMessages; |
| 76 | 76 |
import org.txm.rcp.preferences.RCPPreferences; |
| 77 | 77 |
import org.txm.rcp.swt.GLComposite; |
| 78 |
import org.txm.rcp.swt.dialog.AdvancedProgressMonitorDialog; |
|
| 78 | 79 |
import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget; |
| 79 | 80 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
| 80 | 81 |
import org.txm.rcp.swt.widget.FloatSpinner; |
| ... | ... | |
| 392 | 393 |
|
| 393 | 394 |
try {
|
| 394 | 395 |
|
| 395 |
// since some editor fields need some values of their parent ensure the parent is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.) |
|
| 396 |
// need to set deep, eg. for Partition that must synchronize its Parts (if false, the Parts are not computed) |
|
| 397 |
// it does not break the lazy since the children lazy is now determined by the hasBeenComputedOnce state |
|
| 398 |
// Runnable job = new Runnable() {
|
|
| 399 |
// |
|
| 400 |
// @Override |
|
| 401 |
// public void run() {
|
|
| 402 |
// // TODO Auto-generated method stub |
|
| 403 |
// TXMEditor.this.getResult().getParent().compute(false); |
|
| 404 |
// } |
|
| 405 |
// }; |
|
| 406 |
// |
|
| 407 |
// BusyIndicator.showWhile(getSite().getShell().getDisplay(), job); |
|
| 396 |
// since some editor fields need some values of their parent, |
|
| 397 |
// ensure the parent is ready (e.g. Sub-corpus properties in Cooccurrence editor, etc.) |
|
| 408 | 398 |
|
| 409 | 399 |
// FIXME: SJ: tests to show modal blocking cancelable progression dialog |
| 410 | 400 |
try {
|
| 411 | 401 |
if (!this.getResult().getParent().hasBeenComputedOnce()) {
|
| 412 |
IRunnableWithProgress job2 = new IRunnableWithProgress() {
|
|
| 402 |
|
|
| 403 |
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
|
| 413 | 404 |
|
| 414 | 405 |
@Override |
| 415 |
public void run(IProgressMonitor monitor) {
|
|
| 416 |
// TODO Auto-generated method stub |
|
| 406 |
public void run(IProgressMonitor monitor) throws InterruptedException {
|
|
| 417 | 407 |
TXMEditor.this.getResult().getParent().compute(monitor, false); |
| 418 | 408 |
} |
| 419 | 409 |
}; |
| 420 | 410 |
|
| 421 |
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell()) {
|
|
| 422 |
|
|
| 423 |
@Override |
|
| 424 |
protected void cancelPressed() {
|
|
| 425 |
super.cancelPressed(); |
|
| 426 |
Thread.currentThread().stop(); |
|
| 427 |
} |
|
| 428 |
}; |
|
| 411 |
AdvancedProgressMonitorDialog dialog = new AdvancedProgressMonitorDialog(this.getSite().getShell(), TXMEditor.this.getResult().getParent()); |
|
| 412 |
dialog.run(true, runnable); |
|
| 429 | 413 |
|
| 430 |
// Trying to display the dialog only after X seconds, not at start so it not appears for short tasks |
|
| 431 |
dialog.setOpenOnRun(false); |
|
| 432 |
Timer timer = new Timer(); |
|
| 433 |
timer.schedule(new TimerTask() {
|
|
| 434 |
|
|
| 435 |
protected int elapsedTime = 0; |
|
| 436 |
|
|
| 437 |
@Override |
|
| 438 |
public void run() {
|
|
| 439 |
elapsedTime += 10; |
|
| 440 |
if (elapsedTime > 1000) {
|
|
| 441 |
Display.getDefault().asyncExec(new Runnable() {
|
|
| 442 |
|
|
| 443 |
@Override |
|
| 444 |
public void run() {
|
|
| 445 |
dialog.open(); |
|
| 446 |
} |
|
| 447 |
}); |
|
| 448 |
timer.purge(); |
|
| 449 |
timer.cancel(); |
|
| 450 |
} |
|
| 451 |
} |
|
| 452 |
}, 0, 10); |
|
| 453 |
// end of test |
|
| 454 | 414 |
|
| 455 |
|
|
| 456 |
|
|
| 457 |
dialog.run(true, true, job2); |
|
| 458 | 415 |
} |
| 459 | 416 |
} |
| 460 | 417 |
// Canceling |
| 461 |
catch (ThreadDeath e) {
|
|
| 418 |
catch (InterruptedException e) {
|
|
| 462 | 419 |
|
| 463 |
// set parent as canceled |
|
| 464 |
this.getResult().getParent().cancel(); |
|
| 465 |
|
|
| 466 | 420 |
CorporaView.refresh(); |
| 467 |
|
|
| 468 | 421 |
this.close(); |
| 469 |
return; |
|
| 470 | 422 |
|
| 423 |
return; |
|
| 471 | 424 |
} |
| 472 | 425 |
|
| 473 |
// JobHandler job3 = new JobHandler(TXMCoreMessages.bind(TXMUIMessages.computing, this.getResult().getParent().getName()), true) {
|
|
| 474 |
// |
|
| 475 |
// @Override |
|
| 476 |
// protected IStatus run(IProgressMonitor monitor) {
|
|
| 477 |
// this.runInit(monitor); |
|
| 478 |
// // TODO Auto-generated method stub |
|
| 479 |
// TXMEditor.this.getResult().getParent().compute(true); |
|
| 480 |
// return Status.OK_STATUS; |
|
| 481 |
// } |
|
| 482 |
// }; |
|
| 483 |
// job3.setUser(true); |
|
| 484 |
// job3.startJob(); |
|
| 485 | 426 |
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
// job3.setProperty(IProgressConstants.PROPERTY_IN_DIALOG, true); |
|
| 490 |
// IProgressService ps = PlatformUI.getWorkbench().getProgressService(); |
|
| 491 |
// ps.showInDialog(getSite().getShell(), job3); |
|
| 492 |
// ps.runInUI(ps, (IRunnableWithProgress) job3, org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot()); |
|
| 493 |
// ps.busyCursorWhile((IRunnableWithProgress) job3); |
|
| 494 |
// job3.wait(); |
|
| 495 |
|
|
| 496 |
|
|
| 497 |
// this.getResult().getParent().compute(true); |
|
| 498 |
|
|
| 499 |
// TXMResult corpus = this.getResult().getFirstParent(CorpusBuild.class); |
|
| 500 |
// if (corpus != null) {
|
|
| 501 |
// corpus.compute(false); |
|
| 502 |
// } |
|
| 503 |
|
|
| 504 |
|
|
| 505 |
|
|
| 506 | 427 |
this.parent = parent; |
| 507 | 428 |
|
| 508 | 429 |
// disable the rendering while creating the widgets |
| ... | ... | |
| 1118 | 1039 |
}); |
| 1119 | 1040 |
} |
| 1120 | 1041 |
// for user direct canceling |
| 1121 |
catch (ThreadDeath td) {
|
|
| 1042 |
catch (ThreadDeath | InterruptedException e) {
|
|
| 1122 | 1043 |
// FIXME: SJ: should call clean() and/or set the result as dirty? |
| 1123 | 1044 |
return Status.CANCEL_STATUS; |
| 1124 | 1045 |
// FIXME: SJ tests, but it doesn't seem to improve the canceling, need to check more |
| 1125 | 1046 |
// throw td; |
| 1126 | 1047 |
} |
| 1127 | 1048 |
catch (Exception e) {
|
| 1049 |
TXMEditor.this.getResult().resetComputingState(); |
|
| 1128 | 1050 |
Log.printStackTrace(e); |
| 1129 | 1051 |
} |
| 1130 | 1052 |
finally {
|
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/AdvancedProgressMonitorDialog.java (revision 2565) | ||
|---|---|---|
| 1 |
package org.txm.rcp.swt.dialog; |
|
| 2 |
|
|
| 3 |
import java.lang.reflect.InvocationTargetException; |
|
| 4 |
import java.util.Timer; |
|
| 5 |
import java.util.TimerTask; |
|
| 6 |
|
|
| 7 |
import org.eclipse.jface.dialogs.ProgressMonitorDialog; |
|
| 8 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
|
| 9 |
import org.eclipse.swt.widgets.Display; |
|
| 10 |
import org.eclipse.swt.widgets.Shell; |
|
| 11 |
import org.txm.core.results.TXMResult; |
|
| 12 |
|
|
| 13 |
/** |
|
| 14 |
* An advanced progress monitor modal dialog managing delay before display and the force of cancel using Thread.stop(). |
|
| 15 |
* |
|
| 16 |
* @author sjacquot |
|
| 17 |
* |
|
| 18 |
*/ |
|
| 19 |
public class AdvancedProgressMonitorDialog extends ProgressMonitorDialog {
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
protected TXMResult result; |
|
| 23 |
|
|
| 24 |
/** |
|
| 25 |
* Delay in ms before opening the dialog after starting runnable. |
|
| 26 |
*/ |
|
| 27 |
protected int delayBeforeOpen; |
|
| 28 |
|
|
| 29 |
|
|
| 30 |
/** |
|
| 31 |
* |
|
| 32 |
* @param parent |
|
| 33 |
* @param delayBeforeOpen delay in ms before opening the dialog after starting runnable |
|
| 34 |
*/ |
|
| 35 |
public AdvancedProgressMonitorDialog(Shell parent, TXMResult result, int delayBeforeOpen) {
|
|
| 36 |
super(parent); |
|
| 37 |
this.result = result; |
|
| 38 |
this.delayBeforeOpen = delayBeforeOpen; |
|
| 39 |
// this.setBlockOnOpen(shouldBlock); |
|
| 40 |
this.setOpenOnRun(false); |
|
| 41 |
} |
|
| 42 |
|
|
| 43 |
/** |
|
| 44 |
* |
|
| 45 |
* @param parent |
|
| 46 |
*/ |
|
| 47 |
public AdvancedProgressMonitorDialog(Shell parent, TXMResult result) {
|
|
| 48 |
this(parent, result, 1000); |
|
| 49 |
} |
|
| 50 |
|
|
| 51 |
|
|
| 52 |
/** |
|
| 53 |
* Runs the given <code>IRunnableWithProgress</code>. |
|
| 54 |
* |
|
| 55 |
* @param cancelable |
|
| 56 |
* @param runnable |
|
| 57 |
* @throws InvocationTargetException |
|
| 58 |
* @throws InterruptedException |
|
| 59 |
*/ |
|
| 60 |
public void run(boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
|
|
| 61 |
this.run(true, cancelable, runnable); |
|
| 62 |
} |
|
| 63 |
|
|
| 64 |
|
|
| 65 |
@Override |
|
| 66 |
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
|
|
| 67 |
|
|
| 68 |
// manage the dialog open delay |
|
| 69 |
Timer timer = new Timer(); |
|
| 70 |
timer.schedule(new TimerTask() {
|
|
| 71 |
|
|
| 72 |
protected int elapsedTime = 0; |
|
| 73 |
|
|
| 74 |
@Override |
|
| 75 |
public void run() {
|
|
| 76 |
this.elapsedTime += 10; |
|
| 77 |
if (this.elapsedTime > delayBeforeOpen) {
|
|
| 78 |
Display.getDefault().asyncExec(new Runnable() {
|
|
| 79 |
|
|
| 80 |
@Override |
|
| 81 |
public void run() {
|
|
| 82 |
open(); |
|
| 83 |
} |
|
| 84 |
}); |
|
| 85 |
this.cancel(); |
|
| 86 |
timer.purge(); |
|
| 87 |
timer.cancel(); |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
}, 0, 10); |
|
| 91 |
|
|
| 92 |
super.run(fork, cancelable, runnable); |
|
| 93 |
} |
|
| 94 |
|
|
| 95 |
|
|
| 96 |
@Override |
|
| 97 |
protected void cancelPressed() {
|
|
| 98 |
this.result.getComputingThread().stop(); |
|
| 99 |
super.cancelPressed(); |
|
| 100 |
} |
|
| 101 |
|
|
| 102 |
} |
|
| 0 | 103 | |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java (revision 2565) | ||
|---|---|---|
| 21 | 21 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
| 22 | 22 |
|
| 23 | 23 |
public class UpdateCorpus extends AbstractHandler {
|
| 24 |
|
|
| 24 |
|
|
| 25 | 25 |
public static final String ID = UpdateCorpus.class.getCanonicalName(); |
| 26 |
|
|
| 26 |
|
|
| 27 | 27 |
@Override |
| 28 | 28 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 29 |
|
|
| 30 |
ISelection sel = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
|
|
| 29 |
|
|
| 30 |
ISelection sel = HandlerUtil.getCurrentSelection(event); |
|
| 31 | 31 |
if (!(sel instanceof IStructuredSelection)) return null; |
| 32 | 32 |
IStructuredSelection selection = (IStructuredSelection) sel; |
| 33 | 33 |
|
| ... | ... | |
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
update(corpus); |
| 47 |
|
|
| 47 |
|
|
| 48 | 48 |
return corpus; |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
public static JobHandler update(final MainCorpus corpus) {
|
| 52 |
|
|
| 52 |
|
|
| 53 | 53 |
final Project project = corpus.getProject(); |
| 54 |
if (project == null) return null;
|
|
| 55 |
|
|
| 56 |
// String iname = project.getImportModuleName();
|
|
| 57 |
// if (!iname.matches("xtz|txt|hyperbase|discours|cnr|alceste|xml|xmltxm")) {
|
|
| 58 |
// System.out.println("Can't update a CQP corpus not imported with one of the XTZ, TXT, XML, XML-TXM, CNRS, Alceste, Hyperbase import modules.");
|
|
| 59 |
// System.out.println(NLS.bind("The corpus was imported with the \"{0}\" import module.", iname));
|
|
| 60 |
// return null;
|
|
| 61 |
// }
|
|
| 62 |
|
|
| 54 |
if (project == null) return null; |
|
| 55 |
|
|
| 56 |
// String iname = project.getImportModuleName();
|
|
| 57 |
// if (!iname.matches("xtz|txt|hyperbase|discours|cnr|alceste|xml|xmltxm")) {
|
|
| 58 |
// System.out.println("Can't update a CQP corpus not imported with one of the XTZ, TXT, XML, XML-TXM, CNRS, Alceste, Hyperbase import modules.");
|
|
| 59 |
// System.out.println(NLS.bind("The corpus was imported with the \"{0}\" import module.", iname));
|
|
| 60 |
// return null;
|
|
| 61 |
// }
|
|
| 62 |
|
|
| 63 | 63 |
Display d = Display.getCurrent(); |
| 64 | 64 |
if (d == null) {
|
| 65 | 65 |
d = Display.getDefault(); |
| 66 | 66 |
} |
| 67 | 67 |
if (d != null) {
|
| 68 | 68 |
d.syncExec(new Runnable() {
|
| 69 |
|
|
| 69 | 70 |
@Override |
| 70 |
public void run() {CloseEditorsUsing.corpus(corpus);}
|
|
| 71 |
public void run() {
|
|
| 72 |
CloseEditorsUsing.corpus(corpus); |
|
| 73 |
} |
|
| 71 | 74 |
}); |
| 72 | 75 |
} |
| 73 |
|
|
| 76 |
|
|
| 74 | 77 |
project.setDirty(true, false);// dont propagate dirty |
| 75 | 78 |
project.setNeedToBuild(); |
| 76 |
project.setDoMultiThread(false); //too soon |
|
| 79 |
project.setDoMultiThread(false); // too soon
|
|
| 77 | 80 |
project.setDoUpdate(true); |
| 78 | 81 |
String currentModule = project.getImportModuleName(); |
| 79 | 82 |
if (!(currentModule.equals("xtz") || currentModule.equals("transcriber"))) {
|
| 80 | 83 |
project.setImportModuleName("xtz");
|
| 81 | 84 |
} |
| 82 |
|
|
| 83 |
JobHandler job = new JobHandler("Updating corpus "+corpus+" using "+project) {
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
JobHandler job = new JobHandler("Updating corpus " + corpus + " using " + project) {
|
|
| 87 |
|
|
| 85 | 88 |
@Override |
| 86 | 89 |
protected IStatus run(IProgressMonitor monitor) {
|
| 87 | 90 |
project.setCurrentMonitor(monitor); |
| 88 |
if (project.compute(true)) { // TODO children should be recomputed later when the user needs it
|
|
| 89 |
|
|
| 90 |
this.syncExec(new Runnable() {
|
|
| 91 |
@Override |
|
| 92 |
public void run() {
|
|
| 93 |
RestartTXM.reloadViews(); |
|
| 94 |
} |
|
| 95 |
}); |
|
| 96 |
return Status.OK_STATUS; |
|
| 97 |
} else {
|
|
| 91 |
try {
|
|
| 92 |
if (project.compute(true)) { // TODO children should be recomputed later when the user needs it
|
|
| 93 |
|
|
| 94 |
this.syncExec(new Runnable() {
|
|
| 95 |
|
|
| 96 |
@Override |
|
| 97 |
public void run() {
|
|
| 98 |
RestartTXM.reloadViews(); |
|
| 99 |
} |
|
| 100 |
}); |
|
| 101 |
return Status.OK_STATUS; |
|
| 102 |
} |
|
| 103 |
else {
|
|
| 104 |
return Status.CANCEL_STATUS; |
|
| 105 |
} |
|
| 106 |
} |
|
| 107 |
catch (InterruptedException e) {
|
|
| 108 |
// TODO Auto-generated catch block |
|
| 109 |
e.printStackTrace(); |
|
| 98 | 110 |
return Status.CANCEL_STATUS; |
| 99 | 111 |
} |
| 100 | 112 |
} |
| 101 | 113 |
}; |
| 102 |
|
|
| 114 |
|
|
| 103 | 115 |
job.schedule(); |
| 104 |
|
|
| 105 |
//// String txmhome = Toolbox.getTxmHomePath();
|
|
| 106 |
//// File scriptDir = new File(txmhome, "scripts/groovy/user/org/txm/scripts/importer/xtz");
|
|
| 107 |
//// File script = new File(scriptDir, "xtzLoader.groovy");
|
|
| 108 |
// System.out.println();
|
|
| 109 |
// JobHandler ret = ExecuteImportScript.executeScript(project);
|
|
| 110 |
//
|
|
| 116 |
|
|
| 117 |
//// String txmhome = Toolbox.getTxmHomePath();
|
|
| 118 |
//// File scriptDir = new File(txmhome, "scripts/groovy/user/org/txm/scripts/importer/xtz");
|
|
| 119 |
//// File script = new File(scriptDir, "xtzLoader.groovy");
|
|
| 120 |
// System.out.println();
|
|
| 121 |
// JobHandler ret = ExecuteImportScript.executeScript(project);
|
|
| 122 |
// |
|
| 111 | 123 |
return job; |
| 112 | 124 |
} |
| 113 |
} |
|
| 125 |
} |
|
| tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2565) | ||
|---|---|---|
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 | 165 |
@Override |
| 166 |
public boolean compute(IProgressMonitor monitor) {
|
|
| 166 |
public boolean compute(IProgressMonitor monitor) throws InterruptedException {
|
|
| 167 | 167 |
return compute(monitor, true); |
| 168 | 168 |
} |
| 169 | 169 |
|
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 2565) | ||
|---|---|---|
| 110 | 110 |
super(parametersNodePath); |
| 111 | 111 |
|
| 112 | 112 |
if (getID() != null && getProjectDirectory() != null) {
|
| 113 |
compute(false); |
|
| 113 |
try {
|
|
| 114 |
compute(false); |
|
| 115 |
} |
|
| 116 |
catch (InterruptedException e) {
|
|
| 117 |
// TODO Auto-generated catch block |
|
| 118 |
e.printStackTrace(); |
|
| 119 |
} |
|
| 114 | 120 |
} |
| 115 | 121 |
} |
| 116 | 122 |
|
| tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java (revision 2565) | ||
|---|---|---|
| 848 | 848 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
| 849 | 849 |
|
| 850 | 850 |
corpus = ((SynopticEditorInput) input).getCorpus(); // corpus focused when opening the editions |
| 851 |
corpus.compute(false); |
|
| 851 |
try {
|
|
| 852 |
corpus.compute(false); |
|
| 853 |
} |
|
| 854 |
catch (InterruptedException e) {
|
|
| 855 |
// TODO Auto-generated catch block |
|
| 856 |
e.printStackTrace(); |
|
| 857 |
} |
|
| 852 | 858 |
mainCorpus = corpus.getMainCorpus(); // get the main corpus of the corpus |
| 853 | 859 |
text = ((SynopticEditorInput) input).getText(); |
| 854 | 860 |
editionNames = ((SynopticEditorInput) input).getEditions(); |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2565) | ||
|---|---|---|
| 135 | 135 |
protected IProgressMonitor monitor; |
| 136 | 136 |
|
| 137 | 137 |
/** |
| 138 |
* Thread used when calling compute(). |
|
| 139 |
*/ |
|
| 140 |
protected Thread computingThread; |
|
| 141 |
|
|
| 142 |
/** |
|
| 138 | 143 |
* To manage the computing cancel with TreadDeath. |
| 139 | 144 |
*/ |
| 140 | 145 |
private Semaphore progressSemaphore = new Semaphore(1); |
| ... | ... | |
| 2281 | 2286 |
* @return |
| 2282 | 2287 |
* @throws Exception |
| 2283 | 2288 |
*/ |
| 2284 |
public boolean compute(boolean deepComputing) {
|
|
| 2289 |
public boolean compute(boolean deepComputing) throws InterruptedException {
|
|
| 2285 | 2290 |
return this.compute(new LogMonitor("Computing " + this), deepComputing);
|
| 2286 | 2291 |
} |
| 2287 | 2292 |
|
| ... | ... | |
| 2293 | 2298 |
* @return |
| 2294 | 2299 |
* @throws Exception |
| 2295 | 2300 |
*/ |
| 2296 |
public boolean compute() {
|
|
| 2301 |
public boolean compute() throws InterruptedException {
|
|
| 2297 | 2302 |
return this.compute(true); |
| 2298 | 2303 |
} |
| 2299 | 2304 |
|
| ... | ... | |
| 2306 | 2311 |
* @param monitor |
| 2307 | 2312 |
* @return |
| 2308 | 2313 |
*/ |
| 2309 |
public boolean compute(IProgressMonitor monitor) {
|
|
| 2314 |
public boolean compute(IProgressMonitor monitor) throws InterruptedException {
|
|
| 2310 | 2315 |
return this.compute(monitor, true); |
| 2311 | 2316 |
} |
| 2312 | 2317 |
|
| ... | ... | |
| 2320 | 2325 |
* @param deepComputing |
| 2321 | 2326 |
* @return |
| 2322 | 2327 |
*/ |
| 2323 |
public boolean compute(IProgressMonitor monitor, boolean deepComputing) {
|
|
| 2328 |
public boolean compute(IProgressMonitor monitor, boolean deepComputing) throws InterruptedException {
|
|
| 2324 | 2329 |
|
| 2330 |
this.computingThread = Thread.currentThread(); |
|
| 2331 |
|
|
| 2325 | 2332 |
// skip the process if the result is already in computing stage |
| 2326 | 2333 |
if (this.computing) {
|
| 2327 | 2334 |
return true; |
| ... | ... | |
| 2502 | 2509 |
} |
| 2503 | 2510 |
} |
| 2504 | 2511 |
} |
| 2512 |
catch (ThreadDeath e) {
|
|
| 2513 |
// set parent and its children as canceled |
|
| 2514 |
this.resetComputingState(); |
|
| 2515 |
throw new InterruptedException("TXMResult computing thread stopped.");
|
|
| 2516 |
} |
|
| 2517 |
catch (InterruptedException e) {
|
|
| 2518 |
// set parent and its children as canceled |
|
| 2519 |
this.resetComputingState(); |
|
| 2520 |
throw e; |
|
| 2521 |
} |
|
| 2505 | 2522 |
catch (Exception e) {
|
| 2506 | 2523 |
e.printStackTrace(); |
| 2507 | 2524 |
Log.severe(TXMCoreMessages.bind("TXMResult.compute(): Exception occurs during computing: {0}.", e));
|
| ... | ... | |
| 2533 | 2550 |
|
| 2534 | 2551 |
/** |
| 2535 | 2552 |
* Sets the result and all its children as canceled (set them as dirty and set computing state as false). |
| 2553 |
* Resets the computing state. |
|
| 2536 | 2554 |
* Dedicated to be called when computing has been killed. |
| 2537 | 2555 |
* |
| 2538 | 2556 |
*/ |
| 2539 |
public void cancel() {
|
|
| 2557 |
public void resetComputingState() {
|
|
| 2540 | 2558 |
if (this.computing) {
|
| 2541 | 2559 |
|
| 2542 | 2560 |
// set back to dirty |
| 2543 | 2561 |
this.dirty = true; |
| 2544 | 2562 |
this.computing = false; |
| 2563 |
this.hasBeenComputedOnce = false; |
|
| 2564 |
this.setCanceled(true); |
|
| 2545 | 2565 |
|
| 2566 |
Log.finest(NLS.bind("Computing state of {0} ({1}) has been reset...", this.getName(), this.getClass().getSimpleName()));
|
|
| 2567 |
|
|
| 2546 | 2568 |
// deep canceling |
| 2547 | 2569 |
for (int i = 0; i < this.children.size(); i++) {
|
| 2548 |
this.children.get(i).cancel();
|
|
| 2570 |
this.children.get(i).resetComputingState();
|
|
| 2549 | 2571 |
} |
| 2550 | 2572 |
|
| 2551 | 2573 |
} |
| ... | ... | |
| 2684 | 2706 |
@Override |
| 2685 | 2707 |
public void setCanceled(boolean value) {
|
| 2686 | 2708 |
if (monitor != null) {
|
| 2709 |
Log.info(NLS.bind("Canceling computing of {0} ({1})...", this.getName(), this.getClass().getSimpleName()));
|
|
| 2687 | 2710 |
monitor.setCanceled(value); |
| 2688 | 2711 |
} |
| 2689 |
Log.info("Canceling command...");
|
|
| 2690 | 2712 |
} |
| 2691 | 2713 |
|
| 2692 | 2714 |
@Override |
| ... | ... | |
| 2946 | 2968 |
public boolean mustBeSynchronizedWithParent() {
|
| 2947 | 2969 |
return synchronizedWithParent; |
| 2948 | 2970 |
} |
| 2971 |
|
|
| 2972 |
|
|
| 2973 |
/** |
|
| 2974 |
* @return the computingThread |
|
| 2975 |
*/ |
|
| 2976 |
public Thread getComputingThread() {
|
|
| 2977 |
return computingThread; |
|
| 2978 |
} |
|
| 2949 | 2979 |
} |
| tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 2565) | ||
|---|---|---|
| 156 | 156 |
*/ |
| 157 | 157 |
@SuppressWarnings("unchecked")
|
| 158 | 158 |
public List<Project> getProjects() {
|
| 159 |
return (List<Project>) getChildren(Project.class);
|
|
| 159 |
return getChildren(Project.class); |
|
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 | 162 |
/** |
| ... | ... | |
| 437 | 437 |
Project project = (Project) r; |
| 438 | 438 |
if (project.isOpen()) {
|
| 439 | 439 |
for (CorpusBuild cb : project.getCorpora()) {
|
| 440 |
if (!cb.compute(false)) {
|
|
| 441 |
System.out.println("Deleting broken corpus: " + cb + " of " + cb.getProject());
|
|
| 442 |
cb.delete(); |
|
| 440 |
try {
|
|
| 441 |
if (!cb.compute(false)) {
|
|
| 442 |
System.out.println("Deleting broken corpus: " + cb + " of " + cb.getProject());
|
|
| 443 |
cb.delete(); |
|
| 444 |
} |
|
| 443 | 445 |
} |
| 446 |
catch (InterruptedException e) {
|
|
| 447 |
// TODO Auto-generated catch block |
|
| 448 |
e.printStackTrace(); |
|
| 449 |
} |
|
| 444 | 450 |
} |
| 445 | 451 |
} |
| 446 | 452 |
} |
| tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2565) | ||
|---|---|---|
| 220 | 220 |
this.loadResults(null); |
| 221 | 221 |
|
| 222 | 222 |
for (TXMResult cb : getCorpora()) {
|
| 223 |
if (!cb.compute(false)) {
|
|
| 224 |
Log.warning("Deleting broken corpus: " + cb + " of " + cb.getProject());
|
|
| 225 |
cb.delete(); |
|
| 223 |
try {
|
|
| 224 |
if (!cb.compute(false)) {
|
|
| 225 |
Log.warning("Deleting broken corpus: " + cb + " of " + cb.getProject());
|
|
| 226 |
cb.delete(); |
|
| 227 |
} |
|
| 226 | 228 |
} |
| 229 |
catch (InterruptedException e) {
|
|
| 230 |
// TODO Auto-generated catch block |
|
| 231 |
e.printStackTrace(); |
|
| 232 |
} |
|
| 227 | 233 |
} |
| 228 | 234 |
|
| 229 | 235 |
if (monitor != null) monitor.subTask("");
|
| ... | ... | |
| 684 | 690 |
*/ |
| 685 | 691 |
@SuppressWarnings("unchecked")
|
| 686 | 692 |
public List<Text> getTexts() {
|
| 687 |
return (List<Text>) getChildren(Text.class);
|
|
| 693 |
return getChildren(Text.class); |
|
| 688 | 694 |
} |
| 689 | 695 |
|
| 690 | 696 |
/** |
| ... | ... | |
| 1211 | 1217 |
|
| 1212 | 1218 |
@SuppressWarnings("unchecked")
|
| 1213 | 1219 |
private List<CorpusBuild> getCorpusBuilds() {
|
| 1214 |
return (List<CorpusBuild>) getChildren(CorpusBuild.class);
|
|
| 1220 |
return getChildren(CorpusBuild.class); |
|
| 1215 | 1221 |
} |
| 1216 | 1222 |
|
| 1217 | 1223 |
public void setImportModuleName(String name) {
|
Formats disponibles : Unified diff