Révision 264

tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ComputeLexicalTable.java (revision 264)
303 303
						syncExec(new Runnable() {
304 304
							@Override
305 305
							public void run() {
306
								CorporaView.refresh();
307
								CorporaView.expand(table.getParent());
308 306
								QueriesView.refresh();
309 307
								RVariablesView.refresh();
310 308
							}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/MergeLines.java (revision 264)
119 119

  
120 120
		LTeditor.refreshTable();
121 121
		lineTableViewer.getTable().deselectAll();
122
		LTeditor.refresh();
122 123
		StatusLine.setMessage(""); //$NON-NLS-1$
123 124
	}
124 125
}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/DeleteLines.java (revision 264)
91 91

  
92 92
		LTeditor.refreshTable();
93 93
		LTeditor.getlineTableViewer().getTable().deselectAll();
94
		LTeditor.refresh();
94 95
	}
95 96

  
96 97
}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/messages/LexicalTableUIMessages.java (revision 264)
1 1
package org.txm.lexicaltable.rcp.messages;
2 2

  
3 3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
4
import org.txm.utils.messages.Utf8NLS;
5 5

  
6 6
public class LexicalTableUIMessages extends NLS {
7 7

  
......
32 32
	
33 33
	static {
34 34
		// initialize resource bundle
35
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, LexicalTableUIMessages.class);
35
		Utf8NLS.initializeMessages(BUNDLE_NAME, LexicalTableUIMessages.class);
36 36
	}
37 37

  
38 38
	private LexicalTableUIMessages() {
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor2.java (revision 264)
78 78
import org.txm.searchengine.cqp.corpus.Corpus;
79 79
import org.txm.statsengine.core.StatException;
80 80
import org.txm.statsengine.core.data.Vector;
81
import org.txm.statsengine.r.core.RWorkspaceException;
81
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
82 82
// TODO: Auto-generated Javadoc
83 83
/**
84 84
 * display the lexical table tools to merge/delete lines or columns and display
......
128 128
	Spinner minfreqspinner;
129 129

  
130 130
	/** The top spinner. */
131
	Spinner topSpinner;
131
	Spinner nLinesSpinner;
132 132

  
133 133
	/** The fusion text. */
134 134
	Text fusionText;
......
208 208
			viewer.getTable().setSortDirection(SWT.UP);
209 209
	}
210 210

  
211
	Label infos;
212 211
	/**
213 212
	 * Creates the part control.
214 213
	 *
......
218 217
	@Override
219 218
	public void createPartControl(final Composite parent) {
220 219
		
221
		//FIXME: to do
222
		//super.createPartControl(parent);
220
		super.createPartControl(parent);
223 221
		
224
		
225
		FormLayout parentLayout = new FormLayout();
226
		parent.setLayout(parentLayout);
222
		Composite paramArea = new Composite(this.commandParametersGroup, SWT.NONE);
227 223

  
228
		final Composite paramArea = new Composite(parent, SWT.NONE);
229
		FormData paramLayoutData = new FormData();
230
		paramLayoutData.top = new FormAttachment(0);
231
		paramLayoutData.left = new FormAttachment(0);
232
		paramLayoutData.right = new FormAttachment(100);
233
		paramArea.setLayoutData(paramLayoutData);
234

  
235 224
		GridLayout paramLayout = new GridLayout(5, false);
236 225
		paramArea.setLayout(paramLayout);
237 226

  
238
		infos = new Label(paramArea, SWT.NONE);
239
		infos.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
240
				true, 5, 1));
241
		refreshInfos();
242

  
227
		// Apply button
243 228
		Button keepTop = new Button(paramArea, SWT.PUSH);
244 229
		keepTop.setText(LexicalTableUIMessages.LexicalTableEditor_4);
245 230
		keepTop.addSelectionListener(new SelectionListener() {
246 231
			@Override
247 232
			public void widgetSelected(SelectionEvent e) {
248 233
				StatusLine.setMessage(LexicalTableUIMessages.LexicalTableEditor_16);
249
				System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_5, topSpinner.getSelection(), minfreqspinner.getSelection()));
234
				System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_5, nLinesSpinner.getSelection(), minfreqspinner.getSelection()));
250 235

  
251
				MessageBox messageBox = new MessageBox(e.display
252
						.getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
236
				MessageBox messageBox = new MessageBox(e.display.getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
253 237
				messageBox.setMessage(Messages.DeleteLines_1);
254 238
				int response = messageBox.open();
255 239
				if (response != SWT.YES)
256 240
					return;
257 241

  
258 242
				try {
259
					table.filter(topSpinner.getSelection(), minfreqspinner.getSelection());
260
					refreshTable();
243
					table.filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
244
					refresh();
261 245
					StatusLine.setMessage(""); //$NON-NLS-1$
262
					CorporaView.refreshObject(table);
263 246
				} catch (Exception e1) {
264 247
					// TODO Auto-generated catch block
265 248
					org.txm.rcpapplication.utils.Logger.printStackTrace(e1);
......
271 254
			public void widgetDefaultSelected(SelectionEvent e) {
272 255
			}
273 256
		});
274
		infos = new Label(paramArea, SWT.NONE);
275
		infos.setText(LexicalTableUIMessages.LexicalTableEditor_8);
276
		topSpinner = new Spinner(paramArea, SWT.BORDER);
257
		
258
		// Number of lines
259
		Label nLines = new Label(paramArea, SWT.NONE);
260
		nLines.setText(LexicalTableUIMessages.LexicalTableEditor_8);
261
		nLinesSpinner = new Spinner(paramArea, SWT.BORDER);
277 262

  
278
		infos = new Label(paramArea, SWT.NONE);
279
		infos.setText(LexicalTableUIMessages.LexicalTableEditor_6);
263
		// Fmin
264
		Label fmin = new Label(paramArea, SWT.NONE);
265
		fmin.setText(LexicalTableUIMessages.LexicalTableEditor_6);
280 266
		minfreqspinner = new Spinner(paramArea, SWT.BORDER);
281 267

  
268
		// Merge or delete columns button
282 269
		Button fusionCol = new Button(paramArea, SWT.PUSH);
283 270
		fusionCol.setText(LexicalTableUIMessages.LexicalTableEditor_10);
284 271
		fusionCol.addSelectionListener(new SelectionListener() {
......
377 364
			}
378 365
		});
379 366

  
367
		// Merge or delete lines button
380 368
		Button mergeDeleteRows = new Button(paramArea, SWT.PUSH);
381 369
		mergeDeleteRows.setText(LexicalTableUIMessages.LexicalTableEditor_13);
382 370
		mergeDeleteRows.addSelectionListener(new SelectionListener() {
......
415 403

  
416 404
		// result
417 405
		Composite resultArea = new Composite(parent, SWT.NONE);
418
		FormData resultLayoutData = new FormData();
419
		resultLayoutData.top = new FormAttachment(paramArea, 0);
420
		resultLayoutData.left = new FormAttachment(0);
421
		resultLayoutData.right = new FormAttachment(100);
422
		resultLayoutData.bottom = new FormAttachment(100);
423
		resultArea.setLayoutData(resultLayoutData);
424

  
406
		
407
		GridData gd = new GridData(GridData.FILL_BOTH);
408
		gd.grabExcessVerticalSpace = true;
409
		gd.grabExcessHorizontalSpace = true;
410
		//gd.horizontalSpan = 2;
411
		resultArea.setLayoutData(gd);
412
		
425 413
		FormLayout resultLayout = new FormLayout();
426 414
		resultArea.setLayout(resultLayout);
427 415

  
......
445 433
		formColumn = new TableViewerColumn(viewer, SWT.LEFT);
446 434
		formColumn.getColumn().setText(this.table.getProperty().getName()); 
447 435
		formColumn.getColumn().setWidth(200);
448
		formColumn.getColumn().addSelectionListener(
449
				new ColumnSelectionListener(formColumn, -2));
436
		formColumn.getColumn().addSelectionListener(new ColumnSelectionListener(formColumn, -2));
450 437

  
451 438
		freqColumn = new TableViewerColumn(viewer, SWT.LEFT);
452 439
		freqColumn.getColumn().setText(Messages.FrequencyListEditorInput_4); 
453 440
		freqColumn.getColumn().setWidth(200);
454
		freqColumn.getColumn().addSelectionListener(
455
				new ColumnSelectionListener(freqColumn, -1));
441
		freqColumn.getColumn().addSelectionListener(new ColumnSelectionListener(freqColumn, -1));
456 442
		collist = new ArrayList<Object>();
457 443
		Vector colnames = table.getColNames();
458 444
		
......
467 453
				partColumn.getColumn().setToolTipText(colname); 
468 454
				collist.add(colname);
469 455
				partColumn.getColumn().setWidth(200);
470
				partColumn.getColumn().addSelectionListener(
471
						new ColumnSelectionListener(partColumn, i));
456
				partColumn.getColumn().addSelectionListener(new ColumnSelectionListener(partColumn, i));
472 457
				i++;
473 458
			}
474 459
		} catch (StatException e1) {
......
481 466
		nColumn.getColumn().pack();
482 467

  
483 468
		viewer.setContentProvider(new LineContentProvider());
484
		refreshTable();
485 469
		viewer.setInput(table);
486 470
		parent.layout();
487 471

  
......
489 473
		viewer.getTable().setSortColumn(formColumn.getColumn());
490 474
		viewer.getTable().setSortDirection(SWT.UP);
491 475

  
476

  
477
		refresh();
478

  
479
		
492 480
		createContextMenu(viewer);
481
		
482
		this.commandParametersGroup.pack();
483
		
493 484
	}
494 485

  
495 486
	private void refreshColNames() throws StatException, CqiClientException {
......
501 492
		}
502 493
	}
503 494

  
504
	private void refreshInfos() {
495
	/**
496
	 * Refreshes the description area.
497
	 */
498
	public void refreshInfos() {
505 499
		try {
506
			infos.setText(TXMCoreMessages.T + table.getTotal()
500
			this.setContentDescription(TXMCoreMessages.T + table.getTotal()
507 501
					+ TXMCoreMessages.V + table.getNRows()
508 502
					+ TXMCoreMessages.FMIN_2 + table.getFmin()
509 503
					+ TXMCoreMessages.FMAX_2 + table.getFmax());
510
			infos.redraw();
511
			infos.getParent().layout();
512 504
		} catch (RWorkspaceException e3) {
513 505
			// TODO Auto-generated catch block
514 506
			org.txm.rcpapplication.utils.Logger.printStackTrace(e3);
515 507
		}
508
		catch(StatException e) {
509
			// TODO Auto-generated catch block
510
			e.printStackTrace();
511
		}
516 512
	}
517 513

  
518 514
	/**
519
	 * Creates the context menu.
520
	 *
521
	 * @param tableViewer the table viewer
522
	 */
523
	private void createContextMenu(TableViewer tableViewer) {
524

  
525
		MenuManager menuManager = new MenuManager();
526
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
527
		tableViewer.getTable().setMenu(menu);
528
		getSite().registerContextMenu(menuManager, tableViewer);
529
		getSite().setSelectionProvider(tableViewer);
530
	}
531

  
532
	/**
533 515
	 * Refresh table.
534 516
	 */
535 517
	public void refreshTable() {
518
		
536 519
		LineLabelProvider labelprovider = new LineLabelProvider(table);
537 520
		viewer.setLabelProvider(labelprovider);
538 521
		this.cols = labelprovider.getCols();
539 522
		this.rows = labelprovider.getRows();
540 523
		//this.freqs = labelprovider.getFreqs();
524

  
525

  
526
		// Refresh and pack the columns
527
		viewer.getControl().setRedraw(false);
541 528
		viewer.refresh();
542 529
		for (TableColumn col : viewer.getTable().getColumns()) {
543 530
			col.pack();
544 531
		}
545

  
546
		topSpinner.setMinimum(1);
547
		topSpinner.setMaximum(table.getNRows());
548
		topSpinner.setSelection(table.getNRows());
532
		viewer.getControl().setRedraw(true);
533
		
534
		nLinesSpinner.setMinimum(1);
535
		nLinesSpinner.setMaximum(table.getNRows());
536
		nLinesSpinner.setSelection(table.getNRows());
549 537
		minfreqspinner.setMinimum(table.getFmin());
550 538
		minfreqspinner.setMaximum(table.getFmax());
551 539
		viewer.getTable().setFocus();
552 540
	}
553 541

  
542
	
543
	@Override
544
	public void refresh()	{
545
		this.refreshTable();
546
		this.viewer.getTable().deselectAll();
547
		this.refreshInfos();
548
		super.refresh();
549
	}
550
	
551
	
552

  
554 553
	/**
554
	 * Creates the context menu.
555
	 *
556
	 * @param tableViewer the table viewer
557
	 */
558
	private void createContextMenu(TableViewer tableViewer) {
559

  
560
		MenuManager menuManager = new MenuManager();
561
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
562
		tableViewer.getTable().setMenu(menu);
563
		getSite().registerContextMenu(menuManager, tableViewer);
564
		getSite().setSelectionProvider(tableViewer);
565
	}
566

  
567
	
568
	/**
555 569
	 * Sets the col comparator.
556 570
	 *
557 571
	 * @param comp the comp
tmp/org.txm.lexicaltable.rcp/OSGI-INF/l10n/bundle.properties (revision 264)
1

  
2
command.name = Lexical Table
3

  
4
command.name.37 = Delete line
5

  
6
command.name.38 = Merge lines
7

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

  
10
command.name.40 = Import Table
11

  
12
command.tooltip = Compute Lexical Table
13

  
14
editor.name = Lexical Table
15

  
16
page.name = Lexical Table
0 17

  
tmp/org.txm.lexicaltable.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 264)
1

  
2
command.name = Словарная таблица
3

  
4
command.name.37 = Удалить строку
5

  
6
command.name.38 = Объединить строки
7

  
8
command.name.39 = Экспортировать таблицу
9

  
10
command.name.40 = Импортировать таблицу
11

  
12
command.tooltip = Словарная таблица
13

  
14
editor.name = Словарная таблица
15

  
16
page.name = Словарная таблица
0 17

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

  
2
command.name = Table lexicale
3

  
4
command.name.37 = Supprimer la ligne
5

  
6
command.name.38 = Fusionner les lignes
7

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

  
10
command.name.40 = Importer une table
11

  
12
command.tooltip = Calculer une table lexicale
13

  
14
editor.name = Table lexicale
15

  
16
page.name = Table lexicale
0 17

  
tmp/org.txm.lexicaltable.rcp/plugin.xml (revision 264)
7 7
            category="org.txm.rcpapplication.preferences.UserPreferencePage"
8 8
            class="org.txm.lexicaltable.rcp.preferences.LexicalTablePreferencePage"
9 9
            id="org.txm.lexicaltable.rcp.preferences.LexicalTablePreferencePage"
10
            name="%page.name.13">
10
            name="%page.name">
11 11
      </page>
12 12
   </extension>
13 13
   <extension
......
17 17
         <command
18 18
               commandId="ComputeLexicalTable"
19 19
               icon="icons/lexicaltable.png"
20
               label="%command.label.97"
21
               style="push"
22
               tooltip="%command.tooltip.58">
20
               style="push">
23 21
            <visibleWhen
24 22
                  checkEnabled="false">
25 23
               <or>
......
41 39
         <command
42 40
               commandId="ComputeLexicalTable"
43 41
               icon="icons/lexicaltable.png"
44
               label="%command.label.89"
45
               style="push"
46
               tooltip="%command.tooltip.51">
42
               style="push">
47 43
            <visibleWhen
48 44
                  checkEnabled="false">
49 45
               <or>
......
66 62
         <command
67 63
               commandId="ComputeLexicalTable"
68 64
               icon="icons/lexicaltable.png"
69
               label="%command.label.94"
70 65
               style="push"
71
               tooltip="%command.tooltip.55">
66
               tooltip="%command.tooltip">
72 67
            <visibleWhen
73 68
                  checkEnabled="false">
74 69
               <or>
......
86 81
         </command>
87 82
      </menuContribution>
88 83
            <menuContribution
89
            locationURI="popup:org.txm.lexicaltable.rcp.editors.LexicalTableEditor">
84
            locationURI="popup:LexicalTableEditor">
90 85
         <command
91 86
               commandId="DeleteLines"
92
               label="%command.label.104"
93 87
               style="push">
94 88
         </command>
95 89
         <command
96 90
               commandId="MergeLines"
97
               label="%command.label.105"
98 91
               style="push">
99 92
         </command>
100 93
         <separator
......
103 96
         </separator>
104 97
         <command
105 98
               commandId="ExportLexicalTable"
106
               label="%command.label.106"
107 99
               style="push">
108 100
         </command>
109 101
         <command
110 102
               commandId="ImportTable"
111
               label="%command.label.107"
112 103
               style="push">
113 104
         </command>
114 105
      </menuContribution>
......
120 111
            categoryId="org.txm.rcpapplication.category.txm"
121 112
            defaultHandler="org.txm.lexicaltable.rcp.handlers.ComputeLexicalTable"
122 113
            id="ComputeLexicalTable"
123
            name="%command.name.36">
114
            name="%command.name">
124 115
      </command>
116
            <command
117
            defaultHandler="org.txm.lexicaltable.rcp.handlers.DeleteLines"
118
            id="DeleteLines"
119
            name="%command.name.37">
120
      </command>
121
      
125 122
      <command
126 123
            defaultHandler="org.txm.lexicaltable.rcp.handlers.MergeLines"
127 124
            id="MergeLines"
......
145 142
            default="false"
146 143
            icon="icons/lexicaltable.png"
147 144
            id="LexicalTableEditor"
148
            name="%editor.name.11">
145
            name="%editor.name">
149 146
      </editor>
150 147
   </extension>
151 148
   <extension
......
158 155
         </adapter>
159 156
      </factory>
160 157
   </extension>
158
   <extension
159
         point="org.eclipse.core.expressions.definitions">
160
      <definition
161
            id="OneLexicalTableSelected">
162
         <with
163
               variable="selection">
164
            <iterate
165
                  ifEmpty="false"
166
                  operator="and">
167
               <instanceof
168
                     value="org.txm.lexicaltable.core.statsengine.data.LexicalTable">
169
               </instanceof>
170
            </iterate>
171
         </with>
172
      </definition>
173
   </extension>
161 174

  
162 175
</plugin>
tmp/org.txm.lexicaltable.rcp/META-INF/MANIFEST.MF (revision 264)
10 10
 org.eclipse.core.runtime,
11 11
 org.txm.rcp,
12 12
 org.eclipse.ui;bundle-version="3.106.1",
13
 org.txm.statsengine.r.rcp
13
 org.txm.statsengine.r.rcp,
14
 org.eclipse.core.expressions;bundle-version="3.4.600"
14 15
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
15 16
Bundle-ActivationPolicy: lazy
16 17
Export-Package: org.txm.lexicaltable.rcp.adapters,
......
18 19
 org.txm.lexicaltable.rcp.handlers,
19 20
 org.txm.lexicaltable.rcp.messages,
20 21
 org.txm.lexicaltable.rcp.preferences
22
Bundle-Vendor: Textometrie.org
tmp/org.txm.index.rcp/src/org/txm/index/rcp/messages/messages.properties (revision 264)
1 1

  
2
ComputeIndex_0 = Opening Index results
3

  
2 4
IndexEditor_0  = Index: query is empty
3 5
IndexEditor_1  = ** Failed to compute index
4 6
IndexEditor_10 = CQP error:
tmp/org.txm.index.rcp/src/org/txm/index/rcp/messages/messages_ru.properties (revision 264)
1 1

  
2
ComputeIndex_0 = Открытие Индекса
3

  
2 4
IndexEditor_0  = Запрос пуст
3 5
IndexEditor_1  = ** Не удалось вычислить индекс
4 6
IndexEditor_10 = N/A_CQP error:
tmp/org.txm.index.rcp/src/org/txm/index/rcp/messages/messages_fr.properties (revision 264)
1 1

  
2
ComputeIndex_0 = Ouverture de l'Index
3

  
2 4
IndexEditor_0  = La requête est vide
3 5
IndexEditor_1  = ** Échec du calcul de l'index
4 6
IndexEditor_10 = Echec de la récupération de la dernière erreur CQP:  
tmp/org.txm.index.rcp/src/org/txm/index/rcp/messages/IndexUIMessages.java (revision 264)
1 1
package org.txm.index.rcp.messages;
2 2

  
3 3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
4
import org.txm.utils.messages.Utf8NLS;
5 5

  
6 6
public class IndexUIMessages extends NLS {
7 7

  
......
18 18
	public static String IndexEditor_33;
19 19
	public static String IndexEditor_8;
20 20
	public static String IndexEditor_9;
21
	public static String ComputeIndex_0;
21 22

  
22 23
	
23 24
	static {
24 25
		// initialize resource bundle
25
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, IndexUIMessages.class);
26
		Utf8NLS.initializeMessages(BUNDLE_NAME, IndexUIMessages.class);
26 27
	}
27 28

  
28 29
	private IndexUIMessages() {
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 264)
251 251
	}
252 252

  
253 253
	/**
254
	 * Compute index.
254
	 * Computes index and sets the result node as visible.
255 255
	 */
256 256
	public void compute() {
257
		this.compute(true);
258
	}
259

  
260
	/**
261
	 * Computes index.
262
	 */
263
	public void compute(final boolean visibleIndex) {
257 264
		StatusLine.setMessage(IndexUIMessages.IndexEditor_33);
258 265
		final Query query; // if the query is empty then we put "[]" instead
259 266
		if (queryWidget.isDisposed()) { // lexicon editor
......
300 307
								index = new Index(corpus, query, properties);
301 308
							}
302 309
						}
303

  
310
						
311
						index.setVisible(visibleIndex);
312
						
304 313
						if (monitor.isCanceled())
305 314
							return Status.CANCEL_STATUS;
306 315

  
......
358 367
								System.out.println(message);
359 368
								StatusLine.setMessage(message);
360 369

  
361
								refreshCorporaView();
370
								refresh();
362 371
								
363 372
								QueriesView.refresh();
364 373
								RVariablesView.refresh();
......
918 927
		if (this.partition != null) {
919 928
			List<String> partnames = this.partition.getPartNames();
920 929
			if (partnames.size() > 1)
921
				if (viewer.getTable().getColumnCount() < partnames
922
						.size() + 3) {
930
				if (viewer.getTable().getColumnCount() < partnames.size() + 3) {
923 931
					for (int i = 0; i < partnames.size(); i++) {
924 932
						final TableColumn partColumn = new TableColumn(
925 933
								viewer.getTable(), SWT.RIGHT);
......
1111 1119
		// System.out.println("table refreshed from "+from+" to "+to+" with : "+lines);
1112 1120
		topLine = from;
1113 1121
		bottomLine = to;
1122
		
1123
		
1124
		// Refresh and pack the columns
1125
		viewer.getControl().setRedraw(false);
1126
		viewer.refresh();
1114 1127
		for (TableColumn col : viewer.getTable().getColumns()) {
1115 1128
			col.pack();
1116 1129
		}
1130
		viewer.getControl().setRedraw(true);
1117 1131
	}
1118 1132

  
1119 1133

  
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditorInput.java (revision 264)
46 46
	/** The partition. */
47 47
	protected Partition partition;
48 48

  
49
	
49 50
	/**
50 51
	 * Instantiates a new index editor input.
51 52
	 *
......
114 115
	}
115 116

  
116 117

  
118
	@Override
119
	public boolean equals(Object obj) {
120
		//compare the Lexicons instead of the Index
121
		if(obj instanceof TXMResultEditorInput && this.getIndex() != null && this.getIndex().getLexicon() != null
122
				&& ((TXMResultEditorInput) obj).getResult() != null && ((TXMResultEditorInput) obj).getResult() instanceof Index && ((Index)((TXMResultEditorInput) obj).getResult()).getLexicon() != null)	{
123
			if(this.alwaysRecreateEditor)	{
124
				return false;
125
			}
126
			return this.getIndex().getLexicon() == ((Index)((TXMResultEditorInput) obj).getResult()).getLexicon();
127
		}
128
		return super.equals(obj);
129
	}
117 130

  
118 131
}
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/ComputeIndex.java (revision 264)
27 27
//
28 28
package org.txm.index.rcp.handlers;
29 29

  
30
import org.eclipse.core.commands.AbstractHandler;
31 30
import org.eclipse.core.commands.ExecutionEvent;
32 31
import org.eclipse.core.commands.ExecutionException;
33
import org.eclipse.jface.viewers.IStructuredSelection;
34 32
import org.eclipse.ui.IWorkbenchPage;
35
import org.eclipse.ui.handlers.HandlerUtil;
36
import org.txm.Toolbox;
37 33
import org.txm.index.core.functions.Index;
38 34
import org.txm.index.rcp.editors.IndexEditor;
39 35
import org.txm.index.rcp.editors.IndexEditorInput;
40
import org.txm.rcpapplication.Messages;
36
import org.txm.index.rcp.messages.IndexUIMessages;
37
import org.txm.rcp.handlers.BaseAbstractHandler;
41 38
import org.txm.rcpapplication.StatusLine;
42 39
import org.txm.rcpapplication.TXMWindows;
43 40
import org.txm.rcpapplication.views.corpora.CorporaView;
44 41
import org.txm.searchengine.cqp.corpus.Corpus;
45 42
import org.txm.searchengine.cqp.corpus.Partition;
43

  
46 44
/**
47
 * Open the Index Editor.
45
 * Computes an index and opens an editor.
48 46
 * 
49 47
 * @author mdecorde
50 48
 * @author sjacquot
51 49
 */
52
public class ComputeIndex extends AbstractHandler {
50
public class ComputeIndex extends BaseAbstractHandler {
53 51

  
54 52
	
55 53
	
......
59 57
	}
60 58
	
61 59
	
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
64
	 */
65 60
	@Override
66 61
	public Object execute(ExecutionEvent event) throws ExecutionException {
67
		if (!Toolbox.isSearchEngineInitialized()) return false;
62

  
63
		if(!this.checkCorpusEngine()) {
64
			return false;
65
		}
66

  
68 67
		
69 68
		IndexEditorInput editorInput = null;
70 69
		boolean initializeFields = false;
71
		Object s = ((IStructuredSelection) HandlerUtil.getCurrentSelection(event)).getFirstElement();
70
		Object selection = this.getSelection();
72 71
		
73
		System.err.println("ComputeIndex.execute(): " + s);
74
		
75 72
		// New editor from corpus
76
		if (s instanceof Corpus) {
77
			editorInput = new IndexEditorInput((Corpus) s);
73
		if (selection instanceof Corpus) {
74
			editorInput = new IndexEditorInput((Corpus) selection);
78 75
		}
79 76
		// New editor from partition
80
		else if (s instanceof Partition) {
81
			editorInput = new IndexEditorInput((Partition) s);
77
		else if (selection instanceof Partition) {
78
			editorInput = new IndexEditorInput((Partition) selection);
82 79
			initializeFields = true;
83 80
		}
84 81
		// Reopen an existing result
85
		else if (s instanceof Index) {
86
			editorInput = new IndexEditorInput((Index) s);
82
		else if (selection instanceof Index) {
83
			editorInput = new IndexEditorInput((Index) selection);
87 84
		}
88
		openEditor(editorInput, initializeFields);
89

  
90
		return null;
91
	}
92
	
93
	
94
	/**
95
	 * Opens the editor with specified input.
96
	 * @param editorInput
97
	 * @param initializeFields
98
	 * @return
99
	 */
100
	public static boolean openEditor(IndexEditorInput editorInput, boolean initializeFields) {
101
		if (!Toolbox.isSearchEngineInitialized()) return false;
102 85
		
103
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
86
		
104 87
		try {
105
			StatusLine.setMessage(Messages.ComputeIndex_0);
88
			IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
89
			StatusLine.setMessage(IndexUIMessages.ComputeIndex_0);
106 90
			IndexEditor editor = (IndexEditor) page.openEditor(editorInput, "IndexEditor"); //$NON-NLS-1$
107 91
			if(initializeFields)	{
108 92
				editor.initializeFields();
109 93
			}
110
			return true;
111
		} catch (Exception e) {
94
		}
95
		catch (Exception e) {
112 96
			org.txm.rcpapplication.utils.Logger.printStackTrace(e);
113 97
		}
114
		return false;
98
		return null;
115 99
	}
116
	
117 100

  
118 101
}
tmp/org.txm.index.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 264)
1

  
2
command.name = Индекс
3

  
4
command.tooltip = Вычислить словарный состав ответов на запрос
5

  
6
editor.name = Индекс
0 7

  
tmp/org.txm.index.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 264)
1

  
2
command.name = Index
3

  
4
command.tooltip = Calculer le lexique d'une requête
5

  
6
editor.name = Index
0 7

  
tmp/org.txm.index.rcp/OSGI-INF/l10n/bundle.properties (revision 264)
1

  
2
command.name = Index
3

  
4
command.tooltip = Process the lexicon of a query
5

  
6
editor.name = Index
0 7

  
tmp/org.txm.index.rcp/plugin.xml (revision 264)
8 8
         <command
9 9
               commandId="ComputeIndex"
10 10
               icon="icons/index.png"
11
               label="%command.label.66"
12 11
               style="push">
13 12
            <visibleWhen
14 13
                  checkEnabled="false">
......
28 27
         <command
29 28
               commandId="ComputeIndex"
30 29
               icon="icons/index.png"
31
               label="%command.label.66"
32 30
               style="push">
33 31
            <visibleWhen
34 32
                  checkEnabled="false">
......
49 47
         <command
50 48
               commandId="ComputeIndex"
51 49
               icon="icons/index.png"
52
               label="%command.label.66"
53 50
               style="push"
54
               tooltip="%command.tooltip.62">
51
               tooltip="%command.tooltip">
55 52
            <visibleWhen
56 53
                  checkEnabled="false">
57 54
               <or>
......
67 64
      </menuContribution>
68 65
   </extension>
69 66
   <extension
70
         point="org.eclipse.ui.preferencePages">
71
   </extension>
72
   <extension
73 67
         point="org.eclipse.ui.editors">
74 68
      <editor
75
            class="org.txm.rcpapplication.editors.TableEditor"
76
            default="false"
77
            icon="icons/index.png"
78
            id="org.txm.rcpapplication.editors.TableEditor"
79
            name="%editor.name.0">
80
      </editor>
81
      <editor
82 69
            class="org.txm.index.rcp.editors.IndexEditor"
83 70
            default="false"
84 71
            icon="icons/index.png"
85 72
            id="IndexEditor"
86
            name="%editor.name.7">
73
            name="%editor.name">
87 74
      </editor>
88 75
   </extension>
89 76
   <extension
......
102 89
            categoryId="org.txm.rcpapplication.category.txm"
103 90
            defaultHandler="org.txm.index.rcp.handlers.ComputeIndex"
104 91
            id="ComputeIndex"
105
            name="%command.name.27">
92
            name="%command.name">
106 93
      </command>
107 94
   </extension>
95
   <extension
96
         point="org.eclipse.core.expressions.definitions">
97
      <definition
98
            id="OneIndexSelected">
99
         <with
100
               variable="selection">
101
            <iterate
102
                  ifEmpty="false"
103
                  operator="and">
104
               <instanceof
105
                     value="org.txm.index.core.functions.Index">
106
               </instanceof>
107
            </iterate>
108
         </with>
109
      </definition>
110
   </extension>
108 111

  
109 112
</plugin>
tmp/org.txm.index.rcp/META-INF/MANIFEST.MF (revision 264)
10 10
 org.eclipse.core.runtime;bundle-version="3.10.0",
11 11
 org.txm.rcp,
12 12
 org.txm.statsengine.r.core;bundle-version="1.0.0",
13
 org.txm.statsengine.r.rcp
13
 org.txm.statsengine.r.rcp,
14
 org.eclipse.core.expressions;bundle-version="3.4.600"
14 15
Export-Package: org.txm.index.rcp.adapters,
15 16
 org.txm.index.rcp.editors,
16
 org.txm.index.rcp.handlers
17
 org.txm.index.rcp.handlers,
18
 org.txm.index.rcp.messages
19
Bundle-Vendor: Textometrie.org
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/r/data/LexicalTableImpl.java (revision 264)
40 40
import java.util.Map;
41 41

  
42 42

  
43

  
44 43
//import org.txm.functions.queryindex.*;
45 44
import org.txm.index.core.functions.Index;
46 45
import org.txm.index.core.functions.Line;
47 46
import org.txm.lexicaltable.core.messages.LexicalTableCoreMessages;
48 47
import org.txm.lexicaltable.core.statsengine.data.LexicalTable;
48
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
49 49
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
50 50
import org.txm.searchengine.cqp.corpus.Corpus;
51
import org.txm.searchengine.cqp.corpus.Lexicon;
52 51
import org.txm.searchengine.cqp.corpus.Partition;
53 52
import org.txm.searchengine.cqp.corpus.Property;
54 53
import org.txm.statsengine.core.StatException;
55 54
import org.txm.statsengine.core.data.QuantitativeDataStructure;
56 55
import org.txm.statsengine.core.data.Vector;
57
import org.txm.statsengine.r.core.RException;
58 56
import org.txm.statsengine.r.core.RWorkspace;
59
import org.txm.statsengine.r.core.RWorkspaceException;
60 57
import org.txm.statsengine.r.core.data.ContingencyTableImpl;
58
import org.txm.statsengine.r.core.exceptions.RException;
59
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
61 60

  
62 61
import cern.colt.matrix.DoubleFactory2D;
63 62
import cern.colt.matrix.DoubleMatrix2D;
......
97 96
	private int constructor_fmin;
98 97

  
99 98

  
99
	protected ArrayList<Integer> frequencies;
100
	
100 101
	/**
101 102
	 * Instantiates a new lexical table impl.
102 103
	 *
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/data/LexicalTable.java (revision 264)
38 38
import org.txm.statsengine.core.StatException;
39 39
import org.txm.statsengine.core.data.ContingencyTable;
40 40
import org.txm.statsengine.core.data.Vector;
41
import org.txm.statsengine.r.core.RWorkspaceException;
41
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
42 42

  
43 43
// TODO: Auto-generated Javadoc
44 44
/**
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/messages/LexicalTableCoreMessages.java (revision 264)
1 1
package org.txm.lexicaltable.core.messages;
2 2

  
3 3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
4
import org.txm.utils.messages.Utf8NLS;
5 5

  
6 6
public class LexicalTableCoreMessages extends NLS {
7 7
	
......
22 22
	
23 23
	static {
24 24
		// initialize resource bundle
25
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, LexicalTableCoreMessages.class);
25
		Utf8NLS.initializeMessages(BUNDLE_NAME, LexicalTableCoreMessages.class);
26 26
	}
27 27

  
28 28
	private LexicalTableCoreMessages() {
tmp/org.txm.lexicaltable.core/META-INF/MANIFEST.MF (revision 264)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3
Bundle-Name: LexicalTable Core
3
Bundle-Name: Lexical Table Core
4 4
Bundle-SymbolicName: org.txm.lexicaltable.core;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6
Require-Bundle: org.txm.statsengine.r.core;bundle-version="1.0.0",
6
Require-Bundle: org.txm.statsengine.core;bundle-version="1.0.0",
7
 org.txm.statsengine.r.core;bundle-version="1.0.0",
7 8
 org.txm.core;bundle-version="0.7.0",
8 9
 org.eclipse.core.runtime,
9
 org.txm.index.core;bundle-version="1.0.0"
10
 org.txm.index.core;bundle-version="1.0.0",
11
 org.txm.lexicon.core;bundle-version="1.0.0"
10 12
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
11 13
Bundle-ActivationPolicy: lazy
12 14
Export-Package: org.txm.functions.intertextualdistance,
......
15 17
 org.txm.lexicaltable.core.preferences,
16 18
 org.txm.lexicaltable.core.statsengine.data,
17 19
 org.txm.lexicaltable.core.statsengine.r.data
20
Bundle-Vendor: Textometrie.org
tmp/org.txm.index.core/META-INF/MANIFEST.MF (revision 264)
4 4
Bundle-SymbolicName: org.txm.index.core
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Require-Bundle: org.txm.statsengine.r.core;bundle-version="1.0.0",
7
 org.txm.lexicon.core;bundle-version="1.0.0",
7 8
 org.eclipse.core.runtime,
8 9
 org.txm.core;bundle-version="0.7.0",
9 10
 org.txm.utils;bundle-version="1.0.0"
......
13 14
 org.txm.index.core.messages,
14 15
 org.txm.macro.r,
15 16
 org.txm.test
17
Bundle-Vendor: Textometrie.org
tmp/org.txm.index.core/src/org/txm/index/core/messages/messages.properties (revision 264)
3 3

  
4 4
DetailsFromPartition = Index:\n\	Partition {0}\n\	query {1}\n\	properties {2}\n\	Fmin {3}\n\	Fmax {4}
5 5

  
6
Index_0 = ** Error while computing lexicon:\n 
7
Index_1 = Console : 
8
Index_7 = ** Failed to export Lexicon : 
9

  
6 10
RESULT_TYPE = Index
tmp/org.txm.index.core/src/org/txm/index/core/messages/IndexCoreMessages.java (revision 264)
1 1
package org.txm.index.core.messages;
2 2

  
3 3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
4
import org.txm.utils.messages.Utf8NLS;
5 5

  
6 6
public class IndexCoreMessages extends NLS {
7 7

  
......
13 13
	
14 14
	
15 15
	public static String RESULT_TYPE;
16
	public static String Index_1;
17
	public static String Index_7;
16 18

  
19
	//FIXME unused key
20
	public static String Index_0;
21
	//end of fixme
17 22
	
18 23
	static {
19 24
		// initialize resource bundle
20
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, IndexCoreMessages.class);
25
		Utf8NLS.initializeMessages(BUNDLE_NAME, IndexCoreMessages.class);
21 26
	}
22 27

  
23 28
	private IndexCoreMessages() {
tmp/org.txm.index.core/src/org/txm/index/core/messages/messages_fr.properties (revision 264)
1
Index_0 = ** Erreur lors du calcul du lexique : \n
2
Index_1 = console : 
3
Index_7 = ** Echec de l'exportation du Lexique : 
1 4

  
5

  
2 6
DetailsFromCorpus = Index:\n\	Corpus {0}\n\	Requête {1}\n\	propriétés {2}\n\	Fmin {3}\n\	Fmax {4}
3 7

  
4 8
DetailsFromPartition = Index:\n\	Partition {0}\n\	Requête {1}\n\	propriétés {2}\n\	Fmin {3}\n\	Fmax {4}
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 264)
43 43
import org.apache.commons.lang.StringUtils;
44 44
import org.eclipse.osgi.util.NLS;
45 45
import org.txm.Toolbox;
46
import org.txm.core.messages.TXMCoreMessages;
47 46
import org.txm.functions.Function;
48 47
import org.txm.index.core.messages.IndexCoreMessages;
48
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
49 49
import org.txm.searchengine.cqp.ICqiClient;
50 50
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
51 51
import org.txm.searchengine.cqp.corpus.Corpus;
52 52
import org.txm.searchengine.cqp.corpus.CorpusManager;
53
import org.txm.searchengine.cqp.corpus.Lexicon;
54 53
import org.txm.searchengine.cqp.corpus.Part;
55 54
import org.txm.searchengine.cqp.corpus.Partition;
56 55
import org.txm.searchengine.cqp.corpus.Property;
......
60 59
import org.txm.searchengine.cqp.corpus.query.Query;
61 60
import org.txm.searchengine.cqp.serverException.CqiServerError;
62 61
import org.txm.statsengine.r.core.RWorkspace;
63
import org.txm.statsengine.r.core.RWorkspaceException;
62
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
64 63
import org.txm.utils.logger.Log;
65 64

  
66 65
// TODO: Auto-generated Javadoc
......
218 217
	
219 218
	
220 219
	/**
221
	 * Inits the Index using a lexicon.
220
	 * Initializes the index using a lexicon.
222 221
	 *
223 222
	 * @param corpus the corpus
224 223
	 * @param property the property
......
231 230
			this.props.add(property);
232 231

  
233 232
			lexicon = corpus.getLexicon(property);
233

  
234
			lexicon.addResult(this);
235
			
234 236
			this.nLines = lexicon.nbrOfToken();
235 237
			String[] forms = lexicon.getForms();
236 238
			int[] freqs = lexicon.getFreq();
......
620 622
		try {
621 623
			toTxt(outfile, 0, lines.size(), encoding, colseparator, txtseparator);
622 624
		} catch (Exception e) {
623
			System.err.println(TXMCoreMessages.Index_7 + Log.toString(e));
625
			System.err.println(IndexCoreMessages.Index_7 + Log.toString(e));
624 626
			return false;
625 627
		}
626 628
		return true;
......
728 730
	 * @throws IOException Signals that an I/O exception has occurred.
729 731
	 */
730 732
	public void toConsole() throws CqiClientException, IOException {
731
		System.out.println(TXMCoreMessages.Index_1 + (lines.size()));
733
		System.out.println(IndexCoreMessages.Index_1 + (lines.size()));
732 734
		toConsole(0, lines.size());
733 735
	}
734 736

  
......
776 778
			return ((Partition)this.parent).getCorpus();
777 779
		}
778 780
		catch(Exception e) {
781
			try {
782
				return (Corpus) this.parent;
783
			}
784
			catch(Exception e1) {
785
				return (Corpus) this.lexicon.getCorpus();
786
			}
779 787
		}
780
		return (Corpus) this.parent;
788
		
781 789
	}
782 790

  
783 791
	/**

Formats disponibles : Unified diff