Révision 3523

trunk/org.txm.texts.core/src/org/txm/texts/core/TextsView.java (revision 3523)
203 203
	protected boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
204 204
		
205 205
		PrintWriter writer = org.txm.utils.io.IOUtils.getWriter(outfile, encoding);
206
		
206 207
		writer.println("text"+colseparator+StringUtils.join(pColumns, colseparator));
207 208
		
208 209
		for (String text : result.keySet()) {
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java (revision 3523)
62 62
	 * @param window the window
63 63
	 * @param concordanceEditor the concordance editor
64 64
	 */
65
	public SetContextSize(IWorkbenchWindow window,
66
			ConcordanceEditor concordanceEditor) {
65
	public SetContextSize(IWorkbenchWindow window, ConcordanceEditor concordanceEditor) {
66
		
67 67
		this.window = window;
68 68
		this.concordanceEditor = concordanceEditor;
69 69
		setId(ID);
......
85 85
	public void run() {
86 86
		SetContextSizeDialog d = new SetContextSizeDialog(window.getShell());
87 87
		if (d.open() == Window.OK) {
88
			concordanceEditor.setContextSize(d.getLeftContextSize(), d
89
					.getRightContextSize());
88
			concordanceEditor.setContextSize(d.getLeftContextSize(), d.getRightContextSize());
90 89
			// concordanceEditor.getConcordance().setLeftContextSize(d.getLeftContextSize());
91 90
			// concordanceEditor.getConcordance().setRightContextSize(d.getRightContextSize());
92 91
			// concordanceEditor.sort();
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java (revision 3523)
169 169
	}
170 170
	
171 171
	/**
172
	 * Sets the key.
172
	 * Sets a simple sort with ONE key.
173
	 * 0,1,2,3 or 4 of the available sorts list
173 174
	 *
174 175
	 * @param no the new key
175 176
	 */
176
	public void setKey(int no)
177
	public void setSimpleSortKey(int no)
177 178
	{
178 179
		firstKey.select(no);
179 180
		secondKey.select(0);
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 3523)
424 424
				
425 425
				currentComparator = cComparator;
426 426
				
427
				complexsorter.setKey(4);// set ref key
427
				complexsorter.setSimpleSortKey(4);// set ref key
428 428
				sort();
429 429
				StatusLine.setMessage(""); //$NON-NLS-1$
430 430
			}
......
567 567
				
568 568
				currentComparator = cComparator;
569 569
				
570
				complexsorter.setKey(2);// set ref key
570
				complexsorter.setSimpleSortKey(2);// set ref key
571 571
				sort();
572 572
				StatusLine.setMessage(""); //$NON-NLS-1$
573 573
			}
......
617 617
				
618 618
				currentComparator = cComparator;
619 619
				
620
				complexsorter.setKey(1);// set ref key
620
				complexsorter.setSimpleSortKey(1);// set ref key
621 621
				sort();
622 622
				StatusLine.setMessage(""); //$NON-NLS-1$
623 623
			}
......
665 665
				
666 666
				currentComparator = cComparator;
667 667
				
668
				complexsorter.setKey(3); // set ref key
668
				complexsorter.setSimpleSortKey(3); // set ref key
669 669
				sort();
670 670
				StatusLine.setMessage(""); //$NON-NLS-1$
671 671
			}
......
846 846
	public void sort() {
847 847
		
848 848
		if (concordance != null && currentComparator != null) {
849
			
849
//			System.out.println("SORT !!!!");
850 850
			// System.out.println("concordance sort props: "+concordance.getLeftCAnalysisProperty()+", "+concordance.getKeywordAnalysisProperty()+", "+concordance.getRightCAnalysisProperty());
851
			concordance.resetLines();
851
			//concordance.resetLines();
852 852
			
853 853
			try {
854 854
				Log.fine(NLS.bind(ConcordanceUIMessages.sortingWithP0, currentComparator.getName()));
......
1463 1463
		try {
1464 1464
			QueriesView.refresh();
1465 1465
			
1466
			System.out.println("lines="+concordance.getLines());
1467
			
1466 1468
			this.fillDisplayArea(update);
1467 1469
			
1470
//			if (update) {
1471
//				//System.out.println(this.currentComparator);
1472
//				if (currentComparator instanceof CompositeComparator) {
1473
//					CompositeComparator cc = (CompositeComparator)currentComparator;
1474
//					boolean allDefault = true;
1475
//					for (LineComparator ccc : cc.getComparators()) {
1476
//						allDefault = allDefault && ccc instanceof WordPositionComparator;
1477
//					}
1478
//					
1479
//					if (!allDefault) {
1480
//						this.sort();
1481
//					}
1482
//				} else {
1483
//					this.sort();
1484
//				}
1485
//			}
1486
			
1468 1487
			boolean b = concordance.getQueryResultParameter() == null;
1469 1488
			this.queryWidget.setEnabled(b); // disable the widget if a QueryResult was provided
1470 1489
			
......
1576 1595
	public void setLeftSortProperties(List<WordProperty> list) {
1577 1596
		
1578 1597
		concordance.setLeftAnalysisProperties(list);
1598
		sort();
1579 1599
	}
1580 1600
	
1581 1601
	/**
......
1636 1656
		concordance.setRightContextSize(rightContextSize);
1637 1657
		this.rightSizeSpinner.setSelection(rightContextSize);
1638 1658
		this.leftSizeSpinner.setSelection(leftContextSize);
1639
		fillDisplayArea(false); // we return to the previously
1659
		updateEditorFromResult(true); // we return to the previously
1640 1660
		resetColumnWidths();
1641 1661
	}
1642 1662
	
......
1748 1768
	 */
1749 1769
	private void createActions() {
1750 1770
		
1751
		setSortPropertyAction = new SortPropertySelection(getSite()
1752
				.getWorkbenchWindow(), this, this.viewerRight);
1753
		setContextSizeAction = new SetContextSize(getSite()
1754
				.getWorkbenchWindow(), this);
1771
		setSortPropertyAction = new SortPropertySelection(getSite().getWorkbenchWindow(), this, this.viewerRight);
1772
		setContextSizeAction = new SetContextSize(getSite().getWorkbenchWindow(), this);
1755 1773
		// resetColumnWidths = new ResetColumnWidths(getSite().getWorkbenchWindow(), this);
1756
		setLineNumberAction = new SetLineNumber(getSite().getWorkbenchWindow(),
1757
				this);
1758
		defineViewReferencePatternAction = new DefineViewReferencePattern(getSite()
1759
				.getWorkbenchWindow(), this);
1760
		defineSortReferencePatternAction = new DefineSortReferencePattern(getSite()
1761
				.getWorkbenchWindow(), this);
1762
		setViewPropertyAction = new ViewPropertySelection(getSite()
1763
				.getWorkbenchWindow(), this, this.viewerRight);
1774
		setLineNumberAction = new SetLineNumber(getSite().getWorkbenchWindow(), this);
1775
		defineViewReferencePatternAction = new DefineViewReferencePattern(getSite().getWorkbenchWindow(), this);
1776
		defineSortReferencePatternAction = new DefineSortReferencePattern(getSite().getWorkbenchWindow(), this);
1777
		setViewPropertyAction = new ViewPropertySelection(getSite().getWorkbenchWindow(), this, this.viewerRight);
1764 1778
	}
1765 1779
	
1766 1780
	/**
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/comparators/LineComparator.java (revision 3523)
60 60
		return availableComparator;
61 61
	}
62 62

  
63
	public boolean equals(LineComparator c2) {
64
		return this.getName().equals(c2.getName());
65
	}
66
	
63 67
	/**
64 68
	 * Instantiates a new line comparator.
65 69
	 *
TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 3523)
1235 1235
	 * Brutal way to reset the concordance lines. they will be recomputed when getLines(...) is called
1236 1236
	 */
1237 1237
	public void resetLines() {
1238
		lines = new ArrayList<>(Collections.nCopies(nLines,
1239
				(Line) null)); // empty lines
1238
		lines = new ArrayList<>(Collections.nCopies(nLines,	(Line) null)); // empty lines
1240 1239
	}
1241 1240
	
1242 1241
	/**
......
1560 1559
	 * @throws IOException
1561 1560
	 */
1562 1561
	public void sort(LineComparator comparator, TXMProgressMonitor monitor) throws Exception {
1562
		
1563
		//String[] previousSort = comparator.getAvailableComparators();
1563 1564
		System.currentTimeMillis();
1564 1565
		this.acquireSemaphore();
1565 1566
		comparator.initialize(this.getCorpus());
1566 1567
		this.releaseSemaphore();
1568
		
1569
		resetLines();
1570
		
1567 1571
		if (getNLines() == 0) {
1568 1572
			return;
1569 1573
		}
1574
		
1570 1575
		getLines(0, nLines - 1); // all lines are necessary to sort TODO: if fact only the sort properties are needed
1571 1576
		if (lines.size() > 0) {
1572 1577
			Collections.sort(lines, comparator);

Formats disponibles : Unified diff