Revision 315

tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/DeleteLines.java (revision 315)
87 87
				return;
88 88
		}
89 89

  
90
		LTeditor.getLexicalTable().removeRows(selection);
90
		LTeditor.getLexicalTable().getData().removeRows(selection);
91 91

  
92 92
		LTeditor.refreshTable();
93 93
		LTeditor.getlineTableViewer().getTable().deselectAll();
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/___MergeCols.java (revision 315)
39 39
import org.eclipse.swt.widgets.Shell;
40 40
import org.eclipse.ui.IWorkbenchPart;
41 41
import org.eclipse.ui.handlers.HandlerUtil;
42
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
42
import org.txm.lexicaltable.core.functions.LexicalTable;
43 43
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor2;
44 44
import org.txm.rcpapplication.Messages;
45 45
import org.txm.statsengine.core.StatException;
......
90 90

  
91 91
			// update table
92 92
			for (int j = 0; j < table.getNRows(); j++) {
93
				table.set(j, selectedCols[0], firstcol[j]);
93
				table.getData().set(j, selectedCols[0], firstcol[j]);
94 94
			}
95 95

  
96 96
			// keep only the first col
97 97
			int[] coltodelete = new int[selectedCols.length - 1];
98 98
			System.arraycopy(selectedCols, 1, coltodelete, 0,
99 99
					selectedCols.length - 1);
100
			table.removeCols(coltodelete);
100
			table.getData().removeCols(coltodelete);
101 101

  
102 102
			// reset col name
103 103
			table.getColNames().setString(selectedCols[0], newname);
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ComputeLexicalTable.java (revision 315)
49 49
import org.txm.core.preferences.TXMPreferences;
50 50
//import org.txm.functions.queryindex.QueryIndex;
51 51
import org.txm.index.core.functions.Index;
52
import org.txm.lexicaltable.core.functions.LexicalTable;
52 53
import org.txm.lexicaltable.core.functions.LexicalTableFactory;
53 54
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences;
54
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
55
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
55 56
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
56 57
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
57 58
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor2;
......
151 152
		} else if (s instanceof Partition) {
152 153
			computeWithPartition((Partition) s);
153 154
			return null;
154
		} else if (s instanceof LexicalTableImpl) {
155
			computeWithLexicalTableAble((LexicalTableImpl) s);
155
		} else if (s instanceof LexicalTable) {
156
			computeWithLexicalTableAble((LexicalTable) s);
156 157
			return null;
157 158
		} else
158 159
			return null;
......
163 164
	 *
164 165
	 * @param partition the partition
165 166
	 */
166
	private void computeWithLexicalTableAble(final LexicalTableImpl lexicalTableAble) {
167
	private void computeWithLexicalTableAble(final LexicalTable lexicalTableAble) {
167 168

  
168 169
		JobHandler jobhandler = new JobHandler(
169 170
				Messages.ComputeLexicalTable_0) {
......
268 269
						this.releaseSemaphore();
269 270
						
270 271
						this.acquireSemaphore();
271
						table.cut(vmax);
272
						table.getData().cut(vmax);
272 273
						this.releaseSemaphore();
273 274

  
274 275
						monitor.worked(45);
......
468 469
				try {
469 470
					monitor.beginTask("Computing Lexical table with Index: "+firstIndex+" property: "+property, 100);
470 471
					this.acquireSemaphore();
471
					table = LexicalTableImpl.createLexicalTableImpl(vocabularies, QuantitativeDataStructureImpl.createSymbole(LexicalTableImpl.class), useAllOccurrences);
472
					table = new LexicalTable(vocabularies, QuantitativeDataStructureImpl.createSymbole(LexicalTableImpl.class), useAllOccurrences);
472 473
					monitor.worked(45);
473 474
					this.releaseSemaphore();
474 475
					if (monitor.isCanceled() || table == null)
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/MergeLines.java (revision 315)
38 38
import org.eclipse.swt.widgets.Shell;
39 39
import org.eclipse.ui.IWorkbenchPart;
40 40
import org.eclipse.ui.handlers.HandlerUtil;
41
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
41
import org.txm.lexicaltable.core.functions.LexicalTable;
42 42
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor2;
43 43
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
44 44
import org.txm.rcpapplication.Messages;
......
106 106

  
107 107
		// set values in the first row of the selection
108 108
		for (int j = 0; j < cols.size(); j++)
109
			table.set(selection[0], j, fuz[j]);
109
			table.getData().set(selection[0], j, fuz[j]);
110 110

  
111 111
		// keep only the first selected line
112 112
		int[] lineToDelete = new int[selection.length - 1];
113 113
		System.arraycopy(selection, 1, lineToDelete, 0, selection.length - 1);
114 114
		//System.out.println("Lines to delete : "+Arrays.toString(lineToDelete));
115
		table.removeRows(lineToDelete);
115
		table.getData().removeRows(lineToDelete);
116 116

  
117 117
		// reset line name
118 118
		table.getRowNames().setString(selection[0], newname);
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/adapters/LexicalTableAdapterFactory.java (revision 315)
5 5
import org.eclipse.ui.model.IWorkbenchAdapter;
6 6
import org.eclipse.ui.plugin.AbstractUIPlugin;
7 7
import org.osgi.framework.FrameworkUtil;
8
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
8
import org.txm.lexicaltable.core.functions.LexicalTable;
9 9
import org.txm.rcp.adapters.TXMResultAdapter;
10 10
import org.txm.rcp.adapters.TXMResultAdapterFactory;
11 11

  
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LineContentProvider.java (revision 315)
29 29

  
30 30
import org.eclipse.jface.viewers.IStructuredContentProvider;
31 31
import org.eclipse.jface.viewers.Viewer;
32
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
32
import org.txm.lexicaltable.core.functions.LexicalTable;
33 33

  
34 34
// TODO: Auto-generated Javadoc
35 35
/**
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditorInput.java (revision 315)
38 38
import org.eclipse.swt.graphics.Image;
39 39
import org.eclipse.ui.IEditorInput;
40 40
import org.eclipse.ui.part.EditorPart;
41
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
41
import org.txm.lexicaltable.core.functions.LexicalTable;
42 42
import org.txm.rcp.editors.TXMResultEditorInput;
43 43
import org.txm.rcpapplication.Messages;
44 44
import org.txm.rcpapplication.editors.Tablable;
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor2.java (revision 315)
62 62
import org.eclipse.ui.IEditorSite;
63 63
import org.eclipse.ui.PartInitException;
64 64
import org.txm.core.messages.TXMCoreMessages;
65
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
65
import org.txm.lexicaltable.core.functions.LexicalTable;
66
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
66 67
import org.txm.lexicaltable.rcp.handlers.MergeLines;
67 68
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
68 69
import org.txm.rcp.editors.TXMEditorPart;
......
92 93
	
93 94
	/** The table. */
94 95
	LexicalTable table;
95

  
96
	ILexicalTable itable;
96 97
	// params
97 98
	/** The query widget. */
98 99
	QueryWidget queryWidget;
......
167 168
		super.init(site, input);
168 169
		
169 170
		table = ((LexicalTableEditorInput) input).getLexicalTable();
171
		itable = table.getData();
170 172
	}
171 173

  
172 174
	
......
186 188
		}
187 189

  
188 190
		if (index == -2) {// rownames
189
			table.sortRowNames(reverse);
191
			itable.sortRowNames(reverse);
190 192
		} else if (index == -1) { // freqs
191 193
			try {
192
				table.sortByFreqs(reverse);
194
				itable.sortByFreqs(reverse);
193 195
				StatusLine.setMessage(Messages.SORT_DONE);
194 196
			} catch (Exception e2) {
195 197
				org.txm.rcpapplication.utils.Logger.printStackTrace(e2);
196 198
			}
197 199
		} else if (index >= 0) {
198
			table.sort(index, reverse);
200
			itable.sort(index, reverse);
199 201
		}
200 202

  
201 203
		previousSortedCol = index;
......
240 242
					return;
241 243

  
242 244
				try {
243
					table.filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
245
					itable.filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
244 246
					refresh();
245 247
					StatusLine.setMessage(""); //$NON-NLS-1$
246 248
				} catch (Exception e1) {
......
299 301

  
300 302
						// update first col of the Lexical table
301 303
						for (int j = 0; j < table.getNRows(); j++) {
302
							table.set(j, colindices.get(0), firstcol[j]);
304
							itable.set(j, colindices.get(0), firstcol[j]);
303 305
						}
304 306

  
305 307
						// and its name
......
309 311
						// keep only the first col
310 312
						List<Integer> coltodelete = colindices.subList(1,
311 313
								colindices.size());
312
						table.removeCols(coltodelete);
314
						itable.removeCols(coltodelete);
313 315

  
314 316
						// refresh stuff
315 317
						collist = new ArrayList<Object>();// update col name
......
335 337
					} else// delete
336 338
					{
337 339
						System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_12, colindices));
338
						table.removeCols(colindices);
340
						itable.removeCols(colindices);
339 341

  
340 342
						collist = new ArrayList<Object>();
341 343
						Vector colnames = table.getColNames();
......
389 391
						MergeLines.mergeLines(LexicalTableEditor2.this, d
390 392
								.getMergeName(), rowindices);
391 393
					} else {
392
						table.removeRows(rowindices);
394
						itable.removeRows(rowindices);
393 395
						refreshTable();
394 396
						viewer.getTable().deselectAll();
395 397
					}
......
497 499
	 */
498 500
	public void refreshInfos() {
499 501
		try {
500
			this.setContentDescription(TXMCoreMessages.T + table.getTotal()
501
					+ TXMCoreMessages.V + table.getNRows()
502
					+ TXMCoreMessages.FMIN_2 + table.getFmin()
503
					+ TXMCoreMessages.FMAX_2 + table.getFmax());
502
			this.setContentDescription(TXMCoreMessages.T + itable.getTotal()
503
					+ TXMCoreMessages.V + itable.getNRows()
504
					+ TXMCoreMessages.FMIN_2 + itable.getFmin()
505
					+ TXMCoreMessages.FMAX_2 + itable.getFmax());
504 506
		} catch (RWorkspaceException e3) {
505 507
			// TODO Auto-generated catch block
506 508
			org.txm.rcpapplication.utils.Logger.printStackTrace(e3);
......
532 534
		viewer.getControl().setRedraw(true);
533 535
		
534 536
		nLinesSpinner.setMinimum(1);
535
		nLinesSpinner.setMaximum(table.getNRows());
536
		nLinesSpinner.setSelection(table.getNRows());
537
		minfreqspinner.setMinimum(table.getFmin());
538
		minfreqspinner.setMaximum(table.getFmax());
537
		nLinesSpinner.setMaximum(itable.getNRows());
538
		nLinesSpinner.setSelection(itable.getNRows());
539
		minfreqspinner.setMinimum(itable.getFmin());
540
		minfreqspinner.setMaximum(itable.getFmax());
539 541
		viewer.getTable().setFocus();
540 542
	}
541 543

  
......
683 685
	 * @param file the file
684 686
	 */
685 687
	public void exportData(File file) {
686
		table.exportData(file, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
688
		itable.exportData(file, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
687 689
	}
688 690

  
689 691
	/**
......
693 695
	 */
694 696
	public void importData(File file) {
695 697
		try {
696
			if (table.importData(file)) {
698
			if (itable.importData(file)) {
697 699
				// fix col names
698 700
				String[] colnames = table.getColNames().asStringsArray();
699 701
				TableColumn[] cols = viewer.getTable().getColumns();
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LineLabelProvider.java (revision 315)
35 35
import org.eclipse.jface.viewers.LabelProvider;
36 36
import org.eclipse.swt.graphics.Image;
37 37
import org.txm.cooccurrence.rcp.preferences.CoocPreferencePage;
38
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
38
import org.txm.lexicaltable.core.functions.LexicalTable;
39 39
import org.txm.rcpapplication.TxmPreferences;
40 40

  
41 41
// TODO: Auto-generated Javadoc
......
82 82
			Nrows = table.getNRows();
83 83
			Ncols = table.getNColumns();
84 84
			for (int i = 0; i < Ncols; i++)
85
				cols.add(table.getCol(i).asDoubleArray());
86
			freqs = table.getRowMargins();
85
				cols.add(table.getData().getCol(i).asDoubleArray());
86
			freqs = table.getData().getRowMargins();
87 87
		} catch (Exception e) {
88 88
			// TODO Auto-generated catch block
89 89
			org.txm.rcpapplication.utils.Logger.printStackTrace(e);
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeCAH.java (revision 315)
50 50
import org.txm.cah.rcp.messages.CAHUIMessages;
51 51
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
52 52
import org.txm.core.preferences.TXMPreferences;
53
import org.txm.lexicaltable.core.functions.LexicalTable;
53 54
import org.txm.lexicaltable.core.functions.LexicalTableFactory;
54
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
55 55
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
56 56
import org.txm.rcp.handlers.BaseAbstractHandler;
57 57
import org.txm.rcpapplication.TxmPreferences;
......
134 134
					vmax = d.getMaxLines();
135 135
					
136 136
					lexicaltable = LexicalTableFactory.getLexicalTable(partition, property, fmin); // use the CAPreferencePage Fmin
137
					lexicaltable.cut(vmax);
137
					lexicaltable.getData().cut(vmax);
138 138
					partition.addResult(lexicaltable);
139 139
					
140 140
					ca = new CA(lexicaltable);
tmp/org.txm.cah.rcp/META-INF/MANIFEST.MF (revision 315)
9 9
 org.txm.cah.rcp.handlers,
10 10
 org.txm.cah.rcp.messages,
11 11
 org.txm.cah.rcp.preferences
12
Require-Bundle: org.txm.cah.core;bundle-version="1.0.0",
12
Require-Bundle: org.txm.lexicaltable.core;bundle-version="1.0.0",
13
 org.txm.cah.core;bundle-version="1.0.0",
13 14
 org.txm.chartsengine.rcp;bundle-version="1.0.0",
14 15
 org.txm.core;bundle-version="0.7.0",
15 16
 org.txm.rcp;bundle-version="0.7.8",
16 17
 org.eclipse.ui;bundle-version="3.106.1",
17 18
 org.eclipse.core.runtime;bundle-version="3.10.0",
18 19
 org.txm.ca.core,
19
 org.txm.lexicaltable.core;bundle-version="1.0.0",
20 20
 org.txm.lexicaltable.rcp;bundle-version="1.0.0",
21 21
 org.eclipse.core.expressions;bundle-version="3.4.600"
22 22
Bundle-Vendor: Textometrie.org
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/r/data/LexicalTableImpl.java (revision 315)
158 158
			sortedindex[i] = i;
159 159
	}
160 160

  
161

  
162

  
163

  
164
	/**
165
	 * Creates the lexical table impl.
166
	 *
167
	 * @param partindex the partindex
168
	 * @param symbol the symbol
169
	 * @return the lexical table
170
	 * @throws RWorkspaceException the r workspace exception
171
	 */
172
	static public ILexicalTable createLexicalTableImpl(Index partindex,
173
			String symbol) throws RWorkspaceException {
174
		List<Index> vocabularies = new ArrayList<Index>();
175
		vocabularies.add(partindex);
176

  
177
		ILexicalTable lt = createLexicalTableImpl(vocabularies, symbol, false);
178
		return lt;
179
	}
180

  
181 161
	private static int getNline(File f) {
182 162
		try {
183 163
			BufferedReader reader = new BufferedReader(new FileReader(f));
......
308 288
	}
309 289

  
310 290
	/**
311
	 * Creates the lexical table impl.
312
	 *
313
	 * @param vocabularies the vocabularies
314
	 * @param symbol the symbol
315
	 * @param useAllOccurrences 
316
	 * @return the lexical table
317
	 * @throws RWorkspaceException the r workspace exception
318
	 */
319
	static public ILexicalTable createLexicalTableImpl(
320
			List<Index> vocabularies, String symbol, boolean useAllOccurrences)
321
					throws RWorkspaceException {
322

  
323
		System.out.println(LexicalTableCoreMessages.LexicalTableImpl_1 + vocabularies);
324
		Index partindex = vocabularies.get(0);// FRIGO
325
		if (!partindex.isComputedWithPartition())
326
			return null;
327

  
328
		Partition partition = partindex.getPartition();
329
		Property property = partindex.getProperties().get(0);
330

  
331
		HashMap<String, Line> alllines = new HashMap<String, Line>();
332
		// merge lines of all indexes
333
		for (Index voc : vocabularies) {
334
			for (Line l : voc.getAllLines()) {
335
				if (alllines.containsKey(l.getSignature())) {
336
					Line ll = alllines.get(l.getSignature());
337
					int[] c1 = ll.getFrequencies();
338
					int[] c2 = l.getFrequencies();
339
					for (int i = 0; i < c1.length; i++)
340
						c2[i] += c1[i];
341
					ll.setCounts(c2, 0.0f);
342
				} else
343
					alllines.put(l.toString(), l);
344
			}
345
		}
346

  
347
		List<String> colnames = partindex.getPartnames();
348

  
349
		Collection<Line> lines = alllines.values();
350
		List<String> rownames = new ArrayList<String>(lines.size());
351
		for (Line l : lines) {
352
			rownames.add(l.toString());
353
		}
354
		int extra = 0;
355
		if(useAllOccurrences)
356
			extra = 1;
357

  
358
		String[] entries = new String[alllines.size() + extra];
359

  
360

  
361
		int[][] mat = new int[rownames.size() + extra][colnames.size()];
362
		int[] margins = new int[colnames.size()]; // compute margins
363
		int i = 0;
364
		for (Line l : lines) {
365
			for (int j = 0; j < colnames.size(); j++) {
366
				mat[i][j] = l.getFrequency(j);
367
				margins[j] += l.getFrequency(j);
368
			}
369
			entries[i++] = l.toString();
370
		}
371

  
372
		if (useAllOccurrences) {
373
			try {
374
				int[] partitionSizes = partition.getPartSizes();
375
				int[] reste = new int[partitionSizes.length];
376

  
377
				//System.out.println("margins : "+Arrays.toString(margins));
378
				//System.out.println("partsizes : "+Arrays.toString(partitionSizes));
379

  
380
				for(i = 0 ; i < reste.length ; i++)
381
				{
382
					reste[i] = partitionSizes[i] - margins[i];
383
					if(reste[i] < 0)
384
					{
385
						System.out.println(LexicalTableCoreMessages.LexicalTableImpl_12+i+LexicalTableCoreMessages.LexicalTableImpl_13);
386
						return null;
387
					}
388
					mat[lines.size()][i] = reste[i];
389
				}
390
				entries[lines.size()] = "#RESTE#"; //$NON-NLS-1$
391
				rownames.add("#RESTE#"); //$NON-NLS-1$
392
				//System.out.println("rownames: "+rownames);
393
				//System.out.println("reste : "+Arrays.toString(reste));
394
			} catch (CqiClientException e) {
395
				// TODO Auto-generated catch block
396
				org.txm.utils.logger.Log.printStackTrace(e);
397
			}
398

  
399
		}
400
		//System.out.println("mat size : ["+(rownames.size() + extra)+"]["+colnames.size()+"]");
401
		//System.out.println("rownames size : "+rownames.size());
402
		//System.out.println("colnames size : "+colnames.size());
403
		LexicalTableImpl table = new LexicalTableImpl(mat, rownames.toArray(new String[] {}), colnames
404
				.toArray(new String[] {}));
405
		return table;
406
	}
407

  
408
	/**
409 291
	 * Creates the lexical table.
410 292
	 *
411 293
	 * @param freqs the freqs
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 315)
1 1
package org.txm.lexicaltable.core.functions;
2 2

  
3
import java.io.File;
4
import java.util.ArrayList;
5
import java.util.Arrays;
6
import java.util.Collection;
7
import java.util.HashMap;
8
import java.util.List;
9

  
3 10
import org.txm.core.results.TXMResult;
11
import org.txm.index.core.functions.Index;
12
import org.txm.index.core.functions.Line;
13
import org.txm.lexicaltable.core.messages.LexicalTableCoreMessages;
4 14
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
5 15
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
6 16
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
......
116 126
		this.partition = partition;
117 127
		this.corpus = partition.getCorpus();
118 128
	}
129
	
119 130

  
131
	/**
132
	 * Creates the lexical table.
133
	 *
134
	 * @param partindex the partindex
135
	 * @param symbol the symbol
136
	 * @return the lexical table
137
	 * @throws RWorkspaceException the r workspace exception
138
	 */
139
	public LexicalTable(Index partIndex,
140
			String symbol) throws RWorkspaceException {
141
		this(Arrays.asList(partIndex), symbol, true);
142
	}
143
	
144
	/**
145
	 * Creates the lexical table.
146
	 *
147
	 * @param vocabularies the vocabularies
148
	 * @param symbol the symbol
149
	 * @param useAllOccurrences 
150
	 * @return the lexical table
151
	 * @throws RWorkspaceException the r workspace exception
152
	 */
153
	public LexicalTable(List<Index> vocabularies, String symbol, boolean useAllOccurrences)
154
					throws RWorkspaceException {
155

  
156
		System.out.println(LexicalTableCoreMessages.LexicalTableImpl_1 + vocabularies);
157
		Index partindex = vocabularies.get(0);// FRIGO
158
		if (!partindex.isComputedWithPartition())
159
			throw new IllegalArgumentException("Vocabularies are not computed with a partition. Aborting.");
160

  
161
		this.partition = partindex.getPartition();
162
		this.property = partindex.getProperties().get(0);
163
		this.corpus = partindex.getPartition().getCorpus();
164

  
165
		HashMap<String, Line> alllines = new HashMap<String, Line>();
166
		// merge lines of all indexes
167
		for (Index voc : vocabularies) {
168
			for (Line l : voc.getAllLines()) {
169
				if (alllines.containsKey(l.getSignature())) {
170
					Line ll = alllines.get(l.getSignature());
171
					int[] c1 = ll.getFrequencies();
172
					int[] c2 = l.getFrequencies();
173
					for (int i = 0; i < c1.length; i++)
174
						c2[i] += c1[i];
175
					ll.setCounts(c2, 0.0f);
176
				} else
177
					alllines.put(l.toString(), l);
178
			}
179
		}
180

  
181
		List<String> colnames = partindex.getPartnames();
182

  
183
		Collection<Line> lines = alllines.values();
184
		List<String> rownames = new ArrayList<String>(lines.size());
185
		for (Line l : lines) {
186
			rownames.add(l.toString());
187
		}
188
		int extra = 0;
189
		if(useAllOccurrences)
190
			extra = 1;
191

  
192
		String[] entries = new String[alllines.size() + extra];
193

  
194

  
195
		int[][] mat = new int[rownames.size() + extra][colnames.size()];
196
		int[] margins = new int[colnames.size()]; // compute margins
197
		int i = 0;
198
		for (Line l : lines) {
199
			for (int j = 0; j < colnames.size(); j++) {
200
				mat[i][j] = l.getFrequency(j);
201
				margins[j] += l.getFrequency(j);
202
			}
203
			entries[i++] = l.toString();
204
		}
205

  
206
		if (useAllOccurrences) {
207
			try {
208
				int[] partitionSizes = partition.getPartSizes();
209
				int[] reste = new int[partitionSizes.length];
210

  
211
				//System.out.println("margins : "+Arrays.toString(margins));
212
				//System.out.println("partsizes : "+Arrays.toString(partitionSizes));
213

  
214
				for(i = 0 ; i < reste.length ; i++) {
215
					reste[i] = partitionSizes[i] - margins[i];
216
					if(reste[i] < 0)
217
					{
218
						System.out.println(LexicalTableCoreMessages.LexicalTableImpl_12+i+LexicalTableCoreMessages.LexicalTableImpl_13);
219
						throw new IllegalArgumentException(LexicalTableCoreMessages.LexicalTableImpl_12+i+LexicalTableCoreMessages.LexicalTableImpl_13);
220
					}
221
					mat[lines.size()][i] = reste[i];
222
				}
223
				entries[lines.size()] = "#RESTE#"; //$NON-NLS-1$
224
				rownames.add("#RESTE#"); //$NON-NLS-1$
225
				//System.out.println("rownames: "+rownames);
226
				//System.out.println("reste : "+Arrays.toString(reste));
227
			} catch (CqiClientException e) {
228
				// TODO Auto-generated catch block
229
				org.txm.utils.logger.Log.printStackTrace(e);
230
			}
231

  
232
		}
233
		//System.out.println("mat size : ["+(rownames.size() + extra)+"]["+colnames.size()+"]");
234
		//System.out.println("rownames size : "+rownames.size());
235
		//System.out.println("colnames size : "+colnames.size());
236
		this.data = new LexicalTableImpl(mat, rownames.toArray(new String[] {}), colnames
237
				.toArray(new String[] {}));
238
	}
239

  
120 240
	public ILexicalTable getData() {
121 241
		return data;
122 242
	}
......
140 260
	public Vector getRowMarginsVector() throws StatException {
141 261
		return data.getRowMarginsVector();
142 262
	}
263

  
264
	public int getNRows() {
265
		return data.getNRows();
266
	}
267

  
268
	public Vector getRow(int i) throws StatException {
269
		return data.getRow(i);
270
	}
271

  
272
	public void toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
273
		data.toTxt(outfile, encoding, colseparator, txtseparator);
274
	}
143 275
}
tmp/org.txm.rcp/META-INF/MANIFEST.MF (revision 315)
5 5
Bundle-Version: 0.7.8.qualifier
6 6
Bundle-Activator: org.txm.rcpapplication.Activator
7 7
Bundle-Vendor: %Bundle-Vendor
8
Require-Bundle: org.eclipse.ui,
8
Require-Bundle: org.txm.macro.core;bundle-version="1.0.0",
9
 org.eclipse.ui,
9 10
 org.eclipse.core.runtime,
10 11
 org.eclipse.core.filesystem;bundle-version="1.2.0",
11 12
 org.eclipse.ui.ide,
......
77 78
 org.txm.libs.batik;bundle-version="0.0.0",
78 79
 org.txm.lexicaltable.rcp;bundle-version="1.0.0",
79 80
 org.txm.lexicon.core;bundle-version="1.0.0",
80
 org.txm.lexicon.rcp
81
 org.txm.lexicon.rcp,
82
 org.txm.referencer.core,
83
 org.txm.concordance.core;bundle-version="1.0.0",
84
 org.txm.chartsengine.core;bundle-version="1.0.0",
85
 org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
86
 org.txm.chartsengine.r.core;bundle-version="1.0.0",
87
 org.txm.chartsengine.rcp;bundle-version="1.0.0",
88
 org.txm.chartsengine.svgbatik.rcp;bundle-version="1.0.0",
89
 org.txm.libs.itext;bundle-version="2.1.5",
90
 org.txm.libs.jfreesvg;bundle-version="1.7.0",
91
 org.txm.ca.rcp;bundle-version="1.0.0",
92
 org.txm.cah.rcp;bundle-version="1.0.0",
93
 org.txm.partition.rcp;bundle-version="1.0.0"
81 94
Bundle-ActivationPolicy: lazy
82 95
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
83 96
Export-Package: junit.extensions,
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/TXMPreferencePage.java (revision 315)
80 80
			super.performOk();
81 81
			((ScopedPreferenceStore) this.getPreferenceStore()).save();
82 82
			// FIXME: to remove after the plug-ins split
83
			org.txm.Toolbox.updateProperties(org.txm.rcpapplication.ApplicationWorkbenchAdvisor.getProperties());
83
			//Toolbox.updateProperties(org.txm.rcpapplication.ApplicationWorkbenchAdvisor.getProperties());
84 84
		} catch (Exception e) {
85 85
			System.err.println(org.txm.rcpapplication.Messages.FAILED_TO_SAVE_PREFERENCES + e);
86 86
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/testers/ExpertEnabled.java (revision 315)
1 1
package org.txm.rcp.testers;
2 2

  
3 3
import org.eclipse.core.expressions.PropertyTester;
4
import org.txm.core.preferences.TBXPreferences;
4 5
import org.txm.rcpapplication.TxmPreferences;
5 6
import org.txm.rcpapplication.preferences.AdvancePreferencePage;
6 7

  
......
13 14
	public boolean test(Object receiver, String property, Object[] args,
14 15
			Object expectedValue) {
15 16

  
16
		boolean expert = TxmPreferences.getBoolean(AdvancePreferencePage.EXPERT_USER);
17
		boolean expert = TxmPreferences.getBoolean(TBXPreferences.EXPERT_USER);
17 18
		//System.out.println("IS expert enabled: "+expert);
18 19
		return expert;
19 20
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/link/IndexToLexicalTable.java (revision 315)
43 43
import org.eclipse.ui.dialogs.ListSelectionDialog;
44 44
import org.eclipse.ui.handlers.HandlerUtil;
45 45
import org.txm.index.core.functions.Index;
46
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
46
import org.txm.lexicaltable.core.functions.LexicalTable;
47
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
47 48
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
48 49
import org.txm.lexicaltable.rcp.editors.LexicalTableEditorInput;
49 50
import org.txm.rcp.handlers.BaseAbstractHandler;
......
116 117
		}
117 118
		
118 119
		try {
119
			table = LexicalTableImpl.createLexicalTableImpl(voc, QuantitativeDataStructureImpl
120
			table = new LexicalTable(voc, QuantitativeDataStructureImpl
120 121
					.createSymbole(LexicalTableImpl.class));
121 122
		} catch (RWorkspaceException e) {
122 123
			// TODO Auto-generated catch block
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/link/TextToConcordance.java (revision 315)
30 30
import org.eclipse.core.commands.AbstractHandler;
31 31
import org.eclipse.core.commands.ExecutionEvent;
32 32
import org.eclipse.core.commands.ExecutionException;
33
import org.eclipse.jface.text.ITextSelection;
34
import org.eclipse.jface.viewers.ISelection;
35
import org.eclipse.jface.viewers.IStructuredSelection;
36 33
import org.eclipse.osgi.util.NLS;
37 34
import org.eclipse.ui.IEditorPart;
38 35
import org.eclipse.ui.IWorkbenchPage;
......
41 38
import org.eclipse.ui.handlers.HandlerUtil;
42 39
import org.txm.rcpapplication.Messages;
43 40
import org.txm.rcpapplication.editors.IEditionEditor;
44
import org.txm.rcpapplication.editors.TXMBrowser;
45 41
import org.txm.rcpapplication.editors.concordances.ConcordancesEditor;
46 42
import org.txm.rcpapplication.editors.input.ConcordancesEditorInput;
47 43
import org.txm.searchengine.cqp.corpus.Corpus;
48
import org.txm.tokenizer.TokenizerClasses;
49 44

  
50 45
// TODO: Auto-generated Javadoc
51 46
/**
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/R/OpenEmptyEditor.java (revision 315)
34 34
import org.eclipse.core.commands.ExecutionEvent;
35 35
import org.eclipse.core.commands.ExecutionException;
36 36
import org.eclipse.osgi.util.NLS;
37
import org.txm.Toolbox;
37
import org.txm.core.preferences.TBXPreferences;
38 38
import org.txm.rcpapplication.Messages;
39 39
import org.txm.rcpapplication.TxmPreferences;
40 40
import org.txm.rcpapplication.commands.EditFile;
......
51 51
	 */
52 52
	@Override
53 53
	public Object execute(ExecutionEvent event) throws ExecutionException {
54
		File txmhome = new File(TxmPreferences.getString(Toolbox.USER_TXM_HOME, "")); //$NON-NLS-1$
54
		File txmhome = new File(TxmPreferences.getString(TBXPreferences.USER_TXM_HOME, "")); //$NON-NLS-1$
55 55
		File scripts = new File(txmhome, "scripts"); //$NON-NLS-1$
56 56
		scripts.mkdir();
57 57
		if (!scripts.exists())
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/tests/TestImports.java (revision 315)
43 43
import org.eclipse.swt.widgets.Shell;
44 44
import org.eclipse.ui.handlers.HandlerUtil;
45 45
import org.txm.Toolbox;
46
import org.txm.core.preferences.TBXPreferences;
46 47
import org.txm.objects.BaseParameters;
47 48
import org.txm.rcpapplication.JobsTimer;
48 49
import org.txm.rcpapplication.commands.ExecuteImportScript;
......
82 83
	 */
83 84
	@Override
84 85
	public Object execute(ExecutionEvent event) throws ExecutionException {
85
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
86
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
86 87
		final File scriptsdir = new File(txmhome, "scripts/import");
87 88
		// final File sourcesdir = new
88 89
		// File(System.getProperty("user.home"),"xml/TESTS");
......
130 131
			protected IStatus run(IProgressMonitor monitor) {
131 132
				this.runInit(monitor);
132 133
				try {
133
					String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
134
					String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
134 135
					File outDir = new File(txmhome, "results/TESTS-imports");
135 136
					outDir.mkdirs();
136 137
					ArrayList<File> missings = new ArrayList<File>();
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/EditFile.java (revision 315)
34 34
import org.eclipse.core.commands.ExecutionException;
35 35
import org.eclipse.core.filesystem.EFS;
36 36
import org.eclipse.core.filesystem.IFileStore;
37
import org.eclipse.jface.viewers.ISelection;
38
import org.eclipse.jface.viewers.IStructuredSelection;
39 37
import org.eclipse.swt.SWT;
40 38
import org.eclipse.swt.widgets.FileDialog;
41 39
import org.eclipse.swt.widgets.Shell;
......
46 44
import org.eclipse.ui.handlers.HandlerUtil;
47 45
import org.eclipse.ui.ide.FileStoreEditorInput;
48 46
import org.txm.Toolbox;
47
import org.txm.core.preferences.TBXPreferences;
49 48
import org.txm.rcpapplication.editors.TxtEditor;
50 49
import org.txm.rcpapplication.swt.dialog.LastOpened;
51 50
import org.txm.utils.logger.Log;
......
66 65
	public Object execute(ExecutionEvent event) throws ExecutionException {
67 66

  
68 67
		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
69
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
68
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
70 69

  
71 70
		FileDialog dialog = new FileDialog(shell, SWT.OPEN);
72 71
		if (LastOpened.getFile(ID) != null) {
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/annotation/ExportStandoff.java (revision 315)
35 35
import org.eclipse.core.runtime.IProgressMonitor;
36 36
import org.eclipse.core.runtime.IStatus;
37 37
import org.eclipse.core.runtime.Status;
38
import org.eclipse.jface.dialogs.MessageDialog;
39 38
import org.eclipse.jface.viewers.ISelection;
40 39
import org.eclipse.jface.viewers.IStructuredSelection;
41 40
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.widgets.DirectoryDialog;
43
import org.eclipse.swt.widgets.Display;
44 41
import org.eclipse.swt.widgets.FileDialog;
45 42
import org.eclipse.swt.widgets.Shell;
46 43
import org.eclipse.ui.handlers.HandlerUtil;
47 44
import org.txm.Toolbox;
48 45
import org.txm.annotation.AnnotationManager;
46
import org.txm.core.preferences.TBXPreferences;
49 47
import org.txm.rcpapplication.Messages;
50 48
import org.txm.rcpapplication.StatusLine;
51 49
import org.txm.rcpapplication.swt.dialog.LastOpened;
......
82 80
		//FileDialog dialog = new FileDialog(shell, SWT.SAVE);
83 81
		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
84 82
		MainCorpus corpus = (MainCorpus) s;
85
		String path = Toolbox.getParam(Toolbox.USER_TXM_HOME);
83
		String path = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
86 84
		dialog.setFilterPath(path); //To set a specific path
87 85
		dialog.setFileName(corpus.getName()+"_annotations.zip");
88 86
		dialog.setFilterExtensions(new String[]{"*.zip"});
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ExecuteGroovyMacro.java (revision 315)
44 44
import org.eclipse.ui.handlers.HandlerUtil;
45 45
import org.eclipse.ui.ide.FileStoreEditorInput;
46 46
import org.txm.Toolbox;
47
import org.txm.core.preferences.TBXPreferences;
47 48
import org.txm.rcpapplication.editors.TxtEditor;
48 49
import org.txm.rcpapplication.swt.dialog.LastOpened;
49 50
// TODO: Auto-generated Javadoc
......
96 97
			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
97 98

  
98 99
			IPreferencesService service = Platform.getPreferencesService();
99
			String scriptRootDir = Toolbox.getParam(Toolbox.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
100
			String scriptRootDir = Toolbox.getParam(TBXPreferences.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
100 101

  
101 102
			dialog.setFilterPath(scriptRootDir);
102 103
			result = dialog.open();
......
110 111
	
111 112
	public static void execute(String scriptpath, IWorkbenchPart page, ISelection selection) {
112 113
		IPreferencesService service = Platform.getPreferencesService();
113
		String scriptRootDir = Toolbox.getParam(Toolbox.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
114
		String scriptRootDir = Toolbox.getParam(TBXPreferences.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
114 115
		File currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
115 116
		
116 117
		ExecuteGroovyScript.executeScript(currentRootDir, scriptpath, page, selection, false);
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/base/DeleteObject.java (revision 315)
54 54
import org.txm.functions.concordances.Concordance;
55 55
//import org.txm.functions.queryindex.QueryIndex;
56 56
import org.txm.functions.referencer.Referencer;
57
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
57
import org.txm.lexicaltable.core.functions.LexicalTable;
58 58
import org.txm.objects.TxmObject;
59 59
import org.txm.rcp.editors.TXMEditorPart;
60 60
import org.txm.rcpapplication.Messages;
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/base/ExportCorpus.java (revision 315)
43 43
import org.eclipse.swt.widgets.Shell;
44 44
import org.eclipse.ui.handlers.HandlerUtil;
45 45
import org.txm.Toolbox;
46
import org.txm.core.preferences.TBXPreferences;
46 47
import org.txm.rcpapplication.Messages;
47
import org.txm.rcpapplication.swt.dialog.ConfirmDialog;
48 48
import org.txm.rcpapplication.swt.dialog.LastOpened;
49 49
import org.txm.rcpapplication.utils.JobHandler;
50 50
import org.txm.searchengine.cqp.corpus.MainCorpus;
......
77 77
		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
78 78
				.getShell();
79 79

  
80
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
80
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
81 81
		if (!(selection.getFirstElement() instanceof MainCorpus))
82 82
			return null;
83 83

  
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/CreateFolder.java (revision 315)
32 32
import org.eclipse.core.commands.AbstractHandler;
33 33
import org.eclipse.core.commands.ExecutionEvent;
34 34
import org.eclipse.core.commands.ExecutionException;
35
import org.eclipse.core.runtime.Platform;
36
import org.eclipse.core.runtime.preferences.IPreferencesService;
37 35
import org.eclipse.jface.viewers.ISelection;
38 36
import org.eclipse.jface.viewers.IStructuredSelection;
39 37
import org.eclipse.osgi.util.NLS;
......
42 40
import org.eclipse.swt.widgets.Shell;
43 41
import org.eclipse.ui.IWorkbenchPart;
44 42
import org.eclipse.ui.handlers.HandlerUtil;
45
import org.txm.Toolbox;
46
import org.txm.rcpapplication.Application;
43
import org.txm.core.preferences.TBXPreferences;
47 44
import org.txm.rcpapplication.Messages;
48 45
import org.txm.rcpapplication.TxmPreferences;
49
import org.txm.rcpapplication.preferences.ScriptPreferenceInitializer;
50
import org.txm.rcpapplication.preferences.ScriptPreferencePage;
51 46
import org.txm.rcpapplication.swt.dialog.LastOpened;
52 47
import org.txm.rcpapplication.views.fileexplorer.Explorer;
53 48
import org.txm.rcpapplication.views.fileexplorer.MacroExplorer;
......
67 62
				.getActivePage().getActivePart();
68 63

  
69 64
		//get scripts dir
70
		String dir = TxmPreferences.getString(Toolbox.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
65
		String dir = TxmPreferences.getString(TBXPreferences.USER_TXM_HOME, System.getProperty("user.home")); //$NON-NLS-1$
71 66

  
72 67
		//if selection is a file, get its path
73 68
		ISelection selection = HandlerUtil.getCurrentSelection(event);
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/OpenBrowser.java (revision 315)
30 30
import java.io.File;
31 31
import java.net.MalformedURLException;
32 32
import java.net.URL;
33
import java.util.Iterator;
34 33

  
35 34
import org.eclipse.core.commands.AbstractHandler;
36 35
import org.eclipse.core.commands.ExecutionEvent;
......
48 47
import org.eclipse.ui.internal.browser.BrowserViewer;
49 48
import org.eclipse.ui.internal.browser.WebBrowserEditorInput;
50 49
import org.txm.Toolbox;
50
import org.txm.core.preferences.TBXPreferences;
51 51
import org.txm.rcpapplication.Messages;
52 52
import org.txm.rcpapplication.editors.TXMBrowser;
53 53
import org.txm.rcpapplication.editors.TXMWebBrowserEditor;
......
98 98

  
99 99
		if (file == null) {
100 100
			FileDialog dialog = new FileDialog(shell, SWT.OPEN);
101
			String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
101
			String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
102 102
			if (LastOpened.getFile(ID) != null) {
103 103
				dialog.setFilterPath(LastOpened.getFolder(ID));
104 104
				dialog.setFileName(LastOpened.getFile(ID));
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeInterTextDistance.java (revision 315)
8 8
import org.eclipse.ui.handlers.HandlerUtil;
9 9
import org.rosuda.REngine.REXPMismatchException;
10 10
import org.txm.functions.intertextualdistance.InterTextDistance;
11
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
11
import org.txm.lexicaltable.core.functions.LexicalTable;
12 12
import org.txm.rcpapplication.utils.Logger;
13 13
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
14 14
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
......
37 37
		if (!(s instanceof LexicalTable))
38 38
			return null;
39 39
		LexicalTable table = (LexicalTable) s;
40
		InterTextDistance dist = new InterTextDistance(table);
40
		InterTextDistance dist = new InterTextDistance(table.getData());
41 41

  
42 42
		try {
43 43
			dist.compute();
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ExportResult.java (revision 315)
49 49
import org.txm.functions.concordances.Concordance;
50 50
import org.txm.functions.referencer.Referencer;
51 51
import org.txm.index.core.functions.Index;
52
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
52
import org.txm.lexicaltable.core.functions.LexicalTable;
53 53
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
54 54
import org.txm.progression.core.functions.Progression;
55 55
import org.txm.rcpapplication.JobsTimer;
......
88 88
		final Object s = selection.getFirstElement();
89 89
		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
90 90

  
91
		//String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
91
		//String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
92 92
		FileDialog dialog = new FileDialog(shell, SWT.SAVE);
93 93

  
94 94
		String extensions[] = {"*.csv"}; //$NON-NLS-1$
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeDiagnostic.java (revision 315)
42 42
import org.eclipse.swt.widgets.Shell;
43 43
import org.eclipse.ui.handlers.HandlerUtil;
44 44
import org.txm.Toolbox;
45
import org.txm.core.preferences.TBXPreferences;
45 46
import org.txm.functions.diagnostic.Diagnostic;
46 47
import org.txm.rcpapplication.JobsTimer;
47 48
import org.txm.rcpapplication.Messages;
......
92 93
		
93 94
		final Corpus corpus = (Corpus) selection.getFirstElement();
94 95

  
95
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
96
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
96 97
		if (!new File(txmhome, "informations").exists()) //$NON-NLS-1$
97 98
			new File(txmhome, "informations").mkdir(); //$NON-NLS-1$
98 99
		String filename = corpus.getParent().getName()+"-"+corpus.getName(); //$NON-NLS-1$
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ExportSVG.java (revision 315)
38 38
import org.eclipse.swt.widgets.FileDialog;
39 39
import org.eclipse.swt.widgets.Shell;
40 40
import org.txm.Toolbox;
41
import org.txm.core.preferences.TBXPreferences;
41 42
import org.txm.rcpapplication.Messages;
42 43
import org.txm.rcpapplication.swt.dialog.LastOpened;
43 44
import org.txm.utils.io.FileCopy;
......
60 61
//			System.out.println(Messages.ExportSVG_0);
61 62
//			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
62 63
//
63
//			String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
64
//			String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
64 65
//
65 66
//			// get editor
66 67
//			IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event)
......
150 151
	public static void export(File infile) {
151 152
		// Shell shell =
152 153
		// HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
153
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
154
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
154 155
		FileDialog dialog = new FileDialog(new Shell(), SWT.SAVE);
155 156
		if (LastOpened.getFile(ID) != null) {
156 157
			dialog.setFilterPath(LastOpened.getFolder(ID));
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeIntersection.java (revision 315)
11 11
import org.eclipse.jface.viewers.ISelection;
12 12
import org.eclipse.jface.viewers.IStructuredSelection;
13 13
import org.eclipse.ui.handlers.HandlerUtil;
14
import org.rosuda.REngine.REXPMismatchException;
15 14
import org.txm.Toolbox;
16
import org.txm.functions.intertextualdistance.InterTextDistance;
17
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
18
import org.txm.rcpapplication.utils.Logger;
19 15
import org.txm.searchengine.cqp.AbstractCqiClient;
20
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
21
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
22 16
import org.txm.searchengine.cqp.corpus.Corpus;
23 17
import org.txm.searchengine.cqp.corpus.CqpObject;
24 18
import org.txm.searchengine.cqp.corpus.MainCorpus;
25 19
import org.txm.searchengine.cqp.corpus.Subcorpus;
26
import org.txm.statsengine.core.StatException;
27 20

  
28 21
public class ComputeIntersection extends AbstractHandler {
29 22

  
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/RestartTXM.java (revision 315)
63 63
				JobsTimer.start();
64 64
				try {
65 65
					monitor.beginTask(Messages.RestartTXM_1, 100);
66
					Toolbox.updateProperties(TxmPreferences.getProperties());
66
					//Toolbox.updateProperties(TxmPreferences.getProperties());
67 67
					Toolbox.restart();
68 68

  
69 69
					monitor.worked(95);
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/workspace/PurgeCorpora.java (revision 315)
4 4
import java.util.Arrays;
5 5
import java.util.List;
6 6

  
7
import org.txm.rcpapplication.Messages;
8
import org.txm.rcpapplication.StatusLine;
9
import org.txm.rcpapplication.commands.RestartTXM;
10
import org.txm.rcpapplication.utils.JobHandler;
11 7
import org.eclipse.core.commands.AbstractHandler;
12 8
import org.eclipse.core.commands.ExecutionEvent;
13 9
import org.eclipse.core.commands.ExecutionException;
......
22 18
import org.eclipse.swt.widgets.Shell;
23 19
import org.eclipse.ui.dialogs.ListSelectionDialog;
24 20
import org.txm.Toolbox;
21
import org.txm.core.preferences.TBXPreferences;
25 22
import org.txm.objects.Workspace;
23
import org.txm.rcpapplication.Messages;
24
import org.txm.rcpapplication.StatusLine;
25
import org.txm.rcpapplication.commands.RestartTXM;
26
import org.txm.rcpapplication.utils.JobHandler;
26 27
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
27 28
import org.txm.searchengine.cqp.corpus.CorpusManager;
28 29
import org.txm.searchengine.cqp.corpus.MainCorpus;
......
72 73
			return;
73 74
		}
74 75
		
75
		String path = Toolbox.getParam(Toolbox.USER_TXM_HOME);
76
		String path = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
76 77
		if (path == null || path.trim().length() == 0) {
77 78
			System.out.println(Messages.PurgeCorpora_4);
78 79
			return;
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/workspace/ConvertCorpus.java (revision 315)
13 13
import org.eclipse.swt.widgets.Shell;
14 14
import org.eclipse.ui.handlers.HandlerUtil;
15 15
import org.txm.Toolbox;
16
import org.txm.core.preferences.TBXPreferences;
16 17
import org.txm.importer.Convert5To6;
17 18
import org.txm.objects.Base;
18 19
import org.txm.rcpapplication.Messages;
19
import org.txm.rcpapplication.StatusLine;
20 20
import org.txm.rcpapplication.commands.RestartTXM;
21 21
import org.txm.rcpapplication.utils.JobHandler;
22
import org.txm.rcpapplication.views.QueriesView;
23
import org.txm.statsengine.r.rcp.views.RVariablesView;
24 22
import org.txm.utils.DeleteDir;
25 23

  
26 24
public class ConvertCorpus extends AbstractHandler {
......
33 31
				.getShell();
34 32
		DirectoryDialog dialog = new DirectoryDialog(shell);
35 33

  
36
		dialog.setFilterPath(Toolbox.getParam(Toolbox.USER_TXM_HOME));
34
		dialog.setFilterPath(Toolbox.getParam(TBXPreferences.USER_TXM_HOME));
37 35
		String path = dialog.open();
38 36

  
39
		final File corpora = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME),
37
		final File corpora = new File(Toolbox.getParam(TBXPreferences.USER_TXM_HOME),
40 38
				"corpora"); //$NON-NLS-1$
41 39
		final File indir = new File(path);
42 40
		final File outdir = new File(corpora, indir.getName() + 6);
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/workspace/RecodeCorpus.java (revision 315)
7 7
import java.util.logging.Level;
8 8
import java.util.regex.Pattern;
9 9

  
10
import javax.xml.stream.XMLStreamException;
11

  
10 12
import org.eclipse.core.commands.AbstractHandler;
11 13
import org.eclipse.core.commands.ExecutionEvent;
12 14
import org.eclipse.core.commands.ExecutionException;
......
20 22
import org.kohsuke.args4j.Option;
21 23
import org.txm.Toolbox;
22 24
import org.txm.annotation.conversion.CorpusRuledConvertion;
23
import org.txm.importer.xtz.ImportKeys;
25
import org.txm.core.preferences.TBXPreferences;
26
import org.txm.importer.ImportKeys;
24 27
import org.txm.objects.BaseParameters;
25 28
import org.txm.rcpapplication.commands.CloseEditorsUsing;
26 29
import org.txm.rcpapplication.commands.ExecuteImportScript;
......
82 85
		return corpus;
83 86
	}
84 87

  
85
	public static JobHandler recode(final MainCorpus corpus, CorpusRuledConvertion crc, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException {
88
	public static JobHandler recode(final MainCorpus corpus, CorpusRuledConvertion crc, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException, XMLStreamException {
86 89

  
87 90
		Property p1 = corpus.getProperty(oldType);
88 91
		if (p1 == null) {
......
102 105
		monitor.worked(1);
103 106
		
104 107
		// update corpus indexes and edition
105
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
108
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
106 109

  
107 110
		BaseParameters params = corpus.getBase().getBaseParameters();
108 111
		params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false"); //too soon
......
122 125
		return ret;
123 126
	}
124 127

  
125
	public static JobHandler recode(final MainCorpus corpus, LinkedHashMap<Pattern, String> rules, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException {
128
	public static JobHandler recode(final MainCorpus corpus, LinkedHashMap<Pattern, String> rules, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException, XMLStreamException {
126 129

  
127 130
		// apply conversion file
128 131
		CorpusRuledConvertion crc = new CorpusRuledConvertion(rules, newType, oldType);
129 132
		return recode(corpus, crc, oldType, newType , monitor);
130 133
	}
131 134

  
132
	public static JobHandler recode(final MainCorpus corpus, File conversionFile, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException {
135
	public static JobHandler recode(final MainCorpus corpus, File conversionFile, String oldType, String newType, IProgressMonitor monitor) throws IOException, CqiClientException, XMLStreamException {
133 136
		System.out.println("Create CorpusRuledConvertion with "+conversionFile);
134 137
		// apply conversion file
135 138
		CorpusRuledConvertion crc = new CorpusRuledConvertion(conversionFile, oldType, newType);
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/workspace/UpdateCorpus.java (revision 315)
11 11
import org.eclipse.swt.widgets.Display;
12 12
import org.eclipse.ui.handlers.HandlerUtil;
13 13
import org.txm.Toolbox;
14
import org.txm.importer.xtz.ImportKeys;
14
import org.txm.core.preferences.TBXPreferences;
15
import org.txm.importer.ImportKeys;
15 16
import org.txm.objects.BaseParameters;
16 17
import org.txm.rcpapplication.commands.CloseEditorsUsing;
17 18
import org.txm.rcpapplication.commands.ExecuteImportScript;
......
41 42
	
42 43
	public static JobHandler update(final MainCorpus corpus) {
43 44
		
44
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
45
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
45 46
		
46 47
		BaseParameters params = corpus.getBase().getBaseParameters();
47 48
		params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false"); //too soon
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/workspace/LoadBinaryCorpus.java (revision 315)
44 44
import org.eclipse.swt.widgets.Shell;
45 45
import org.eclipse.ui.handlers.HandlerUtil;
46 46
import org.txm.Toolbox;
47
import org.txm.core.preferences.TBXPreferences;
47 48
import org.txm.objects.Base;
48 49
import org.txm.objects.Project;
49 50
import org.txm.objects.Workspace;
......
131 132
	public boolean loadBinaryCorpusArchive(final File zipFile) throws ExecutionException {
132 133

  
133 134
		String filename = zipFile.getName();
134
		final File corporaDir = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora"); //$NON-NLS-1$
135
		final File corporaDir = new File(Toolbox.getParam(TBXPreferences.USER_TXM_HOME), "corpora"); //$NON-NLS-1$
135 136
		corporaDir.mkdir();
136 137

  
137 138
		if (!filename.endsWith(".txm") && !filename.endsWith(".zip")) { //$NON-NLS-1$ //$NON-NLS-2$
......
204 205
					monitor.subTask(Messages.AddBase_33);
205 206

  
206 207
					this.acquireSemaphore();
207
					org.txm.Toolbox.updateProperties(org.txm.rcpapplication.ApplicationWorkbenchAdvisor
208
							.getProperties());
208
					//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
209 209
					org.txm.Toolbox.restartWorkspace();
210 210
					org.txm.Toolbox.restartSearchEngine();
211 211
					this.releaseSemaphore();
......
288 288
			return null; 
289 289
		}
290 290

  
291
		//File txmregistry = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "registry"); //$NON-NLS-1$
291
		//File txmregistry = new File(Toolbox.getParam(TBXPreferences.USER_TXM_HOME), "registry"); //$NON-NLS-1$
292 292
		//txmregistry.mkdir();
293
		File txmcorpora = new File(Toolbox.getParam(Toolbox.USER_TXM_HOME), "corpora"); //$NON-NLS-1$
293
		File txmcorpora = new File(Toolbox.getParam(TBXPreferences.USER_TXM_HOME), "corpora"); //$NON-NLS-1$
294 294
		txmcorpora.mkdir();
295 295

  
296 296
		Workspace w = org.txm.Toolbox.workspace;
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ExecuteLastGroovyScript.java (revision 315)
32 32
import org.eclipse.core.commands.AbstractHandler;
33 33
import org.eclipse.core.commands.ExecutionEvent;
34 34
import org.eclipse.core.commands.ExecutionException;
35
import org.eclipse.core.runtime.Platform;
36
import org.eclipse.core.runtime.preferences.IPreferencesService;
37 35
import org.eclipse.jface.viewers.ISelection;
38
import org.eclipse.jface.viewers.IStructuredSelection;
39 36
import org.eclipse.ui.IWorkbenchPart;
40 37
import org.eclipse.ui.handlers.HandlerUtil;
41 38
import org.txm.Toolbox;
42
import org.txm.rcpapplication.Application;
39
import org.txm.core.preferences.TBXPreferences;
43 40
import org.txm.rcpapplication.Messages;
44
import org.txm.rcpapplication.preferences.ScriptPreferenceInitializer;
45
import org.txm.rcpapplication.preferences.ScriptPreferencePage;
46 41
// TODO: Auto-generated Javadoc
47 42
/**
48 43
 * Handler: execute a Macro (Groovy script that opens an UI for parameters)
......
87 82
			System.out.println(Messages.ExecuteLastGroovyScript_1+lastScript);
88 83
		
89 84
		//IPreferencesService service = Platform.getPreferencesService();
90
		String scriptRootDir = Toolbox.getParam(Toolbox.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
85
		String scriptRootDir = Toolbox.getParam(TBXPreferences.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
91 86
		File currentRootDir;
92 87
		if (macro) {
93 88
			currentRootDir = new File(scriptRootDir, "macro"); //$NON-NLS-1$
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ExecuteImportScript.java (revision 315)
51 51
import org.eclipse.swt.widgets.Shell;
52 52
import org.eclipse.ui.handlers.HandlerUtil;
53 53
import org.txm.Toolbox;
54
import org.txm.importer.xtz.ImportKeys;
54
import org.txm.core.preferences.TBXPreferences;
55
import org.txm.importer.ImportKeys;
55 56
import org.txm.objects.Base;
56 57
import org.txm.objects.BaseParameters;
57 58
import org.txm.rcpapplication.Application;
......
100 101
		} else {
101 102
			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
102 103
			FileDialog dialog = new FileDialog(shell, SWT.SAVE);
103
			dialog.setFilterPath(Toolbox.getParam(Toolbox.USER_TXM_HOME)+"/scripts/import");
104
			dialog.setFilterPath(Toolbox.getParam(TBXPreferences.USER_TXM_HOME)+"/scripts/import");
104 105
			filepath = dialog.open();
105 106
		}
106 107
		
......
145 146
			public void run() {	StatusLine.setMessage(Messages.ExecuteScriptImport_0); }
146 147
		});
147 148

  
148
		final String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
149
		final String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
149 150
		final File corporadir = new File(txmhome,"corpora"); //$NON-NLS-1$
150 151
		corporadir.mkdir(); // the binary corpus are stored here
151 152
		if (!corporadir.exists()) {
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ImportSelectedText.java (revision 315)
44 44
import org.eclipse.osgi.util.NLS;
45 45
import org.eclipse.swt.widgets.Shell;
46 46
import org.txm.Toolbox;
47
import org.txm.core.preferences.TBXPreferences;
47 48
import org.txm.objects.BaseParameters;
48 49
import org.txm.objects.Project;
49 50
import org.txm.rcpapplication.Messages;
......
112 113
			System.err.println(Messages.ImportSelectedText_2);
113 114
			return null;
114 115
		}
115
		String txmhome = Toolbox.getParam(Toolbox.USER_TXM_HOME);
116
		String txmhome = Toolbox.getParam(TBXPreferences.USER_TXM_HOME);
116 117
		new File(txmhome, "clipboard").mkdir(); //$NON-NLS-1$
117 118
		File clipboardDirectory = new File(txmhome, "clipboard/" + basename); //$NON-NLS-1$
118 119
		
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/ExecuteGroovyScript.java (revision 315)
31 31

  
32 32
import java.io.File;
33 33
import java.io.FilenameFilter;
34
import java.io.IOException;
35 34
import java.net.MalformedURLException;
36
import java.util.ArrayList;
37
import java.util.HashMap;
38
import java.util.HashSet;
39 35
import java.util.Iterator;
40 36
import java.util.List;
41 37

  
42 38
import org.eclipse.core.commands.AbstractHandler;
43 39
import org.eclipse.core.commands.ExecutionEvent;
44 40
import org.eclipse.core.commands.ExecutionException;
45
import org.eclipse.core.internal.runtime.InternalPlatform;
46
import org.eclipse.core.runtime.FileLocator;
47 41
import org.eclipse.core.runtime.IProgressMonitor;
48 42
import org.eclipse.core.runtime.IStatus;
49 43
import org.eclipse.core.runtime.Platform;
......
58 52
import org.eclipse.ui.IWorkbenchPart;
59 53
import org.eclipse.ui.handlers.HandlerUtil;
60 54
import org.eclipse.ui.ide.FileStoreEditorInput;
61
import org.osgi.framework.Bundle;
62
import org.osgi.framework.BundleContext;
63
import org.osgi.framework.wiring.BundleWiring;
64 55
import org.txm.Toolbox;
56
import org.txm.core.preferences.TBXPreferences;
65 57
import org.txm.rcpapplication.Messages;
66
import org.txm.rcpapplication.TXMClassLoader;
67 58
import org.txm.rcpapplication.editors.TxtEditor;
68 59
import org.txm.rcpapplication.swt.dialog.LastOpened;
69 60
import org.txm.rcpapplication.swt.widget.parameters.UIParameterException;
70 61
import org.txm.rcpapplication.utils.GSERunner;
71 62
import org.txm.rcpapplication.utils.JobHandler;
72 63
import org.txm.rcpapplication.views.corpora.CorporaView;
73
import org.txm.utils.logger.Log;
74 64
// TODO: Auto-generated Javadoc
75 65
/**
76 66
 * Execute a Groovy script
......
126 116
			dialog.setFilterExtensions(new String[] { "*.groovy" }); //$NON-NLS-1$
127 117

  
128 118
			IPreferencesService service = Platform.getPreferencesService();
129
			String scriptCurrentDir = Toolbox.getParam(Toolbox.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
119
			String scriptCurrentDir = Toolbox.getParam(TBXPreferences.USER_TXM_HOME) + "/scripts"; //$NON-NLS-1$
130 120

  
131 121
			dialog.setFilterPath(scriptCurrentDir);
132 122
			result = dialog.open();
......
151 141
		//				ScriptPreferencePage.SCRIPT_ROOT_DIR,
152 142
		//				ScriptPreferenceInitializer.SCRIPT_ROOT_DIR_DEFAULT, null);
153 143
		//		
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff