Revision 2622

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java (revision 2622)
46 46
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
47 47
import org.txm.searchengine.cqp.corpus.query.MatchUtils;
48 48
import org.txm.searchengine.cqp.serverException.CqiServerError;
49
import org.txm.utils.TXMProgressMonitor;
49 50
//import org.txm.statsengine.core.StatException;
50 51
//import org.txm.statsengine.core.data.Vector;
51 52
//import org.txm.statsengine.r.core.data.VectorImpl;
......
627 628
	}
628 629
	
629 630
	
630
	public static CQPLexicon getLexicon(CQPCorpus corpus, Property property, IProgressMonitor monitor, boolean visible) throws Exception {
631
	public static CQPLexicon getLexicon(CQPCorpus corpus, Property property, TXMProgressMonitor monitor, boolean visible) throws Exception {
631 632
		CQPLexicon lexicon = null;
632 633
		
633 634
		// recycling parent Lexicon if exists
......
661 662
	 * @return
662 663
	 * @throws Exception
663 664
	 */
664
	public static CQPLexicon getLexicon(CQPCorpus corpus, Property property, IProgressMonitor monitor) throws Exception {
665
	public static CQPLexicon getLexicon(CQPCorpus corpus, Property property, TXMProgressMonitor monitor) throws Exception {
665 666
		return getLexicon(corpus, property, monitor, true);
666 667
	}
667 668
	
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/PropertiesComputer.java (revision 2622)
3 3
import java.util.LinkedHashMap;
4 4
import java.util.List;
5 5

  
6
import org.eclipse.core.runtime.IProgressMonitor;
7 6
import org.txm.core.results.TXMResult;
7
import org.txm.utils.TXMProgressMonitor;
8 8

  
9 9
/**
10 10
 * Properties use this existing class implementations to retrieve informations to show
11
 * 
11 12
 * @author mdecorde
12 13
 *
13 14
 */
14 15
public abstract class PropertiesComputer<T extends TXMResult> {
15 16
	
16 17
	protected T result;
18
	
17 19
	protected Properties props;
18 20
	
19 21
	public PropertiesComputer(Properties props, T result) {
......
23 25
	
24 26
	/**
25 27
	 * The ordered list of informations to display
28
	 * 
26 29
	 * @return
27 30
	 */
28 31
	public abstract List<String> getComputableInformations();
29 32
	
30 33
	/**
31 34
	 * raw informations
35
	 * 
32 36
	 * @param name
33 37
	 * @return
34 38
	 */
35 39
	public abstract LinkedHashMap<String, String> getInformation(String name);
36

  
40
	
37 41
	/**
38 42
	 * HTML formated informations to insert a HTML element
43
	 * 
39 44
	 * @return
40 45
	 */
41 46
	public abstract String getInformationHTML(String info);
42 47
	
43 48
	/**
44 49
	 * if the PropertiesComputer needs to prepare informations or the compute the available informations
50
	 * 
45 51
	 * @return
46 52
	 */
47
	public abstract boolean _compute(IProgressMonitor monitor) throws Exception;
48

  
53
	public abstract boolean _compute(TXMProgressMonitor monitor) throws Exception;
54
	
49 55
	public String getName() {
50
		return result.getClass().getSimpleName()+"-"+result.getName();
56
		return result.getClass().getSimpleName() + "-" + result.getName();
51 57
	}
52 58
}
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/Properties.java (revision 2622)
117 117
				}
118 118
				
119 119
				@Override
120
				public boolean _compute(IProgressMonitor monitor) throws Exception {
120
				public boolean _compute(TXMProgressMonitor monitor) throws Exception {
121 121
					return true;
122 122
				}
123 123
			};
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/CorpusPropertiesComputer.java (revision 2622)
11 11
import java.util.Locale;
12 12

  
13 13
import org.apache.commons.lang.StringUtils;
14
import org.eclipse.core.runtime.IProgressMonitor;
15 14
import org.eclipse.osgi.util.NLS;
16 15
import org.txm.core.messages.TXMCoreMessages;
17
import org.txm.core.results.TXMResult;
18 16
import org.txm.objects.Project;
19 17
import org.txm.properties.core.messages.PropertiesCoreMessages;
20 18
import org.txm.searchengine.cqp.AbstractCqiClient;
......
27 25
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
28 26
import org.txm.searchengine.cqp.corpus.WordProperty;
29 27
import org.txm.searchengine.cqp.corpus.query.Match;
28
import org.txm.utils.TXMProgressMonitor;
30 29
import org.txm.utils.logger.Log;
31 30

  
32 31
public class CorpusPropertiesComputer extends PropertiesComputer<CQPCorpus> {
......
454 453
	}
455 454
	
456 455
	@Override
457
	public boolean _compute(IProgressMonitor monitor) throws Exception {
456
	public boolean _compute(TXMProgressMonitor monitor) throws Exception {
458 457
		
459
		if (monitor != null) monitor.beginTask(props.getComputingStartMessage(), 3);
458
		monitor.monitorSetTask(props.getComputingStartMessage());
459
		
460 460
		this.stepGeneralInfos();
461
		if (monitor != null) monitor.worked(1);
461
		monitor.monitorSetWorked(34);
462 462
		
463 463
		this.stepLexicalProperties();
464
		if (monitor != null) monitor.worked(1);
464
		monitor.monitorSetWorked(33);
465 465
		
466 466
		this.stepStructuralUnits();
467
		if (monitor != null) monitor.worked(1);
467
		monitor.monitorSetWorked(33);
468
		
468 469
		return true;
469 470
	}
470 471
	
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2622)
2325 2325
		this.computingThread = Thread.currentThread();
2326 2326
		
2327 2327
		// FIXME: SJ: Debug tests
2328
		boolean debugSlowingProcess = false;
2329
		int sleepDuration = 10000;
2328
		boolean debugSlowingProcess = true;
2329
		int sleepDuration = 5000;
2330 2330
		
2331 2331
		// skip the process if the result is already in computing stage
2332 2332
		if (this.computing) {
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2622)
455 455
		description.setLocation(folder.getLocation());
456 456
		description.setNatureIds(new String[] { TXMCORPUSNATURE });
457 457
		
458
		SubMonitor subMonitor = monitor.createNewMonitor(100);
458
		// SubMonitor subMonitor = monitor.createNewMonitor(100);
459
		IProgressMonitor subMonitor = new LogMonitor();
459 460
		
461
		
460 462
		rcpProject.create(description, subMonitor);
461 463
		rcpProject.open(subMonitor);
462 464
		// TODO might fail if corpus source directory changed
tmp/org.txm.core/src/java/org/txm/utils/TXMProgressMonitor.java (revision 2622)
104 104
	 * @param totalWork
105 105
	 * @return
106 106
	 */
107
	public SubMonitor createNewMonitor(int totalWork) {
108
		return this.monitor.split(totalWork).setWorkRemaining(100);
107
	public TXMProgressMonitor createNewMonitor(int totalWork) {
108
		return new TXMProgressMonitor(this.monitor.split(totalWork));
109 109
	}
110 110
	
111 111
}
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2622)
186 186
			
187 187
			// FIXME: SJ: Computes the result only if at least one computing parameter has changed
188 188
			// if(this.hasParameterChanged()) {
189
			computingState = this.__compute(monitor);
189
			computingState = this.__compute(monitor.createNewMonitor(90));
190 190
			// }
191 191
			if (computingState) {
192
				computingState = this.renderChart(monitor);
192
				computingState = this.renderChart(monitor.createNewMonitor(10));
193 193
			}
194 194
		}
195 195
		catch (Exception e) {
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 2622)
70 70
import org.txm.statsengine.core.StatException;
71 71
import org.txm.statsengine.r.core.RWorkspace;
72 72
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
73
import org.txm.utils.LogMonitor;
73 74
import org.txm.utils.TXMProgressMonitor;
74 75
import org.txm.utils.logger.Log;
75 76

  
......
955 956
			}
956 957
		}
957 958
		
959
		// TODO: MD: implement a sibling dependency system
958 960
		if (index == null) {
959 961
			try {
960 962
				index = new Index(corpus);
961 963
				index.setVisible(false);
962 964
				index.setParameters(new CQLQuery(pCooccurentQueryFilter), pProperties, null, null, null, null);
963
				if (!index.compute(monitor.createNewMonitor(10))) {
965
				if (!index.compute(new LogMonitor())) {
964 966
					Log.severe("Cooccurrence internal Index compute failed. Aborting.");
965 967
					return false;
966 968
				}
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAParametersDialog.java (revision 2622)
45 45
import org.txm.core.messages.TXMCoreMessages;
46 46
import org.txm.core.preferences.TXMPreferences;
47 47
import org.txm.lexicaltable.core.messages.LexicalTableCoreMessages;
48
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
49 48
import org.txm.rcp.messages.TXMUIMessages;
50 49
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
51 50
import org.txm.searchengine.cqp.corpus.CQPCorpus;

Also available in: Unified diff