Révision 1197

tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1197)
1401 1401

  
1402 1402
	/**
1403 1403
	 * return the column under the mouse pointer.
1404
	 *
1404
	 * TODO this method wont work if columns are added before the keyword column
1405 1405
	 * @return the pointed column
1406 1406
	 */
1407 1407
	public int getPointedColumn() {
1408
		int x = getMousePosition().x; // + lineTableViewer.getTable().get;
1408
		Point p = getMousePosition();
1409
		if (p == null) return 0;
1410
		
1411
		int x = p.x; // + lineTableViewer.getTable().get;
1409 1412
		int sumWidthColumn = 0;
1410 1413

  
1411 1414
		sumWidthColumn += this.leftContextColumn.getWidth();
......
1416 1419
		if (x < sumWidthColumn)
1417 1420
			return 2;
1418 1421

  
1419
		sumWidthColumn += this.rightContextColumn.getWidth();
1420
		if (x < sumWidthColumn)
1421
			return 3;
1422
//		sumWidthColumn += this.rightContextColumn.getWidth();
1423
//		if (x < sumWidthColumn)
1424
			return 3; // last column
1422 1425

  
1423
		return 0;
1426
//		return 0;
1424 1427
	}
1425 1428

  
1426 1429
	/**
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 1197)
79 79

  
80 80
	/** The currentpartid. */
81 81
	protected int currentpartid = 0;
82
	
82

  
83 83
	/** The current Fmax value. */
84 84
	protected int Fmax = 0;
85 85
	/** The current Fmin value. */
......
90 90
	protected Lexicon lexicon;
91 91
	@Deprecated
92 92
	protected boolean lexiconMode = false;
93
	
94
	
93

  
94

  
95 95
	/** The current lines. */
96 96
	protected List<Line> lines = new ArrayList<Line>();
97 97
	/** The current number of lines. */
......
107 107
	 */
108 108
	@Parameter(key=TXMPreferences.F_MAX)
109 109
	protected Integer pFmaxFilter;
110
	
110

  
111 111
	/**
112 112
	 * Minimum frequency filter value.
113 113
	 */
114 114
	@Parameter(key=TXMPreferences.F_MIN)
115 115
	protected Integer pFminFilter;
116
	
116

  
117 117
	/**
118 118
	 * Number of lines to display per page.
119 119
	 */
120 120
	@Parameter(key=TXMPreferences.N_LINES_PER_PAGE)
121 121
	protected Integer pNLinesPerPage;
122
	
122

  
123 123
	/**
124 124
	 * The word properties to display.
125 125
	 */
126 126
	@Parameter(key=TXMPreferences.UNIT_PROPERTIES)
127 127
	protected List<WordProperty> pProperties;
128
	
128

  
129 129
	/**
130 130
	 * The string used to separated property values.
131 131
	 */
132 132
	@Parameter(key=IndexPreferences.PROPERTIES_SEPARATOR)
133 133
	protected String pPropertiesSeparator;
134
	
134

  
135 135
	/**
136 136
	 * The CQP query.
137 137
	 */
138 138
	@Parameter(key=TXMPreferences.QUERY)
139 139
	protected Query pQuery;
140
	
140

  
141 141
	/**
142 142
	 * The line index of the current index page.
143 143
	 */
144 144
	@Parameter(key=IndexPreferences.N_TOP_INDEX)
145 145
	private Integer pTopIndex;
146
	
146

  
147 147
	/**
148 148
	 * The vmax filter value parameter.
149 149
	 */
150 150
	@Parameter(key=TXMPreferences.V_MAX)
151 151
	protected Integer pVmaxFilter;
152
	
152

  
153 153
	/**
154 154
	 * 
155 155
	 * @param parent
......
165 165
	public Index(String parametersNodePath)	{
166 166
		super(parametersNodePath);
167 167
	}
168
	
169 168

  
169

  
170 170
	@Override
171 171
	protected boolean _compute() throws Exception {
172 172

  
173
		
174
		lines.clear();
175
		counts.clear();
176
		currentpartid = 0;
177
		nTotalTokens = 0;
173
		// reset all stored data
174
		if (lines != null) {
175
			lines.clear();
176
			counts.clear();
177
			currentpartid = 0;
178
			nTotalTokens = 0;
179
		}
180

  
178 181
		// FIXME: tests to not recompute all on fmax, vmax, etc. changes
179 182
		// It works but the problem is the cut() method that really cut the lines rather than doing getLines() that could filtering and returns only the lines between fmin/fmax
180
//		if(this.hasParameterChanged(TXMPreferences.QUERY) || this.hasParameterChanged(TXMPreferences.UNIT_PROPERTIES))	{
181
		
182
			if (parent instanceof MainCorpus && "[]".equals(pQuery.getQueryString()) && pProperties.size() == 1) {
183
	
184
				computeWithCorpusAndNoQuery(); // internally using a lexicon
185
			}
186
			else {
187
				this.lexicon = null;
188
	
189
				if (parent instanceof CQPCorpus) {
190
	
191
					if (!scanCorpus((CQPCorpus)parent)) {
192
						lines = new ArrayList<Line>();
193
						return false;
194
					}
195
	
196
					setLineCounts();
197
	
198
					getAllLines();
199
	
200
				}
201
				else {
202
					Log.severe("Error: Index parent is not a corpus.");
183
		//		if(this.hasParameterChanged(TXMPreferences.QUERY) || this.hasParameterChanged(TXMPreferences.UNIT_PROPERTIES))	{
184

  
185
		if (parent instanceof MainCorpus && "[]".equals(pQuery.getQueryString()) && pProperties.size() == 1) {
186
			computeWithCorpusAndNoQuery(); // internally using a lexicon
187
		}
188
		else {
189
			this.lexicon = null;
190

  
191
			if (parent instanceof CQPCorpus) {
192

  
193
				if (!scanCorpus((CQPCorpus)parent)) {
194
					lines = new ArrayList<Line>();
203 195
					return false;
204 196
				}
197

  
198
				setLineCounts();
199

  
200
				getAllLines();
201

  
205 202
			}
206
	//	}
203
			else {
204
				Log.severe("Error: Index parent is not a corpus.");
205
				return false;
206
			}
207
		}
208
		//	}
207 209

  
208 210
		this.filterLines();
209 211

  
210 212
		this.subTask("Sorting...");
211
		
213

  
212 214
		this.sortLines(SortMode.FREQUNIT, true);
213 215

  
214 216
		this.cut();
215 217

  
216 218
		this.dirty = false;
217 219
		this.pTopIndex = 0;
218
		
220

  
219 221
		this.subTask("Index done.");
220
		
222

  
221 223
		return true;
222 224
	}
223
	
224
	
225
	
225

  
226

  
227

  
226 228
	/**
227 229
	 * Creates a CQL query string from the specified Index lines.
228 230
	 *
......
234 236
		if (lines.size() == 0) {
235 237
			return query;
236 238
		}
237
		
239

  
238 240
		Line line = lines.get(0);
239 241
		int nbToken = line.getUnitsProperties().get(0).size();
240 242
		int nbProps = line.getProperties().size();
......
297 299
		return queries;
298 300

  
299 301
	}
300
	
301
	
302
	
302

  
303

  
304

  
303 305
	/**
304 306
	 * This method alter the index first column frequencies using a table stored in the R workspace
305 307
	 * 
......
332 334
		return true;
333 335
		//voc.toTxt(new File("/home/mdecorde/TEMP/after.tsv"), "UTF-8", "\t", "");
334 336
	}
335
	
337

  
336 338
	@Override
337 339
	public boolean canCompute() {
338 340
		if (getCorpus() == null) {
......
349 351
			Log.severe("No query set."); //$NON-NLS-1$
350 352
			return false;
351 353
		}
352
		
354

  
353 355
		return true;
354 356
	}
355 357

  
356 358
	@Override
357 359
	public boolean saveParameters() {
358
			
360

  
359 361
		this.saveParameter(TXMPreferences.UNIT_PROPERTIES, WordProperty.propertiesToString(pProperties));
360
		
362

  
361 363
		if (pQuery != null) {
362 364
			this.saveParameter(TXMPreferences.QUERY, pQuery.getQueryString());
363 365
		}
364
		
365
		
366

  
367

  
366 368
		return true;
367 369
	}
368
	
370

  
369 371
	@Override
370 372
	public boolean loadParameters() {
371 373
		this.pProperties = (List<WordProperty>) Property.stringToProperties(getCorpus(), this.getStringParameterValue(TXMPreferences.UNIT_PROPERTIES));
372 374
		this.pQuery = new CQLQuery(this.getStringParameterValue(TXMPreferences.QUERY));
373 375
		return true;
374 376
	}
375
	
377

  
376 378
	@Override
377 379
	public void clean() {
378 380
		try {
......
391 393
	 */
392 394
	private void computeWithCorpusAndNoQuery() {
393 395
		try {
394
			
396

  
395 397
			//			this.query = new Query("[]"); //$NON-NLS-1$
396 398
			//			this.props = new ArrayList<Property>();
397 399
			//			this.props.add(property);
......
403 405
			lexicon.setProperty(property);
404 406
			lexicon.setDirty();
405 407
			lexicon.compute(monitor);
406
		
407 408

  
408
		
409

  
410

  
409 411
			this.nTotalTokens = lexicon.nbrOfToken();
410 412
			String[] forms = lexicon.getForms();
411 413
			int[] freqs = lexicon.getFreq();
......
433 435
					}
434 436
				}
435 437
			}
436
			
438

  
437 439
		} catch (Exception e) {
438 440
			// TODO Auto-generated catch block
439 441
			org.txm.utils.logger.Log.printStackTrace(e);
......
484 486
	 *
485 487
	 **/
486 488
	public void filterLines() {
487
		
489

  
488 490
		if (!(pFminFilter > 0 && pFmaxFilter > 0 && pFminFilter <= pFmaxFilter)) {
489 491
			return;
490 492
		}
......
537 539
			try {
538 540
				Object[] params = new Object[]{this.parent.getSimpleName(), this.getQuery().getQueryString(), this.getProperties(), this.getFmin(), this.getFmax()}; 
539 541
				String str;
540
					str = IndexCoreMessages.DetailsFromCorpus;
542
				str = IndexCoreMessages.DetailsFromCorpus;
541 543
				return NLS.bind(str, params);
542 544
			}
543 545
			catch(Exception e) {
......
663 665
		return selectedLines;
664 666
	}
665 667

  
666
	
668

  
667 669
	/**
668 670
	 * return all the lines of the index.
669 671
	 *
......
690 692
			line.setCounts(c, -1);
691 693
		}
692 694
	}
693
	
694 695

  
695
	
696
	
696

  
697

  
698

  
697 699
	@Override
698 700
	public String getName() {
699 701
		try {
......
900 902

  
901 903
			String signature = line.getSignature();
902 904

  
903
			 // if the counts contains the signature, increment its corresponding value
905
			// if the counts contains the signature, increment its corresponding value
904 906
			if (counts.containsKey(signature)) {
905 907
				while (counts.get(signature).size() <= currentpartid) {
906 908
					counts.get(signature).add(0);
......
962 964
	public void setQuery(CQLQuery query)	{
963 965
		this.pQuery = query;
964 966
	}
965
	
967

  
966 968
	/**
967 969
	 * Sets the properties.
968 970
	 * @param properties
......
970 972
	public void setProperties(List<WordProperty> properties)	{
971 973
		this.pProperties = properties;
972 974
	}
973
	
975

  
974 976
	/**
975 977
	 * Sets the property.
976 978
	 * Clears all existing properties.
......
981 983
		properties.add(property);
982 984
		this.setProperties(properties);
983 985
	}
984
	
985
	
986
	
986

  
987

  
988

  
987 989
	public void setParameters(CQLQuery query, List<WordProperty> props, Integer filterFmin, Integer filterFmax, Integer filterVmax, Integer nLinesPerPage) {
988 990
		this.pQuery = query;
989 991
		this.pProperties = props;
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 1197)
472 472
			if (i >= 0 && i < lines.size()) {
473 473
				Line line = lines.get(i);
474 474
				// System.out.println("line text "+line.getTextId());
475
				if (line.getTextId().equals(text)) {
475
				if (line.getTextId() != null && line.getTextId().equals(text)) {
476 476
					allids.addAll(line.getKeywordIds());
477 477
				}
478 478
			}
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 1197)
241 241
	
242 242
	@Override
243 243
	public String getSimpleName() {
244
		return WordCloudCoreMessages.RESULT_TYPE + " (" + this.fMin + " / " + this.maxWordsCount + ")"; //$NON-NLS-1$  //$NON-NLS-2$  //$NON-NLS-3$
244
		return "Fmin=" + this.fMin + " Vmax=" + this.maxWordsCount; //$NON-NLS-1$  //$NON-NLS-2$  //$NON-NLS-3$
245 245
	}
246 246

  
247 247
	@Override
tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/vlcplayer/VLCPlayer.java (revision 1197)
3 3
import java.awt.Canvas;
4 4
import java.awt.Frame;
5 5
import java.io.File;
6
import java.util.List;
6 7

  
7 8
import org.eclipse.swt.SWT;
8 9
import org.eclipse.swt.awt.SWT_AWT;
9
import org.eclipse.swt.events.ModifyEvent;
10
import org.eclipse.swt.events.ModifyListener;
11 10
import org.eclipse.swt.events.SelectionEvent;
12 11
import org.eclipse.swt.events.SelectionListener;
13 12
import org.eclipse.swt.layout.GridData;
......
17 16
import org.eclipse.swt.widgets.FileDialog;
18 17
import org.eclipse.swt.widgets.Label;
19 18
import org.eclipse.swt.widgets.Scale;
20
import org.eclipse.swt.widgets.Text;
21
import org.mihalis.opal.rangeSlider.RangeSlider;
22 19
import org.txm.backtomedia.commands.function.TripleRangeSlider;
23
import org.txm.backtomedia.preferences.BackToMediaPreferencePage;
24 20
import org.txm.backtomedia.preferences.BackToMediaPreferences;
25
import org.txm.core.preferences.TXMPreferences;
26 21
import org.txm.utils.logger.Log;
27 22

  
28
import uk.co.caprica.vlcj.binding.internal.libvlc_media_t;
29 23
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
30
import uk.co.caprica.vlcj.logger.Logger;
31
import uk.co.caprica.vlcj.logger.Logger.Level;
24
import uk.co.caprica.vlcj.discovery.linux.DefaultLinuxNativeDiscoveryStrategy;
25
import uk.co.caprica.vlcj.discovery.mac.DefaultMacNativeDiscoveryStrategy;
26
import uk.co.caprica.vlcj.discovery.windows.DefaultWindowsNativeDiscoveryStrategy;
32 27
import uk.co.caprica.vlcj.player.MediaPlayer;
33 28
import uk.co.caprica.vlcj.player.MediaPlayerEventAdapter;
34
import uk.co.caprica.vlcj.player.MediaPlayerEventListener;
35 29
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
36 30
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
37 31
import uk.co.caprica.vlcj.player.embedded.videosurface.CanvasVideoSurface;
......
39 33
import uk.co.caprica.vlcj.player.embedded.videosurface.linux.LinuxVideoSurfaceAdapter;
40 34
import uk.co.caprica.vlcj.player.embedded.videosurface.mac.MacVideoSurfaceAdapter;
41 35
import uk.co.caprica.vlcj.player.embedded.videosurface.windows.WindowsVideoSurfaceAdapter;
42
import uk.co.caprica.vlcj.version.LibVlcVersion;
43 36
import vlcplayerrcp.MessagesMP;
37

  
44 38
public class VLCPlayer extends Composite {
45 39
	static {
46
		if (!new NativeDiscovery().discover()) {
40
		
41
		NativeDiscovery nd = new NativeDiscovery(
42
				new DefaultLinuxNativeDiscoveryStrategy() {
43
			@Override
44
		    protected void onGetDirectoryNames(List<String> directoryNames) {
45
		        directoryNames.add("/usr/lib");
46
		        directoryNames.add("/usr/local/lib");
47
		        directoryNames.add("/snap/vlc/current/usr/lib");
48
		    }
49
		},
50
	            new DefaultWindowsNativeDiscoveryStrategy(),
51
	            new DefaultMacNativeDiscoveryStrategy());
52
		
53
		if (!nd.discover()) {
47 54
			System.out.println(MessagesMP.error_native_libs);
48 55
		} else {
49 56
			//System.out.println("VLC native libraries found !");
tmp/org.txm.annotation.kr.rcp/src/org/txm/annotation/kr/rcp/concordance/SimpleKRAnnotation.java (revision 1197)
418 418

  
419 419
	public void updateAnnotationWidgetStates() {
420 420
		if (annotationArea == null) return; // :)
421
		annotationArea.getDisplay().syncExec(new Runnable() {
422
			
423
			@Override
424
			public void run() {
425
				if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
421 426

  
422
		if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
427
					if (getSelectedAnnotationType() != null) {
428
						annotationValuesText.setEnabled(true);
423 429

  
424
			if (getSelectedAnnotationType() != null) {
425
				annotationValuesText.setEnabled(true);
430
						affectAnnotationButton.setEnabled(true);
431
						affectCombo.setEnabled(true);
432
					} else {
433
						annotationValuesText.setEnabled(false);
426 434

  
427
				affectAnnotationButton.setEnabled(true);
428
				affectCombo.setEnabled(true);
429
			} else {
430
				annotationValuesText.setEnabled(false);
435
						affectAnnotationButton.setEnabled(false);
436
						affectCombo.setEnabled(false);
437
					}
438
				} else {
439
					annotationValuesText.setEnabled(false);
431 440

  
432
				affectAnnotationButton.setEnabled(false);
433
				affectCombo.setEnabled(false);
434
			}
435
		} else {
436
			annotationValuesText.setEnabled(false);
441
					if (getSelectedAnnotationType() != null) {
442
						affectAnnotationButton.setEnabled(true);
443
						affectCombo.setEnabled(true);
444
					} else {
445
						affectAnnotationButton.setEnabled(false);
446
						affectCombo.setEnabled(false);
447
					}
448
				}
437 449

  
438
			if (getSelectedAnnotationType() != null) {
439
				affectAnnotationButton.setEnabled(true);
440
				affectCombo.setEnabled(true);
441
			} else {
442
				affectAnnotationButton.setEnabled(false);
443
				affectCombo.setEnabled(false);
450

  
451
				if (addTypedValueLink != null) {
452
					addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
453
				}				
444 454
			}
445
		}
446

  
447

  
448
		if (addTypedValueLink != null) {
449
			addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
450
		}
455
		});
451 456
	}
452 457

  
453 458
	protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {

Formats disponibles : Unified diff