Révision 3389

TXM/trunk/org.txm.whatsnew.rcp/plugin.xml (revision 3389)
35 35
            category="org.txm.rcp.preferences.UserPreferencePage"
36 36
            class="org.txm.whatsnew.rcp.NewsPreferencesPage"
37 37
            id="org.txm.whatsnew.rcp.NewsPreferencesPage"
38
            name="New setups">
38
            name="New version">
39 39
      </page>
40 40
   </extension>
41 41
   <extension
TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 3389)
1494 1494
				if (queryWidgetInitBackground != null) queryWidget.setBackground(queryWidgetInitBackground);
1495 1495
			}
1496 1496
			
1497
			if (update) {
1497
			if (!update) {
1498 1498
				resetColumnWidths();
1499 1499
			}
1500 1500
		}
......
2322 2322
	 */
2323 2323
	public int resetRightTableColumnWidths() {
2324 2324
		
2325
		float W = 1f + queryLabel.getSize().x / (float) queryLabel.getText().length();
2325
		//float W = 1f + queryLabel.getSize().x / (float) queryLabel.getText().length(); // does nto work until the label is drawn
2326
		float W = queryLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).x / (float) queryLabel.getText().length();
2326 2327
		
2328
		
2327 2329
		int n = 0;
2328 2330
		TableColumn[] columns = viewerRight.getTable().getColumns();
2329 2331
		for (int i = 0; i < columns.length; i++) {
......
2331 2333
			if (column.getWidth() == 0) continue; // skip closed columns
2332 2334
			
2333 2335
			int max = column.getText().length();
2336
			//System.out.println("initial max of '"+column.getText()+"' = "+max);
2334 2337
			if (max == 0) continue; // skip no-title columns
2335 2338
			
2336 2339
			n = 0;
2337 2340
			for (TableItem item : viewerRight.getTable().getItems()) {
2338
				if (max < item.getText(i).length()) max = item.getText(i).length();
2341
				if (max < item.getText(i).length()) {
2342
					max = item.getText(i).length();
2343
					//System.out.println("update max with '"+item.getText(i)+"' at "+i+" = "+max);
2344
				}
2339 2345
				if (n++ > 100) break; // stop testing after 100 lines
2340 2346
			}
2341 2347
			
......
2345 2351
			
2346 2352
			int s = 15 + (int) (max * W);
2347 2353
			column.setWidth(s);
2348
//			System.out.println(column.getText()+"SIZE="+s);
2354
			//System.out.println(column.getText()+"SIZE="+s);
2349 2355
		}
2350 2356
		
2351 2357
		viewerRight.getTable().layout(true, true);
......
2365 2371
	public int resetColumnWidths() {
2366 2372
		if (!concordance.hasBeenComputedOnce()) return 0;
2367 2373
		
2368
		
2369 2374
		resetLeftTableColumnWidths();
2370 2375
		int c = resetRightTableColumnWidths();
2371 2376
		getResultArea().layout(true, true);
TXM/trunk/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 3389)
15 15
import org.eclipse.swt.widgets.Menu;
16 16
import org.eclipse.swt.widgets.MenuItem;
17 17
import org.eclipse.swt.widgets.Spinner;
18
import org.eclipse.swt.widgets.Text;
18 19
import org.eclipse.swt.widgets.ToolItem;
19 20
import org.txm.ca.core.functions.CA;
20 21
import org.txm.ca.core.preferences.CAPreferences;
......
101 102
	 */
102 103
	@Parameter(key = TXMPreferences.V_MAX)
103 104
	protected Spinner vMaxSpinner;
105

  
106
	@Parameter(key = CAPreferences.ROW_SUP_NAMES)
107
	private Text supRowNamesText;
108

  
109
	@Parameter(key = CAPreferences.COL_SUP_NAMES)
110
	private Text supColNamesText;
104 111
	
105 112
	/**
106 113
	 *
......
357 364
			}
358 365
		}
359 366
		
367
//		Label l = new Label(this.getExtendedParametersGroup(), SWT.NONE);
368
//		l.setText("Supplementary row names:");
369
//		
370
//		supRowNamesText = new Text(this.getExtendedParametersGroup(), SWT.BORDER);
371
//		
372
//		l = new Label(this.getExtendedParametersGroup(), SWT.NONE);
373
//		l.setText("Supplementary col names:");
374
//		
375
//		supColNamesText = new Text(this.getExtendedParametersGroup(), SWT.BORDER);
376
		
360 377
		this.chartToolBar.pack();
361 378
	}
362 379
	
TXM/trunk/org.txm.ca.core/src/org/txm/ca/core/preferences/CAPreferences.java (revision 3389)
40 40
	public static final String SHOW_INDIVIDUALS = "chart_show_individuals"; //$NON-NLS-1$
41 41
	public static final String SHOW_VARIABLES = "chart_show_variables"; //$NON-NLS-1$
42 42
	public static final String SHOW_POINT_SHAPES = "chart_show_point_shapes"; //$NON-NLS-1$
43
	public static final String ROW_SUP_NAMES = "row_sup_names";
44
	public static final String COL_SUP_NAMES = "col_sup_names";
43 45
	
44 46
	
45 47
	/**
TXM/trunk/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/CA.java (revision 3389)
508 508
	}
509 509
	
510 510
	@Override
511
	public void compute() throws StatException {
511
	public void compute(String pRowSupNames, String pColsSupNames) throws StatException {
512 512
		
513 513
		if (!rw.containsVariable(table.getSymbol())) {
514 514
			throw new StatException(CACoreMessages.error_lexicalTableNotFoundInWorkspace);
TXM/trunk/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/FactoMineRCA.java (revision 3389)
30 30
import java.io.File;
31 31
import java.util.Arrays;
32 32

  
33
import org.apache.commons.lang.StringUtils;
33 34
import org.eclipse.osgi.util.NLS;
34 35
import org.rosuda.REngine.REXP;
35 36
import org.rosuda.REngine.REXPMismatchException;
......
112 113
	}
113 114
	
114 115
	@Override
115
	public void compute() throws StatException {
116
	public void compute(String pRowSupNames, String pColSupNames) throws StatException {
116 117
		
117 118
		// reset cache
118 119
		rowscoords = null;
......
136 137
		try {
137 138
			// rw.callFunctionAndAffect("FactoMineR:CA", new String[] { table.getSymbol() }, symbol); //$NON-NLS-1$
138 139
			// rw.eval(symbol+" <- FactoMineR::CA("+table.getSymbol()+", graph=FALSE)"); //$NON-NLS-1$ //$NON-NLS-2$
139
			rw.eval(symbol + " <- FactoMineR::CA(" + table.getSymbol() + "[,colSums(" + table.getSymbol() + ") != 0], graph=FALSE)"); //$NON-NLS-1$ //$NON-NLS-2$
140
			StringBuilder script = new StringBuilder();
141
			script.append(symbol + " <- FactoMineR::CA(" + table.getSymbol() + "[,colSums(" + table.getSymbol() + ") != 0]");
142
			if (pRowSupNames != null && pRowSupNames.length() > 0) {
143
				String[] split = pRowSupNames.split(",");
144
				for (int i = 0 ; i < split.length ; i++) {
145
					split[i] = split[i].replace("\"", "\\\"");
146
				}
147
				script.append(",row.sup=Filter(Negate(is.null), which(rownames("+table.getSymbol()+") == c(\""+StringUtils.join(split, "\", \"")+"\")))");
148
				 //which(rownames(children) == c("money", "fear"))
149
			}
150
			if (pColSupNames != null && pColSupNames.length() > 0) {
151
				String[] split = pColSupNames.split(",");
152
				for (int i = 0 ; i < split.length ; i++) {
153
					split[i] = split[i].replace("\"", "\\\"");
154
				}
155
				script.append(",col.sup=Filter(Negate(is.null), which(colnames("+table.getSymbol()+") == c(\""+StringUtils.join(split, "\", \"")+"\")))");
156
			}
157
			script.append(", graph=FALSE)");
158
			rw.eval(script.toString()); //$NON-NLS-1$ //$NON-NLS-2$
140 159
			
141 160
		}
142 161
		catch (RWorkspaceException e) {
TXM/trunk/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/ICA.java (revision 3389)
40 40
 */
41 41
public interface ICA {
42 42
	
43
	public void compute() throws StatException;
43
	public void compute(String pRowSupNames, String pColsSupNames) throws StatException;
44 44
	
45 45
	/**
46 46
	 * Gets the col contrib.
TXM/trunk/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 3389)
127 127
	@Parameter(key = CAPreferences.SHOW_POINT_SHAPES, type = Parameter.RENDERING)
128 128
	protected boolean showPointShapes;
129 129
	
130
	/**
131
	 * Supplementary/illustrative row names
132
	 */
133
	@Parameter(key = CAPreferences.ROW_SUP_NAMES)
134
	protected String pRowSupNames;
130 135
	
136
	/**
137
	 * Supplementary/illustrative row names
138
	 */
139
	@Parameter(key = CAPreferences.COL_SUP_NAMES)
140
	protected String pColSupNames;
131 141
	
132 142
	
143
	
133 144
	/**
134 145
	 * Creates a new empty CA.
135 146
	 *
......
211 222
				this.r_ca = new org.txm.ca.core.statsengine.r.functions.CA(this.getLexicalTable().getData());
212 223
			}
213 224
			
214
			this.r_ca.compute();
225
			this.r_ca.compute(pRowSupNames, pColSupNames);
215 226
			
216 227
			return true;
217 228
		}
......
391 402
	public String[] getColNames() throws StatException {
392 403
		
393 404
		if (colnames == null) {
394
			colnames = this.getCA().getColNames().asStringsArray();
405
			colnames = r_ca.getColNames().asStringsArray();
395 406
		}
396 407
		return colnames;
397 408
	}
......
690 701
	public String[] getRowNames() throws Exception {
691 702
		
692 703
		if (rownames == null) {
693
			rownames = this.getLexicalTable().getRowNames().asStringsArray();
704
			//rownames = this.getLexicalTable().getRowNames().asStringsArray();
705
			rownames = r_ca.getRowNames().asStringsArray();
694 706
		}
695 707
		return rownames;
696 708
	}
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java (revision 3389)
106 106
			structLimitsText.setText(concPrefs.get("context_limits"));
107 107
		}
108 108
		else {
109
			structLimitsText.setText("");
109
			structLimitsText.setText("text"); // TODO use the concordance preferences instead ofhardcoding 'text'
110 110
		}
111 111
		if (concPrefs.get("view_reference_pattern") != null) {
112 112
			String gsonString = concPrefs.get("view_reference_pattern");
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/LangSection.java (revision 3389)
71 71
		sectionClient.setLayout(slayout);
72 72
		this.section.setClient(sectionClient);
73 73
		
74
		btnSelectAnnotate = toolkit.createButton(sectionClient, TXMUIMessages.annotateTheCorpus, SWT.CHECK);
75
		toolkit.createLabel(sectionClient, ""); //$NON-NLS-1$
76
		
77
		
78
		
79
		EnginesManager<? extends Engine> ema = Toolbox.getEngineManager(EngineType.ANNOTATION);
80
		ArrayList<String> engines = new ArrayList<>();
81
		for (String engine : ema.getEngines().keySet()) {
82
			AnnotationEngine e = (AnnotationEngine) ema.getEngine(engine);
83
			if (e.isAutomatic()) {
84
				engines.add(engine);
85
			}
86
		}
87
		if (engines.size() > 1) {
88
			
89
			Label tmp = toolkit.createLabel(sectionClient, "Annotation engine"); //$NON-NLS-1$
90
			TableWrapData gdata = getTextGridData();
91
			gdata.indent = 20;
92
			tmp.setLayoutData(gdata);
93
			
94
			annotateEngineCombo = new Combo(sectionClient, SWT.BORDER);
95
			gdata = getTextGridData();
96
			annotateEngineCombo.setLayoutData(gdata);
97
			annotateEngineCombo.setToolTipText("Annotation engines");
98
			annotateEngineCombo.setItems(engines.toArray(new String[engines.size()]));
99
			annotateEngineCombo.setText(annotateEngineCombo.getItem(0));
100
		}
101
		
74
		Label l = toolkit.createLabel(sectionClient, "Corpus language"); //$NON-NLS-1$
75
		TableWrapData gdata = getTextGridData();
76
		gdata.colspan = 2;
77
		l.setLayoutData(gdata);
102 78
		// if widget selected change the radio buttons value
103 79
		
104 80
		btnGuessLang = toolkit.createButton(sectionClient, TXMUIMessages.guessColon, SWT.RADIO);
105
		TableWrapData gdata = getTextGridData();
81
		gdata = getTextGridData();
106 82
		gdata.indent = 20;
107 83
		btnGuessLang.setLayoutData(gdata);
108 84
		toolkit.createLabel(sectionClient, ""); //$NON-NLS-1$
......
156 132
		if (langToSelectIndex >= 0) {
157 133
			langcombo.select(langToSelectIndex);
158 134
		}
135
		
136
		btnSelectAnnotate = toolkit.createButton(sectionClient, TXMUIMessages.lemmatizeTheCorpus, SWT.CHECK);
137
		toolkit.createLabel(sectionClient, ""); //$NON-NLS-1$
138
		
139
		EnginesManager<? extends Engine> ema = Toolbox.getEngineManager(EngineType.ANNOTATION);
140
		ArrayList<String> engines = new ArrayList<>();
141
		for (String engine : ema.getEngines().keySet()) {
142
			AnnotationEngine e = (AnnotationEngine) ema.getEngine(engine);
143
			if (e.isAutomatic()) {
144
				engines.add(engine);
145
			}
146
		}
147
		if (engines.size() > 1) {
148
			
149
			Label tmp = toolkit.createLabel(sectionClient, "Annotation engine"); //$NON-NLS-1$
150
			gdata = getTextGridData();
151
			gdata.indent = 20;
152
			tmp.setLayoutData(gdata);
153
			
154
			annotateEngineCombo = new Combo(sectionClient, SWT.BORDER);
155
			gdata = getTextGridData();
156
			annotateEngineCombo.setLayoutData(gdata);
157
			annotateEngineCombo.setToolTipText("Annotation engines");
158
			annotateEngineCombo.setItems(engines.toArray(new String[engines.size()]));
159
			annotateEngineCombo.setText(annotateEngineCombo.getItem(0));
160
		}
161
		
159 162
	}
160 163
	
161 164
	@Override
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 3389)
134 134
			buildFacsEditionCheckButton.setSelection(false);
135 135
			TableWrapData gdata22 = getButtonLayoutData();
136 136
			gdata22.colspan = 4; // one line
137
			gdata22.indent = 20;
137 138
			buildFacsEditionCheckButton.setLayoutData(gdata22);
138 139
			buildFacsEditionCheckButton.addSelectionListener(new SelectionListener() {
139 140
				
......
148 149
			// image directory
149 150
			tmpLabel = toolkit.createLabel(sectionClient, "Images directory: ");
150 151
			TableWrapData gdata = getLabelGridData();
151
			gdata.indent = 20;
152
			gdata.indent = 40;
152 153
			tmpLabel.setLayoutData(gdata);
153 154
			imageDirectoryText = toolkit.createText(sectionClient, "", SWT.BORDER); //$NON-NLS-1$
154 155
			gdata = getTextGridData();
......
182 183
				public void widgetDefaultSelected(SelectionEvent e) {}
183 184
			});
184 185
			
185
			tmpLabel = toolkit.createLabel(sectionClient, "Default edition: ");
186
			tmpLabel.setLayoutData(getLabelGridData());
186
			tmpLabel = toolkit.createLabel(sectionClient, "Default edition ");
187
			gdata = getLabelGridData();
188
			gdata.indent = 20;
189
			tmpLabel.setLayoutData(gdata);
187 190
			
188 191
			defaultEditions = toolkit.createText(sectionClient, "", SWT.BORDER);
189 192
			gdata = getTextGridData();
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3389)
528 528
			
529 529
			this.setDirty(this.dirty);
530 530
			
531
			// this.parent.setRedraw(true);
532
			
533
			
534 531
		}
535 532
		catch (Throwable e) {
536 533
			Log.severe(TXMCoreMessages.bind("TXMEditor.createPartControl(): can not create the editor for result {0}.", this.getResult())); //$NON-NLS-1$
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 3389)
125 125

  
126 126
andFrom = and from
127 127

  
128
annotateTheCorpus = Annotate the corpus
128
lemmatizeTheCorpus=Lemmatize the corpus
129 129

  
130 130
areYouSureYouWantToDeleteP0Colon = Are you sure you want to delete files {0}
131 131

  
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 3389)
106 106

  
107 107
andFrom = et de
108 108

  
109
annotateTheCorpus = Annoter le corpus
109
lemmatizeTheCorpus = Lemmatiser
110 110

  
111 111
areYouSureYouWantToDeleteP0Colon = Êtes vous sûr de vouloir supprimer les fichiers {0}
112 112

  
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 3389)
92 92
	
93 93
	public static String andFrom;
94 94
	
95
	public static String annotateTheCorpus;
95
	public static String lemmatizeTheCorpus;
96 96
	
97 97
	public static String areYouSureYouWantToDeleteP0Colon;
98 98
	
TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/preferences/URSPreferencePage.java (revision 3389)
47 47
		addField(prefix_autocompletion_field);
48 48
		
49 49
		save_timer_field = new IntegerFieldEditor(
50
				URSPreferences.SAVE_TIMER, "Save timer duration (0 desactivate the timer)",
50
				URSPreferences.SAVE_TIMER, "Delay between saves/Délai entre les sauvegardes (0 desactivate the timer)",
51 51
				getFieldEditorParent());
52 52
		addField(save_timer_field);
53 53
		

Formats disponibles : Unified diff