Revision 364

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 364)
642 642
	
643 643
	
644 644
	/**
645
	 * Opens the specified <code>ChartEditorPart</code> in the active page and registers the event listeners and context menus according to the <code>EventCallBack</code> installed extensions. 
645
	 * Opens the <code>ChartEditorPart</code> specified by its id and ChartEditorInput in the active page and registers the event listeners and context menus according to the <code>EventCallBack</code> installed extensions. 
646 646
	 * @param chartEditorInput
647 647
	 * @param editorPartId
648 648
	 * @param chartType
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 364)
267 267
		//FIXME: description test
268 268
		//this.setContentDescription("details");
269 269
		//this.setContentDescription(this.getResultData().getDetails());
270
		
270 271
	}
271 272

  
272 273

  
......
376 377

  
377 378
	
378 379
	/**
379
	 * Computes and creates or updates the chart.
380
	 * @param update
380
	 * Computes and creates or updates the char (from the linked editor input data)t.
381
	 * @param update set if it's an update of an existing chart or a creation of a new chart
381 382
	 */
382 383
	public void computeChart(boolean update) {
383 384
		this.computeChart(update, false, false);
......
385 386
	
386 387
	
387 388
	/**
388
	 * Computes and creates or updates the chart.
389
	 * Computes and creates or updates the chart (from the linked editor input data).
389 390
	 * @param jobName
390
	 * @param update
391
	 * @param update set if it's an update of an existing chart or a creation of a new chart
391 392
	 */
392 393
	public void computeChart(String jobName, boolean update) {
393 394
		this.computeChart(jobName, update, false, false, false);
......
395 396

  
396 397
	
397 398
	/**
398
	 * Computes and creates or updates the chart.
399
	 * @param update
399
	 * Computes and creates or updates the chart (from the linked editor input data).
400
	 * @param update set if it's an update of an existing chart or a creation of a new chart
400 401
	 * @param resetView
401 402
	 * @param clearChartItemsSelection
402 403
	 */
......
405 406
	}
406 407
	
407 408
	/**
408
	 * Computes and creates or updates the chart.
409
	 * Computes and creates or updates the chart (from the linked editor input data).
409 410
	 * @param jobName
410
	 * @param update
411
	 * @param update set if it's an update of an existing chart or a creation of a new chart
411 412
	 * @param setUser
412 413
	 */
413 414
	public void computeChart(String jobName, boolean update, boolean setUser) {
......
415 416
	}
416 417
	
417 418
	/**
418
	 * Computes and creates or updates the chart.
419
	 * Computes and creates or updates the chart (from the linked editor input data).
419 420
	 * @param jobName
420
	 * @param update
421
	 * @param update set if it's an update of an existing chart or a creation of a new chart
421 422
	 * @param setUser if true, the progression bar dialog will be visible otherwise it will be reduced at bottom right status bar area.
422 423
	 * @param resetView
423 424
	 * @param clearChartItemsSelection
......
431 432

  
432 433
		    	this.runInit(monitor);
433 434
		    	
434
		    	// creating/updating
435
				monitor.beginTask("Computing", IProgressMonitor.UNKNOWN);
436
		    	
437
				if(update)	{
438
					updateChart();
439
				}
440
				else	{
441
					createChart();
442
				}
435
		    	try {
436
					// creating/updating
437
					monitor.beginTask("Computing", IProgressMonitor.UNKNOWN);
438
					
439
					if(update)	{
440
						updateChart();
441
					}
442
					else	{
443
						createChart();
444
					}
443 445

  
444
				// cancel
445
				if(monitor.isCanceled())	{
446
					close();
447
					return Status.CANCEL_STATUS;
448
				}
449
				
450
				// loading
451
				monitor.setTaskName("Loading");
452
				loadChart(resetView, clearChartItemsSelection);
446
					// cancel
447
					if(monitor.isCanceled())	{
448
						close(true);
449
						return Status.CANCEL_STATUS;
450
					}
451
					
452
					// loading
453
					monitor.setTaskName("Loading");
454
					loadChart(resetView, clearChartItemsSelection);
453 455

  
454
				// FIXME: refresh the tree node
456
					// FIXME: refresh the tree node
455 457
//				getSite().getShell().getDisplay().syncExec(new Runnable() {
456 458
//					@Override
457 459
//					public void run() {
458
						refresh();
460
							refresh();
459 461
//					}
460 462
//				});
461 463

  
462
				
463
				// done
464
				monitor.done(); 
464
					
465
					// done
466
					monitor.done();
467
				}
468
		    	// for direct canceling
469
		    	catch(ThreadDeath td) {
470
		    		close(true);
471
		    		return Status.CANCEL_STATUS;
472
		    	}
473
				catch(Exception e) {
474
					// TODO Auto-generated catch block
475
					e.printStackTrace();
476
				} 
465 477
				return Status.OK_STATUS;
466 478
		    }
467 479

  
......
475 487

  
476 488

  
477 489
	/**
478
	 * Gets the editor input.
490
	 * Convenience method the get the casted linked editor input.
479 491
	 * @return the editorInput
480 492
	 */
481 493
	public ChartEditorInput getEditorInput() {
......
571 583
	
572 584
	/**
573 585
	 * Creates a new chart for the specified result data and save it in the current editor input.
574
	 * @param resultData
586
	 * @param result
575 587
	 * @param preferencesNode
576 588
	 */
577
	public void createChart(ITXMResult resultData, String preferencesNode)	{
578
		this.getSWTChartsComponentsProvider().createChart(this.getEditorInput(), resultData, preferencesNode);
589
	public void createChart(ITXMResult result, String preferencesNode)	{
590
		this.getSWTChartsComponentsProvider().createChart(this.getEditorInput(), result, preferencesNode);
579 591
	}
580 592
	
581 593
	/**
......
602 614
		return this.getEditorInput().getPreferencesNodeQualifier();
603 615
	}
604 616

  
605
	/**
606
	 * Closes the editor from the UI thread.
607
	 */
608
	public void close()	{
609
		final EditorPart self = this;
610
		getSite().getShell().getDisplay().syncExec(new Runnable() {
611
			@Override
612
			public void run() {
613
				getSite().getPage().closeEditor(self, false);
614
			}
615
		});
616
	}
617 617

  
618 618
	/**
619 619
	 * Returns the tool bar of this editor.
......
881 881

  
882 882

  
883 883

  
884
	@Override
885
	public void computeResult(boolean update) {
886
		// TODO Auto-generated method stub
887
		
888
	}
884 889

  
890

  
891

  
892

  
885 893
}
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionSelectionListener.java (revision 364)
50 50
//	
51 51
//				try {
52 52
//					IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage();
53
//					ConcordancesEditor editor = (ConcordancesEditor) page.openEditor(editorInput, "org.txm.rcp.editors.ConcordancesEditor"); //$NON-NLS-1$
53
//					ConcordanceEditor editor = (ConcordanceEditor) page.openEditor(editorInput, "ConcordanceEditor"); //$NON-NLS-1$
54 54
//					editor.setQuery(query);
55 55
//					editor.compute();
56 56
//					
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionEventCallBack.java (revision 364)
20 20
import org.jfree.chart.entity.ChartEntity;
21 21
import org.txm.chartsengine.rcp.events.EventCallBack;
22 22
import org.txm.chartsengine.rcp.events.ZoomAndPanCallBack;
23
import org.txm.concordances.functions.comparators.LineComparator;
23
import org.txm.concordance.core.functions.comparators.LineComparator;
24
import org.txm.concordance.rcp.editors.ConcordanceEditor;
25
import org.txm.concordance.rcp.editors.ConcordanceEditorInput;
24 26
import org.txm.objects.Edition;
25 27
import org.txm.objects.Page;
26 28
import org.txm.objects.Text;
27 29
import org.txm.progression.core.chartsengine.base.ProgressionChartCreator;
28 30
import org.txm.progression.core.chartsengine.base.Utils;
29 31
import org.txm.progression.core.functions.Progression;
32
import org.txm.rcp.Messages;
30 33
import org.txm.rcp.synoptic.commands.OpenEdition;
31 34
import org.txm.rcp.synoptic.editor.EditionPanel.RGBA;
32 35
import org.txm.rcp.synoptic.editor.SynopticEditionEditor;
33
import org.txm.rcp.Messages;
34
import org.txm.rcp.editors.concordances.ConcordancesEditor;
35
import org.txm.rcp.editors.input.ConcordancesEditorInput;
36 36
import org.txm.rcp.utils.SWTEditorsUtils;
37 37
import org.txm.searchengine.cqp.corpus.Corpus;
38 38
import org.txm.searchengine.cqp.corpus.Property;
......
94 94
//						// Linked concordance
95 95
//						else	{
96 96
//							// Updates the linked editor
97
//							updateLinkedConcordanceEditor(chartEditor.getLinkedEditors(ConcordancesEditor.class), selectedPointPositions);
97
//							updateLinkedConcordanceEditor(chartEditor.getLinkedEditors(ConcordanceEditor.class), selectedPointPositions);
98 98
//						}
99 99
//					}
100 100
//					else if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 1 && eventArea == EventCallBack.AREA_ITEM) {
101 101
//
102 102
//						// Get the linked concordance editors and update the one linked to the progression curve if it exists
103
//						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
103
//						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordanceEditor.class);
104 104
//						if(!linkedConcordancesEditors.isEmpty())	{
105 105
//							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
106 106
//						}
......
137 137
//						final ArrayList<Integer> selectedPointPositions = Utils.getChartCreator(chartEditor.getChartsEngine()).getSelectedPointPositions(chartEditor.getChart());
138 138
//	
139 139
//						// Get the linked concordance editors and update the one linked to the progression curve if it exists
140
//						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
140
//						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordanceEditor.class);
141 141
//						if(!linkedConcordancesEditors.isEmpty())	{
142 142
//							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
143 143
//						}
......
187 187
						// Linked concordance
188 188
						else	{
189 189
							// Updates the linked editor
190
							updateLinkedConcordanceEditor(chartEditor.getLinkedEditors(ConcordancesEditor.class), selectedPointPositions);
190
							updateLinkedConcordanceEditor(chartEditor.getLinkedEditors(ConcordanceEditor.class), selectedPointPositions);
191 191
						}
192 192
					}
193 193
					else if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 1 && eventArea == EventCallBack.AREA_ITEM) {
194 194

  
195 195
						// Get the linked concordance editors and update the one linked to the progression curve if it exists
196
						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
196
						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordanceEditor.class);
197 197
						if(!linkedConcordancesEditors.isEmpty())	{
198 198
							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
199 199
						}
......
230 230
						final ArrayList<Integer> selectedPointPositions = Utils.getChartCreator(chartEditor.getChartsEngine()).getSelectedPointPositions(chartEditor.getChart());
231 231
	
232 232
						// Get the linked concordance editors and update the one linked to the progression curve if it exists
233
						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
233
						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordanceEditor.class);
234 234
						if(!linkedConcordancesEditors.isEmpty())	{
235 235
							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
236 236
						}
......
284 284
		
285 285
		
286 286
		// gets the linked editor according to the query if it exists
287
		ConcordancesEditor linkedEditor = null;
287
		ConcordanceEditor linkedEditor = null;
288 288
		for(int i = 0; i < linkedEditors.size(); i++) {
289
			if(query.equals(((ConcordancesEditor) linkedEditors.get(i)).getConcordance().getQuery().getQueryString()))	{
290
				linkedEditor = ((ConcordancesEditor) linkedEditors.get(i));
289
			if(query.equals(((ConcordanceEditor) linkedEditors.get(i)).getConcordance().getQuery().getQueryString()))	{
290
				linkedEditor = ((ConcordanceEditor) linkedEditors.get(i));
291 291
				break;
292 292
			}
293 293
		}
294 294
		
295 295
		
296 296
		
297
		ConcordancesEditorInput editorInput;
297
		ConcordanceEditorInput editorInput;
298 298
		boolean newEditor = false;
299 299
		// Create the linked editor input if needed
300 300
		if(linkedEditor == null) {
301
			editorInput = new ConcordancesEditorInput(((Progression) chartEditor.getResultData()).getCorpus(), null);
301
			editorInput = new ConcordanceEditorInput(((Progression) chartEditor.getResultData()).getCorpus(), null);
302 302
			newEditor = true;
303 303
		}
304 304
		else	{
305
			editorInput = (ConcordancesEditorInput) linkedEditor.getEditorInput();
305
			editorInput = (ConcordanceEditorInput) linkedEditor.getEditorInput();
306 306
		}
307 307

  
308 308
		try {
309 309
			boolean wasOpenEditor = SWTEditorsUtils.isOpenEditor(editorInput);
310 310
			
311
			linkedEditor = (ConcordancesEditor) page.openEditor(editorInput, "org.txm.rcp.editors.ConcordancesEditor", false); //$NON-NLS-1$
311
			linkedEditor = (ConcordanceEditor) page.openEditor(editorInput, "ConcordanceEditor", false); //$NON-NLS-1$
312 312
			if(newEditor)	{
313 313
				chartEditor.addLinkedEditor(linkedEditor);
314 314
			}
......
488 488
					int position = EModelService.BELOW;;
489 489
					EditorPart parentEditor = chartEditor;
490 490
					// Split vertically if there is already a concordance editor otherwise split horizontally
491
					ConcordancesEditor linkedConcordanceEditor = (ConcordancesEditor)chartEditor.getLinkedEditor(ConcordancesEditor.class);
491
					ConcordanceEditor linkedConcordanceEditor = (ConcordanceEditor)chartEditor.getLinkedEditor(ConcordanceEditor.class);
492 492
					if(linkedConcordanceEditor != null)	{
493 493
						position = EModelService.RIGHT_OF;
494 494
						parentEditor = linkedConcordanceEditor;
......
581 581
//					int position = EModelService.BELOW;;
582 582
//					EditorPart parentEditor = chartEditor;
583 583
//					// Split vertically if there is already a concordance editor otherwise split horizontally
584
//					ConcordancesEditor linkedConcordanceEditor = (ConcordancesEditor)chartEditor.getLinkedEditor(ConcordancesEditor.class);
584
//					ConcordanceEditor linkedConcordanceEditor = (ConcordanceEditor)chartEditor.getLinkedEditor(ConcordanceEditor.class);
585 585
//					if(linkedConcordanceEditor != null)	{
586 586
//						position = EModelService.RIGHT_OF;
587 587
//						parentEditor = linkedConcordanceEditor;
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 364)
149 149
			
150 150

  
151 151
			// FIXME: tests parameters composite extension
152
			// Contribute to the tool bar without extending ChartEditorPart
152 153
			if(!editor.wasAlreadyOpened())	{
153 154
				new ProgressionParametersComposite(editor.getCommandParametersGroup(), SWT.NONE);
154 155
				editor.getCommandParametersGroup().pack();
tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF (revision 364)
17 17
 org.txm.rcp,
18 18
 org.eclipse.core.runtime;bundle-version="3.10.0",
19 19
 org.txm.synopticeditor.rcp,
20
 org.eclipse.core.expressions;bundle-version="3.4.600"
20
 org.eclipse.core.expressions;bundle-version="3.4.600",
21
 org.txm.concordance.rcp
21 22
Export-Package: org.txm.progression.rcp.adapters,
22 23
 org.txm.progression.rcp.chartsengine.events,
23 24
 org.txm.progression.rcp.dialogs,
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableEditor.java (revision 364)
598 598
		// TODO Auto-generated method stub
599 599
		return false;
600 600
	}
601

  
602
	@Override
603
	public void computeResult(boolean update) {
604
		// FIXME! not yet implemented
605
		System.err.println("SpecificitiesTableEditor.computeResult(): not yet implemented.");
606
	}
601 607
}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesBarChart.java (revision 364)
91 91
			editor.getEditorInput().setAlwaysRecreateEditor(true);
92 92

  
93 93
			
94
			// Contribute to tool bar
94
			// Contribute to the tool bar without extending ChartEditorPart
95 95
			if(!editor.wasAlreadyOpened())	{
96 96
				ChartEditorToolBar toolBar = editor.getToolBar();
97 97
				// Group bars by lines
tmp/org.txm.lexicaltable.rcp/plugin.xml (revision 364)
83 83
            <menuContribution
84 84
            locationURI="popup:LexicalTableEditor">
85 85
         <command
86
               commandId="DeleteLines"
86
               commandId="DeleteLexicalTableLines"
87 87
               style="push">
88 88
         </command>
89 89
         <command
......
115 115
      </command>
116 116
            <command
117 117
            defaultHandler="org.txm.lexicaltable.rcp.handlers.DeleteLines"
118
            id="DeleteLines"
118
            id="DeleteLexicalTableLines"
119 119
            name="%command.name.37">
120 120
      </command>
121 121
      
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 364)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.lexicaltable.rcp.editors;
29

  
30
import org.eclipse.core.runtime.IProgressMonitor;
31
import org.eclipse.jface.action.MenuManager;
32
import org.eclipse.jface.viewers.TableViewer;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.GridLayout;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Menu;
39
import org.eclipse.swt.widgets.Table;
40
import org.eclipse.ui.IEditorInput;
41
import org.eclipse.ui.IEditorSite;
42
import org.eclipse.ui.PartInitException;
43
import org.eclipse.ui.part.EditorPart;
44
import org.txm.core.messages.TXMCoreMessages;
45
import org.txm.rcp.editors.TableKeyListener;
46
import org.txm.searchengine.cqp.corpus.Property;
47

  
48
/**
49
 * The Class LexicalTableEditor.
50
 */
51
//FIXME: unused?
52
public class LexicalTableEditor extends EditorPart {
53

  
54
	/**
55
	 * Instantiates a new lexical table editor.
56
	 */
57
	public LexicalTableEditor() {
58
		// TODO Auto-generated constructor stub
59
	}
60

  
61
	/** The Constant ID. */
62
	public static final String ID = "LexicalTableEditor"; //$NON-NLS-1$
63

  
64
	/**
65
	 * Creates the part control.
66
	 *
67
	 * @param parent the parent
68
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
69
	 */
70
	@Override
71
	public void createPartControl(Composite parent) {
72
		GridLayout parentLayout = new GridLayout(1, false);
73
		parent.setLayout(parentLayout);
74

  
75
//		Lexicon lexicon = null; // ((LexicalTableEditorInput)getEditorInput()).getLexicon();
76
		Property property = ((LexicalTableEditorInput) getEditorInput()).getProperty();
77

  
78
		Composite corpusInfo = new Composite(parent, SWT.NONE);
79
		GridLayout corpusInfoLayout = new GridLayout(1, false);
80
		corpusInfo.setLayout(corpusInfoLayout);
81

  
82
		Label propertyLabel = new Label(corpusInfo, SWT.NONE);
83
		propertyLabel.setText(TXMCoreMessages.PROPERTY_1 + property.getName());
84
		propertyLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
85
				false, false));
86

  
87
		Label numberOfTypeLabel = new Label(corpusInfo, SWT.NONE);
88
		//numberOfTypeLabel.setText(Messages.bind(Messages.LexicalTable_2, lexicon.nbrOfType()));
89
		numberOfTypeLabel.setLayoutData(new GridData(GridData.END,
90
				GridData.CENTER, false, false));
91

  
92
		Label numberOfTokenLabel = new Label(corpusInfo, SWT.NONE);
93
//		int numberOfToken = lexicon.nbrOfToken();
94
//		numberOfTokenLabel.setText(Messages.LexicalTable_3 + numberOfToken);
95
		numberOfTokenLabel.setLayoutData(new GridData(GridData.END,
96
				GridData.CENTER, false, false));
97

  
98
		TableViewer viewer = new TableViewer(parent, SWT.VIRTUAL | SWT.BORDER
99
				| SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
100
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
101
		Table table = viewer.getTable();
102
		table.setHeaderVisible(true);
103
		table.setLinesVisible(true);
104
		/*TableColumn nameColumn = new TableColumn(table, SWT.LEFT);
105
		nameColumn.setText(Messages.IndexEditor_27
106
				+ lexicon.getProperty().toString());
107
		nameColumn.setWidth(320);
108
		TableColumn sizeColumn = new TableColumn(table, SWT.RIGHT);
109
		sizeColumn.setText(Messages.FrequencyListEditorInput_4);
110
		sizeColumn.setWidth(80);
111
		int[] freqs = lexicon.getFreq();
112
		String[] types = lexicon.getForms();
113
		for (int i = 0; i < lexicon.nbrOfType(); i++) {
114
			TableItem item = new TableItem(table, SWT.NONE);
115
			item.setText(new String[] { types[i], String.valueOf(freqs[i]) });
116
		}
117
		*/
118
		createContextMenu(viewer);
119
	}
120

  
121
	/**
122
	 * Creates the context menu.
123
	 *
124
	 * @param tableViewer the table viewer
125
	 */
126
	private void createContextMenu(TableViewer tableViewer) {
127
		MenuManager menuManager = new MenuManager();
128
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
129

  
130
		// Set the MenuManager
131
		tableViewer.getTable().setMenu(menu);
132
		getSite().registerContextMenu(menuManager, tableViewer);
133
		// Make the selection available
134
		getSite().setSelectionProvider(tableViewer);
135
	}
136

  
137
	@Override
138
	public void setFocus() {
139
	}
140
	
141
	@Override
142
	public void doSave(IProgressMonitor arg0) {
143
		// TODO Auto-generated method stub
144
	}
145

  
146
	@Override
147
	public void doSaveAs() {
148
		// TODO Auto-generated method stub
149
	}
150

  
151
	@Override
152
	public void init(IEditorSite site, IEditorInput input)
153
			throws PartInitException {
154
		setSite(site);
155
		setInput(input);
156
	}
157

  
158
	@Override
159
	public boolean isDirty() {
160
		return false;
161
	}
162

  
163
	@Override
164
	public boolean isSaveAsAllowed() {
165
		return false;
166
	}
167

  
168

  
169
}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditor.java (revision 364)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.lexicaltable.rcp.editors;
29

  
30
import org.eclipse.core.runtime.IProgressMonitor;
31
import org.eclipse.jface.action.MenuManager;
32
import org.eclipse.jface.viewers.TableViewer;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.GridLayout;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.Label;
38
import org.eclipse.swt.widgets.Menu;
39
import org.eclipse.swt.widgets.Table;
40
import org.eclipse.ui.IEditorInput;
41
import org.eclipse.ui.IEditorSite;
42
import org.eclipse.ui.PartInitException;
43
import org.eclipse.ui.part.EditorPart;
44
import org.txm.core.messages.TXMCoreMessages;
45
import org.txm.rcp.editors.TableKeyListener;
46
import org.txm.searchengine.cqp.corpus.Property;
47

  
48
/**
49
 * The Class LexicalTableEditor.
50
 */
51
//FIXME: unused?
52
public class ___LexicalTableEditor extends EditorPart {
53

  
54
	/**
55
	 * Instantiates a new lexical table editor.
56
	 */
57
	public ___LexicalTableEditor() {
58
		// TODO Auto-generated constructor stub
59
	}
60

  
61
	/** The Constant ID. */
62
	public static final String ID = "LexicalTableEditor"; //$NON-NLS-1$
63

  
64
	/**
65
	 * Creates the part control.
66
	 *
67
	 * @param parent the parent
68
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
69
	 */
70
	@Override
71
	public void createPartControl(Composite parent) {
72
		GridLayout parentLayout = new GridLayout(1, false);
73
		parent.setLayout(parentLayout);
74

  
75
//		Lexicon lexicon = null; // ((LexicalTableEditorInput)getEditorInput()).getLexicon();
76
		Property property = ((LexicalTableEditorInput) getEditorInput()).getProperty();
77

  
78
		Composite corpusInfo = new Composite(parent, SWT.NONE);
79
		GridLayout corpusInfoLayout = new GridLayout(1, false);
80
		corpusInfo.setLayout(corpusInfoLayout);
81

  
82
		Label propertyLabel = new Label(corpusInfo, SWT.NONE);
83
		propertyLabel.setText(TXMCoreMessages.PROPERTY_1 + property.getName());
84
		propertyLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
85
				false, false));
86

  
87
		Label numberOfTypeLabel = new Label(corpusInfo, SWT.NONE);
88
		//numberOfTypeLabel.setText(Messages.bind(Messages.LexicalTable_2, lexicon.nbrOfType()));
89
		numberOfTypeLabel.setLayoutData(new GridData(GridData.END,
90
				GridData.CENTER, false, false));
91

  
92
		Label numberOfTokenLabel = new Label(corpusInfo, SWT.NONE);
93
//		int numberOfToken = lexicon.nbrOfToken();
94
//		numberOfTokenLabel.setText(Messages.LexicalTable_3 + numberOfToken);
95
		numberOfTokenLabel.setLayoutData(new GridData(GridData.END,
96
				GridData.CENTER, false, false));
97

  
98
		TableViewer viewer = new TableViewer(parent, SWT.VIRTUAL | SWT.BORDER
99
				| SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
100
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
101
		Table table = viewer.getTable();
102
		table.setHeaderVisible(true);
103
		table.setLinesVisible(true);
104
		/*TableColumn nameColumn = new TableColumn(table, SWT.LEFT);
105
		nameColumn.setText(Messages.IndexEditor_27
106
				+ lexicon.getProperty().toString());
107
		nameColumn.setWidth(320);
108
		TableColumn sizeColumn = new TableColumn(table, SWT.RIGHT);
109
		sizeColumn.setText(Messages.FrequencyListEditorInput_4);
110
		sizeColumn.setWidth(80);
111
		int[] freqs = lexicon.getFreq();
112
		String[] types = lexicon.getForms();
113
		for (int i = 0; i < lexicon.nbrOfType(); i++) {
114
			TableItem item = new TableItem(table, SWT.NONE);
115
			item.setText(new String[] { types[i], String.valueOf(freqs[i]) });
116
		}
117
		*/
118
		createContextMenu(viewer);
119
	}
120

  
121
	/**
122
	 * Creates the context menu.
123
	 *
124
	 * @param tableViewer the table viewer
125
	 */
126
	private void createContextMenu(TableViewer tableViewer) {
127
		MenuManager menuManager = new MenuManager();
128
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
129

  
130
		// Set the MenuManager
131
		tableViewer.getTable().setMenu(menu);
132
		getSite().registerContextMenu(menuManager, tableViewer);
133
		// Make the selection available
134
		getSite().setSelectionProvider(tableViewer);
135
	}
136

  
137
	@Override
138
	public void setFocus() {
139
	}
140
	
141
	@Override
142
	public void doSave(IProgressMonitor arg0) {
143
		// TODO Auto-generated method stub
144
	}
145

  
146
	@Override
147
	public void doSaveAs() {
148
		// TODO Auto-generated method stub
149
	}
150

  
151
	@Override
152
	public void init(IEditorSite site, IEditorInput input)
153
			throws PartInitException {
154
		setSite(site);
155
		setInput(input);
156
	}
157

  
158
	@Override
159
	public boolean isDirty() {
160
		return false;
161
	}
162

  
163
	@Override
164
	public boolean isSaveAsAllowed() {
165
		return false;
166
	}
167

  
168

  
169
}
0 170

  
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor2.java (revision 364)
68 68
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
69 69
import org.txm.lexicaltable.rcp.handlers.MergeLines;
70 70
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
71
import org.txm.rcp.editors.TXMEditorPart;
72 71
import org.txm.rcp.Messages;
73 72
import org.txm.rcp.StatusLine;
74 73
import org.txm.rcp.commands.editor.CustomizableEditor;
74
import org.txm.rcp.editors.TXMEditorPart;
75 75
import org.txm.rcp.editors.TableKeyListener;
76
import org.txm.rcp.swt.provider.SimpleLabelProvider;
77 76
import org.txm.rcp.swt.widget.ObjectSelector;
78 77
import org.txm.rcp.swt.widget.PropertiesSelector;
79 78
import org.txm.rcp.swt.widget.QueryWidget;
80
import org.txm.rcp.views.corpora.CorporaView;
81 79
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
82 80
import org.txm.searchengine.cqp.corpus.Corpus;
83 81
import org.txm.statsengine.core.StatException;
84 82
import org.txm.statsengine.core.data.Vector;
85
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
86 83
// TODO: Auto-generated Javadoc
87 84
/**
88 85
 * display the lexical table tools to merge/delete lines or columns and display
......
681 678
	 *
682 679
	 * @param file the file
683 680
	 */
681
	 @Deprecated
684 682
	public void exportData(File file) {
685 683
		itable.exportData(file, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
686 684
	}
......
690 688
	 *
691 689
	 * @param file the file
692 690
	 */
691
	 @Deprecated
693 692
	public void importData(File file) {
694 693
		try {
695 694
			if (itable.importData(file)) {
......
814 813
		return false;
815 814
	}
816 815

  
816

  
817

  
818
	@Override
819
	public void computeResult(boolean update) {
820
		// FIXME! not yet implemented
821
		System.err.println("LexicalTableEditor2.computeResult(): not yet implemented.");
822
	}
823

  
824

  
825

  
817 826
}
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/CAHChartEditor.java (revision 364)
148 148
				
149 149
				
150 150
				// Recompute the CAH and the chart
151
				compute(true);
151
				computeResult(true);
152 152
			}
153 153
			
154 154
			@Override
......
162 162
		computeColumns.addSelectionListener(listener);
163 163
		displayCombo.addSelectionListener(listener);
164 164
		
165
		this.compute(false);
165
		this.computeResult(false);
166 166
		
167 167
		
168 168

  
......
173 173
	 * Computes the result and the chart.
174 174
	 * @param update
175 175
	 */
176
	public void compute(final boolean update)	{
176
	public void computeResult(final boolean update)	{
177 177
		
178 178
		JobHandler jobhandler = new JobHandler(CAHCoreMessages.LOG_COMPUTE_CAH) {
179 179
			@Override
tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/handlers/ComputeLexicon.java (revision 364)
88 88
				//FIXME: to hide the created index, but the problem is when user deletes the Lexicon node, the Index is not deleted, discuss about this
89 89
				//Actually I do not understand well the link between Lexicon and Index classes.
90 90
				//FIXME 2: now the Index is a child of the Lexicon so we can hide it if we want and it will be deleted when the Lexicon will be deleted
91
				editor.compute(false);
91
				editor.computeResult(false);
92 92
				//editor.compute();
93 93
				// editor.initializeFields();
94 94
			}
tmp/org.txm.lexicon.rcp/plugin.xml (revision 364)
48 48
            </visibleWhen>
49 49
         </command>
50 50
      </menuContribution>
51
      <menuContribution
52
            locationURI="popup:LexiconEditor">
53
         <command
54
               commandId="org.txm.rcp.commands.link.IndexToConcordance"
55
               style="push">
56
         </command>
57
         <command
58
               commandId="org.txm.rcp.commands.link.LexiconToIndex"
59
               style="push">
60
         </command>
61
         <command
62
               commandId="org.txm.rcp.commands.link.IndexToProgression"
63
               style="push">
64
         </command>
65
      </menuContribution>
51 66
   </extension>
52 67
   <extension
53 68
         point="org.eclipse.ui.commands">
tmp/org.txm.partition.rcp/OSGI-INF/l10n/bundle_ru_utf-8.properties (revision 364)
1
command.name=Размеры
2
command.tooltip=Размеры
tmp/org.txm.partition.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 364)
1
command.name=\u0420\u0430\u0437\u043c\u0435\u0440\u044b
2
command.tooltip=\u0420\u0430\u0437\u043c\u0435\u0440\u044b
1
command.name=Размеры
2
command.tooltip=Размеры
tmp/org.txm.partition.rcp/.settings/org.eclipse.core.resources.prefs (revision 364)
1 1
eclipse.preferences.version=1
2
encoding//OSGI-INF/l10n/bundle_ru_utf-8.properties=UTF-8
2
encoding//OSGI-INF/l10n/bundle_ru.properties=UTF-8
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java (revision 364)
118 118
//					"Partition Dimensions Pie Chart");
119 119

  
120 120
			
121
			// Contribute to the tool bar
121
			// Contribute to the tool bar without extending ChartEditorPart
122 122
			if(!editor.wasAlreadyOpened())	{
123 123
				
124 124
				new ToolItem(editor.getToolBar(), SWT.SEPARATOR);
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 364)
42 42
import java.util.Set;
43 43

  
44 44
import org.rosuda.REngine.REXPMismatchException;
45
import org.txm.concordances.functions.Concordance;
46
import org.txm.concordances.functions.Line;
45
import org.txm.concordance.core.functions.Concordance;
46
import org.txm.concordance.core.functions.Line;
47 47
import org.txm.cooccurrence.core.functions.comparators.CLineComparator;
48 48
import org.txm.cooccurrence.core.messages.CooccurrenceCoreMessages;
49 49
import org.txm.functions.Function;
......
89 89
	String referenceCorpus;
90 90

  
91 91
	/** The conclines. */
92
	List<org.txm.concordances.functions.Line> conclines;
92
	List<org.txm.concordance.core.functions.Line> conclines;
93 93

  
94 94
	/** The corpus. */
95 95
	Corpus corpus;
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeLexicon.java (revision 364)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.index.rcp.handlers;
29

  
30
import org.eclipse.core.commands.ExecutionEvent;
31
import org.eclipse.core.commands.ExecutionException;
32
import org.eclipse.ui.IWorkbenchPage;
33
import org.txm.index.core.functions.Index;
34
import org.txm.index.rcp.editors.IndexEditorInput;
35
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
36
import org.txm.lexicon.rcp.editors.DictionnaryEditor;
37
import org.txm.rcp.handlers.BaseAbstractHandler;
38
import org.txm.rcp.TXMWindows;
39
import org.txm.rcp.views.corpora.CorporaView;
40
import org.txm.searchengine.cqp.corpus.Corpus;
41

  
42
// TODO: Auto-generated Javadoc
43
/**
44
 * Compute a Lexicon used it to create a Index (object) then open it in the
45
 * DictionnaryEditor
46
 * 
47
 * @author mdecorde
48
 * @author sjacquot
49
 */
50
public class ComputeLexicon extends BaseAbstractHandler {
51

  
52
	
53
	
54
	// adds a double click listener to the Corpus View
55
	static	{
56
		CorporaView.addDoubleClickListener(Lexicon.class, ComputeLexicon.class);
57
	}
58

  
59
	
60
	@Override
61
	public Object execute(ExecutionEvent event) throws ExecutionException {
62

  
63
		if(!this.checkCorpusEngine()) {
64
			return false;
65
		}
66
		
67
		Object selection = this.getSelection();
68
		IndexEditorInput editorInput = null;
69
		
70
		
71
		// New lexicon from corpus
72
		if(selection instanceof Corpus)	{
73
			editorInput = new IndexEditorInput((Corpus) selection);
74
		}
75
		// Reopens an existing lexicon
76
		else if(selection instanceof Lexicon)	{
77
			Lexicon lex = (Lexicon) selection;
78
			Index index = new Index(lex.getCorpus(), lex.getProperty());
79
			editorInput = new IndexEditorInput(index);
80
		}
81
		
82
		try {
83
			IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
84
			DictionnaryEditor editor = (DictionnaryEditor) page.openEditor(editorInput, "LexiconEditor"); //$NON-NLS-1$
85
			
86
			// compute
87
			if(selection instanceof Corpus)	{
88
				//FIXME: to hide the created index, but the problem is when user deletes the Lexicon node, the Index is not deleted, discuss about this
89
				//Actually I do not understand well the link between Lexicon and Index classes.
90
				//FIXME 2: now the Index is a child of the Lexicon so we can hide it if we want and it will be deleted when the Lexicon will be deleted
91
				editor.compute(false);
92
				//editor.compute();
93
				// editor.initializeFields();
94
			}
95
			
96
		}
97
		catch (Exception e) {
98
			org.txm.rcp.utils.Logger.printStackTrace(e);
99
		} 
100

  
101
		
102
		return null;
103
	}
104
	
105

  
106
}
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/DictionnaryEditor.java (revision 364)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.index.rcp.editors;
29

  
30
import org.eclipse.osgi.util.NLS;
31
import org.eclipse.swt.widgets.Composite;
32
import org.txm.index.rcp.editors.IndexEditor;
33
import org.txm.lexicon.core.messages.LexiconCoreMessages;
34
// TODO: Auto-generated Javadoc
35
/**
36
 * extends the index editor to set : the number of property to 1 hide the
37
 * query field @ author mdecorde.
38
 */
39
public class DictionnaryEditor extends IndexEditor {
40

  
41
	/* (non-Javadoc)
42
	 * @see org.txm.rcp.editors.index.IndexEditor#createPartControl(org.eclipse.swt.widgets.Composite)
43
	 */
44
	@Override
45
	public void createPartControl(final Composite parent) {
46
		super.createPartControl(parent);
47
		this.propsArea.setMaxPropertyNumber(1);
48
		this.queryWidget.setText("[]"); //$NON-NLS-1$
49
		this.queryWidget.setEnabled(false);
50
		this.queryWidget.setVisible(false);
51
		this.queryWidget.setSize(0, 0);
52
		this.queryWidget.dispose();
53
		this.queryLabel.setVisible(false);
54
		this.queryLabel.dispose();
55
		saveIndex = false;
56
	}
57
	
58

  
59
	/* (non-Javadoc)
60
	 * @see org.txm.rcp.editors.index.IndexEditor#getTitleToolTip()
61
	 */
62
	@Override
63
	public String getTitleToolTip() {
64
		if (index != null) {
65
			String str;
66

  
67
			if (partition != null)
68
				str = NLS.bind(LexiconCoreMessages.DetailsFromPartition, new Object[]{partition.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()});
69
			else
70
				str = NLS.bind(LexiconCoreMessages.DetailsFromCorpus, new Object[]{corpus.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()});
71
			return str;
72
		}
73
		return ""; //$NON-NLS-1$
74
	}
75
	
76
	/* (non-Javadoc)
77
	 * @see org.txm.rcp.editors.index.IndexEditor#getSource()
78
	 */
79
	@Override
80
	public Object getSource()
81
	{
82
		return index.getLexicon();
83
	}
84
}
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 364)
253 253
	/**
254 254
	 * Computes index and sets the result node as visible.
255 255
	 */
256
	public void compute() {
257
		this.compute(true);
256
	public void computeResult() {
257
		this.computeResult(false);
258 258
	}
259 259

  
260
	@Override
261
	public void computeResult(boolean update) {
262
		this.computeResult(update, true);
263
	}
264
	
260 265
	/**
261 266
	 * Computes index.
262 267
	 */
263
	public void compute(final boolean visibleIndex) {
268
	public void computeResult(boolean update, final boolean visibleIndex) {
264 269
		StatusLine.setMessage(IndexUIMessages.IndexEditor_33);
265 270
		final Query query; // if the query is empty then we put "[]" instead
266 271
		if (queryWidget.isDisposed()) { // lexicon editor
......
532 537
			@Override
533 538
			public void keyPressed(KeyEvent e) {
534 539
				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
535
					compute();
540
					computeResult();
536 541
				}
537 542
			}
538 543
			@Override
......
550 555
			@Override
551 556
			public void handleEvent(Event event) {
552 557
				if (!initializing && TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.AUTO_UPDATE_EDITOR))
553
					compute();
558
					computeResult();
554 559
			}
555 560
		});
556 561

  
......
572 577
		SelectionListener listener2 = new SelectionListener() {
573 578
			@Override
574 579
			public void widgetSelected(SelectionEvent e) {
575
				compute();
580
				computeResult();
576 581
			}
577 582
			@Override
578 583
			public void widgetDefaultSelected(SelectionEvent e) { }
......
1238 1243
	public void doSaveAs() {
1239 1244
		// TODO Auto-generated method stub
1240 1245
	}
1246

  
1247

  
1241 1248
}
tmp/org.txm.cooccurrence.rcp/META-INF/MANIFEST.MF (revision 364)
10 10
 org.txm.cooccurrence.rcp.messages,
11 11
 org.txm.cooccurrence.rcp.preferences
12 12
Require-Bundle: org.txm.cooccurrence.core;bundle-version="1.0.0",
13
 org.eclipse.core.commands,
13
 org.txm.concordance.core;bundle-version="1.0.0",
14
 org.eclipse.ui;bundle-version="3.106.1",
14 15
 org.txm.core,
15 16
 org.txm.rcp,
16
 org.eclipse.ui;bundle-version="3.106.1",
17 17
 org.eclipse.core.runtime;bundle-version="3.10.0",
18 18
 org.eclipse.core.expressions;bundle-version="3.4.600"
19 19
Bundle-Vendor: Textometrie.org
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrenceEditorInput.java (revision 364)
67 67
		return (Cooccurrence) this.result;
68 68
	}
69 69

  
70
	/* (non-Javadoc)
71
	 * @see org.eclipse.ui.IEditorInput#exists()
72
	 */
73
	@Override
74
	public boolean exists() {
75
		return false;
76
	}
77 70

  
71

  
78 72
	/**
79 73
	 * Gets the corpus.
80 74
	 *
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 364)
90 90
import org.txm.rcp.JobsTimer;
91 91
import org.txm.rcp.Messages;
92 92
import org.txm.rcp.StatusLine;
93
import org.txm.rcp.TxmPreferences;
94 93
import org.txm.rcp.commands.editor.CustomizableEditor;
95 94
import org.txm.rcp.commands.link.CooccurrencesToConcordances;
96 95
import org.txm.rcp.editors.TXMEditorPart;
96
import org.txm.rcp.editors.TXMResultEditorInput;
97 97
import org.txm.rcp.editors.TableKeyListener;
98 98
import org.txm.rcp.preferences.RCPPreferences;
99 99
import org.txm.rcp.swt.widget.AssistedQueryWidget;
......
252 252
	 * org.eclipse.ui.IEditorInput)
253 253
	 */
254 254
	@Override
255
	public void init(IEditorSite site, IEditorInput input)
256
	throws PartInitException {
257
		setSite(site);
258
		setInput(input);
255
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
256
		super.init(site, input);
259 257

  
260
		this.cooc = ((CooccurrenceEditorInput) input).getCooc();
261
		if (cooc != null)
258
		if (((TXMResultEditorInput) input).getResult() != null)
262 259
		{
260
			this.cooc = (Cooccurrence) ((TXMResultEditorInput) input).getResult();
263 261
			this.corpus = cooc.getCorpus();
262
			//FIXME: deprecated
264 263
			setPartName(cooc.getCorpus().getName()+": "+cooc.getName()); //$NON-NLS-1$
265 264
		}
266 265
		else
267
			this.corpus = ((CooccurrenceEditorInput) input).getCorpus();
266
			this.corpus = (Corpus) ((TXMResultEditorInput) input).getSource();
268 267
	}
269 268

  
270 269
	/**
......
389 388
			public void keyPressed(KeyEvent e) {
390 389
				// System.out.println("key pressed : "+e.keyCode);
391 390
				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
392
					compute();
391
					computeResult(false);
393 392
				}
394 393
			}
395 394

  
......
416 415
		go.addSelectionListener(new SelectionListener() {
417 416
			@Override
418 417
			public void widgetSelected(SelectionEvent e) {
419
				compute();
418
				computeResult(false);
420 419
			}
421 420

  
422 421
			@Override
......
445 444
		propsArea.addValueChangeListener(new Listener() {
446 445
			@Override
447 446
			public void handleEvent(Event event) {
448
				if (TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.AUTO_UPDATE_EDITOR))
449
					compute();
447
				if (TXMPreferences.getBoolean(RCPPreferences.PREFERENCES_NODE, RCPPreferences.AUTO_UPDATE_EDITOR))	{
448
					computeResult(false);
449
				}
450 450
			}
451 451
		});
452 452
		/*
......
655 655
		setColComparator(new ScoreComparator(), scoreColumn);
656 656
		sort();
657 657
		createContextMenu(viewer);
658
		setParametersFromCooc();
658
		updateParameters();
659 659

  
660 660
		for (TableColumn col : viewer.getTable().getColumns())
661 661
			col.pack();
......
696 696
		return 5;
697 697
	}
698 698

  
699
	/**
700
	 * Compute.
701
	 */
702
	public void compute() {
699
	
700

  
701

  
702
	@Override
703
	public void computeResult(boolean update) {
703 704
		StatusLine.setMessage(CooccurrenceUIMessages.CooccurrencesEditor_33);
704 705
		if (this.queryWidget.getQueryString().trim().length() == 0
705 706
				|| this.queryWidget.getQueryString().trim().equals("\"\"")) //$NON-NLS-1$
......
892 893
	/**
893 894
	 * Sets the parameters from cooc.
894 895
	 */
895
	private void setParametersFromCooc() {
896
	private void updateParameters() {
897
		// from result
896 898
		if (this.cooc != null) {
897 899
			this.queryWidget.setText(cooc.getQuery().getQueryString());
898 900
			List<Property> available;
......
911 913
			this.empantPanel.setMaxRight(cooc.getMaxRight()-1);
912 914

  
913 915
		}
916
		// from params
917
		else if(this.getEditorInput().getParams() != null)	{
918
			this.queryWidget.setText(this.getEditorInput().getParams().getProperty("query"));
919
		}
920
		//FIXME: from default preferences
914 921
	}
915 922

  
916 923
	/**
......
1031 1038
		// TODO Auto-generated method stub
1032 1039
		return false;
1033 1040
	}
1041

  
1034 1042
}
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 364)
28 28
package org.txm.cooccurrence.rcp.handlers;
29 29

  
30 30
import java.util.ArrayList;
31
import java.util.HashMap;
31 32
import java.util.List;
33
import java.util.Properties;
32 34

  
33 35
import org.eclipse.core.commands.ExecutionEvent;
34 36
import org.eclipse.core.commands.ExecutionException;
35 37
import org.eclipse.ui.IWorkbenchPage;
36 38
import org.eclipse.ui.IWorkbenchWindow;
39
import org.eclipse.ui.handlers.HandlerUtil;
37 40
import org.txm.Toolbox;
38
import org.txm.concordances.functions.Concordance;
41
import org.txm.concordance.core.functions.Concordance;
39 42
import org.txm.cooccurrence.core.functions.Cooccurrence;
40 43
import org.txm.cooccurrence.core.preferences.CooccurrencePreferences;
41
import org.txm.cooccurrence.rcp.editors.CooccurrenceEditorInput;
42 44
import org.txm.cooccurrence.rcp.editors.CooccurrencesEditor;
43 45
import org.txm.core.preferences.TXMPreferences;
44
import org.txm.rcp.handlers.BaseAbstractHandler;
46
import org.txm.core.results.ITXMResult;
45 47
import org.txm.rcp.Messages;
46 48
import org.txm.rcp.StatusLine;
47
import org.txm.rcp.TXMWindows;
49
import org.txm.rcp.editors.TXMResultEditorInput;
50
import org.txm.rcp.handlers.BaseAbstractHandler;
48 51
import org.txm.rcp.views.corpora.CorporaView;
49 52
import org.txm.searchengine.cqp.corpus.Corpus;
50 53
import org.txm.searchengine.cqp.corpus.Property;
......
84 87

  
85 88
		
86 89
		Object selection = this.getSelection();
87
		CooccurrenceEditorInput editorInput = null;
90
		TXMResultEditorInput editorInput = null;
88 91
		
89 92
		// new editor from concordance
90 93
		if (selection instanceof Concordance) {
91 94
			Cooccurrence cooc = computeCooc(selection);
92 95
			if (cooc != null) {
93
				editorInput = new CooccurrenceEditorInput(cooc);
96
				editorInput = new TXMResultEditorInput(cooc);
94 97
			}
95 98
		}
96 99
		// new editor from corpus
97 100
		else if (selection instanceof Corpus) {
98
			editorInput = new CooccurrenceEditorInput((Corpus)selection);
101

  
102
			//FIXME: params tests
103
			HashMap<String, Object> params = new HashMap<String, Object>();
104
			params.put("query", "[word=\"faire\"]");
105
			editorInput = new TXMResultEditorInput((ITXMResult) selection, params);
106
			
107
			//editorInput = new TXMResultEditorInput((Corpus) selection);
108
			
99 109
		}
100 110
		// reopening an existing result
101 111
		else if (selection instanceof Cooccurrence) {
102
			editorInput = new CooccurrenceEditorInput((Cooccurrence)selection);
112
			editorInput = new TXMResultEditorInput((Cooccurrence)selection);
103 113

  
104 114
		}
105 115
		else {
......
107 117
		}
108 118
		
109 119
		try {
110
			IWorkbenchWindow window =TXMWindows.getActiveWindow();
120
			IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
111 121
			IWorkbenchPage page = window.getActivePage();
112 122

  
113 123
			StatusLine.setMessage(Messages.ComputeCooccurrences_0);
114 124

  
115
			CooccurrencesEditor conceditor = (CooccurrencesEditor) page.openEditor(editorInput, CooccurrencesEditor.ID); 
125
			
126
//			 return page.openEditor(editorInput, CooccurrencesEditor.ID);
127
			CooccurrencesEditor conceditor = (CooccurrencesEditor) page.openEditor(editorInput, CooccurrencesEditor.ID);
128
			conceditor.computeResult(false);
116 129
			return conceditor;
117 130
		}
118 131
		catch (Exception e) {
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/preferences/CoocPreferencePage.java (revision 364)
39 39
import org.txm.rcp.jface.DoubleFieldEditor;
40 40

  
41 41
/**
42
 * Cooccurrence preference page.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff