Révision 2077
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 2077) | ||
---|---|---|
165 | 165 |
Project p = Toolbox.workspace.getProject(basedirname); |
166 | 166 |
|
167 | 167 |
if (corpusdir.exists() || p != null) { |
168 |
boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.warning, NLS.bind(TXMUIMessages.theP0CorpusDirectoryAlreadyExistsDoYouWantToReplaceIt, corpusdir.getName().toUpperCase())); |
|
169 |
if (b) { |
|
170 |
//TODO: to enable backup of binary corpus I need to be able to reload correctly a corpus in CQP corpus manager |
|
171 |
// backup = new File(corpusdir.getParentFile(), corpusdir.getName()+"-back"); //$NON-NLS-1$ |
|
172 |
// DeleteDir.deleteDirectory(backup); |
|
173 |
// if (backup.exists()) { |
|
174 |
// System.out.println(Messages.LoadBinaryCorpus_1+backup); |
|
175 |
// return false; |
|
176 |
// } |
|
177 |
// if (!corpusdir.renameTo(backup)) { |
|
178 |
// System.out.println(Messages.LoadBinaryCorpus_2+backup); |
|
179 |
// return false; |
|
180 |
// } |
|
168 |
if (Display.getCurrent() == null) { // not a UI thread -> delete the previous corpus |
|
169 |
p.delete(); // the user said yes, so delete the previous project |
|
170 |
} else { |
|
181 | 171 |
|
182 |
if (p != null) { |
|
183 |
p.delete(); // the user said yes, so delete the previous project |
|
172 |
boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.warning, NLS.bind(TXMUIMessages.theP0CorpusDirectoryAlreadyExistsDoYouWantToReplaceIt, corpusdir.getName().toUpperCase())); |
|
173 |
if (b) { |
|
174 |
//TODO: to enable backup of binary corpus I need to be able to reload correctly a corpus in CQP corpus manager |
|
175 |
// backup = new File(corpusdir.getParentFile(), corpusdir.getName()+"-back"); //$NON-NLS-1$ |
|
176 |
// DeleteDir.deleteDirectory(backup); |
|
177 |
// if (backup.exists()) { |
|
178 |
// System.out.println(Messages.LoadBinaryCorpus_1+backup); |
|
179 |
// return false; |
|
180 |
// } |
|
181 |
// if (!corpusdir.renameTo(backup)) { |
|
182 |
// System.out.println(Messages.LoadBinaryCorpus_2+backup); |
|
183 |
// return false; |
|
184 |
// } |
|
185 |
|
|
186 |
if (p != null) { |
|
187 |
p.delete(); // the user said yes, so delete the previous project |
|
188 |
} else { |
|
189 |
DeleteDir.deleteDirectory(corpusdir); |
|
190 |
} |
|
191 |
|
|
192 |
if (corpusdir.exists()) { |
|
193 |
return null; |
|
194 |
} |
|
184 | 195 |
} else { |
185 |
DeleteDir.deleteDirectory(corpusdir);
|
|
196 |
return null; // abandon
|
|
186 | 197 |
} |
187 |
|
|
188 |
if (corpusdir.exists()) { |
|
189 |
return null; |
|
190 |
} |
|
191 |
} else { |
|
192 |
return null; // abandon |
|
193 | 198 |
} |
194 | 199 |
} |
195 | 200 |
|
tmp/org.txm.analec.rcp/src/org/txm/macro/urs/democrat/BuildDemocratCorpusVersion1Macro.groovy (revision 2077) | ||
---|---|---|
121 | 121 |
if (corpus == null) { |
122 | 122 |
File binCorpusFile = new File(inputDirectory, txm_file) |
123 | 123 |
if (!binCorpusFile.exists()) { |
124 |
println " ** no corpus binary file found for ID=$corpus_id : $binCorpusFile"
|
|
124 |
println " ** no corpus binary file found for ID='$corpus_id' : $binCorpusFile"
|
|
125 | 125 |
continue; |
126 | 126 |
} |
127 | 127 |
println " loading corpus from ${binCorpusFile}..." |
... | ... | |
129 | 129 |
job.join(); |
130 | 130 |
project = job.getResultObject(); |
131 | 131 |
corpus = project.getCorpusBuild(corpus_id); |
132 |
if (corpus == null) { |
|
133 |
println " ** no corpus for ID='$corpus_id' found in the binary corpus." |
|
134 |
conitnue |
|
135 |
} |
|
132 | 136 |
corpora[corpus.getID()] = corpus; |
133 | 137 |
loaded = true |
134 | 138 |
} else { |
tmp/org.txm.analec.rcp/src/org/txm/macro/urs/export/ExportAsMacro.groovy (revision 2077) | ||
---|---|---|
98 | 98 |
println "renaming $txmFile : "+txmFile.renameTo(txmFile2) |
99 | 99 |
|
100 | 100 |
// patch name in settings |
101 |
println "replacing old name $name -> ${new_name}" |
|
102 |
String node = mainCorpus.getProject().getParametersNodePath() |
|
103 |
node = node.substring(node.lastIndexOf("/")) |
|
104 |
File projectPrefs = new File(newBinDirectory, ".settings/"+node+".prefs") |
|
105 |
node = mainCorpus.getParametersNodePath() |
|
106 |
node = node.substring(node.lastIndexOf("/")) |
|
107 |
File maincorpusPrefs = new File(newBinDirectory, ".settings/"+node+".prefs") |
|
108 |
IOUtils.write(projectPrefs, projectPrefs.getText().replace(name, new_name)) |
|
109 |
IOUtils.write(maincorpusPrefs, maincorpusPrefs.getText().replace(name, new_name)) |
|
101 |
println "replacing old name $name -> ${new_name} in preferences" |
|
102 |
File settingsDirectory = new File(newBinDirectory, ".settings") |
|
103 |
for (File prefFile : settingsDirectory.listFiles()) { |
|
104 |
IOUtils.write(prefFile, prefFile.getText().replace(name, new_name)) |
|
105 |
} |
|
106 |
|
|
110 | 107 |
File projectSetting = new File(newBinDirectory, ".project") |
111 | 108 |
IOUtils.write(projectSetting, projectSetting.getText().replace(name, new_name)) |
112 | 109 |
|
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy (revision 2077) | ||
---|---|---|
427 | 427 |
outfile.delete(); // fail |
428 | 428 |
} |
429 | 429 |
} |
430 |
println ""
|
|
430 |
cpb.done()
|
|
431 | 431 |
} |
432 | 432 |
return true; |
433 | 433 |
} |
... | ... | |
469 | 469 |
} |
470 | 470 |
} |
471 | 471 |
filesToProcess = outputDirectory.listFiles(); |
472 |
println ""
|
|
472 |
cpb.done();
|
|
473 | 473 |
return true; |
474 | 474 |
} |
475 | 475 |
|
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZCompilerStep.groovy (revision 2077) | ||
---|---|---|
224 | 224 |
foundtei = false; |
225 | 225 |
break; |
226 | 226 |
case "text": |
227 |
output.write("</text>\n"); |
|
227 | 228 |
foundtext = false; |
228 | 229 |
break; |
229 | 230 |
case FORM: |
Formats disponibles : Unified diff