Révision 3392

TXM/trunk/org.txm.searchengine.core/src/org/txm/searchengine/core/QueryBasedTXMResult.java (revision 3392)
1
package org.txm.searchengine.core;
2

  
3
import org.txm.core.results.TXMResult;
4

  
5
/**
6
 * abstract class of result built on query
7
 * 
8
 * @author mdecorde
9
 *
10
 */
11
public abstract class QueryBasedTXMResult extends TXMResult {
12
	
13

  
14
	public QueryBasedTXMResult(String parametersNodePath) {
15
		
16
		super(parametersNodePath);
17
	}
18
	
19
	public QueryBasedTXMResult(String parametersNodePath, TXMResult parent) {
20
		
21
		super(parametersNodePath, parent);
22
	}
23
	
24
	public QueryBasedTXMResult(TXMResult parent) {
25
		
26
		super(parent);
27
	}
28

  
29
	/**
30
	 * 
31
	 * @return a query based on the result parameters
32
	 */
33
	public abstract IQuery getQuery();
34
}
0 35

  
TXM/trunk/org.txm.properties.core/src/org/txm/properties/core/functions/CorpusPropertiesComputer.java (revision 3392)
152 152
		int s = Math.min(props.pMaxPropertiesToDisplay, numberOfWords);
153 153
		int[] positions = new int[s];
154 154
		int n = 0;
155
		List<Match> matches = result.getMatches();
156
		for (Match m : matches) {
155
		List<? extends org.txm.objects.Match> matches = result.getMatches();
156
		for (org.txm.objects.Match m : matches) {
157 157
			if (n >= s) break;
158 158
			for (int i = m.getStart(); i < m.getEnd(); i++) {
159 159
				if (n >= s) break;
TXM/trunk/org.txm.connlu.core/src/org/txm/conllu/core/function/UDSearch.java (revision 3392)
60 60
			//File file = File.createTempFile("txm", ".svg", new File(Toolbox.getTxmHomePath(), "results"));
61 61
			
62 62
			Match match = this.matches.getMatches().get(sent);
63
			Match sentence = null;
64
			for (Match s : udSentences.getMatches()) {
63
			org.txm.objects.Match sentence = null;
64
			for (org.txm.objects.Match s : udSentences.getMatches()) {
65 65
				if (s.getStart() <= match.getStart() && match.getEnd() <= s.getEnd()) {
66 66
					sentence = s;
67 67
					break;
......
294 294
		WordProperty pid = corpus.getProperty("id");
295 295
		StructuralUnitProperty ptextid = corpus.getStructuralUnitProperty("text_id");
296 296
		
297
		Match match = this.udSentences.getMatches().get(this.index);
297
		org.txm.objects.Match match = this.udSentences.getMatches().get(this.index);
298 298
		int[] positions = new int[match.size()];
299 299
		for (int i = 0 ; i < match.size() ; i++) {
300 300
			positions[i] = match.getStart() + i;
TXM/trunk/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 3392)
52 52
import org.txm.index.core.preferences.IndexPreferences;
53 53
import org.txm.objects.Match;
54 54
import org.txm.searchengine.core.IQuery;
55
import org.txm.searchengine.core.Query;
56
import org.txm.searchengine.core.QueryBasedTXMResult;
55 57
import org.txm.searchengine.core.Selection;
56 58
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
57 59
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
72 74
 * 
73 75
 * @author mdecorde
74 76
 */
75
public class Index extends TXMResult {
77
public class Index extends QueryBasedTXMResult {
76 78
	
77 79
	/** The counts. */
78 80
	protected LinkedHashMap<String, ArrayList<Integer>> counts = new LinkedHashMap<>();
TXM/trunk/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OriflammsFunction.java (revision 3392)
99 99
	
100 100
	boolean processText(CQPCorpus corpus, String text_id) throws CqiClientException, IOException, CqiServerError {
101 101

  
102
		List<Match> matches = corpus.getMatches();
103
		Match last_match = matches.get(matches.size()-1);
102
		List<? extends org.txm.objects.Match> matches = corpus.getMatches();
103
		org.txm.objects.Match last_match = matches.get(matches.size()-1);
104 104
		int end = last_match.getEnd();
105

  
106 105
		
107 106
		QueryResult r = corpus.query(new CQLQuery("[pbstart=\"0\"]"), "ABBRORI1", false);
108 107
		int[] pb_pos = r.getStarts();
TXM/trunk/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 3392)
196 196
	
197 197
	
198 198
	/**
199
	 * Number of lines to display per page.
199
	 * Number of lines to display per result page.
200 200
	 */
201 201
	public static final String N_LINES_PER_PAGE = "n_lines_per_page"; //$NON-NLS-1$
202 202
	
......
228 228
	
229 229
	public static final String PERSITABLE = "persistable";
230 230

  
231
	public static final String INTERNAL_PERSITABLE = "internal_persistable";
231 232
	
232 233
	/**
233 234
	 * Preferences node qualifier of the instance.
......
1724 1725
			ClassNotFoundException {
1725 1726
		
1726 1727
		byte[] data = Base64.getDecoder().decode(s);
1727
		ObjectInputStream ois = new ObjectInputStream(
1728
				new ByteArrayInputStream(data));
1728
		ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
1729 1729
		Object o = ois.readObject();
1730 1730
		ois.close();
1731 1731
		return (Serializable) o;
TXM/trunk/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 3392)
320 320
			}
321 321
		}
322 322
		catch (Exception e) {
323
			Log.severe("Fail to load " + parametersNodePath + "result: " + e); //$NON-NLS-1$ //$NON-NLS-2$
323
			Log.severe("Fail to load the " + parametersNodePath + " result: " + e); //$NON-NLS-1$ //$NON-NLS-2$
324 324
			Log.printStackTrace(e);
325 325
		}
326 326
		
......
1071 1071
		Log.finest("TXMResult.autoSaveParametersFromAnnotations(): " + this.getClass().getSimpleName() + ": saving parameters to local node...");
1072 1072
		
1073 1073
		// internal data to save for unserialization
1074
		this.saveParameter(TXMPreferences.CLASS, this.getClass().getName());
1074
		if (this.getClass().isAnonymousClass()) {
1075
			this.saveParameter(TXMPreferences.CLASS, this.getClass().getSuperclass().getName()); // avoid bug later if an anonymous class has been used.
1076
		} else {
1077
			this.saveParameter(TXMPreferences.CLASS, this.getClass().getName());
1078
		}
1075 1079
		this.saveParameter(TXMPreferences.RESULT_PARAMETERS_NODE_PATH, this.parametersNodePath);
1076 1080
		this.saveParameter(TXMPreferences.BUNDLE_ID, FrameworkUtil.getBundle(getClass()).getSymbolicName());
1077 1081
		
TXM/trunk/org.txm.core/src/java/org/txm/objects/Project.java (revision 3392)
509 509
			try {
510 510
				Preferences node = TXMPreferences.preferencesRootNode.node(resultNodePath);
511 511
				
512
				String className = node.get("class", ""); //$NON-NLS-1$ //$NON-NLS-2$
512
				String className = node.get(TXMPreferences.CLASS, ""); //$NON-NLS-1$ //$NON-NLS-2$
513 513
				
514 514
				// Skip Project object
515 515
				if (Project.class.getName().equals(className)) { // already loaded in loadProjectFromProjectScope
......
1505 1505
				
1506 1506
				// Log.finest("Toolbox.initialize(): checking result type linked to node path " + parametersNodePath);
1507 1507
				Preferences node = TXMPreferences.preferencesRootNode.node(parametersNodePath);
1508
				String className = node.get("class", ""); //$NON-NLS-1$
1508
				String className = node.get(TXMPreferences.CLASS, ""); //$NON-NLS-1$
1509 1509
				
1510 1510
				if (className == null || className.length() == 0) {
1511 1511
					Log.warning(NLS.bind("Warning: can not restore object with no class name set with path={0}.", parametersNodePath)); //$NON-NLS-1$
TXM/trunk/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 3392)
188 188
		super(parametersNodePath);
189 189
	}
190 190
	
191
	public CorpusBuild(TXMResult result) {
192
		
193
		super(result);
194
	}
195

  
191 196
	public String getID() {
192 197
		return pID;
193 198
	}
TXM/trunk/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java (revision 3392)
184 184
	
185 185
	@Override
186 186
	public boolean canCompute() {
187
		
187 188
		return getCorpus() != null &&
188 189
				pStructuralUnit != null &&
189 190
				pWordProperties != null &&
......
202 203
	 * @throws CqiClientException
203 204
	 */
204 205
	protected LinkedHashMap<Property, List<String>> getPageContent(int i) throws CqiClientException {
206
		
205 207
		LinkedHashMap<Property, List<String>> rez = new LinkedHashMap<>();
206 208
		
207 209
		if (i >= 0 && i < nmatches) {
......
229 231
	 * @throws CqiClientException
230 232
	 */
231 233
	public HashMap<Property, List<String>> getCurrentPageContent() throws CqiClientException {
234
		
232 235
		HashMap<Property, List<String>> current = this.getPageContent(pCurrentPage);
233 236
		return current;
234 237
	}
......
242 245
	 * @return the current page number
243 246
	 */
244 247
	public int getCurrentPage() {
248
		
245 249
		return pCurrentPage;
246 250
	}
247 251
	
248 252
	@Override
249 253
	public boolean saveParameters() {
254
		
250 255
		if (pStructuralUnit != null) {
251 256
			this.saveParameter(InternalViewPreferences.STRUCTURAL_UNIT, pStructuralUnit.getName());
252 257
		}
......
264 269
	
265 270
	@Override
266 271
	public String getComputingStartMessage() {
272
		
267 273
		if (this.hasBeenComputedOnce()) {
268 274
			return TXMCoreMessages.bind("Updating the browser of {0}", this.getParent().getSimpleName());
269 275
		} else {
......
284 290
	 * @return
285 291
	 */
286 292
	public CQPCorpus getCorpus() {
293
		
287 294
		return (CQPCorpus) getParent();
288 295
	}
289 296
	
290 297
	
291 298
	@Override
292 299
	public String getDetails() {
300
		
293 301
		return getCorpus().getName() + " " + this.pStructuralUnit.getName() + " " + (this.pCurrentPage + 1); //$NON-NLS-1$ //$NON-NLS-2$
294 302
	}
295 303
	
......
307 315
	
308 316
	@Override
309 317
	public String getName() {
318
		
310 319
		return this.getCorpus().getName() + TXMPreferences.PARENT_NAME_SEPARATOR + this.getSimpleName();
311 320
	}
312 321
	
TXM/trunk/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 3392)
374 374
			return true;
375 375
		}
376 376
		else {
377
			Match previousMatch = null;
378
			for (Match m : corpus.getMatches()) {
377
			org.txm.objects.Match previousMatch = null;
378
			for (org.txm.objects.Match m : corpus.getMatches()) {
379 379
				if (previousMatch == null) {
380 380
					previousMatch = m;
381 381
					continue;
......
573 573
	 */
574 574
	public boolean stepFinalize() throws CqiClientException {
575 575
		if (this.getCorpus() instanceof Subcorpus) {
576
			List<Match> matches = ((Subcorpus) getCorpus()).getMatches();
576
			List<? extends org.txm.objects.Match> matches = ((Subcorpus) getCorpus()).getMatches();
577 577
			if (matches.size() == 0) {
578 578
				Log.severe(ProgressionCoreMessages.errorColonSubcorpusWithSize0);
579 579
				return false;
TXM/trunk/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 3392)
182 182
					supLimits.add(new Match(l[0], l[1]));
183 183
				}
184 184
				//System.out.println("All sup limits are "+sup_limits);
185
				List<Match> corpus_matches = this.getCorpus().getMatches();
185
				List<? extends org.txm.objects.Match> corpus_matches = this.getCorpus().getMatches();
186 186
				//System.out.println("corpus matches: "+corpus_matches);
187 187
				ArrayList<Integer> inter = intersect(corpus_matches, supLimits);
188 188
				//System.out.println( "No of $sup that covers $corpus: "+inter);
......
242 242
	 * @param structs
243 243
	 * @return
244 244
	 */
245
	public static ArrayList<Integer> intersect(List<Match> corpus, List<Match> structs) {
245
	public static ArrayList<Integer> intersect(List<? extends org.txm.objects.Match> corpus, List<? extends org.txm.objects.Match> structs) {
246 246
		int ai=0, bi=0;
247 247
		ArrayList<Integer> result = new ArrayList<Integer>();
248 248

  
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TSIndex.java (revision 3392)
342 342
		
343 343
		// one word per match ! the word is inside one of the CQP (sub-)Corpus matches
344 344
		List<Match> finalMatches = new ArrayList<>();
345
		List<Match> corpusMatches = corp.getMatches();
345
		List<? extends org.txm.objects.Match> corpusMatches = corp.getMatches();
346 346
		int iCorpusStart = 0;
347 347
		for (int iMatch = 0; iMatch < matches.size(); iMatch++) {
348 348
			Match m1 = matches.get(iMatch);
349 349
			for (int iCorpus = iCorpusStart; iCorpus < corpusMatches.size(); iCorpus++) {
350
				Match m2 = corpusMatches.get(iCorpus);
350
				org.txm.objects.Match m2 = corpusMatches.get(iCorpus);
351 351
				if (m2.getStart() <= m1.getStart() && m1.getEnd() <= m2.getEnd()) {
352 352
					finalMatches.add(m1);
353 353
					iCorpusStart = iCorpus; // optimizing ! \o/
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 3392)
100 100
	 * @throws CqiClientException
101 101
	 */
102 102
	public static int[] getSentMinMax(CQPCorpus cqpCorpus) throws UnexpectedAnswerException, IOException, CqiServerError, CqiClientException {
103
		List<org.txm.searchengine.cqp.corpus.query.Match> matches = cqpCorpus.getMatches();
103
		List<? extends org.txm.objects.Match> matches = cqpCorpus.getMatches();
104 104
		if (matches.size() == 0) {
105 105
			return new int[] { 0, 0 };
106 106
		}
......
120 120
	 */
121 121
	public static int[] getSentMinMax(CQPCorpus cqpCorpus, int start, int end) throws UnexpectedAnswerException, IOException, CqiServerError, CqiClientException {
122 122
		AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
123
		List<org.txm.searchengine.cqp.corpus.query.Match> matches = cqpCorpus.getMatches();
123
		List<? extends org.txm.objects.Match> matches = cqpCorpus.getMatches();
124 124
		if (matches.size() == 0) {
125 125
			return new int[] { 0, 0 };
126 126
		}
......
176 176
		else {
177 177
			CQPCorpus cqpCorpus = (CQPCorpus) corpus;
178 178
			AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
179
			List<org.txm.searchengine.cqp.corpus.query.Match> matches = cqpCorpus.getMatches();
179
			List<? extends Match> matches = cqpCorpus.getMatches();
180 180
			if (matches.size() == 0) {
181 181
				return new EmptySelection(query);
182 182
			}
TXM/trunk/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java (revision 3392)
228 228
	@Override
229 229
	public void updateEditorFromResult(boolean update) throws Exception {
230 230

  
231
		List<Match> matches = getResult().getMatches();
231
		List<? extends org.txm.objects.Match> matches = getResult().getMatches();
232 232
		if (matches == null || matches.size() == 0) {
233 233

  
234 234
			if (getResult().hasBeenComputedOnce()) {
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 3392)
43 43
import org.txm.core.results.TXMResult;
44 44
import org.txm.objects.CorpusCommandPreferences;
45 45
import org.txm.objects.Project;
46
import org.txm.searchengine.core.QueryBasedTXMResult;
46 47
import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
47 48
import org.txm.searchengine.cqp.CQPSearchEngine;
48 49
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
388 389
	// }
389 390
	// }
390 391
	
392
	public CQPCorpus(QueryBasedTXMResult result) {
393
		
394
		super(result);
395
	}
396

  
391 397
	/*
392 398
	 * (non-Javadoc)
393 399
	 * @see org.txm.objects.TxmObject#load()
......
923 929
	}
924 930
	
925 931
	@Override
926
	abstract public List<Match> getMatches();
932
	abstract public List<? extends org.txm.objects.Match> getMatches();
927 933
	
928 934
	@Override
929 935
	public String getName() {
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 3392)
41 41
import org.txm.core.results.Parameter;
42 42
import org.txm.core.results.TXMParameters;
43 43
import org.txm.objects.CorpusBuild;
44
import org.txm.objects.Match;
45
import org.txm.searchengine.core.IQuery;
46
import org.txm.searchengine.core.QueryBasedTXMResult;
47
import org.txm.searchengine.core.Selection;
44 48
import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
45 49
import org.txm.searchengine.cqp.AbstractCqiClient;
46 50
import org.txm.searchengine.cqp.CQPSearchEngine;
......
51 55
import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
52 56
import org.txm.searchengine.cqp.core.messages.CQPSearchEngineCoreMessages;
53 57
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
54
import org.txm.searchengine.cqp.corpus.query.Match;
55 58
import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery;
56 59
import org.txm.searchengine.cqp.serverException.CqiServerError;
57 60
import org.txm.utils.TXMProgressMonitor;
......
70 73
	 * Query used to build the corpus.
71 74
	 */
72 75
	@Parameter(key = TXMPreferences.QUERY)
73
	protected CQLQuery pQuery;
76
	protected IQuery pQuery;
74 77
	
75
	protected QueryResult qresult;
78
	protected Selection qresult;
76 79
	
77 80
	protected SelectionResult selectionResult;
78 81
	
......
101 104
	
102 105
	/**
103 106
	 * 
107
	 * @param partition
108
	 */
109
	public Subcorpus(QueryBasedTXMResult result) {
110
		super(result);
111
		this.pQuery = result.getQuery();
112
		this.setUserName(pQuery.toString());
113
	}
114
	
115
	/**
116
	 * 
104 117
	 * @param parametersNodePath
105 118
	 */
106 119
	public Subcorpus(String parametersNodePath) {
......
121 134
	 */
122 135
	@Override
123 136
	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
137
		
138
		if (this.getParent() instanceof QueryBasedTXMResult) { // update the pQuery
139
			this.pQuery = ((QueryBasedTXMResult)this.getParent()).getQuery();
140
		}
141
		
124 142
		if (pID == null || pID.length() == 0) {
125 143
			pID = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
126 144
		}
......
153 171
//				}
154 172
			}
155 173
			
156
			this.qresult = new QueryResult(this.pID, this.getUserName(), this.getCorpusParent(), this.pQuery); // getCorpusParent().query(pQuery, this.pID, true);
174
			this.qresult = this.pQuery.getSearchEngine().query(this.getCorpusParent(), this.pQuery, this.getUserName(), true);
175
			
176
			//this.qresult = new QueryResult(this.pID, this.getUserName(), this.getCorpusParent(), this.pQuery); // getCorpusParent().query(pQuery, this.pID, true);
157 177
		}
158 178
		
159 179
		cqpTextIDS = null; // reset text ids cache
......
280 300
	
281 301
	
282 302
	@Override
283
	public List<Match> getMatches() {
303
	public List<? extends Match> getMatches() {
284 304
		if (qresult == null) { // not computed
285 305
			return new ArrayList<>();
286 306
		}
287 307
		try {
288 308
			return qresult.getMatches();
289 309
		}
290
		catch (CqiClientException e) {
291
			// TODO Auto-generated catch block
310
		catch (Exception e) {
292 311
			org.txm.utils.logger.Log.printStackTrace(e);
293 312
			return new ArrayList<>();
294 313
		}
......
298 317
		try {
299 318
			return qresult.getNMatch();
300 319
		}
301
		catch (CqiClientException e) {
320
		catch (Exception e) {
302 321
			// TODO Auto-generated catch block
303 322
			org.txm.utils.logger.Log.printStackTrace(e);
304 323
			return 0;
......
368 387
	 *
369 388
	 * @return the query
370 389
	 */
371
	public CQLQuery getQuery() {
390
	public IQuery getQuery() {
372 391
		return pQuery;
373 392
	}
374 393
	
......
670 689
		
671 690
		List<Integer> structsIncorpus = new ArrayList<>();
672 691
		// filter structs with matches
673
		List<Match> matches = this.getMatches();
692
		List<? extends Match> matches = this.getMatches();
674 693
		int iText = 0;
675 694
		int iMatch = 0;
676 695
		nbtext = 0;
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java (revision 3392)
36 36
import org.txm.searchengine.cqp.corpus.CorpusManager;
37 37
import org.txm.searchengine.cqp.corpus.Property;
38 38
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
39
import org.txm.searchengine.cqp.corpus.WordProperty;
40 39

  
41 40
/**
42 41
 * A Match of a query on a corpus = [start -> end]
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java (revision 3392)
39 39
	
40 40
	protected boolean computePartition() {
41 41
		boolean ok = false;
42
		List<Match> matches = corpus.getMatches();
43
		for (Match m : matches) {
42
		List<? extends org.txm.objects.Match> matches = corpus.getMatches();
43
		for (org.txm.objects.Match m : matches) {
44 44
			if (m.size() >= n) {
45 45
				ok = true;
46 46
			}
......
49 49
	}
50 50
	
51 51
	private String getLine(CQPCorpus corpus) {
52
		List<Match> matches = corpus.getMatches();
52
		List<? extends org.txm.objects.Match> matches = corpus.getMatches();
53 53
		if (matches.size() == 0) return ""; //$NON-NLS-1$
54 54
		
55
		Match firstOkMatch = matches.get(0);
56
		for (Match m : matches) {
55
		org.txm.objects.Match firstOkMatch = matches.get(0);
56
		for (org.txm.objects.Match m : matches) {
57 57
			if (m.size() >= n) {
58 58
				Collection<? extends Integer> positions = m.getRange();
59 59
				
TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/BackToText.java (revision 3392)
53 53
import org.txm.objects.Text;
54 54
import org.txm.rcp.StatusLine;
55 55
import org.txm.rcp.utils.SWTEditorsUtils;
56
import org.txm.searchengine.core.SearchEngine;
57 56
import org.txm.searchengine.cqp.AbstractCqiClient;
58 57
import org.txm.searchengine.cqp.CQPSearchEngine;
59 58
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
157 156
		}
158 157
		
159 158
		SynopticEditionEditor editor = null;
160
		boolean newEditor = false;
159
		//boolean newEditor = false;
161 160
		if (ieditor != null && ieditor instanceof SynopticEditionEditor) {
162 161
			editor = (SynopticEditionEditor) ieditor;
163 162
		}
164 163
		else {
165 164
			editor = OpenEdition.openEdition(corpus, editions);
166
			newEditor = true;
165
			//newEditor = true;
167 166
		}
168 167
		
169 168
		Text text = null;
......
201 200
	public boolean backToText(ConcordanceEditor editor, Match match) {
202 201
		Concordance conc = editor.getConcordance();
203 202
		CQPCorpus corpus = editor.getCorpus();
204
		SearchEngine se = conc.getQuery().getSearchEngine();
203
		//SearchEngine se = conc.getQuery().getSearchEngine();
205 204
		
206 205
		try {
207 206
			if (match == null) return false;
TXM/trunk/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java (revision 3392)
232 232
					LinkedHashSet<Integer> positions = new LinkedHashSet<Integer>();
233 233
					Property word = corpus.getProperty("word");
234 234
					AbstractCqiClient CQI = CQPSearchEngine.getCqiClient();
235
					for (Match m : corpus.getMatches()) {
235
					for (org.txm.objects.Match m : corpus.getMatches()) {
236 236
						for (int i = m.getStart(); i <= m.getEnd(); i++) { // end match must be included
237 237
							positions.add(i);
238 238
							
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/BackToText.java (revision 3392)
34 34
import org.txm.rcp.messages.TXMUIMessages;
35 35
// TODO: Auto-generated Javadoc
36 36
/**
37
 * action called to set the complex sort of the concordance @ author mdecorde.
37
 * action called to set the complex sort of the concordance 
38
 * 
39
 * @author mdecorde.
38 40
 */
39 41
public class BackToText extends Action implements IWorkbenchAction {
40 42

  
......
42 44
	private static final String ID = "org.txm.rcp.editors.concordances.backtotext"; //$NON-NLS-1$
43 45
	
44 46
	/** The window. */
45
	private IWorkbenchWindow window;
47
	//private IWorkbenchWindow window;
46 48
	
47 49
	/** The concordance editor. */
48 50
	private ConcordanceEditor concordanceEditor;
......
54 56
	 * @param concordanceEditor the concordance editor
55 57
	 */
56 58
	public BackToText(IWorkbenchWindow window, ConcordanceEditor concordanceEditor) {
57
		this.window = window;
59
		//this.window = window;
58 60
		this.concordanceEditor = concordanceEditor;
59 61
		setId(ID);
60 62
		setText(TXMUIMessages.displayInFullText);
......
66 68
	 */
67 69
	@Override
68 70
	public void dispose() {
71
		
69 72
	}
70 73

  
71 74
	/* (non-Javadoc)
......
73 76
	 */
74 77
	@Override
75 78
	public void run() {
79
		
76 80
		concordanceEditor.backToText();
77

  
78 81
	}
79 82
}
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 3392)
1094 1094
		propertiesPanel.getLayout().numColumns = 5;
1095 1095
		propertiesPanel.getLayout().makeColumnsEqualWidth = false;
1096 1096
		
1097
		ArrayList<WordProperty> tmp; // tmp to store properties
1097
		//ArrayList<WordProperty> tmp; // tmp to store properties
1098 1098
		
1099 1099
		try {
1100 1100
			Label l = new Label(propertiesPanel, SWT.NONE);
......
2304 2304
		}
2305 2305
		
2306 2306
		// System.out.println("Size="+queryLabel.getSize().x +" label="+queryLabel.getText()+" l size"+ queryLabel.getText().length());
2307
		float W = 1f + queryLabel.getSize().x / (float) queryLabel.getText().length();
2307
		float X = queryLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
2308
		float W = 1f + X / (float) queryLabel.getText().length();
2308 2309
		// System.out.println("W= "+W+" Maxs "+refMax+ " " +leftMax+" " +keywordMax+" "+rightMax);
2309 2310
		
2310 2311
		if (sash == null) return; // there was a problem during initialization
TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 3392)
30 30
import org.eclipse.jface.viewers.ITableLabelProvider;
31 31
import org.eclipse.jface.viewers.LabelProvider;
32 32
import org.eclipse.swt.graphics.Image;
33
import org.txm.core.preferences.TXMPreferences;
34 33
import org.txm.searchengine.cqp.corpus.Subcorpus;
35 34
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
36 35

  
TXM/trunk/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 3392)
155 155
			GLComposite resultArea = this.getResultArea();
156 156
			
157 157
			// create table viewer
158
			viewer = new TableViewer(resultArea, SWT.VIRTUAL | SWT.MULTI | SWT.FULL_SELECTION);
158
			viewer = new TableViewer(resultArea, SWT.VIRTUAL);
159
			viewer.setUseHashlookup(false);
159 160
			viewer.getTable().addKeyListener(new TableKeyListener(viewer));
160 161
			viewer.getTable().setLinesVisible(true);
161 162
			viewer.getTable().setHeaderVisible(true);
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java (revision 3392)
71 71
		sectionClient.setLayout(slayout);
72 72
		this.section.setClient(sectionClient);
73 73
		
74
		Label l = toolkit.createLabel(sectionClient, "Corpus language"); //$NON-NLS-1$
74
		Label l = toolkit.createLabel(sectionClient, "Language/Langue"); //$NON-NLS-1$
75 75
		TableWrapData gdata = getTextGridData();
76 76
		gdata.colspan = 2;
77 77
		l.setLayoutData(gdata);
......
206 206
	public boolean saveFields(Project project) {
207 207
		if (!this.section.isDisposed()) {
208 208
			// LANGUAGE
209
			String lang = null, annotate = null;
209
			String lang = null;
210 210
			
211 211
			if (btnGuessLang != null && btnGuessLang.getSelection()) {
212 212
				lang = "??"; //$NON-NLS-1$
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 3392)
18 18
import org.eclipse.ui.forms.widgets.TableWrapData;
19 19
import org.eclipse.ui.forms.widgets.TableWrapLayout;
20 20
import org.txm.Toolbox;
21
import org.txm.core.preferences.TBXPreferences;
22 21
import org.txm.objects.EditionDefinition;
23 22
import org.txm.objects.Project;
24 23
import org.txm.rcp.editors.imports.ImportModuleCustomization;
25 24
import org.txm.rcp.messages.TXMUIMessages;
26 25
import org.txm.rcp.swt.dialog.LastOpened;
27
import org.w3c.dom.Element;
28 26

  
29 27
public class EditionSection extends ImportEditorSection {
30 28
	
......
134 132
			buildFacsEditionCheckButton.setSelection(false);
135 133
			TableWrapData gdata22 = getButtonLayoutData();
136 134
			gdata22.colspan = 4; // one line
137
			gdata22.indent = 20;
135
			gdata22.indent = 40;
138 136
			buildFacsEditionCheckButton.setLayoutData(gdata22);
139 137
			buildFacsEditionCheckButton.addSelectionListener(new SelectionListener() {
140 138
				
......
147 145
				public void widgetDefaultSelected(SelectionEvent e) {}
148 146
			});
149 147
			// image directory
150
			tmpLabel = toolkit.createLabel(sectionClient, "Images directory: ");
148
			tmpLabel = toolkit.createLabel(sectionClient, "Images directory ");
151 149
			TableWrapData gdata = getLabelGridData();
152
			gdata.indent = 40;
150
			gdata.indent = 60;
153 151
			tmpLabel.setLayoutData(gdata);
154 152
			imageDirectoryText = toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
155 153
			gdata = getTextGridData();
TXM/trunk/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 3392)
53 53
import org.txm.core.results.TXMResult;
54 54
import org.txm.index.core.functions.Index;
55 55
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
56
import org.txm.searchengine.core.QueryBasedTXMResult;
56 57
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
57 58
import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
58 59
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
78 79
 * @author mdecorde
79 80
 * 
80 81
 */
81
public class Cooccurrence extends TXMResult {
82
public class Cooccurrence extends QueryBasedTXMResult {
82 83

  
83 84
	boolean debug = false;
84 85
	
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java (revision 3392)
28 28
package org.txm.concordance.core.functions;
29 29

  
30 30
import java.util.ArrayList;
31
import java.util.Collection;
32 31
import java.util.HashMap;
33 32
import java.util.HashSet;
34 33
import java.util.List;
......
341 340
		List<String> words = new ArrayList<>();
342 341
		Map<Property, List<String>> values = getKeywordsViewProperties();
343 342
		int s = values.get(concordance.getKeywordViewProperties().get(0)).size();
344
		int keywordEndPos = keywordpos + s - 1;
343
		//int keywordEndPos = keywordpos + s - 1;
345 344
		// System.out.println("Build STR of currentpos="+currentPos+" length="+s);
346 345
		for (int i = 0; i < s; i++) {
347 346
			List<String> word = new ArrayList<>();
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 3392)
54 54
import org.txm.core.results.TXMResult;
55 55
import org.txm.objects.Match;
56 56
import org.txm.searchengine.core.IQuery;
57
import org.txm.searchengine.core.QueryBasedTXMResult;
57 58
import org.txm.searchengine.core.Selection;
58 59
import org.txm.searchengine.cqp.AbstractCqiClient;
59 60
import org.txm.searchengine.cqp.CQPSearchEngine;
......
79 80
 * 
80 81
 * @author jmague, mdecorde
81 82
 */
82
public class Concordance extends TXMResult {
83
public class Concordance extends QueryBasedTXMResult {
83 84
	
84 85
	public static final String TARGET_SELECT = "Select";
85 86
	public static final String TARGET_SHOW = "Show";
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/preferences/ConcordancePreferences.java (revision 3392)
14 14
 */
15 15
public class ConcordancePreferences extends TXMPreferences {
16 16
	
17
	// FIXME; Should be stored at an higher level, eg. "Pagination"
18
	@Deprecated
19
	public static final String N_LINES_PER_PAGE = "n_lines_per_page"; //$NON-NLS-1$
20
	
21 17
	public static final String LEFT_CONTEXT_SIZE = "left_context_size"; //$NON-NLS-1$
22 18
	
23 19
	public static final String RIGHT_CONTEXT_SIZE = "right_context_size"; //$NON-NLS-1$
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java (revision 3392)
88 88
			
89 89
			CQPCorpus subcorpus = null;
90 90
			try {
91
				for (Subcorpus c : corpus.getChildren(Subcorpus.class)) {
91
				for (Subcorpus c : index.getChildren(Subcorpus.class)) {
92 92
					if (c.getQuery().equals(cqlQuery) && !c.isAltered()) {
93 93
						subcorpus = c;
94 94
						break;
95 95
					}
96 96
				}
97 97
				if (subcorpus == null) {
98
					subcorpus = corpus.createSubcorpus(cqlQuery, cqlQuery.getQueryString());
99
					subcorpus.setVisible(true);
98
					//subcorpus = corpus.createSubcorpus(cqlQuery, cqlQuery.getQueryString());
99
					subcorpus = new Subcorpus(index) {
100
						public boolean isInternalPersistable() {
101
							return false; // disable the internal persistable state of the Subcorpus
102
						}
103
					};
104
					subcorpus.setVisible(false);
105
					subcorpus.compute(false);
100 106
				}
101 107
			}
102
			catch (CqiClientException e) {
108
			catch (Exception e) {
103 109
				Log.printStackTrace(e);
104 110
				return null;
105 111
			}

Formats disponibles : Unified diff