Révision 1455

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1455)
222 222
	@Override
223 223
	public final void updateEditorFromResult(boolean update) {
224 224
		
225
		this.updateEditorFromChart(update);
226
		
227 225
		// check that the charts engine used for the result matches the SWT components provider otherwise find a suitable components provider
228 226
		if(this.getResult().getChartsEngine() != this.getSWTChartsComponentsProvider().getChartsEngine())	{
229 227
			
......
271 269
					//editor2.getChartToolBar().synchronize();
272 270
					
273 271
					// initialize the default shared context menus as Export, etc.
274
					initDefaultContextMenus();
272
					this.initDefaultContextMenus();
275 273
			
276 274
					// registers user entries event call back extensions
277
					registerEventCallBackExtensions();
275
					this.registerEventCallBackExtensions();
278 276
					
279 277
					//FIXME: test to contribute to menu only in some context and also for key binding
280 278
					// create chart editor part context
......
288 286
					//editor2..setContentDescription("details");
289 287
					//editor2..setContentDescription(this.getResultData().getDetails());
290 288
	
291
					initializeAWTDelegationListeners();
289
					this.initializeAWTDelegationListeners();
292 290
					
293 291
//				}
294 292
//			});
293
					
294
			this.onInit();
295 295
		}
296 296
		
297
		// sublcass updating
298
		this.updateEditorFromChart(update);
299

  
297 300
		
298 301
		if(this.parentMultiPagesEditor == null)	{
299 302
			this.forceFocus();			
300 303
		}
301 304
	}
302 305

  
306
	
303 307
	/**
308
	 * Method called if the editor needs initialization (if the chart component has not yet been created and if the chart is not null) and dedicated to be override by subclasses if needed to do some process after the initialization.
309
	 */
310
	protected void onInit()	{
311
		// nothing to do
312
	}
313
	
314
	/**
304 315
	 * Activates the chart editor context.
305 316
	 */
306 317
	public void activateContext()	{
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/handlers/ResetChartView.java (revision 1455)
17 17
	@Override
18 18
	public Object execute(ExecutionEvent event) throws ExecutionException {
19 19
		ChartEditor chartEditor = SWTChartsComponentsProvider.getActiveChartEditor(event);
20
		chartEditor.resetView();
21
		chartEditor.forceFocus();
22
		return null;
20
		
21
		//ChartEditor chartEditor = null;
22
		
23
		try {
24
			//chartEditor = (ChartEditor)SWTEditorsUtils.getActiveEditor(event);
25
			
26
			chartEditor.resetView();
27
			chartEditor.forceFocus();
28
		}
29
		catch (Exception e) {
30
			// nothing to do
31
		}
32
		return chartEditor;
23 33
	}
24 34

  
25 35
}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 1455)
40 40
import org.eclipse.ui.IWorkbenchWindow;
41 41
import org.eclipse.ui.PartInitException;
42 42
import org.eclipse.ui.PlatformUI;
43
import org.eclipse.ui.contexts.IContextService;
44 43
import org.eclipse.ui.part.MultiPageEditorPart;
45 44
import org.txm.chartsengine.core.ChartsEngine;
46 45
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
......
55 54
import org.txm.chartsengine.rcp.swt.ChartComposite;
56 55
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
57 56
import org.txm.core.preferences.TXMPreferences;
58
import org.txm.rcp.editors.SplitedGenericMultiPageEditor;
57
import org.txm.rcp.editors.TXMMultiPageEditor;
59 58
import org.txm.rcp.preferences.TXMPreferencePage;
60 59
import org.txm.rcp.preferences.TXMPreferenceStore;
61 60
import org.txm.utils.logger.Log;
......
634 633
			}
635 634
		}
636 635
		// Context menu, multi pages editor
637
		else if(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart() instanceof SplitedGenericMultiPageEditor)	{
636
		else if(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart() instanceof TXMMultiPageEditor)	{
638 637
			// Main editor
639
			if(((SplitedGenericMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart() instanceof ChartEditor
640
					&& ((ChartEditor)((SplitedGenericMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart()).hasFocus())	{
641
				chartEditor = (ChartEditor)((SplitedGenericMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart();
638
			if(((TXMMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart() instanceof ChartEditor
639
					&& ((ChartEditor)((TXMMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart()).hasFocus())	{
640
				chartEditor = (ChartEditor)((TXMMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart()).getMainEditorPart();
642 641
			}
643
			else if(((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage() instanceof ChartEditor
644
					&& ((ChartEditor)((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage()).hasFocus() )	{
645
				chartEditor = (ChartEditor)((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage();
646
			}
642
			// FIXME: became useless?
643
//			else if(((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage() instanceof ChartEditor
644
//					&& ((ChartEditor)((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage()).hasFocus() )	{
645
//				chartEditor = (ChartEditor)((MultiPageEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).getSelectedPage();
646
//			}
647 647
		}
648 648
		// Context menu, Normal editor
649 649
		else if(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart() instanceof ChartEditor)	{
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java (revision 1455)
269 269
	@Override
270 270
	public void chartMouseMoved(ChartMouseEvent event) {
271 271

  
272
		
273 272
		// Mouse over selection
274 273
		ChartEntity entity = event.getEntity();
275 274

  
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/handlers/SendEditionTo.java (revision 1455)
32 32
import org.txm.core.results.TXMResult;
33 33
import org.txm.links.rcp.handlers.SendSelectionToQueryable;
34 34
import org.txm.rcp.editors.IEditionEditor;
35
import org.txm.rcp.utils.SWTEditorsUtils;
35 36
import org.txm.searchengine.cqp.corpus.query.CQLQuery;
36 37

  
37 38
/**
......
46 47
	@Override
47 48
	public String createQuery(ExecutionEvent event, ISelection selection) {
48 49
		
49
		IEditionEditor editor = (IEditionEditor) this.getActiveEditor(event);
50
		IEditionEditor editor = (IEditionEditor) SWTEditorsUtils.getActiveEditor(event);
50 51
		String query = ((IEditionEditor)editor).getTextSelection();
51 52
		query = query.replaceAll("\n", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
52 53
		query = "\"" + CQLQuery.addBackSlash(query) + "\""; //$NON-NLS-1$ //$NON-NLS-2$
......
55 56
	
56 57
	@Override
57 58
	public TXMResult getResultParent(ExecutionEvent event) {
58
		return ((IEditionEditor) this.getActiveEditor(event)).getCorpus();
59
		return ((IEditionEditor) SWTEditorsUtils.getActiveEditor(event)).getCorpus();
59 60
	}
60 61
}
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1455)
78 78
	 * @throws Exception
79 79
	 */
80 80
	public LexicalTable(Subcorpus corpus) throws Exception {
81
		//this(corpus, corpus.getDefaultProperty(), null);
82 81
		super(corpus);
83
//		if (property == null) {
84
//			this.setUnitProperty(corpus.getDefaultProperty());
85
//		}
86
		
87 82
		try { // create empty LT to store infos
88 83
			String[] rowNames = {};
89 84
			String[] colNames = {NLS.bind("{0}-{1}", corpus.getCorpusParent().getName(), corpus.getName()), corpus.getName()};
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java (revision 1455)
108 108
					}
109 109

  
110 110
					// FIXME: SJ: temporary version before we fix the problems listed below
111
					lexicalTable = new LexicalTable(partition);
112
					lexicalTable.setParameters((WordProperty) partition.getCorpus().getDefaultProperty(), 20, 200, null);
113
					ca = new CA(lexicalTable);
111
//					lexicalTable = new LexicalTable(partition);
112
//					lexicalTable.setParameters((WordProperty) partition.getCorpus().getDefaultProperty(), 20, 200, null);
113
//					ca = new CA(lexicalTable);
114 114

  
115 115
					// FIXME: SJ: new version, creating a, empty LT and an empty CA
116 116
					// does not work at this time because of some problems in CAEditor (refreshing and components creation + eigenvalues computing)
117
//					lexicalTable = new LexicalTable(partition);
118
//					ca = new CA(lexicalTable);
117
					lexicalTable = new LexicalTable(partition);
118
					ca = new CA(lexicalTable);
119 119
				}
120 120
				else if (selection instanceof PartitionIndex) {
121 121
					PartitionIndex index = (PartitionIndex) selection;
......
156 156

  
157 157
					ca = new CA(lexicalTable);
158 158
				}
159
				
159

  
160 160
				// show the lexical table only if the command was called from a lexical table
161
				if(!(selection instanceof LexicalTable))	{
161
				if(!(selection instanceof LexicalTable)) {
162 162
					lexicalTable.setVisible(false);
163 163
				}
164 164

  
......
166 166

  
167 167
			// FIXME: should be done in the CAEditor
168 168
			// compute the CA
169
			ca.compute();
169
			//ca.compute();
170 170

  
171 171
			try {
172 172
				Log.info(CAUIMessages.loadingCorrespondenceAnalysisResults);
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 1455)
189 189

  
190 190
			// add the other editors
191 191
			for (int i = 1; i < editors.size(); i++) {
192
				int editorIndex = this.addPage(editors.get(i), inputs.get(i));
192
				int editorIndex = this.addPage(editors.get(i), inputs.get(i)); // NOTE: the method addPage() calls the createPartControl() method of the editors
193 193
				this.setPageText(editorIndex, this.names.get(i));
194 194
			}
195 195
	
196
			caFactorialMapEditorPart.compute(false);
197
			
196 198
			// to force the creation of the chart component and then add some listeners to it
197 199
			// FIXME: this code may be moved in CaFactorialMapChartEditor class
198
			caFactorialMapEditorPart.refresh(false);
200
	//		caFactorialMapEditorPart.refresh(false);
199 201

  
200 202
			// Axis unit square ratio constraint
201
			caFactorialMapEditorPart.getComposite().getChartComponent().setSquareOffEnabled(true);
202
			caFactorialMapEditorPart.getComposite().getChartComponent().squareOff();
203
			Component chartComponent = (Component) caFactorialMapEditorPart.getComposite().getChartComponent();
204
			// Axis unit square ratio constraint on resize
205
			chartComponent.addComponentListener(new ComponentListener() {
203
//			caFactorialMapEditorPart.getComposite().getChartComponent().setSquareOffEnabled(true);
204
//			caFactorialMapEditorPart.getComposite().getChartComponent().squareOff();
205
//			Component chartComponent = (Component) caFactorialMapEditorPart.getComposite().getChartComponent();
206
//			// Axis unit square ratio constraint on resize
207
//			chartComponent.addComponentListener(new ComponentListener() {
208
//
209
//				@Override
210
//				public void componentShown(ComponentEvent arg0) {
211
//					// TODO Auto-generated method stub
212
//				}
213
//
214
//				@Override
215
//				public void componentResized(ComponentEvent e) {
216
//					caFactorialMapEditorPart.getComposite().getChartComponent().squareOff();
217
//				}
218
//
219
//				@Override
220
//				public void componentMoved(ComponentEvent arg0) {
221
//					// TODO Auto-generated method stub
222
//				}
223
//
224
//				@Override
225
//				public void componentHidden(ComponentEvent arg0) {
226
//					// TODO Auto-generated method stub
227
//				}
228
//			});
206 229

  
207
				@Override
208
				public void componentShown(ComponentEvent arg0) {
209
					// TODO Auto-generated method stub
210
				}
211 230

  
212
				@Override
213
				public void componentResized(ComponentEvent e) {
214
					caFactorialMapEditorPart.getComposite().getChartComponent().squareOff();
215
				}
216 231

  
217
				@Override
218
				public void componentMoved(ComponentEvent arg0) {
219
					// TODO Auto-generated method stub
220
				}
221

  
222
				@Override
223
				public void componentHidden(ComponentEvent arg0) {
224
					// TODO Auto-generated method stub
225
				}
226
			});
227

  
228

  
229

  
230 232
			
231 233
		}
232 234
		catch (Exception e1) {
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 1455)
1 1
package org.txm.ca.rcp.editors;
2 2

  
3
import java.awt.Component;
4
import java.awt.event.ComponentEvent;
5
import java.awt.event.ComponentListener;
6

  
3 7
import org.eclipse.swt.SWT;
4 8
import org.eclipse.swt.custom.CLabel;
5 9
import org.eclipse.swt.events.SelectionEvent;
......
11 15
import org.txm.ca.core.functions.CA;
12 16
import org.txm.ca.core.preferences.CAPreferences;
13 17
import org.txm.ca.rcp.messages.CAUIMessages;
18
import org.txm.chartsengine.rcp.IChartComponent;
14 19
import org.txm.chartsengine.rcp.editors.ChartEditor;
15 20
import org.txm.chartsengine.rcp.editors.ChartEditorInput;
16 21
import org.txm.core.messages.TXMCoreMessages;
......
109 114

  
110 115
				// unit property
111 116
				new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
112
				this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, false,
117
				this.unitPropertyComboViewer = new PropertiesComboViewer(
118
						mainParametersArea,
119
						this,
120
						false,
113 121
						CQPCorpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(),
114
						this.getResult().getUnitProperty(), false);
122
						this.getResult().getUnitProperty(),
123
						false);
115 124
			}
116 125

  
117 126
		}
......
275 284
			// TODO Auto-generated catch block
276 285
			e.printStackTrace();
277 286
		}
287
	}
288

  
289
	
290
	@Override
291
	protected void onInit() {
278 292
		
279
		
280
//		if(!update)	{
281
//		// Axis unit square ratio constraint
282
//		this.getComposite().getChartComponent().setSquareOffEnabled(true);
283
//		this.getComposite().getChartComponent().squareOff();
284
//		Component chartComponent = (Component) this.getComposite().getChartComponent();
285
//		// Axis unit square ratio constraint on resize
286
//		chartComponent.addComponentListener(new ComponentListener() {
287
//
288
//			@Override
289
//			public void componentShown(ComponentEvent arg0) {
290
//				// TODO Auto-generated method stub
291
//			}
292
//
293
//			@Override
294
//			public void componentResized(ComponentEvent e) {
295
//				getComposite().getChartComponent().squareOff();
296
//			}
297
//
298
//			@Override
299
//			public void componentMoved(ComponentEvent arg0) {
300
//				// TODO Auto-generated method stub
301
//			}
302
//
303
//			@Override
304
//			public void componentHidden(ComponentEvent arg0) {
305
//				// TODO Auto-generated method stub
306
//			}
307
//		});
308
//		}
293
		IChartComponent chartComponent = this.getComposite().getChartComponent();
309 294

  
295
		// Axis unit square ratio constraint
296
		chartComponent.setSquareOffEnabled(true);
297
		chartComponent.squareOff();
298

  
299
		// FIXME: this code is too much AWT related
300
		// Axis unit square ratio constraint on resize
301
		((Component)chartComponent).addComponentListener(new ComponentListener() {
302

  
303
			@Override
304
			public void componentShown(ComponentEvent arg0) {
305
				// TODO Auto-generated method stub
306
			}
307

  
308
			@Override
309
			public void componentResized(ComponentEvent e) {
310
				getComposite().getChartComponent().squareOff();
311
			}
312

  
313
			@Override
314
			public void componentMoved(ComponentEvent arg0) {
315
				// TODO Auto-generated method stub
316
			}
317

  
318
			@Override
319
			public void componentHidden(ComponentEvent arg0) {
320
				// TODO Auto-generated method stub
321
			}
322
		});
323

  
310 324
	}
311

  
325
	
312 326
}
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 1455)
90 90

  
91 91

  
92 92

  
93

  
94 93
	/**
95 94
	 * First dimension.
96 95
	 */
......
134 133
		this(null, lexicalTable);
135 134
	}
136 135
	
137
	public LexicalTable getParent() {
138
		return (LexicalTable)parent;
139
	}
140
	
141 136
	/**
142 137
	 * Creates a new empty CA.
143 138
	 *
......
156 151
	 */
157 152
	public CA(String parametersNodePath, LexicalTable lexicalTable) {
158 153
		super(parametersNodePath, lexicalTable);
154
		
155
		Eigenvalues eigenvalues = (Eigenvalues) this.getFirstChild(Eigenvalues.class);
156
		if(eigenvalues == null)	{
157
			eigenvalues = new Eigenvalues(this);
158
		}
159

  
159 160
	}
160 161

  
161 162
	@Override
......
166 167
	@Override
167 168
	protected boolean _compute() throws Exception {
168 169
		
169
		
170
		Eigenvalues eigenvalues = (Eigenvalues) this.getFirstChild(Eigenvalues.class);
171
		if(eigenvalues == null)	{
172
			eigenvalues = new Eigenvalues(this);
173
		}
174

  
175
		
176 170
		try {
177 171
			// clear cache
178 172
			this.colnames = null;
......
321 315
		return colfilter;
322 316
	}
323 317

  
324
	/**
325
	 * Gets the col all infos as Array of arrays.
326
	 *
327
	 * @return the col infos
328
	 */
329
	public Object[] getColInfos() {
330 318

  
331
		if (coltabledata != null) {
332
			return coltabledata.toArray();
333
		}
334

  
335
		double[] sv = null;
336
		double[] mass = null;
337
		double[][] colcoords = null;
338
		double[][] colcontribs = null;
339
		double[][] colcos2s = null;
340
		double[] coldist = null;
341

  
342
		try {
343
			sv = getValeursPropres();
344
			mass = r_ca.getColsMass();
345
			colcoords = r_ca.getColsCoords();
346
			colcontribs = r_ca.getColContrib();
347
			colcos2s = r_ca.getColCos2();
348
			coldist = r_ca.getColDist();
349
			//add dist
350
			getColNames();
351
		} catch (StatException e) {
352
			org.txm.utils.logger.Log.printStackTrace(e);
353
			return null;
354
		}
355

  
356
		coltabledata = new ArrayList<List<Object>>(colnames.length);
357

  
358
		double[] cos2 = new double[3];
359
		for (int i = 0; i < colnames.length; i++) {
360
			List<Object> entry = new ArrayList<Object>(4);
361

  
362
			cos2[0] = colcos2s[i][0];
363
			cos2[1] = colcos2s[i][1];
364
			cos2[2] = colcos2s[i][2];
365

  
366
			entry.add(colnames[i]); // Factor
367
			entry.add(""); //separator //$NON-NLS-1$
368
			entry.add(new Double(cos2[0] + cos2[1])); // Q12
369
			entry.add(new Double(cos2[0] + cos2[2])); // Q23
370
			entry.add(new Double(cos2[2] + cos2[1])); // Q13
371
			entry.add(new Double(mass[i] * 100.0)); // mass
372

  
373
			entry.add(coldist[i]); // dist
374

  
375
			for (int c = 0; c < 3; c++) { // 3 first axis
376
				entry.add(""); //separator //$NON-NLS-1$
377
				entry.add(colcontribs[i][c]); // contrib
378
				entry.add(cos2[c]); // cos²
379
			}
380
			entry.add(""); //separator //$NON-NLS-1$
381
			for (int c = 0; c < 3; c++) { // 3 first axis
382
				entry.add(colcoords[i][c]); // coords
383
			}
384
			entry.add("");//separator //$NON-NLS-1$
385
			coltabledata.add(entry);
386
		}
387

  
388
		return coltabledata.toArray();
389
	}
390

  
391 319
	/**
392 320
	 * Get the column infos titles array.
393 321
	 *
......
533 461
	 */
534 462
	public Object[] getRowInfos() {
535 463

  
536
		if (rowtabledata != null)
464
		if (rowtabledata != null) {
537 465
			return rowtabledata.toArray();
466
		}
538 467

  
539
		double[] mass = null;
540
		double[] dist = null;
541
		double[][] rowcoords = null;
542
		double[][] rowcontribs = null;
543
		double[][] rowcos2s = null;
468
		rowtabledata = new ArrayList<List<Object>>();
544 469

  
545
		try {
546
			mass = r_ca.getRowsMass();
547
			rowcoords = r_ca.getRowsCoords();
548
			rowcontribs = r_ca.getRowContrib();
549
			rowcos2s = r_ca.getRowCos2();
550
			dist = r_ca.getRowDist();
551
			getRowNames();
552
		} catch (Exception e) {
553
			org.txm.utils.logger.Log.printStackTrace(e);
554
			return null;
470
		if(r_ca != null)	{
471
		
472
			double[] mass = null;
473
			double[] dist = null;
474
			double[][] rowcoords = null;
475
			double[][] rowcontribs = null;
476
			double[][] rowcos2s = null;
477
	
478
			try {
479
				mass = r_ca.getRowsMass();
480
				rowcoords = r_ca.getRowsCoords();
481
				rowcontribs = r_ca.getRowContrib();
482
				rowcos2s = r_ca.getRowCos2();
483
				dist = r_ca.getRowDist();
484
				getRowNames();
485
			} catch (Exception e) {
486
				org.txm.utils.logger.Log.printStackTrace(e);
487
				return null;
488
			}
489
	
490
	
491
			double[] cos2 = new double[3];
492
			for (int i = 0; i < rownames.length; i++) {
493
				double distt = dist[i];
494
	
495
				cos2[0] = rowcos2s[i][0];
496
				cos2[1] = rowcos2s[i][1];
497
				cos2[2] = rowcos2s[i][2];
498
	
499
				List<Object> entry = new ArrayList<Object>(4);
500
				entry.add(rownames[i]); // Factor
501
				entry.add(""); // separator //$NON-NLS-1$
502
				entry.add(new Double(cos2[0] + cos2[1])); // Q12
503
				entry.add(new Double(cos2[0] + cos2[2])); // Q23
504
				entry.add(new Double(cos2[2] + cos2[1])); // Q13
505
	
506
				entry.add(new Double(mass[i]) * 100.0); // mass
507
	
508
				entry.add(distt); // dist
509
				for (int c = 0; c < 3; c++) { // 3 first axis
510
					entry.add(""); // separator //$NON-NLS-1$
511
					entry.add(rowcontribs[i][c] * 100.0); // contrib
512
					entry.add(cos2[c]); // cos²
513
				}
514
				entry.add(""); //separator //$NON-NLS-1$
515
				for (int c = 0; c < 3; c++) { // 3 first axis
516
					entry.add(rowcoords[i][c]); // coords
517
				}
518
				entry.add("");// separator //$NON-NLS-1$
519
				rowtabledata.add(entry);
520
			}
521
		
555 522
		}
523
		
524
		return rowtabledata.toArray();
525
	}
556 526

  
557
		rowtabledata = new ArrayList<List<Object>>(rownames.length);
527
	/**
528
	 * Gets the col all infos as Array of arrays.
529
	 *
530
	 * @return the col infos
531
	 */
532
	public Object[] getColInfos() {
558 533

  
559
		double[] cos2 = new double[3];
560
		for (int i = 0; i < rownames.length; i++) {
561
			double distt = dist[i];
534
		if (coltabledata != null) {
535
			return coltabledata.toArray();
536
		}
562 537

  
563
			cos2[0] = rowcos2s[i][0];
564
			cos2[1] = rowcos2s[i][1];
565
			cos2[2] = rowcos2s[i][2];
538
		coltabledata = new ArrayList<List<Object>>();
566 539

  
567
			List<Object> entry = new ArrayList<Object>(4);
568
			entry.add(rownames[i]); // Factor
569
			entry.add(""); // separator //$NON-NLS-1$
570
			entry.add(new Double(cos2[0] + cos2[1])); // Q12
571
			entry.add(new Double(cos2[0] + cos2[2])); // Q23
572
			entry.add(new Double(cos2[2] + cos2[1])); // Q13
573

  
574
			entry.add(new Double(mass[i]) * 100.0); // mass
575

  
576
			entry.add(distt); // dist
577
			for (int c = 0; c < 3; c++) { // 3 first axis
578
				entry.add(""); // separator //$NON-NLS-1$
579
				entry.add(rowcontribs[i][c] * 100.0); // contrib
580
				entry.add(cos2[c]); // cos²
540
		if(r_ca != null)	{
541
			double[] sv = null;
542
			double[] mass = null;
543
			double[][] colcoords = null;
544
			double[][] colcontribs = null;
545
			double[][] colcos2s = null;
546
			double[] coldist = null;
547
			
548
			try {
549
				sv = this.getValeursPropres();
550
				mass = r_ca.getColsMass();
551
				colcoords = r_ca.getColsCoords();
552
				colcontribs = r_ca.getColContrib();
553
				colcos2s = r_ca.getColCos2();
554
				coldist = r_ca.getColDist();
555
				//add dist
556
				this.getColNames();
557
			} catch (StatException e) {
558
				org.txm.utils.logger.Log.printStackTrace(e);
559
				return null;
581 560
			}
582
			entry.add(""); //separator //$NON-NLS-1$
583
			for (int c = 0; c < 3; c++) { // 3 first axis
584
				entry.add(rowcoords[i][c]); // coords
561
	
562
	
563
			double[] cos2 = new double[3];
564
			for (int i = 0; i < colnames.length; i++) {
565
				List<Object> entry = new ArrayList<Object>(4);
566
	
567
				cos2[0] = colcos2s[i][0];
568
				cos2[1] = colcos2s[i][1];
569
				cos2[2] = colcos2s[i][2];
570
	
571
				entry.add(colnames[i]); // Factor
572
				entry.add(""); //separator //$NON-NLS-1$
573
				entry.add(new Double(cos2[0] + cos2[1])); // Q12
574
				entry.add(new Double(cos2[0] + cos2[2])); // Q23
575
				entry.add(new Double(cos2[2] + cos2[1])); // Q13
576
				entry.add(new Double(mass[i] * 100.0)); // mass
577
	
578
				entry.add(coldist[i]); // dist
579
	
580
				for (int c = 0; c < 3; c++) { // 3 first axis
581
					entry.add(""); //separator //$NON-NLS-1$
582
					entry.add(colcontribs[i][c]); // contrib
583
					entry.add(cos2[c]); // cos²
584
				}
585
				entry.add(""); //separator //$NON-NLS-1$
586
				for (int c = 0; c < 3; c++) { // 3 first axis
587
					entry.add(colcoords[i][c]); // coords
588
				}
589
				entry.add("");//separator //$NON-NLS-1$
590
				coltabledata.add(entry);
585 591
			}
586
			entry.add("");// separator //$NON-NLS-1$
587
			rowtabledata.add(entry);
588 592
		}
589 593

  
590
		return rowtabledata.toArray();
594
		return coltabledata.toArray();
591 595
	}
592 596

  
597
	
593 598
	/**
594 599
	 * Get the row infos titles as array.
595 600
	 *
......
629 634
	 */
630 635
	public String[] getRowNames() throws Exception {
631 636
		if (rownames == null) {
632
			rownames = getLexicalTable().getRowNames().asStringsArray();
637
			rownames = this.getLexicalTable().getRowNames().asStringsArray();
633 638
		}
634 639
		return rownames;
635 640
	}
......
981 986
		return this.getLexicalTable().getProperty();
982 987
	}
983 988

  
989

  
990
	@Override
991
	public LexicalTable getParent() {
992
		return (LexicalTable)this.parent;
993
	}
994

  
984 995
	
996

  
985 997
}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 1455)
175 175

  
176 176
			// unit property
177 177
			new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
178
			this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, false,
178
			this.unitPropertyComboViewer = new PropertiesComboViewer(
179
					mainParametersArea,
180
					this,
181
					false,
179 182
					CQPCorpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(),
180
					this.getResult().getProperty(), false);
183
					this.getResult().getProperty(),
184
					false);
181 185

  
182 186
			// Extended parameters
183 187
			Composite extendedParametersArea = this.getExtendedParametersGroup();
......
466 470
	 */
467 471
	public void refreshInfos() {
468 472
		try {
469
			
470 473
			this.setContentDescription(TXMCoreMessages.bind(LexicalTableUIMessages.tP0vP1fminP2fmaxP3, lexicalTable.getData().getTotal(), lexicalTable.getData().getNRows(), lexicalTable.getData().getFMin(), lexicalTable.getData().getFMax()));
471 474
		} catch (Exception e3) {
472 475
			org.txm.rcp.utils.Logger.printStackTrace(e3);
......
539 542

  
540 543
		
541 544
		if(this.lexicalTable.hasBeenComputedOnce())	{
542
			
543
//			collist = new ArrayList<Object>();
544
//			Vector colnames = lexicalTable.getColNames();
545
//			
546
//			try {
547
//				int[] colmargins = lexicalTable.getColMarginsVector().asIntArray();
548
//				
549
//				int i = 3;
550
//				for (String colname : colnames.asStringsArray()) {
551
//					TableColumn partColumn = viewer.getTable().getColumn(i);
552
//					partColumn.setText(colname + " t=" + colmargins[i - 3]); //$NON-NLS-1$
553
//					partColumn.setToolTipText(colname); 
554
//					collist.add(colname);
555
//					i++;
556
//				}
557
//				
558
//				viewer.setInput(lexicalTable);
559
//
560
//				
561
//			} catch (StatException e1) {
562
//				org.txm.rcp.utils.Logger.printStackTrace(e1);
563
//				return;
564
//			}
565

  
566
		
567 545
			LineLabelProvider labelprovider = new LineLabelProvider(this.lexicalTable);
568 546
			this.viewer.setLabelProvider(labelprovider);
569 547
			this.cols = labelprovider.getCols();
570 548
			this.rows = labelprovider.getRows();
571
			//this.freqs = labelprovider.getFreqs();
572
	
573
			viewer.setInput(lexicalTable);
549
			this.viewer.setInput(this.lexicalTable);
574 550
		}
575 551

  
576 552
		this.viewer.getControl().setRedraw(true);
......
735 711
			TXMEditor.packColumns(this.viewer);
736 712

  
737 713
		}
738

  
739 714
		
740 715

  
741 716
	 @Override
742 717
	public void updateEditorFromResult(boolean update) {
743 718
		if(this.lexicalTable.getData() != null)	{
744
			//vMax.setMaximum(lexicalTable.getData().getNRows());
745
			//vMax.setSelection(lexicalTable.getFMinFilter());
746
//			fMin.setMinimum(lexicalTable.getData().getFMin());
747
			//fMin.setMaximum(lexicalTable.getData().getFMax());
748
			//fMin.setSelection(lexicalTable.getData().getFMin());
749
			
750 719
			this.mergeDeleteColumnsButton.setEnabled(true);
751 720
			this.mergeDeleteRowsButton.setEnabled(true);
752 721
			
......
758 727
		}
759 728

  
760 729
		this.refreshTable(update);
761

  
762 730
		
763 731
		QueriesView.refresh();
764 732
		RVariablesView.refresh();
765

  
766 733
	}
767 734

  
768 735
	 
769 736
	@Override
770 737
	public void updateResultFromEditor() {
738
		//FIXME: SJ: needs to manage here the merge/deletion of rows and columns
771 739
	}
772 740
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/utils/SWTEditorsUtils.java (revision 1455)
5 5

  
6 6
import java.util.ArrayList;
7 7

  
8
import org.eclipse.core.commands.ExecutionEvent;
8 9
import org.eclipse.e4.ui.model.application.ui.MUIElement;
9 10
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
10 11
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
......
18 19
import org.eclipse.ui.IWorkbenchPage;
19 20
import org.eclipse.ui.IWorkbenchWindow;
20 21
import org.eclipse.ui.PlatformUI;
22
import org.eclipse.ui.handlers.HandlerUtil;
21 23
import org.eclipse.ui.part.EditorPart;
22 24
import org.txm.core.results.TXMResult;
23 25
import org.txm.rcp.editors.TXMEditor;
......
89 91
		
90 92
	}
91 93
	
94
	/**
95
	 * Gets the current active editor.
96
	 * @param event
97
	 * @return
98
	 */
99
	public static TXMEditor getActiveEditor(ExecutionEvent event)	{
100
		
101
		IEditorPart editor = null;
102
		
103
		if(event != null)	{
104
			editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor();
105
		}
106
		else	{
107
			editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
108
		}
109
		
110
		if(editor instanceof TXMMultiPageEditor)	{
111
			editor = ((TXMMultiPageEditor)editor).getMainEditorPart();
112
			
113
		}
114
		
115
		if(!(editor instanceof TXMEditor))	{
116
			return null;
117
		}
118
		
119
		return (TXMEditor)editor;
120
	}
121

  
122
	
92 123
//	// FIXME: SJ: seems useless since page.findEditor() seem to return the multipage editor if a nested editor exists? 
93 124
//	/***
94 125
//	 * Gets an editor for the specified result if its opened inside a TXMMultiPageEditor.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java (revision 1455)
29 29
import org.txm.core.results.TXMResult;
30 30
import org.txm.rcp.editors.TXMEditor;
31 31
import org.txm.rcp.editors.TXMMultiPageEditor;
32
import org.txm.rcp.utils.SWTEditorsUtils;
32 33
import org.txm.rcp.views.corpora.CorporaView;
33 34
import org.txm.searchengine.cqp.CQPSearchEngine;
34 35
import org.txm.statsengine.core.messages.StatsEngineCoreMessages;
......
116 117
		return page.showView(id);
117 118
	}
118 119
	
119

  
120
	
121 120
	/**
122 121
	 * Gets the result stored in the current active editor.
123 122
	 * @param event
......
125 124
	 */
126 125
	public static TXMResult getActiveEditorResult(ExecutionEvent event)	{
127 126
		try {
128
			return getActiveEditor(event).getResult();
127
			return SWTEditorsUtils.getActiveEditor(event).getResult();
129 128
		}
130 129
		catch (Exception e) {
131 130
			return null;
132 131
		}
133 132
	}
134 133

  
135
	/**
136
	 * Gets the current active editor.
137
	 * @param event
138
	 * @return
139
	 */
140
	public static TXMEditor getActiveEditor(ExecutionEvent event)	{
141
		
142
		IEditorPart editor = null;
143
		
144
		if(event != null)	{
145
			editor = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActiveEditor();
146
		}
147
		else	{
148
			editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
149
		}
150
		
151
		if(editor instanceof TXMMultiPageEditor)	{
152
			editor = ((TXMMultiPageEditor)editor).getMainEditorPart();
153
			
154
		}
155
		
156
		if(!(editor instanceof TXMEditor))	{
157
			return null;
158
		}
159
		
160
		return (TXMEditor)editor;
161
	}
162 134
	
163 135
	/**
164 136
	 * Gets the parent of the result stored in the active editor.
......
172 144
	}
173 145
	
174 146
	
147
	
175 148
	/**
176 149
	 * Logs a severe entry.
177 150
	 * @param selection
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1455)
220 220
	}
221 221

  
222 222

  
223
	@Override
224
	public boolean isSaveOnCloseNeeded() {
225
		return false;
226
	}
227
	
223 228
	/**
224 229
	 * Initializes plug-ins extensions.
225 230
	 */
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMMultiPageEditor.java (revision 1455)
35 35
import org.eclipse.ui.IEditorPart;
36 36
import org.eclipse.ui.part.EditorPart;
37 37
import org.eclipse.ui.part.MultiPageEditorPart;
38
import org.txm.rcp.editors.input.IProvidingMultiPageEditorInput;
39 38

  
40 39
/**
41
 * A GenericMultiPageEditor is a MultiPageEditor whose content and behavior is
42
 * determined on the fly by an EditorInput implementing the {@link IProvidingMultiPageEditorInput} interface.
43 40
 * 
44
 * @author Sylvain Loiseau
41
 * Multipage editor.
42
 * 
43
 * @author sjacquot
44
 * @author sloiseau
45 45
 */
46
//FIXME: the editors should not be retrieve from the editor input that should not itself store or create some UI components
47
@Deprecated
48 46
public abstract class TXMMultiPageEditor extends MultiPageEditorPart {
49 47

  
50 48
	/** The Constant ID. */

Formats disponibles : Unified diff