Révision 739

tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 739)
79 79
	 */
80 80
	protected SpecificitiesLinesViewerComparator viewerComparator;
81 81

  
82

  
83
	TableColumn typeFrequencyColumn;
82 84
	
83 85
	
84 86
	/**
......
159 161
			
160 162
			
161 163
			// create 2nd column
162
			TableColumn typeFrequencyColumn = new TableColumn(viewer.getTable(), SWT.NONE);
163
			typeFrequencyColumn.setText(TXMCoreMessages.common_frequency + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); //$NON-NLS-1$ //$NON-NLS-2$
164
			typeFrequencyColumn.setToolTipText(typeFrequencyColumn.getText()); 
165
			typeFrequencyColumn.setAlignment(SWT.RIGHT);
166
			typeFrequencyColumn.pack();
167
			
164
			this.typeFrequencyColumn = new TableColumn(viewer.getTable(), SWT.NONE);
168 165
			viewerComparator.addSelectionAdapter(viewer, typeFrequencyColumn, 1);
169 166
			
170 167
			
......
172 169
			TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE);
173 170
			separatorColumn.setResizable(false);
174 171

  
175
			String[] partNames = null;
176
			int[] partSize = null;
177
			try {
178
				partNames = this.getResult().getPartShortNames();
179
				partSize = this.getResult().getPartSizes();
180
			} catch (StatException e) {
181
				System.err.println(NLS.bind(RCoreMessages.error_unexpectedErrorInRStatisticsEngine, e));
182
				Log.printStackTrace(e);
183
				return;
184
			}
185
			// System.out.println("partnames: "+Arrays.toString(partNames));
186
			for (int i = 0, columnIndex = 2; i < partNames.length ; i++) { // for each part
187 172

  
188
				//FREQ COLUMN
189
				final TableColumn freqpartTableColumn = new TableColumn(specificitesTable, SWT.NONE);
190
				freqpartTableColumn.setText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
191
				freqpartTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
192
				// System.out.println("create column "+partNames[i]);
193
				freqpartTableColumn.setAlignment(SWT.RIGHT);
194
				freqpartTableColumn.pack();
195
				
196
				viewerComparator.addSelectionAdapter(viewer, freqpartTableColumn, ++columnIndex);
197 173

  
198
				//SCORE COLUMN
199
				final TableColumn partTableColumn = new TableColumn(specificitesTable, SWT.NONE);
200
				partTableColumn.setText("score");//partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
201
				partTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
202
				// System.out.println("create column "+partNames[i]);
203
				partTableColumn.setAlignment(SWT.RIGHT);
204
				partTableColumn.pack();
205

  
206
				viewerComparator.addSelectionAdapter(viewer, partTableColumn, ++columnIndex);
207
				
208
			}
209

  
210 174
			specificitesTable.setHeaderVisible(true);
211 175

  
212 176
			// Horizontal bar on second table takes up a little extra space.
......
237 201
	@Override
238 202
	public void updateEditorFromResult(boolean update) {
239 203
		try {
204
			if(!update)	{
205
				typeFrequencyColumn.setText(TXMCoreMessages.common_frequency + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); //$NON-NLS-1$ //$NON-NLS-2$
206
				typeFrequencyColumn.setToolTipText(typeFrequencyColumn.getText()); 
207
				typeFrequencyColumn.setAlignment(SWT.RIGHT);
208
				typeFrequencyColumn.pack();
209
				
210
				String[] partNames = null;
211
				int[] partSize = null;
212
				try {
213
					partNames = this.getResult().getPartShortNames();
214
					partSize = this.getResult().getPartSizes();
215
				} catch (StatException e) {
216
					System.err.println(NLS.bind(RCoreMessages.error_unexpectedErrorInRStatisticsEngine, e));
217
					Log.printStackTrace(e);
218
					return;
219
				}
220
				// System.out.println("partnames: "+Arrays.toString(partNames));
221
				for (int i = 0, columnIndex = 2; i < partNames.length ; i++) { // for each part
222

  
223
					//FREQ COLUMN
224
					final TableColumn freqpartTableColumn = new TableColumn(specificitesTable, SWT.NONE);
225
					freqpartTableColumn.setText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
226
					freqpartTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
227
					// System.out.println("create column "+partNames[i]);
228
					freqpartTableColumn.setAlignment(SWT.RIGHT);
229
					freqpartTableColumn.pack();
230
					
231
					viewerComparator.addSelectionAdapter(viewer, freqpartTableColumn, ++columnIndex);
232

  
233
					//SCORE COLUMN
234
					final TableColumn partTableColumn = new TableColumn(specificitesTable, SWT.NONE);
235
					partTableColumn.setText("score");//partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
236
					partTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
237
					// System.out.println("create column "+partNames[i]);
238
					partTableColumn.setAlignment(SWT.RIGHT);
239
					partTableColumn.pack();
240

  
241
					viewerComparator.addSelectionAdapter(viewer, partTableColumn, ++columnIndex);
242
					
243
				}
244
			}
245

  
246
			
240 247
			// units
241 248
			String[] typeNames = getResult().getTypeNames();
242 249
			// units' total freq
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 739)
93 93

  
94 94
	private Corpus corpus;
95 95

  
96
	
97
	/**
98
	 * 
99
	 * @param corpus
100
	 */
96 101
	public Lexicon(Corpus corpus) {
97 102
		super(corpus);
98 103
		this.corpus = corpus;
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 739)
160 160
	}
161 161

  
162 162
	
163
	
164
	public LexicalTable(String uuid)	{
165
		super(uuid, null);
166
	}
167

  
168
	
169
	
163 170
	@Override
164 171
	public boolean loadParameters() {
165 172
		try {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeSelectionListener.java (revision 739)
1
/**
2
 * 
3
 */
4 1
package org.txm.rcp.editors.listeners;
5 2

  
6 3
import org.eclipse.jface.viewers.ISelectionChangedListener;
......
13 10
import org.txm.rcp.preferences.RCPPreferences;
14 11

  
15 12
/**
16
 * A selection listener that can be added to editors widgets and that call the TXMEditor.compute() method.
13
 * A selection listener that can be added to editors widgets and that calls the TXMEditor.compute() method.
17 14
 * @author sjacquot
18 15
 *
19 16
 */
......
39 36

  
40 37
	@Override
41 38
	public void selectionChanged(SelectionChangedEvent event) {
42
		// to skip programmatically setSelection() calls
39
		// to skip programmatically setSelection() calls on some widgets or if auto-compute preference is false
43 40
		if(!mustIgnoreEvent(event)
44 41
				&& TXMPreferences.getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR, RCPPreferences.PREFERENCES_NODE))	{
45 42
			this.editor.compute(true);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/StructuralUnitsCombosGroup.java (revision 739)
1 1
package org.txm.rcp.swt.widget.structures;
2 2

  
3 3
import org.eclipse.jface.viewers.ISelectionChangedListener;
4
import org.eclipse.jface.viewers.IStructuredSelection;
5 4
import org.eclipse.jface.viewers.SelectionChangedEvent;
6
import org.eclipse.jface.viewers.Viewer;
7 5
import org.eclipse.swt.SWT;
8 6
import org.eclipse.swt.layout.RowLayout;
9 7
import org.eclipse.swt.widgets.Composite;
......
13 11
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
14 12

  
15 13
/**
16
 * A group Widget that manages the Structural Unit and Structural Unit Property with two linked combo viewers.
14
 * A Widgets group that manages the Structural Unit and Structural Unit Property with two linked combo viewers.
17 15
 * 
18 16
 * @author sjacquot
19 17
 *
20 18
 */
21 19
public class StructuralUnitsCombosGroup extends Group {
22 20

  
23
	
21
		
24 22
	/**
25 23
	 * Structural Units.
26 24
	 */
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/structures/PropertiesComboViewer.java (revision 739)
44 44
		
45 45
		this.setContentProvider(ArrayContentProvider.getInstance());
46 46

  
47
		this.updateFromList(properties, selectedProperty);
48

  
47 49
		// Listener
48 50
		if(autoCompute)	{
49 51
			this.addSelectionChangedListener(new ComputeSelectionListener(editor));
50 52
		}
51
		
52
		this.updateFromList(properties, selectedProperty);
53
		
53

  
54 54
	}
55 55

  
56 56

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/ComputeTXMResult.java (revision 739)
7 7
import org.eclipse.ui.handlers.HandlerUtil;
8 8
import org.txm.rcp.editors.TXMEditor;
9 9

  
10
/**
11
 * Calls TXMEditor.ompute() on the current active editor.
12
 * 
13
 * @author mdecorde
14
 * @author sjacquot
15
 *
16
 */
10 17
public class ComputeTXMResult extends AbstractHandler {
11 18

  
12 19
	@Override
......
18 25
		}
19 26

  
20 27
		TXMEditor editor = (TXMEditor) part;
21
		editor.compute(false);
28
		editor.compute(true);
22 29

  
23 30
		return null;
24 31
	}
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 739)
633 633
			return false;
634 634
		}
635 635
		
636
		if (this.lexicalTable.getNColumns() < 2) {
637
			Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS);
638
			return false;
639
		}
636
//		if (this.lexicalTable.getNColumns() < 2) {
637
//			Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS);
638
//			return false;
639
//		}
640 640
		
641 641
		return true;
642 642
	}

Formats disponibles : Unified diff