Révision 723

tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/preferences/PartitionPreferencePage.java (revision 723)
67 67
	@Override
68 68
	public void init(IWorkbench workbench) {
69 69
		this.setPreferenceStore(new TXMPreferenceStore(PartitionDimensionsPreferences.PREFERENCES_NODE));
70
		//this.setDescription(Messages.DiagnosticPreferencePage_1);
71 70
		this.setTitle(TXMCoreMessages.common_description);
72 71
	}
73 72
}
tmp/org.txm.index.core/src/org/txm/index/core/preferences/IndexPreferences.java (revision 723)
5 5
import org.osgi.framework.FrameworkUtil;
6 6
import org.osgi.service.prefs.Preferences;
7 7
import org.txm.core.preferences.TXMPreferences;
8
import org.txm.core.results.Parameter;
8 9

  
9 10
/**
10 11
 * Preferences initializer and manager.
......
20 21
	
21 22
	public static final String PROPERTIES = PREFERENCES_PREFIX + "properties"; //$NON-NLS-1$
22 23
	public static final String QUERY = PREFERENCES_PREFIX + "query"; //$NON-NLS-1$
24
	
25
	/**
26
	 * Minimum frequency filter value.
27
	 */
23 28
	public static final String F_MIN = PREFERENCES_PREFIX + "f_min"; //$NON-NLS-1$
29
	
30
	/**
31
	 * Maximum frequency filter value.
32
	 */
24 33
	public static final String F_MAX = PREFERENCES_PREFIX + "f_max"; //$NON-NLS-1$
34
	
35
	/**
36
	 * V max filter. 
37
	 */
25 38
	public static final String V_MAX = PREFERENCES_PREFIX + "v_max"; //$NON-NLS-1$
39
	
40
	/**
41
	 * Number of lines to display per page.
42
	 */
26 43
	public static final String N_LINES_PER_PAGE = PREFERENCES_PREFIX + "n_lines_per_page"; //$NON-NLS-1$
44
	
45
	/**
46
	 * 
47
	 */
27 48
	public static final String PROPERTIES_SEPARATOR = PREFERENCES_PREFIX + "properties_separator"; //$NON-NLS-1$
49
	
50
	/**
51
	 * 
52
	 */
28 53
	public static final String N_TOP_INDEX = PREFERENCES_PREFIX + "n_top_index"; //$NON-NLS-1$
29 54

  
30 55
	@Override
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 723)
100 100

  
101 101
	// PARAMETERS
102 102
	/**
103
	 * The fmax filter value parameter.
103
	 * Maximum frequency filter value.
104 104
	 */
105 105
	@Parameter(key=IndexPreferences.F_MAX)
106
	protected Integer pFmaxFilter;
106
	protected int pFmaxFilter;
107 107
	
108 108
	/**
109
	 * The fmin filter value parameter.
109
	 * Minimum frequency filter value.
110 110
	 */
111 111
	@Parameter(key=IndexPreferences.F_MIN)
112
	protected Integer pFminFilter;
112
	protected int pFminFilter;
113 113
	
114 114
	/**
115
	 * The number of lines shown per page parameter.
115
	 * Number of lines to display per page.
116 116
	 */
117 117
	@Parameter(key=IndexPreferences.N_LINES_PER_PAGE)
118 118
	protected Integer pNLinesPerPage;
......
120 120
	/**
121 121
	 * The word properties shown.
122 122
	 */
123
	@Parameter
123
	@Parameter(key=IndexPreferences.PROPERTIES)
124 124
	protected List<Property> pProperties;
125 125
	
126 126
	/**
......
132 132
	/**
133 133
	 * The CQP query.
134 134
	 */
135
	@Parameter
135
	@Parameter(key=IndexPreferences.QUERY)
136 136
	protected Query pQuery;
137 137
	
138 138
	/**
......
464 464

  
465 465

  
466 466
	/**
467
	 * remove linen which frequency is not in the [Fmin,Fmax] interval parameters.
467
	 * Removes lines with frequency not in [Fmin,Fmax] range.
468 468
	 *
469 469
	 **/
470 470
	public void filterLines() {
471
		if (pFminFilter == null && pFmaxFilter == null) return;
472
		if (!(pFminFilter > 0 && pFmaxFilter > 0 && pFminFilter <= pFmaxFilter)) return;
471
		
472
		if (!(pFminFilter > 0 && pFmaxFilter > 0 && pFminFilter <= pFmaxFilter)) {
473
			return;
474
		}
473 475

  
474
		Log.info("Filtering Fmin="+pFminFilter+" and Fmax="+pFmaxFilter);
476
		Log.info("Filtering Fmin = " + pFminFilter + " and Fmax = " + pFmaxFilter); //$NON-NLS-1$  //$NON-NLS-2$
475 477

  
476 478
		for (int i = 0; i < lines.size(); i++) { // for each line
477 479

  
478 480
			Line line = lines.get(i);
479 481
			int f = line.getFrequency();
480
			if (pFminFilter != null && f < pFminFilter) { // if its frequency is not in the interval, remove it
482
			if (f < pFminFilter) { // if its frequency is not in the interval, remove it
481 483

  
482 484
				nTotalTokens -= line.getFrequency();
483 485
				lines.remove(i);
484 486
				i--;
485 487
				continue; // no need to go further the line is removed
486 488
			}
487
			if (pFmaxFilter != null && f > pFmaxFilter) { // if its frequency is not in the interval, remove it
489
			if (f > pFmaxFilter) { // if its frequency is not in the interval, remove it
488 490

  
489 491
				nTotalTokens -= line.getFrequency();
490 492
				lines.remove(i);
tmp/org.txm.searchengine.cqp.rcp/plugin.xml (revision 723)
266 266
         </adapter>
267 267
      </factory>
268 268
   </extension>
269
   <extension
270
         point="org.eclipse.core.expressions.definitions">
271
      <definition
272
            id="OneMainCorpusSelected">
273
         <with
274
               variable="selection">
275
            <iterate
276
                  ifEmpty="false"
277
                  operator="and">
278
               <instanceof
279
                     value="org.txm.searchengine.cqp.corpus.MainCorpus">
280
               </instanceof>
281
            </iterate>
282
         </with>
283
      </definition>
284
      <definition
285
            id="OneSubCorpusSelected">
286
         <with
287
               variable="selection">
288
            <iterate
289
                  ifEmpty="false"
290
                  operator="and">
291
               <instanceof
292
                     value="org.txm.searchengine.cqp.corpus.Subcorpus">
293
               </instanceof>
294
            </iterate>
295
         </with>
296
      </definition>
297
      <definition
298
            id="OneCorpusSelected">
299
         <with
300
               variable="selection">
301
            <iterate
302
                  ifEmpty="false"
303
                  operator="and">
304
               <instanceof
305
                     value="org.txm.searchengine.cqp.corpus.Corpus">
306
               </instanceof>
307
            </iterate>
308
         </with>
309
      </definition>
310
   </extension>
269 311

  
270 312
</plugin>
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 723)
214 214
	protected List<Property> pProperties;
215 215
	
216 216
	/** The keyword query. */
217
	@Parameter
217
	@Parameter(key=CooccurrencePreferences.QUERY)
218 218
	protected Query pQuery;
219 219
	
220 220
	/** The minscore. */
tmp/org.txm.synopticeditor.rcp/src/org/txm/synopticedition/rcp/editors/SynopticEditionEditor.java (revision 723)
880 880
	}
881 881

  
882 882
	/**
883
	 * Clear all highlighted words
883
	 * Clears all highlighted words.
884 884
	 */
885 885
	public void removeHighlightWords() {
886 886
		for (EditionPanel p : editionPanels.values()) {
tmp/org.txm.lexicaltable.rcp/plugin.xml (revision 723)
97 97
         </command>
98 98
      </menuContribution>
99 99
            <menuContribution
100
            locationURI="popup:LexicalTableEditorContextMenu">
100
            locationURI="popup:org.txm.lexicaltable.rcp.editors.LexicalTableEditor">
101 101
         <command
102 102
               commandId="org.txm.lexicaltable.rcp.handlers.DeleteLines"
103 103
               style="push">
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/DeleteLines.java (revision 723)
81 81
			Shell shell = d.getActiveShell();
82 82
			MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION
83 83
					| SWT.YES | SWT.NO);
84
			messageBox.setMessage(TXMUIMessages.DeleteLines_1);
84
			messageBox.setMessage(TXMUIMessages.common_areYouSure);
85 85
			int response = messageBox.open();
86 86
			if (response != SWT.YES)
87 87
				return;
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/preferences/LexicalTablePreferencePage.java (revision 723)
29 29

  
30 30
import org.eclipse.jface.preference.IntegerFieldEditor;
31 31
import org.eclipse.ui.IWorkbench;
32
import org.txm.core.messages.TXMCoreMessages;
32 33
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences;
33 34
import org.txm.lexicaltable.rcp.adapters.LexicalTableAdapterFactory;
34 35
import org.txm.lexicaltable.rcp.messages.LexicalTableUIMessages;
......
37 38

  
38 39
/**
39 40
 * Lexical Table preferences page.
41
 * 
40 42
 * @author mdecorde
41 43
 * @author sjacquot
42 44
 *
......
47 49
	@Override
48 50
	public void createFieldEditors() {
49 51
		
50
		IntegerFieldEditor fmin = new IntegerFieldEditor(LexicalTablePreferences.F_MIN, LexicalTableUIMessages.LexicalTablePreferencePage_1, this.getFieldEditorParent()); 
52
		IntegerFieldEditor fmin = new IntegerFieldEditor(LexicalTablePreferences.F_MIN, TXMCoreMessages.common_lowestFrequency, this.getFieldEditorParent()); 
51 53
		fmin.setValidRange(1, 999999999);
52 54
		
53
		IntegerFieldEditor vmax = new IntegerFieldEditor(LexicalTablePreferences.V_MAX, "vmax", this.getFieldEditorParent()); 
55
		IntegerFieldEditor vmax = new IntegerFieldEditor(LexicalTablePreferences.V_MAX, TXMCoreMessages.common_numberOfLines, this.getFieldEditorParent()); 
54 56
		vmax.setValidRange(1, 999999999);
55 57
		
56 58
		this.addField(fmin);
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/messages/messages_ru.properties (revision 723)
5 5
ComputeLexicalTable_12 = Употребления в индексе
6 6
ComputeLexicalTable_13 = Выберите пределы для расчетов
7 7
ComputeLexicalTable_16 = Использовать все употребления
8
ComputeLexicalTable_2  = N/A_no property
8
ComputeLexicalTable_2  = 
9 9
ComputeLexicalTable_3  = Открытие диалогового окна конфигурации пределов
10 10
ComputeLexicalTable_5  = ** Невозможно построить словарную таблицу из Индекса, рассчитанного на корпусе
11 11
ComputeLexicalTable_6  = ** Списки значений должны строиться на одинаковых сочетаниях свойств: {0}
......
23 23
LexicalTableEditor_18 = Объединение строк
24 24
LexicalTableEditor_4  = Оставить
25 25
LexicalTableEditor_5  = Оставить {0} строк, Fmin {1}
26
LexicalTableEditor_6  = Fmin :
27 26
LexicalTableEditor_7  = \ после  
28
LexicalTableEditor_8  = Число строк 
29 27

  
30 28
LexicalTablePreferencePage_0 = Словарная таблица
31
LexicalTablePreferencePage_1 = Минимальная частотность
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/messages/messages_fr.properties (revision 723)
2 2
ComputeLexicalTable_0  = Calcul de la table lexicale avec {0}
3 3
ComputeLexicalTable_1  = Calcul de la table lexicale {0} avec la propriété {1}
4 4
ComputeLexicalTable_10 = Ouverture de la table lexicale
5
ComputeLexicalTable_12 = Total  toutes les occurrences recenses par l'index 
5
ComputeLexicalTable_12 = Total toutes les occurrences recenses par l'index 
6 6
ComputeLexicalTable_13 = Sélectionnez les marges à utiliser
7 7
ComputeLexicalTable_16 = Total  toutes les occurrences du corpus 
8 8
ComputeLexicalTable_2  = Pas de propriété
......
23 23
LexicalTableEditor_18 = Fusion de lignes
24 24
LexicalTableEditor_4  = Appliquer
25 25
LexicalTableEditor_5  = Garder {0} lignes, Fmin {1}
26
LexicalTableEditor_6  = Fmin :
27 26
LexicalTableEditor_7  = \ après  
28
LexicalTableEditor_8  = Nombre de lignes 
29 27

  
30 28
LexicalTablePreferencePage_0 = Table lexicale
31
LexicalTablePreferencePage_1 = Fréquence minimale
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/messages/LexicalTableUIMessages.java (revision 723)
18 18
	public static String LexicalTableEditor_18;
19 19
	public static String LexicalTableEditor_4;
20 20
	public static String LexicalTableEditor_5;
21
	public static String LexicalTableEditor_6;
22 21
	public static String LexicalTableEditor_7;
23
	public static String LexicalTableEditor_8;
24 22
	public static String LexicalTablePreferencePage_0;
25
	public static String LexicalTablePreferencePage_1;
26
	
27
	public static String ComputeLexicalTable_0;
28 23
	public static String ComputeLexicalTable_10;
29 24
	public static String ComputeLexicalTable_12;
30 25
	public static String ComputeLexicalTable_13;
31 26
	public static String ComputeLexicalTable_16;
32
	public static String ComputeLexicalTable_1;
33
	public static String ComputeLexicalTable_2;
34 27
	public static String ComputeLexicalTable_3;
35
	public static String ComputeLexicalTable_4;
36
	public static String ComputeLexicalTable_5;
37
	public static String ComputeLexicalTable_6;
38
	public static String ComputeLexicalTable_7;
39
	public static String ComputeLexicalTable_9;
40 28

  
41 29

  
42 30
	static {
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/messages/messages.properties (revision 723)
1 1

  
2
ComputeLexicalTable_0  = Computing the Lexical Table with {0}
3
ComputeLexicalTable_1  = Computing the Lexical Table {0} with the property {1}
4 2
ComputeLexicalTable_10 = Opening the lexical table
5 3
ComputeLexicalTable_12 = User index occurrences
6 4
ComputeLexicalTable_13 = Select which margins you want to use
7 5
ComputeLexicalTable_16 = Use all occurrences
8
ComputeLexicalTable_2  = no property
9 6
ComputeLexicalTable_3  = Opening marge configuration dialog
10
ComputeLexicalTable_4  = StatEngine is not ready. Canceling command.
11
ComputeLexicalTable_5  = Can not create a lexical table with an Index created on a Corpus
12
ComputeLexicalTable_6  = Vocabularies must share the same properties: {0}
13
ComputeLexicalTable_7  = Vocabularies must share the same partition: {0}
14
ComputeLexicalTable_9  = LexicalTable dialog, failed to get corpus size: {0}
15 7

  
16 8
LexicalTableEditor_1  = ** Error: different columns number: before
17 9
LexicalTableEditor_10 = Merge or Delete columns
......
24 16
LexicalTableEditor_18 = Merging lines
25 17
LexicalTableEditor_4  = Apply
26 18
LexicalTableEditor_5  = Keep: {0} lines, Fmin {1}
27
LexicalTableEditor_6  = Fmin:
28 19
LexicalTableEditor_7  = \ after
29
LexicalTableEditor_8  = Number of lines
30 20

  
31 21
LexicalTablePreferencePage_0 = Lexical table
32
LexicalTablePreferencePage_1 = Lowest frequency
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditor.java (revision 723)
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/TableEditor.java (revision 723)
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.jface.viewers.TableViewerColumn;
34
import org.eclipse.swt.SWT;
35
import org.eclipse.swt.events.SelectionAdapter;
36
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.layout.FillLayout;
38
import org.eclipse.swt.widgets.Composite;
39
import org.eclipse.swt.widgets.Menu;
40
import org.eclipse.swt.widgets.Table;
41
import org.eclipse.ui.IEditorInput;
42
import org.eclipse.ui.IEditorSite;
43
import org.eclipse.ui.PartInitException;
44
import org.eclipse.ui.part.EditorPart;
45
import org.txm.rcp.editors.ITablableEditorInput;
46
import org.txm.rcp.editors.TableKeyListener;
47
import org.txm.rcp.editors.TableSorter;
48
import org.txm.rcp.messages.TXMUIMessages;
49
// TODO: Auto-generated Javadoc
50
/**
51
 * Generic editor of tableable objects.
52
 *
53
 * @author sloiseau
54
 */
55
public class TableEditor extends EditorPart {
56

  
57
	/** The ID. */
58
	static public String ID = "org.txm.rcp.editors.TableEditor"; //$NON-NLS-1$
59
	
60
	/** The viewer. */
61
	private TableViewer viewer;
62
	
63
	/** The i editor input. */
64
	private IEditorInput iEditorInput;
65

  
66
	/** The table sorter. */
67
	private TableSorter tableSorter;
68

  
69
	/**
70
	 * Linking with the OutlineView.
71
	 *
72
	 * @param monitor the monitor
73
	 */
74
	// private OverviewOutlinePage overviewOutlinePage;
75

  
76
	@Override
77
	public void doSave(IProgressMonitor monitor) {
78
		// TODO Auto-generated method stub
79

  
80
	}
81

  
82
	/* (non-Javadoc)
83
	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
84
	 */
85
	@Override
86
	public void doSaveAs() {
87
		// TODO Auto-generated method stub
88

  
89
	}
90

  
91
	/* (non-Javadoc)
92
	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
93
	 */
94
	@Override
95
	public void init(IEditorSite site, IEditorInput input)
96
			throws PartInitException {
97
		setSite(site);
98
		setInput(input);
99
		this.iEditorInput = input;
100
	}
101

  
102
	/* (non-Javadoc)
103
	 * @see org.eclipse.ui.part.EditorPart#isDirty()
104
	 */
105
	@Override
106
	public boolean isDirty() {
107
		// TODO Auto-generated method stub
108
		return false;
109
	}
110

  
111
	/* (non-Javadoc)
112
	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
113
	 */
114
	@Override
115
	public boolean isSaveAsAllowed() {
116
		// TODO Auto-generated method stub
117
		return false;
118
	}
119

  
120
	/* (non-Javadoc)
121
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
122
	 */
123
	@Override
124
	public void createPartControl(Composite parent) {
125
		parent.setLayout(new FillLayout());
126

  
127
		viewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL
128
				| SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
129
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
130
		Table table = viewer.getTable();
131
		table.setHeaderVisible(true);
132
		table.setLinesVisible(true);
133

  
134
		if (!(iEditorInput instanceof ITablableEditorInput)) {
135
			throw new IllegalArgumentException(TXMUIMessages.TableEditor_0);
136
		}
137

  
138
		ITablableEditorInput tableInput = (ITablableEditorInput) iEditorInput;
139

  
140
		String[] titles = tableInput.getColumnTitles();
141

  
142
		for (int i = 0; i < titles.length; i++) {
143
			final int index = i;
144
			final TableViewerColumn column = new TableViewerColumn(viewer,
145
					SWT.NONE);
146

  
147
			column.getColumn().setText(titles[i]);
148
			column.getColumn().setWidth(100);
149
			column.getColumn().setResizable(true);
150
			column.getColumn().setMoveable(true);
151

  
152
			column.getColumn().addSelectionListener(new SelectionAdapter() {
153
				@Override
154
				public void widgetSelected(SelectionEvent e) {
155
					tableSorter.setColumn(index);
156
					int dir = viewer.getTable().getSortDirection();
157
					if (viewer.getTable().getSortColumn() == column.getColumn()) {
158
						dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
159
					} else {
160
						dir = SWT.DOWN;
161
					}
162
					viewer.getTable().setSortDirection(dir);
163
					viewer.getTable().setSortColumn(column.getColumn());
164
					viewer.refresh();
165
				}
166
			});
167
		}
168

  
169
		viewer.setContentProvider(tableInput.getContentProvider());
170
		viewer.setLabelProvider(tableInput.getLabelProvider());
171
		viewer.setInput(tableInput.getInput());
172

  
173
		tableSorter = new TableSorter();
174
		tableSorter.setColumnTypes(tableInput.getColumnTypes());
175
		if (this.iEditorInput instanceof ___LexicalTableEditorInput) {
176
			___LexicalTableEditorInput ed = (___LexicalTableEditorInput) this.iEditorInput;
177
			tableSorter.setLocale(ed.getResult().getPartition().getCorpus().getLocale());
178
		}
179
		viewer.setSorter(tableSorter);
180

  
181
		createContextMenu(viewer);
182
	}
183

  
184
	/**
185
	 * Creates the context menu.
186
	 *
187
	 * @param tableViewer the table viewer
188
	 */
189
	private void createContextMenu(TableViewer tableViewer) {
190

  
191
		MenuManager menuManager = new MenuManager();
192
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
193

  
194
		// Set the MenuManager
195
		tableViewer.getTable().setMenu(menu);
196
		getSite().registerContextMenu(menuManager, tableViewer);
197
		// Make the selection available
198
		getSite().setSelectionProvider(tableViewer);
199
	}
200

  
201
	/**
202
	 * Gets the table sorter.
203
	 *
204
	 * @return the table sorter
205
	 */
206
	public TableSorter getTableSorter() {
207
		return tableSorter;
208
	}
209

  
210
	/**
211
	 * Gets the table viewer.
212
	 *
213
	 * @return the table viewer
214
	 */
215
	public TableViewer getTableViewer() {
216
		return viewer;
217
	}
218

  
219
	/* (non-Javadoc)
220
	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
221
	 */
222
	@Override
223
	public void setFocus() {
224
		viewer.getControl().setFocus();
225
	}
226
}
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 723)
120 120
	
121 121
	/** The minfreqspinner. */
122 122
//	@Parameter(key=LexicalTablePreferences.F_MIN)
123
	Spinner fMin;
123
	protected Spinner fMin;
124 124

  
125 125
	/** The top spinner. */
126 126
//	@Parameter(key=LexicalTablePreferences.V_MAX)
127
	Spinner vMax;
127
	protected Spinner vMax;
128 128

  
129 129

  
130 130
	
......
139 139
	@Override
140 140
	public void _createPartControl(final Composite parent) {
141 141
		
142
//		super.createPartControl(parent);
143
		
144 142
		lexicalTable = (LexicalTable) this.getResult();
145
		//iTable = lexicalTable.getData();
146

  
147 143
		
148 144
		Composite paramArea = this.getCommandParametersGroup();
149 145
		
150
//		Composite paramArea = new Composite(this.getCommandParametersGroup(), SWT.NONE);
151

  
152
//		GridLayout paramLayout = new GridLayout(5, false);
153
//		paramArea.setLayout(paramLayout);
154

  
155 146
		// Apply button
156 147
		Button keepTop = new Button(paramArea, SWT.PUSH);
157 148
		keepTop.setText(LexicalTableUIMessages.LexicalTableEditor_4);
......
162 153
				System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_5, vMax.getSelection(), fMin.getSelection()));
163 154

  
164 155
				MessageBox messageBox = new MessageBox(e.display.getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
165
				messageBox.setMessage(TXMUIMessages.DeleteLines_1);
156
				messageBox.setMessage(TXMUIMessages.common_areYouSure);
166 157
				int response = messageBox.open();
167 158
				if (response != SWT.YES) {
168 159
					return;
......
174 165
				} catch (Exception e1) {
175 166
					// TODO Auto-generated catch block
176 167
					org.txm.rcp.utils.Logger.printStackTrace(e1);
177
					StatusLine.setMessage("LT: sort error"); //$NON-NLS-1$
168
					StatusLine.setMessage("LexicalTable: sorting error."); //$NON-NLS-1$
178 169
				}
179 170
			}
180 171

  
......
185 176
		
186 177
		// Number of lines
187 178
		Label nLines = new Label(paramArea, SWT.NONE);
188
		nLines.setText(LexicalTableUIMessages.LexicalTableEditor_8);
179
		nLines.setText(TXMCoreMessages.common_numberOfLines);
189 180
		vMax = new Spinner(paramArea, SWT.BORDER);
190 181

  
191 182
		// Fmin
192 183
		Label fmin = new Label(paramArea, SWT.NONE);
193
		fmin.setText(LexicalTableUIMessages.LexicalTableEditor_6);
184
		fmin.setText(TXMCoreMessages.common_fMin);
194 185
		fMin = new Spinner(paramArea, SWT.BORDER);
195 186

  
196 187
		// Merge or delete columns button
......
325 316
			}
326 317
		});
327 318

  
328
		// result
329
		//Composite resultArea = new Composite(parent, SWT.NONE);
330 319
		Composite resultArea = this.getResultArea();
331 320
		
332 321
		
......
409 398
		this.updateEditorFromResult(false);
410 399
		
411 400
		// Register the context menu
412
		TXMEditor.initContextMenu(this.viewer.getTable(), "LexicalTableEditorContextMenu", this.getSite(), this.viewer); // $NON-NLS-1$
401
		TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer); // $NON-NLS-1$
413 402

  
414 403
		
415 404
		//this.commandParametersGroup.pack();
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableDialog.java (revision 723)
188 188
		maxlinesSpinner.setSelection(vmax);
189 189
		
190 190
		fminLabel = new Label(composite, SWT.NONE);
191
		fminLabel.setText(TXMCoreMessages.FMIN_1);
191
		fminLabel.setText(TXMCoreMessages.common_fMin);
192 192
		fminLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
193 193
		fminSpinner = new Spinner(composite, SWT.BORDER);
194 194
		fminSpinner.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___TableEditor.java (revision 723)
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.jface.viewers.TableViewerColumn;
34
import org.eclipse.swt.SWT;
35
import org.eclipse.swt.events.SelectionAdapter;
36
import org.eclipse.swt.events.SelectionEvent;
37
import org.eclipse.swt.layout.FillLayout;
38
import org.eclipse.swt.widgets.Composite;
39
import org.eclipse.swt.widgets.Menu;
40
import org.eclipse.swt.widgets.Table;
41
import org.eclipse.ui.IEditorInput;
42
import org.eclipse.ui.IEditorSite;
43
import org.eclipse.ui.PartInitException;
44
import org.eclipse.ui.part.EditorPart;
45
import org.txm.rcp.editors.ITablableEditorInput;
46
import org.txm.rcp.editors.TableKeyListener;
47
import org.txm.rcp.editors.TableSorter;
48
import org.txm.rcp.messages.TXMUIMessages;
49
// TODO: Auto-generated Javadoc
50
/**
51
 * Generic editor of tableable objects.
52
 *
53
 * @author sloiseau
54
 */
55
public class ___TableEditor extends EditorPart {
56

  
57
	/** The ID. */
58
	static public String ID = "org.txm.rcp.editors.TableEditor"; //$NON-NLS-1$
59
	
60
	/** The viewer. */
61
	private TableViewer viewer;
62
	
63
	/** The i editor input. */
64
	private IEditorInput iEditorInput;
65

  
66
	/** The table sorter. */
67
	private TableSorter tableSorter;
68

  
69
	/**
70
	 * Linking with the OutlineView.
71
	 *
72
	 * @param monitor the monitor
73
	 */
74
	// private OverviewOutlinePage overviewOutlinePage;
75

  
76
	@Override
77
	public void doSave(IProgressMonitor monitor) {
78
		// TODO Auto-generated method stub
79

  
80
	}
81

  
82
	/* (non-Javadoc)
83
	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
84
	 */
85
	@Override
86
	public void doSaveAs() {
87
		// TODO Auto-generated method stub
88

  
89
	}
90

  
91
	/* (non-Javadoc)
92
	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
93
	 */
94
	@Override
95
	public void init(IEditorSite site, IEditorInput input)
96
			throws PartInitException {
97
		setSite(site);
98
		setInput(input);
99
		this.iEditorInput = input;
100
	}
101

  
102
	/* (non-Javadoc)
103
	 * @see org.eclipse.ui.part.EditorPart#isDirty()
104
	 */
105
	@Override
106
	public boolean isDirty() {
107
		// TODO Auto-generated method stub
108
		return false;
109
	}
110

  
111
	/* (non-Javadoc)
112
	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
113
	 */
114
	@Override
115
	public boolean isSaveAsAllowed() {
116
		// TODO Auto-generated method stub
117
		return false;
118
	}
119

  
120
	/* (non-Javadoc)
121
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
122
	 */
123
	@Override
124
	public void createPartControl(Composite parent) {
125
		parent.setLayout(new FillLayout());
126

  
127
		viewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL
128
				| SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
129
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
130
		Table table = viewer.getTable();
131
		table.setHeaderVisible(true);
132
		table.setLinesVisible(true);
133

  
134
		if (!(iEditorInput instanceof ITablableEditorInput)) {
135
			throw new IllegalArgumentException(TXMUIMessages.TableEditor_0);
136
		}
137

  
138
		ITablableEditorInput tableInput = (ITablableEditorInput) iEditorInput;
139

  
140
		String[] titles = tableInput.getColumnTitles();
141

  
142
		for (int i = 0; i < titles.length; i++) {
143
			final int index = i;
144
			final TableViewerColumn column = new TableViewerColumn(viewer,
145
					SWT.NONE);
146

  
147
			column.getColumn().setText(titles[i]);
148
			column.getColumn().setWidth(100);
149
			column.getColumn().setResizable(true);
150
			column.getColumn().setMoveable(true);
151

  
152
			column.getColumn().addSelectionListener(new SelectionAdapter() {
153
				@Override
154
				public void widgetSelected(SelectionEvent e) {
155
					tableSorter.setColumn(index);
156
					int dir = viewer.getTable().getSortDirection();
157
					if (viewer.getTable().getSortColumn() == column.getColumn()) {
158
						dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
159
					} else {
160
						dir = SWT.DOWN;
161
					}
162
					viewer.getTable().setSortDirection(dir);
163
					viewer.getTable().setSortColumn(column.getColumn());
164
					viewer.refresh();
165
				}
166
			});
167
		}
168

  
169
		viewer.setContentProvider(tableInput.getContentProvider());
170
		viewer.setLabelProvider(tableInput.getLabelProvider());
171
		viewer.setInput(tableInput.getInput());
172

  
173
		tableSorter = new TableSorter();
174
		tableSorter.setColumnTypes(tableInput.getColumnTypes());
175
		if (this.iEditorInput instanceof ___LexicalTableEditorInput) {
176
			___LexicalTableEditorInput ed = (___LexicalTableEditorInput) this.iEditorInput;
177
			tableSorter.setLocale(ed.getResult().getPartition().getCorpus().getLocale());
178
		}
179
		viewer.setSorter(tableSorter);
180

  
181
		createContextMenu(viewer);
182
	}
183

  
184
	/**
185
	 * Creates the context menu.
186
	 *
187
	 * @param tableViewer the table viewer
188
	 */
189
	private void createContextMenu(TableViewer tableViewer) {
190

  
191
		MenuManager menuManager = new MenuManager();
192
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
193

  
194
		// Set the MenuManager
195
		tableViewer.getTable().setMenu(menu);
196
		getSite().registerContextMenu(menuManager, tableViewer);
197
		// Make the selection available
198
		getSite().setSelectionProvider(tableViewer);
199
	}
200

  
201
	/**
202
	 * Gets the table sorter.
203
	 *
204
	 * @return the table sorter
205
	 */
206
	public TableSorter getTableSorter() {
207
		return tableSorter;
208
	}
209

  
210
	/**
211
	 * Gets the table viewer.
212
	 *
213
	 * @return the table viewer
214
	 */
215
	public TableViewer getTableViewer() {
216
		return viewer;
217
	}
218

  
219
	/* (non-Javadoc)
220
	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
221
	 */
222
	@Override
223
	public void setFocus() {
224
		viewer.getControl().setFocus();
225
	}
226
}
0 227

  
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___LexicalTableEditorInput.java (revision 723)
70 70
		super(table);
71 71
		
72 72
		editors = new ArrayList<EditorPart>();
73
		editors.add(new TableEditor());
73
		editors.add(new ___TableEditor());
74 74

  
75 75
		inputs = new ArrayList<IEditorInput>();
76 76

  
tmp/org.txm.ahc.rcp/plugin.xml (revision 723)
121 121
                  ifEmpty="false"
122 122
                  operator="and">
123 123
               <instanceof
124
                     value="org.txm.ahc.core.functions.CAH">
124
                     value="org.txm.ahc.core.functions.AHC">
125 125
               </instanceof>
126 126
            </iterate>
127 127
         </with>
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 723)
30 30
import java.util.ArrayList;
31 31
import java.util.List;
32 32

  
33
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.IStatus;
35
import org.eclipse.core.runtime.Status;
36
import org.eclipse.jface.action.MenuManager;
37 33
import org.eclipse.jface.viewers.TableViewer;
38
import org.eclipse.osgi.util.NLS;
39 34
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.events.KeyEvent;
41
import org.eclipse.swt.events.KeyListener;
42 35
import org.eclipse.swt.events.SelectionEvent;
43 36
import org.eclipse.swt.events.SelectionListener;
44 37
import org.eclipse.swt.graphics.Font;
45 38
import org.eclipse.swt.graphics.FontData;
46
import org.eclipse.swt.graphics.Point;
47 39
import org.eclipse.swt.layout.FormAttachment;
48 40
import org.eclipse.swt.layout.FormData;
49 41
import org.eclipse.swt.layout.FormLayout;
......
52 44
import org.eclipse.swt.widgets.Button;
53 45
import org.eclipse.swt.widgets.Composite;
54 46
import org.eclipse.swt.widgets.Display;
55
import org.eclipse.swt.widgets.Event;
56 47
import org.eclipse.swt.widgets.Label;
57
import org.eclipse.swt.widgets.Listener;
58
import org.eclipse.swt.widgets.Menu;
59 48
import org.eclipse.swt.widgets.Spinner;
60 49
import org.eclipse.swt.widgets.TableColumn;
61
import org.eclipse.ui.IEditorInput;
62
import org.eclipse.ui.IEditorSite;
63
import org.eclipse.ui.PartInitException;
64 50
import org.txm.core.messages.TXMCoreMessages;
65
import org.txm.core.preferences.TXMPreferences;
66
import org.txm.core.results.TXMResult;
51
import org.txm.core.results.Parameter;
67 52
import org.txm.index.core.functions.Index;
68 53
import org.txm.index.core.functions.Line;
69 54
import org.txm.index.core.functions.LineComparator.SortMode;
70 55
import org.txm.index.core.preferences.IndexPreferences;
71 56
import org.txm.index.rcp.messages.IndexUIMessages;
72
import org.txm.rcp.JobsTimer;
73 57
import org.txm.rcp.StatusLine;
74 58
import org.txm.rcp.editors.TXMEditor;
75
import org.txm.rcp.editors.TXMResultEditorInput;
76 59
import org.txm.rcp.editors.TableKeyListener;
60
import org.txm.rcp.editors.listeners.ComputeKeyListener;
61
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
77 62
import org.txm.rcp.messages.TXMUIMessages;
78
import org.txm.rcp.preferences.RCPPreferences;
79 63
import org.txm.rcp.swt.widget.AssistedQueryWidget;
80 64
import org.txm.rcp.swt.widget.NavigationWidget;
81 65
import org.txm.rcp.swt.widget.PropertiesSelector;
82
import org.txm.rcp.utils.JobHandler;
83 66
import org.txm.rcp.views.QueriesView;
84
import org.txm.searchengine.cqp.CQPEngine;
85 67
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
86 68
import org.txm.searchengine.cqp.corpus.Corpus;
87 69
import org.txm.searchengine.cqp.corpus.Property;
88
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
89 70
import org.txm.searchengine.cqp.corpus.WordProperty;
90 71
import org.txm.searchengine.cqp.corpus.query.Query;
91 72
import org.txm.statsengine.r.rcp.views.RVariablesView;
......
105 86
	/** The query label. */
106 87
	protected Label queryLabel;
107 88

  
108
	/** The query widget. */
109
	protected AssistedQueryWidget queryWidget;
110

  
111 89
	/** The go. */
112
	protected Button go;
90
	protected Button searchButton;
113 91

  
114
	/** The props area. */
115
	protected PropertiesSelector<Property> propsArea;
116
	// seuils
117
	/** The Fmin spinner. */
118
	protected Spinner fMinSpinner;
119 92

  
120
	/** The Fmax spinner. */
121
	protected Spinner fMaxSpinner;
122

  
123
	/** The Tmax spinner. */
124
	protected Spinner vMaxSpinner;
125

  
126
	/** The N ligne p page spinner. */
127
	protected Spinner nLinesPerPageSpinner;
128 93
	// infos
129 94
	/** The navigation area. */
130 95
	protected NavigationWidget navigationArea;
......
160 125
	/** The title. */
161 126
	String title;
162 127

  
128
	
129
	
130
	/** The query widget. */
131
	@Parameter(key=IndexPreferences.QUERY)
132
	protected AssistedQueryWidget queryWidget;
163 133

  
164
	/**
165
	 * Inits the editor result.
166
	 *
167
	 * @param site the site
168
	 * @param input the input
169
	 * @throws PartInitException the part init exception
170
	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
171
	 * org.eclipse.ui.IEditorInput)
172
	 */
173
	@Override
174
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
175
		super.init(site, input);
134
	/** The Fmin spinner. */
135
	@Parameter(key=IndexPreferences.F_MIN)
136
	protected Spinner fMinSpinner;
176 137

  
177
		TXMResult result = ((TXMResultEditorInput) input).getResult();
178
		if (result != null && result instanceof Index) {
179
			this.index = (Index) result;
180
		}
181
		else { 
182
			throw new PartInitException("TXMResult input is not an Index: " + result);
183
		}
184
	}
138
	/** The Fmax spinner. */
139
	@Parameter(key=IndexPreferences.F_MAX)
140
	protected Spinner fMaxSpinner;
185 141

  
142
	/** The Tmax spinner. */
143
	@Parameter(key=IndexPreferences.V_MAX)
144
	protected Spinner vMaxSpinner;
186 145

  
187
	@Override
188
	public void updateResultFromEditor() {
189
		final Query query = new Query("");
190
		if (!queryWidget.isDisposed() && !queryWidget.getQueryString().equals("\"\"")) { //$NON-NLS-1$
191
			query.setQueryString(queryWidget.getQueryString());
192
		}
193

  
194
		final Integer fMin = Integer.parseInt(fMinSpinner.getText());
195
		final Integer fMax = Integer.parseInt(fMaxSpinner.getText());
196
		final Integer tMax = Integer.parseInt(this.vMaxSpinner.getText());
197
		final Integer nLines = Integer.parseInt(this.nLinesPerPageSpinner.getText());
198
		final List<Property> properties = propsArea.getSelectedProperties();
199
		
200
		index.setNLinesPerPage(nLinesPerPageSpinner.getSelection());
201
		index.setVMax(vMaxSpinner.getSelection());
202
		
203
		index.setParameters(query, properties, fMin, fMax, tMax, nLines);
204
		index.setDirty();
205
	}
206

  
146
	/** The N ligne p page spinner. */
147
	@Parameter(key=IndexPreferences.N_LINES_PER_PAGE)
148
	protected Spinner nLinesPerPageSpinner;
207 149
	
208 150
	/**
209
	 * Computes index.
151
	 * Word properties selector.
210 152
	 */
211
	@Override
212
	public void updateEditorFromResult(final boolean update) {
213
		
214
		//System.out.println("PROPERTIES: "+properties);
215
//		title = "Index...";
216
//		try {
217
//			JobHandler jobhandler = new JobHandler(title) {
218
//				@Override
219
//				protected IStatus run(IProgressMonitor monitor) {
220
//					this.runInit(monitor);
221
//					try {
222
//						JobsTimer.start();
223
//
224
//						monitor.worked(95);
225
//						// refresh ui
226
//						syncExec(new Runnable() {
227
//							@Override
228
//							public void run() {
153
	@Parameter(key=IndexPreferences.PROPERTIES)
154
	protected PropertiesSelector<WordProperty> propertiesSelector;
155
	
229 156

  
230
								QueriesView.refresh();
231
								RVariablesView.refresh();
232

  
233
								if (!queryWidget.isDisposed()) {
234
									queryWidget.memorize();
235
								}
236
								
237
								fillDisplayArea();
238

  
239
								viewer.getTable().setFocus();
240
//							}
241
//						});
242
//
243
//					} catch (ThreadDeath td) {
244
//						return Status.CANCEL_STATUS;
245
//					} catch (Exception e) {
246
//						e.printStackTrace();
247
//						System.out.println(e.getLocalizedMessage());
248
//						try {
249
//							System.out.println(RCPMessages.LastCQPError+CQPEngine.getCqiClient().getLastCQPError());
250
//						} catch (Exception e1) {
251
//							System.out.println(IndexUIMessages.IndexEditor_10+e1);
252
//							org.txm.rcp.utils.Logger.printStackTrace(e1);
253
//						}
254
//						Log.severe("Error while computing Index: "+e.getLocalizedMessage());
255
//					} finally {
256
//						monitor.done();
257
//						JobsTimer.stopAndPrint();
258
//					}
259
//					return Status.OK_STATUS;
260
//				}
261
//			};
262
//			jobhandler.startJob();
263
//
264
//		} catch (Exception e1) {
265
//			org.txm.rcp.utils.Logger.printStackTrace(e1);
266
//		}
267
	}
268

  
269 157
	/**
270 158
	 * Creates the part control.
271 159
	 *
......
274 162
	 */
275 163
	@Override
276 164
	public void _createPartControl(Composite parent) {
277
//		super.createPartControl(parent);
278 165

  
166
		
167
		this.index = (Index) this.getResult();
168

  
169
		
170
		// Computing listener
171
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
172
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
173
		
279 174
		Composite paramArea = this.getCommandParametersGroup();
280 175
		paramArea.setLayout(new FormLayout());
281 176

  
......
300 195
		// | Query: [ (v)] [Search] |
301 196
		// Query:
302 197
		queryLabel = new Label(queryArea, SWT.NONE);
303
		queryLabel.setText(TXMCoreMessages.QUERY_1);
304
		queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
305
				true));
198
		queryLabel.setText(TXMCoreMessages.common_query);
199
		queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true));
306 200

  
307 201
		// [ (v)]
308 202
		queryWidget = new AssistedQueryWidget(queryArea, SWT.DROP_DOWN,	index.getCorpus());
......
310 204
		layoutData.horizontalAlignment = GridData.FILL;
311 205
		layoutData.grabExcessHorizontalSpace = true;
312 206
		queryWidget.setLayoutData(layoutData);
207
		queryWidget.addKeyListener(computeKeyListener);
313 208

  
314
		KeyListener listener = new KeyListener() {
315
			@Override
316
			public void keyPressed(KeyEvent e) {
317
				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
318
					updateResultFromEditor();
319
					compute(true);
320
				}
321
			}
322
			@Override
323
			public void keyReleased(KeyEvent e) {
324
			}
325
		};
326
		queryWidget.addKeyListener(listener);
209
		
210
		// Word properties selector
211
		propertiesSelector = new PropertiesSelector<WordProperty>(queryArea, SWT.NONE);
212
		propertiesSelector.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
213
		propertiesSelector.setLayout(new GridLayout(3, false));
214
		try {
215
			propertiesSelector.setProperties(index.getCorpus().getOrderedProperties());
216
		}
217
		catch (CqiClientException e) {
218
			Log.printStackTrace(e);
219
		}
220
		// Listener
221
		propertiesSelector.addSelectionListener(computeSelectionListener);
222
		
223
		//Search button
224
		searchButton = new Button(queryArea, SWT.BOLD);
225
		searchButton.setText(TXMUIMessages.SEARCH);
327 226

  
328
		// select focus properties
329
		propsArea = new PropertiesSelector<Property>(queryArea, SWT.NONE);
330
		propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
331
		propsArea.setLayout(new GridLayout(3, false));
332
		propsArea.addValueChangeListener(new Listener() {
333
			@Override
334
			public void handleEvent(Event event) {
335
				if (!initializing && TXMPreferences.getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR, RCPPreferences.PREFERENCES_NODE)) {
336
					updateResultFromEditor();
337
					compute(false);
338
				}
339
			}
340
		});
341

  
342
		//propsArea
343
		go = new Button(queryArea, SWT.BOLD);
344
		go.setText(TXMUIMessages.SEARCH);
345

  
346
		Font f = go.getFont();
227
		Font f = searchButton.getFont();
347 228
		FontData defaultFont = f.getFontData()[0];
348 229
		defaultFont.setStyle(SWT.BOLD);
349
		Font newf = new Font(go.getDisplay(), defaultFont);
350
		go.setFont(newf);
230
		Font newf = new Font(searchButton.getDisplay(), defaultFont);
231
		searchButton.setFont(newf);
351 232

  
352 233
		layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
353 234
		layoutData.horizontalAlignment = GridData.FILL;
354 235
		layoutData.grabExcessHorizontalSpace = false;
355
		go.setLayoutData(layoutData);
236
		searchButton.setLayoutData(layoutData);
237
		searchButton.addSelectionListener(computeSelectionListener);
356 238

  
357
		SelectionListener listener2 = new SelectionListener() {
358
			@Override
359
			public void widgetSelected(SelectionEvent e) {
360
				updateResultFromEditor();
361
				compute(true);
362
			}
363
			@Override
364
			public void widgetDefaultSelected(SelectionEvent e) { }
365
		};
366
		go.addSelectionListener(listener2);
367

  
368 239
		// Filters
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff