Révision 1172
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 1172) | ||
---|---|---|
283 | 283 |
@Override |
284 | 284 |
protected boolean _load(Element e) { |
285 | 285 |
if (e != null) { |
286 |
this.userName = this.pID = e.getAttribute(NAME); |
|
286 | 287 |
this.pQuery = new CQLQuery(e.getAttribute("query")); //$NON-NLS-1$ |
287 | 288 |
|
288 | 289 |
NodeList subcorpusElems = e.getElementsByTagName("subcorpus"); //$NON-NLS-1$ |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 1172) | ||
---|---|---|
820 | 820 |
Element subcorpusElem = (Element) subcorpusElems.item(i); |
821 | 821 |
if (!subcorpusElem.getParentNode().equals(preBuildElem)) continue; //level 1 elements |
822 | 822 |
//System.out.println("subcorpus "+subcorpusElem.getAttribute("name")); |
823 |
try { |
|
824 |
Subcorpus subcorp = this.createSubcorpus(subcorpusElem);
|
|
823 |
// try {
|
|
824 |
Subcorpus subcorp = new Subcorpus(this);
|
|
825 | 825 |
subcorp._load(subcorpusElem); |
826 |
subcorp.compute(); |
|
827 |
} catch (CqiClientException ex) { |
|
828 |
Log.warning(this.pID + TXMCoreMessages.Corpus_12 + pID |
|
829 |
+ " : " + ex); //$NON-NLS-1$ |
|
830 |
} |
|
826 |
//subcorp.compute();
|
|
827 |
// } catch (CqiClientException ex) {
|
|
828 |
// Log.warning(this.pID + TXMCoreMessages.Corpus_12 + pID
|
|
829 |
// + " : " + ex); //$NON-NLS-1$
|
|
830 |
// }
|
|
831 | 831 |
} |
832 | 832 |
|
833 | 833 |
NodeList partitionElems = preBuildElem.getElementsByTagName("partition"); //$NON-NLS-1$ |
... | ... | |
851 | 851 |
|
852 | 852 |
// partition.setSelfElement(partitionElem); |
853 | 853 |
// partition.load(); |
854 |
partition.compute(); |
|
854 |
//partition.compute();
|
|
855 | 855 |
} catch (Exception ex) { |
856 | 856 |
Log.warning(this.pID + TXMCoreMessages.Corpus_19 + name |
857 | 857 |
+ " : " + ex); //$NON-NLS-1$ |
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1172) | ||
---|---|---|
1037 | 1037 |
super.widgetSelected(e); |
1038 | 1038 |
} |
1039 | 1039 |
}); |
1040 |
leftSizeSpinner.addKeyListener(new KeyListener() { |
|
1041 |
@Override |
|
1042 |
public void keyReleased(KeyEvent e) { |
|
1043 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
|
1044 |
concordance.setLeftContextSize(leftSizeSpinner.getSelection()); |
|
1045 |
ConcordanceEditor.this.compute(true); |
|
1046 |
} |
|
1047 |
} |
|
1048 |
@Override |
|
1049 |
public void keyPressed(KeyEvent e) { } |
|
1050 |
}); |
|
1040 | 1051 |
new Label(propertiesPanel, SWT.NONE); |
1041 | 1052 |
rightSizeSpinner = new Spinner(propertiesPanel, SWT.BORDER); |
1042 | 1053 |
rightSizeSpinner.addSelectionListener(new ComputeSelectionListener(this) { |
... | ... | |
1046 | 1057 |
super.widgetSelected(e); |
1047 | 1058 |
} |
1048 | 1059 |
}); |
1060 |
rightSizeSpinner.addKeyListener(new KeyListener() { |
|
1061 |
@Override |
|
1062 |
public void keyReleased(KeyEvent e) { |
|
1063 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
|
1064 |
concordance.setRightContextSize(rightSizeSpinner.getSelection()); |
|
1065 |
ConcordanceEditor.this.compute(true); |
|
1066 |
} |
|
1067 |
} |
|
1068 |
@Override |
|
1069 |
public void keyPressed(KeyEvent e) { } |
|
1070 |
}); |
|
1049 | 1071 |
} catch (Exception e1) { |
1050 | 1072 |
// TODO Auto-generated catch block |
1051 | 1073 |
e1.printStackTrace(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java (revision 1172) | ||
---|---|---|
28 | 28 |
package org.txm.rcp.commands.workspace; |
29 | 29 |
|
30 | 30 |
import java.io.File; |
31 |
import java.util.ArrayList; |
|
31 | 32 |
|
32 | 33 |
import org.eclipse.core.commands.AbstractHandler; |
33 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
... | ... | |
79 | 80 |
File directory = new File(dialog.getFilterPath()); |
80 | 81 |
|
81 | 82 |
if (directory.exists()) { |
82 |
|
|
83 | 83 |
LastOpened.set(ID, directory); |
84 | 84 |
return loadBinaryCorpusFromCorporaDirectory(directory); |
85 | 85 |
} |
... | ... | |
119 | 119 |
return Status.CANCEL_STATUS; |
120 | 120 |
} |
121 | 121 |
|
122 |
final Project newProject2 = loadBinaryCorpusFromCorporaDirectory(corporaDirectory, this, monitor);
|
|
122 |
final ArrayList<Project> newProjects = loadBinaryCorpusFromCorporaDirectory(directory, this, monitor);
|
|
123 | 123 |
|
124 | 124 |
this.acquireSemaphore(); |
125 | 125 |
try { |
126 | 126 |
SearchEnginesManager.getCQPSearchEngine().start(null); |
127 | 127 |
} catch (Exception e) { |
128 |
// TODO Auto-generated catch block |
|
129 | 128 |
e.printStackTrace(); |
130 | 129 |
} |
131 | 130 |
this.releaseSemaphore(); |
... | ... | |
134 | 133 |
@Override |
135 | 134 |
public void run() { |
136 | 135 |
|
137 |
if (newProject2 != null) {
|
|
138 |
Project.loadTXMResultsFromProjectScope(newProject2.getRCPProject());
|
|
136 |
for (Project newProject2 : newProjects) {
|
|
137 |
newProject2.save();
|
|
139 | 138 |
} |
140 | 139 |
|
141 | 140 |
RestartTXM.reloadViews(); |
... | ... | |
160 | 159 |
* @param monitor |
161 | 160 |
* @return |
162 | 161 |
*/ |
163 |
protected static Project loadBinaryCorpusFromCorporaDirectory(File corporaDirectory, JobHandler job, IProgressMonitor monitor) { |
|
164 |
Project project = null; |
|
162 |
protected static ArrayList<Project> loadBinaryCorpusFromCorporaDirectory(File corporaDirectory, JobHandler job, IProgressMonitor monitor) { |
|
165 | 163 |
|
164 |
ArrayList<Project> projects = new ArrayList<Project>(); |
|
165 |
|
|
166 | 166 |
try { |
167 | 167 |
|
168 | 168 |
SearchEngine engine = SearchEnginesManager.getCQPSearchEngine(); |
... | ... | |
177 | 177 |
|
178 | 178 |
monitor.subTask(TXMUIMessages.AddBase_32); |
179 | 179 |
for (File corpusDirectory : corporaDirectory.listFiles()) { |
180 |
|
|
180 |
|
|
181 |
if (corpusDirectory.isFile()) continue; |
|
182 |
if (corpusDirectory.isHidden()) continue; |
|
183 |
|
|
184 |
Project project = null; |
|
181 | 185 |
if (corpusDirectory.isDirectory()) { |
182 | 186 |
project = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(corpusDirectory, monitor); |
183 | 187 |
} else if (corpusDirectory.getName().endsWith(".txm")) { |
... | ... | |
187 | 191 |
} |
188 | 192 |
|
189 | 193 |
// Project base = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(corpusDirectory); |
190 |
// if (base == null) { |
|
191 |
// System.out.println("Fail to load binary corpus: "+corpusDirectory); |
|
192 |
// } |
|
194 |
if (project == null) { |
|
195 |
System.out.println("Fail to load binary corpus: "+corpusDirectory); |
|
196 |
} else { |
|
197 |
projects.add(project); |
|
198 |
} |
|
193 | 199 |
} |
194 | 200 |
|
195 | 201 |
monitor.subTask(TXMUIMessages.AddBase_33); |
196 | 202 |
|
197 | 203 |
} catch (ThreadDeath td) { |
198 |
return null; |
|
199 | 204 |
} catch (Exception e2) { |
200 | 205 |
org.txm.rcp.utils.Logger.printStackTrace(e2); |
201 |
return null; |
|
202 | 206 |
} finally { |
203 | 207 |
monitor.done(); |
204 | 208 |
} |
205 | 209 |
|
206 |
return project; |
|
210 |
return projects;
|
|
207 | 211 |
} |
208 | 212 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load079BinaryCorpus.java (revision 1172) | ||
---|---|---|
114 | 114 |
MainCorpus c = new MainCorpus(project); |
115 | 115 |
BaseOldParameters params = new BaseOldParameters(new File(project.getProjectDirectory(), "import.xml")); |
116 | 116 |
params.load(); |
117 |
if (c._load(params.getCorpusElement())) { |
|
118 |
project.compute(); |
|
119 |
} else { |
|
120 |
project.delete(); |
|
121 |
} |
|
117 |
c._load(params.getCorpusElement()); |
|
122 | 118 |
|
119 |
project.saveParameters(true); |
|
123 | 120 |
|
124 | 121 |
//Toolbox.workspace.save(); |
125 | 122 |
return project; |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1172) | ||
---|---|---|
200 | 200 |
} |
201 | 201 |
|
202 | 202 |
if (newProject2 != null) { |
203 |
Project.loadTXMResultsFromProjectScope(newProject2.getRCPProject());
|
|
203 |
newProject2.save();
|
|
204 | 204 |
RestartTXM.reloadViews(); |
205 | 205 |
//System.out.println("Select newly loaded corpus: "+base2.getCorpora().values()); |
206 | 206 |
CorporaView.select(newProject2.getChildren(MainCorpus.class)); |
... | ... | |
236 | 236 |
public static Project loadBinaryCorpusArchive(File zipFile, JobHandler jobhandler, final IProgressMonitor monitor) { |
237 | 237 |
Project project = null; |
238 | 238 |
try { |
239 |
SearchEngine engine = SearchEnginesManager.getCQPSearchEngine(); |
|
240 |
if (engine.isRunning()) { |
|
241 |
engine.stop(); |
|
242 |
} |
|
239 |
// SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
|
|
240 |
// if (engine.isRunning()) {
|
|
241 |
// engine.stop();
|
|
242 |
// }
|
|
243 | 243 |
|
244 | 244 |
//CHECK ZIPPED FILE |
245 | 245 |
project = Load080BinaryCorpus.loadBinaryCorpus(zipFile, monitor); |
... | ... | |
299 | 299 |
return null; |
300 | 300 |
} |
301 | 301 |
|
302 |
SearchEngine engine = SearchEnginesManager.getCQPSearchEngine(); |
|
303 |
if (engine.isRunning()) { |
|
304 |
engine.stop(); |
|
305 |
} |
|
302 |
// SearchEngine engine = SearchEnginesManager.getCQPSearchEngine();
|
|
303 |
// if (engine.isRunning()) {
|
|
304 |
// engine.stop();
|
|
305 |
// }
|
|
306 | 306 |
|
307 | 307 |
// //File txmregistry = new File(Toolbox.getTxmHomePath(), "registry"); //$NON-NLS-1$ |
308 | 308 |
// //txmregistry.mkdir(); |
... | ... | |
319 | 319 |
// seems like a binary corpus directory |
320 | 320 |
// copy files in the new current corpora directory |
321 | 321 |
File destDir = new File(Toolbox.workspace.getLocation(), corpusDirectory.getName().toUpperCase()); |
322 |
if (!destDir.equals(corpusDirectory) && !destDir.exists()) {
|
|
322 |
if (!destDir.equals(corpusDirectory)) { |
|
323 | 323 |
FileCopy.copyFiles(corpusDirectory, destDir); // the corpus directory is not in the corpora directory |
324 | 324 |
} |
325 | 325 |
|
tmp/org.txm.core/src/java/org/txm/Toolbox.java (revision 1172) | ||
---|---|---|
277 | 277 |
e.printStackTrace(); |
278 | 278 |
} |
279 | 279 |
|
280 |
// loads and recreate the existing projects |
|
280 |
// loads and recreate the existing projects, loadParameters() needs engines to be ready
|
|
281 | 281 |
workspace.loadTXMResultsFromProjectScopes(); |
282 | 282 |
|
283 | 283 |
|
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1172) | ||
---|---|---|
1972 | 1972 |
* @return |
1973 | 1973 |
*/ |
1974 | 1974 |
public boolean mustBePersisted() { |
1975 |
if (this.internalPersistable |
|
1976 |
|| this.userPersistable) { |
|
1977 |
return true; |
|
1978 |
} |
|
1979 |
return false; |
|
1975 |
return this.internalPersistable || this.userPersistable; |
|
1980 | 1976 |
} |
1981 | 1977 |
|
1982 | 1978 |
/** |
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1172) | ||
---|---|---|
229 | 229 |
} |
230 | 230 |
|
231 | 231 |
//System.out.println(parameters.toString()); |
232 |
Project b = new Project(this, binCorpusDir.getName()); |
|
233 | 232 |
|
233 |
// load the project from the project .settings directory |
|
234 |
IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace(); |
|
235 |
//rcpWorkspace.getRoot().refreshLocal(1, new LogMonitor()); |
|
236 |
IProject rcpProject = rcpWorkspace.getRoot().getProject(binCorpusDir.getName()); |
|
237 |
if (!rcpProject.exists()) rcpProject.create(new LogMonitor()); |
|
238 |
if (!rcpProject.isOpen()) rcpProject.open(new LogMonitor()); |
|
239 |
Project.loadTXMResultsFromProjectScope(rcpProject); |
|
240 |
|
|
241 |
Project b = getProject(binCorpusDir.getName()); |
|
242 |
|
|
234 | 243 |
return b; |
235 | 244 |
} else { |
236 | 245 |
System.out.println(TXMCoreMessages.bind(TXMCoreMessages.Project_26, binCorpusDir)); |
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1172) | ||
---|---|---|
211 | 211 |
// } |
212 | 212 |
// |
213 | 213 |
// this.scope = new BasePreferenceScope(this); |
214 |
|
|
215 |
|
|
214 |
|
|
216 | 215 |
// reloading existing results |
217 | 216 |
this.loadResults(); |
218 |
|
|
219 | 217 |
} |
220 | 218 |
|
221 | 219 |
|
... | ... | |
259 | 257 |
/** |
260 | 258 |
* Loads and create the persisted results from the preferences service. |
261 | 259 |
*/ |
262 |
protected void loadResults() {
|
|
260 |
public void loadResults() {
|
|
263 | 261 |
// if (TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED)) { |
264 |
Log.finest("*** Project.loadResults(): reloading persitent results..."); |
|
262 |
Log.finest("*** Project.loadResults(): reloading project persitent results...");
|
|
265 | 263 |
|
266 | 264 |
IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace(); |
267 | 265 |
// IProject projects[] = rcpWorkspace.getRoot().getProjects(); |
... | ... | |
364 | 362 |
*/ |
365 | 363 |
public boolean _load(BaseOldParameters params) throws Exception { |
366 | 364 |
params.load(); |
367 |
String name = params.name;
|
|
368 |
File dir = new File(this.getWorkspace().getLocation(), name);
|
|
365 |
pName = userName = params.name;
|
|
366 |
File dir = new File(this.getWorkspace().getLocation(), userName);
|
|
369 | 367 |
File paramFile = new File(dir, "import.xml"); |
370 | 368 |
if (!paramFile.exists()) return false; |
371 | 369 |
|
... | ... | |
1150 | 1148 |
|
1151 | 1149 |
public boolean save() { |
1152 | 1150 |
try { |
1153 |
super.saveParameters(true); |
|
1151 |
autoSaveParametersFromAnnotations(); |
|
1152 |
saveParameters(true); |
|
1154 | 1153 |
} catch (Exception e) { |
1155 | 1154 |
// TODO Auto-generated catch block |
1156 | 1155 |
e.printStackTrace(); |
Formats disponibles : Unified diff