Révision 1508

tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 1508)
53 53
import org.eclipse.swt.widgets.TableColumn;
54 54
import org.txm.Toolbox;
55 55
import org.txm.core.messages.TXMCoreMessages;
56
import org.txm.core.preferences.TBXPreferences;
56 57
import org.txm.core.results.Parameter;
57 58
import org.txm.index.core.functions.PartitionIndex;
58 59
import org.txm.lexicaltable.core.functions.LexicalTable;
......
644 645
	 @Deprecated
645 646
	public void importData(File file) {
646 647
		try {
648
			String encoding = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_ENCODING);
649
			String colseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR);
650
			String txtseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_TXT_SEPARATOR);
647 651
			
648
			if (lexicalTable.getData().importData(file)) {
652
			if (lexicalTable.getData().importData(file, encoding, colseparator, txtseparator)) {
649 653
				lexicalTable.setAltered();
650 654
				// fix col names
651 655
				String[] colnames = lexicalTable.getColNames().asStringsArray();
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ImportTable.java (revision 1508)
39 39
import org.eclipse.ui.IWorkbenchPart;
40 40
import org.eclipse.ui.handlers.HandlerUtil;
41 41
import org.rosuda.REngine.REXPMismatchException;
42
import org.txm.core.preferences.TBXPreferences;
43
import org.txm.core.preferences.TXMPreferences;
42 44
import org.txm.lexicaltable.core.functions.LexicalTable;
43 45
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor;
44 46
import org.txm.rcp.handlers.BaseAbstractHandler;
......
63 65
		
64 66
		Object sel = this.getCorporaViewSelectedObject(event);
65 67
		
68
		String encoding = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_ENCODING);
69
		String colseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_COL_SEPARATOR);
70
		String txtseparator = TBXPreferences.getInstance().getString(TBXPreferences.EXPORT_TXT_SEPARATOR);
71
		
66 72
		if (editor instanceof LexicalTableEditor) {
67 73
			LexicalTableEditor LTeditor = (LexicalTableEditor) editor;
68 74
			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
......
96 102
				if (file.exists()) {
97 103
					try {
98 104
						lt.compute();
99
						lt.getData().importData(file);
105
						lt.getData().importData(file, encoding, colseparator, txtseparator);
100 106
						lt.setAltered();
101 107
						System.out.println(NLS.bind("Data imported: {0} columns and {1} rows.",lt.getNColumns(), lt.getNRows()));
102 108
					} catch (Exception e) {
tmp/org.txm.lexicaltable.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 1508)
7 7

  
8 8
command.name.39 = \u042D\u043A\u0441\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443
9 9

  
10
command.name.40 = \u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443
10
command.name.40 = \u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u0430\u0431\u043B\u0438\u0446\u0443...
11 11

  
12 12
command.tooltip = \u0421\u043B\u043E\u0432\u0430\u0440\u043D\u0430\u044F \u0442\u0430\u0431\u043B\u0438\u0446\u0430
13 13

  
tmp/org.txm.lexicaltable.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 1508)
7 7

  
8 8
command.name.39 = Exporter la table pour r\u00E9-import
9 9

  
10
command.name.40 = Importer une table
10
command.name.40 = Importer une table lexicale depuis un fichier...
11 11

  
12 12
command.tooltip = Calculer une table lexicale
13 13

  
tmp/org.txm.lexicaltable.rcp/OSGI-INF/l10n/bundle.properties (revision 1508)
7 7

  
8 8
command.name.39 = Export table to re-import
9 9

  
10
command.name.40 = Import Table
10
command.name.40 = Import Table from file...
11 11

  
12 12
command.tooltip = Compute lexical table
13 13

  
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/data/ILexicalTable.java (revision 1508)
203 203
	 *
204 204
	 * @param file the file
205 205
	 */
206
	public abstract boolean importData(File file) throws RWorkspaceException, REXPMismatchException;
206
	public abstract boolean importData(File file, String encoding, String colseparator, String txtseparator) throws RWorkspaceException, REXPMismatchException;
207 207

  
208 208
	public abstract void sortByFreqs(boolean reverse) throws Exception;
209 209

  
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 1508)
251 251
command.name.38         = Fusionner
252 252
command.name.39         = Exporter la table
253 253
command.name.4          = Sp\u00E9cificit\u00E9s
254
command.name.40         = Importer une table
254
command.name.40         = Importer table lexicale depuis un fichier...
255 255
command.name.41         = CoocToConc
256 256
command.name.42         = VocToProgress
257 257
command.name.43         = VocToLexicalTable
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java (revision 1508)
600 600
	 * @throws RWorkspaceException 
601 601
	 * @throws REXPMismatchException 
602 602
	 */
603
	public boolean importData(File f) throws RWorkspaceException, REXPMismatchException {
603
	public boolean importData(File f, String encoding, String colseparator, String txtseparator) throws RWorkspaceException, REXPMismatchException {
604 604

  
605 605
		String path = f.getAbsolutePath();
606 606

  
......
615 615
t3 <- t2[1:nrow(t2),];
616 616
colnames(t3) <- header;
617 617
 */
618
		rw.voidEval("tmpmat <- as.matrix(read.table(file=\"" + path + "\", row.names=1, skip=1, fileEncoding=\"UTF-8\"));"); //$NON-NLS-1$ //$NON-NLS-2$
619
		rw.voidEval("tmpheader <- scan(file=\"" + path + "\", what = character(), nlines=1, sep=\"\t\", fileEncoding=\"UTF-8\");"); //$NON-NLS-1$ //$NON-NLS-2$
618
		rw.voidEval("tmpmat <- as.matrix(read.table(file=\"" + path + "\", quote=\""+txtseparator.replace("\"", "\\\"")+"\", sep=\""+colseparator+"\", row.names=1, skip=1, fileEncoding=\""+encoding+"\"));"); //$NON-NLS-1$ //$NON-NLS-2$
619
		rw.voidEval("tmpheader <- scan(file=\"" + path + "\", what = character(), nlines=1, quote=\""+txtseparator.replace("\"", "\\\"")+"\", sep=\""+colseparator+"\", fileEncoding=\""+encoding+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
620 620
		rw.voidEval("tmpheader <- tmpheader[2:length(tmpheader)];"); //$NON-NLS-1$
621 621
		rw.voidEval("tmpmat <- tmpmat[1:nrow(tmpmat),];"); //$NON-NLS-1$
622 622
		rw.voidEval("colnames(tmpmat) <- tmpheader"); //$NON-NLS-1$

Formats disponibles : Unified diff