Révision 2109

tmp/org.txm.annotation.rcp/src/org/txm/annotation/rcp/editor/AnnotationExtension.java (revision 2109)
134 134

  
135 135
			@Override
136 136
			public void widgetSelected(SelectionEvent e) {
137
				boolean needToUpdateIndexes = false;
138
				//System.out.println("Saving annotations...");
139
				if (annotationAreas != null && annotationAreas.size() > 0) {
140
					for (AnnotationArea aa : annotationAreas) {
141
						needToUpdateIndexes = needToUpdateIndexes || (aa.save() &&  aa.needToUpdateIndexes());
142
					}
143
					CorporaView.refresh();
137
				try {
138
					notifyDoSave();
139
				} catch (Exception e1) {
140
					// TODO Auto-generated catch block
141
					e1.printStackTrace();
144 142
				}
145

  
146
				if (needToUpdateIndexes) {
147
					JobHandler job = new JobHandler("Updating corpus editions and indexes", true) {
148

  
149
						@Override
150
						protected IStatus run(IProgressMonitor monitor) {
151
							final MainCorpus corpus = (MainCorpus) editor.getResult().getFirstParent(MainCorpus.class);
152
							monitor.setTaskName("updating corpus indexes and editions");
153
							if (corpus != null && UpdateCorpus.update(corpus) != null) {
154
								monitor.worked(50);
155
								this.syncExec(new Runnable() {
156
									public void run() {
157
										CorporaView.refreshObject(corpus);
158
									}
159
								});
160
								return Status.OK_STATUS;
161
							} else {
162
								monitor.worked(50);
163
								System.out.println("Fail to update corpus. Aborting");
164
								System.out.println("Fix XML-TXM files and call command 'UpdateCorpus'");
165
								return Status.CANCEL_STATUS;
166
							}
167
						}
168
					};
169
					job.schedule();
170
				}
171 143
			}
172 144

  
173 145
			@Override
......
271 243
	
272 244
	@Override
273 245
	public void notifyDoSave() throws Exception {
274
		for (AnnotationArea aa : annotationAreas) {
275
			aa.save();
246
		boolean needToUpdateIndexes = false;
247
		//System.out.println("Saving annotations...");
248
		if (annotationAreas != null && annotationAreas.size() > 0) {
249
			for (AnnotationArea aa : annotationAreas) {
250
				needToUpdateIndexes = needToUpdateIndexes || (aa.save() &&  aa.needToUpdateIndexes());
251
			}
252
			CorporaView.refresh();
276 253
		}
254

  
255
		if (needToUpdateIndexes) {
256
			JobHandler job = new JobHandler("Updating corpus editions and indexes", true) {
257

  
258
				@Override
259
				protected IStatus run(IProgressMonitor monitor) {
260
					final MainCorpus corpus = (MainCorpus) editor.getResult().getFirstParent(MainCorpus.class);
261
					monitor.setTaskName("updating corpus indexes and editions");
262
					if (corpus != null && UpdateCorpus.update(corpus) != null) {
263
						monitor.worked(50);
264
						this.syncExec(new Runnable() {
265
							public void run() {
266
								CorporaView.refreshObject(corpus);
267
							}
268
						});
269
						return Status.OK_STATUS;
270
					} else {
271
						monitor.worked(50);
272
						System.out.println("Fail to update corpus. Aborting");
273
						System.out.println("Fix XML-TXM files and call command 'UpdateCorpus'");
274
						return Status.CANCEL_STATUS;
275
					}
276
				}
277
			};
278
			job.schedule();
279
		}
277 280
	}
278 281

  
279 282
	@Override
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2109)
341 341
			return true;
342 342
		}
343 343
	}
344

  
344
	
345 345
	/**
346 346
	 * Initializes the RCP project and project scope.
347 347
	 * 
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy (revision 2109)
56 56
		
57 57
		// remove extra XSL editions -> they will be recreated by the doPostEditionXSLStep call 
58 58
		for (EditionDefinition eDef : project.getEditionDefinitions()) {
59
			if (eDef.getName() != "facs" || eDef.getName() != "default") {
59
			if (eDef.getName() != "facs" && eDef.getName() != "default") {
60 60
				eDef.delete();
61 61
			}
62 62
		}
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/debug/DescribeTXMResultMacro.groovy (revision 2109)
3 3
// @author sheiden
4 4
package org.txm.macro.debug
5 5

  
6
import org.txm.objects.*
7

  
6 8
def printResult(def obj, String prof) {
7 9
	println (prof+obj.getClass().getSimpleName()+"="+obj)
8 10
	for (def c : obj.getChildren()) {
......
11 13
}
12 14

  
13 15
def projet = corpusViewSelection.getProject()
16
if (projet == null && projet instanceof Project) projet = corpusViewSelection
17
if (projet == null) {
18
	println "no selection usable $corpusViewSelection"
19
	return;
20
}
14 21

  
15 22
printResult(projet, "")
16 23

  
17 24
println " object creation: "+corpusViewSelection.getCreationDate()
18 25
println " object update  : "+corpusViewSelection.getLastComputingDate()	
19 26
println "project creation: "+projet.getCreationDate()
20
println "project update  : "+projet.getLastComputingDate()
27
println "project update  : "+projet.getLastComputingDate()
28
println "project 'default' edition : "+projet.getEditionDefinition("default")
29
println "project 'default' edition : "+projet.getEditionDefinition("facs")

Formats disponibles : Unified diff