Révision 1397

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java (revision 1397)
422 422
		}
423 423
		this.freqs = freq;
424 424
		this.ids = ids;
425
		this.forms = null;
425
		this.forms = getForms();
426 426
		this.pProperty = property;
427 427
	}
428 428

  
......
544 544
		if(lexicon == null || !lexicon.getProperty().getFullName().equals(property.getFullName()))	{
545 545
			lexicon = new CQPLexicon(corpus);
546 546
			lexicon.setProperty(property);
547
			lexicon._compute();
547 548
		}
548 549
		System.out.println("Lexicon="+lexicon+" "+lexicon.hashCode());
549 550
		return lexicon;
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 1397)
702 702
	 // FIXME: try to use a ViewerSorter instead of this but also manage the result sorting for export
703 703
		public void sort(TableViewerColumn col, int index) {
704 704

  
705
			if (lexicalTable.getData() == null) return;
706
			
705 707
			if (index == previousSortedCol) {
706 708
				reverse = !reverse;
707 709
			} else {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreateSubcorpusDialog.java (revision 1397)
155 155
		nameLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
156 156

  
157 157
		name = new Text(nameComposite, SWT.BORDER);
158
		name.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
158
		name.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
159 159

  
160 160
		// Param panel
161 161
		final TabFolder tabFolder = new TabFolder(inclosing, SWT.NONE);
......
189 189
				GridData.CENTER, false, false));
190 190

  
191 191
		queryText = new QueryWidget(compositeForAdvanced, SWT.DROP_DOWN);
192
		queryText.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
193
				true, false));
194
		GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
195
				false);
192
		queryText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
193
		GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
196 194
		gridData.widthHint = convertHeightInCharsToPixels(20);
197 195
		queryText.setLayoutData(gridData);
198 196

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreatePartitionDialog.java (revision 1397)
27 27
//
28 28
package org.txm.rcp.actions;
29 29

  
30
import java.io.File;
31
import java.io.FileNotFoundException;
32
import java.io.IOException;
33
import java.io.UnsupportedEncodingException;
30 34
import java.util.ArrayList;
31 35
import java.util.List;
36
import java.util.Properties;
32 37

  
33 38
import org.eclipse.jface.dialogs.Dialog;
34 39
import org.eclipse.jface.dialogs.IDialogConstants;
......
49 54
import org.eclipse.swt.widgets.Composite;
50 55
import org.eclipse.swt.widgets.Control;
51 56
import org.eclipse.swt.widgets.Event;
57
import org.eclipse.swt.widgets.FileDialog;
52 58
import org.eclipse.swt.widgets.Label;
53 59
import org.eclipse.swt.widgets.Listener;
54 60
import org.eclipse.swt.widgets.Shell;
......
64 70
import org.txm.searchengine.cqp.corpus.Partition;
65 71
import org.txm.searchengine.cqp.corpus.StructuralUnit;
66 72
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
73
import org.txm.utils.io.IOUtils;
67 74
import org.txm.utils.logger.Log;
68 75
// TODO: Auto-generated Javadoc
69 76
/**
......
313 320
		advancedTab.setText(TXMUIMessages.advanced);
314 321

  
315 322
		Composite advanceContainer = new Composite(tabFolder, SWT.NONE);
316
		GridLayout advanceLayout = new GridLayout(1, true);
323
		GridLayout advanceLayout = new GridLayout(2, false);
317 324
		advanceContainer.setLayout(advanceLayout);
318 325
		advancedTab.setControl(advanceContainer);
319 326

  
320 327
		scrollComposite = new ScrolledComposite(advanceContainer, SWT.V_SCROLL
321 328
				| SWT.BORDER);
322 329
		scrollComposite.setLayoutData(new GridData(GridData.FILL,
323
				GridData.FILL, true, true));
330
				GridData.FILL, true, true, 2, 1));
324 331

  
325 332
		Button plusButton = new Button(advanceContainer, SWT.NONE);
326 333
		plusButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER,
......
329 336
		plusButton.addListener(SWT.Selection, new Listener() {
330 337
			@Override
331 338
			public void handleEvent(Event event) {
332
				addQueryField(compositeForAdvanced);
339
				addQueryField();
333 340
			}
334 341
		});
342
		
343
		Button importButton = new Button(advanceContainer, SWT.NONE);
344
		importButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER,
345
				GridData.FILL, false, false));
346
		importButton.setText("Import from properties file..."); //$NON-NLS-1$
347
		importButton.addListener(SWT.Selection, new Listener() {
348
			@Override
349
			public void handleEvent(Event event) {
350
				FileDialog d = new FileDialog(event.display.getActiveShell());
351
				d.setFilterExtensions(new String[] {"*.properties"});
352
				d.setText("Select a properties file containing CQL queries");
353
				String path = d.open();
354
				if (path != null) {
355
					Properties props = new Properties();
356
					try {
357
						props.load(IOUtils.getReader(new File(path)));
358
						for (Object key : props.keySet()) {
359
							String value = props.getProperty(key.toString());
360
							QueryWidget qw = addQueryField(key.toString().substring(0, Math.min(20, key.toString().length())), value);
361
						}
362
					} catch (Exception e) {
363
						// TODO Auto-generated catch block
364
						e.printStackTrace();
365
					}
366
				}
367
				
368
			}
369
		});
335 370

  
336 371
		compositeForAdvanced = new Composite(scrollComposite, SWT.NONE);
337 372
		GridLayout layoutForAdvanced = new GridLayout(3, false);
......
437 472
	 * @param composite the composite
438 473
	 */
439 474
	private void createAdvancedQueryField() {
440
		addQueryField(compositeForAdvanced);
475
		addQueryField();
441 476
		Rectangle r = scrollComposite.getClientArea();
442 477
		scrollComposite.setMinSize(compositeForAdvanced.computeSize(r.width,
443 478
				SWT.DEFAULT));
......
448 483
	 *
449 484
	 * @param composite the composite
450 485
	 */
451
	private void addQueryField(final Composite composite) {
452
		final Text advancedPartLabel = new Text(composite, SWT.NONE);
486
	private QueryWidget addQueryField() {
487
		return addQueryField(null, null);
488
	}
489
	
490
	/**
491
	 * Adds the query field.
492
	 *
493
	 * @param name the query name
494
	 * @param value the query
495
	 */
496
	private QueryWidget addQueryField(String name, String value) {
497
		final Text advancedPartLabel = new Text(compositeForAdvanced, SWT.BORDER);
453 498
		advancedPartLabel.setText(TXMUIMessages.part
454 499
				+ (partNames.size() + 1)); 
455
		advancedPartLabel.setLayoutData(new GridData(GridData.END,
500
		advancedPartLabel.setLayoutData(new GridData(GridData.FILL,
456 501
				GridData.CENTER, false, false));
502
		if (name != null && name.length() > 0) {
503
			advancedPartLabel.setText(name);
504
		}
457 505
		partNames.add(advancedPartLabel);
458 506

  
459 507
		final QueryWidget queryText;
460
		queryText = new QueryWidget(composite, SWT.DROP_DOWN);
508
		queryText = new QueryWidget(compositeForAdvanced, SWT.DROP_DOWN);
461 509
		queryText.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
462 510
				true, false));
463 511
		GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
......
465 513
		// gridData.widthHint = convertHeightInCharsToPixels(20);
466 514
		queryText.setLayoutData(gridData);
467 515
		queries.add(queryText);
468

  
469
		final Button minusButton = new Button(composite, SWT.NONE);
516
		if (value != null) {
517
			queryText.setText(value);
518
		}
519
		final Button minusButton = new Button(compositeForAdvanced, SWT.NONE);
470 520
		minusButton.setText("-"); //$NON-NLS-1$
471 521
		// minusButton.setData(queryText);
472 522
		minusButton.addListener(SWT.Selection, new Listener() {
......
477 527
				advancedPartLabel.dispose();
478 528
				queryText.dispose();
479 529
				minusButton.dispose();
530
				compositeForAdvanced.layout(true);
480 531
			}
481 532
		});
482 533
		Rectangle r = scrollComposite.getClientArea();
......
484 535
				SWT.DEFAULT));
485 536
		scrollComposite.update();
486 537
		scrollComposite.layout();
487
		composite.update();
488
		composite.layout();
538
		compositeForAdvanced.update();
539
		compositeForAdvanced.layout();
540
		
541
		return queryText;
489 542
	}
490 543

  
491 544
	/* (non-Javadoc)

Formats disponibles : Unified diff