Révision 731

tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 731)
167 167
		this.index = (Index) this.getResult();
168 168

  
169 169
		
170
		// Computing listener
170
		// Computing listeners
171 171
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
172 172
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
173 173
		
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/IndexToProgression.java (revision 731)
27 27
//
28 28
package org.txm.index.rcp.handlers;
29 29

  
30
import java.util.ArrayList;
31 30
import java.util.List;
32 31

  
33 32
import org.eclipse.core.commands.ExecutionEvent;
......
35 34
import org.eclipse.jface.viewers.IStructuredSelection;
36 35
import org.eclipse.ui.handlers.HandlerUtil;
37 36
import org.txm.core.preferences.TXMPreferences;
37
import org.txm.index.core.functions.Index;
38 38
import org.txm.index.core.functions.Line;
39 39
import org.txm.rcp.editors.TXMEditor;
40 40
import org.txm.rcp.handlers.BaseAbstractHandler;
41 41
import org.txm.searchengine.cqp.corpus.Corpus;
42
import org.txm.searchengine.cqp.corpus.Property;
43 42
import org.txm.searchengine.cqp.corpus.query.Query;
44 43

  
45 44
/**
......
58 57

  
59 58
		if (selection != null && selection.getFirstElement() instanceof Line) {
60 59

  
61
			List<Query> queries = getQueries(selection);
60
			List<Query> queries = Index.createQueries(selection.toList());
62 61

  
63 62
			TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
64 63
			Corpus corpus = Corpus.getFirstParentCorpus(editor.getResult());
......
79 78
	}
80 79

  
81 80

  
82
	/**
83
	 * Creates and returns the queries list from the selected table lines.
84
	 *
85
	 * @param selection the selection
86
	 * @return the queries
87
	 */
88
	public static List<Query> getQueries(IStructuredSelection selection) {
89
		List<Line> lines = selection.toList();
90
		List<Query> queries = new ArrayList<Query>();
91
		for (Line line : lines) {
92
			String query = ""; //$NON-NLS-1$
93
			int nbToken = line.getUnitsProperties().get(0).size();
94
			int nbProps = line.getProperties().size();
95
			List<List<String>> values = line.getUnitsProperties();
96
			List<Property> props = line.getProperties();
97
			for (int t = 0; t < nbToken; t++) {
98
				query += "["; //$NON-NLS-1$
99
				for (int p = 0; p < nbProps; p++) {
100
					query += props.get(p).getName() + "=\""; //$NON-NLS-1$
101
					String s = values.get(p).get(t);
102
					s = Query.addBackSlash(s);
103
					query += s;
104
					query += "\" & "; //$NON-NLS-1$
105
				}
106
				query = query.substring(0, query.length() - 3);
107
				query += "] "; //$NON-NLS-1$
108
			}
109
			queries.add(new Query(query));
110
		}
111
		return queries;
112
	}
113 81
	
114 82
	
115 83
}
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/IndexToConcordance.java (revision 731)
35 35
import org.eclipse.jface.viewers.IStructuredSelection;
36 36
import org.eclipse.ui.IWorkbenchWindow;
37 37
import org.eclipse.ui.handlers.HandlerUtil;
38
import org.txm.index.core.functions.Index;
38 39
import org.txm.index.core.functions.Line;
39 40
import org.txm.index.rcp.editors.IndexEditor;
40 41
import org.txm.rcp.editors.TXMResultEditorInput;
......
157 158
	 * @return the query
158 159
	 */
159 160
	private static String getQuery(IStructuredSelection selection) {
160
		String query = ""; //$NON-NLS-1$
161

  
162
		Line line = (Line) selection.getFirstElement();
163
		int nbToken = line.getUnitsProperties().get(0).size();
164
		int nbProps = line.getProperties().size();
165
		int nbLines = selection.size();
166
		List<Line> lines = selection.toList();
167
		List<Property> props = line.getProperties();
168
		for (int t = 0; t < nbToken; t++) {
169
			query += "["; //$NON-NLS-1$
170
			for (int p = 0; p < nbProps; p++) {
171
				if (props.get(p) instanceof StructuralUnitProperty) {
172
					query += "_."+((StructuralUnitProperty)props.get(p)).getFullName() + "=\""; //$NON-NLS-1$ //$NON-NLS-2$
173
				} else {
174
					query += props.get(p) + "=\""; //$NON-NLS-1$
175
				}
176
				for (int l = 0; l < nbLines; l++) {
177
					line = lines.get(l);
178
					List<List<String>> values = line.getUnitsProperties();
179
					String s = values.get(p).get(t);
180
					s = Query.addBackSlash(s);
181
					query += s + "|"; //$NON-NLS-1$
182
				}
183
				query = query.substring(0, query.length() - 1);
184
				query += "\" & "; //$NON-NLS-1$
185
			}
186
			query = query.substring(0, query.length() - 3);
187
			query += "] "; //$NON-NLS-1$
188
		}
189
		query = query.substring(0, query.length() - 1);
190
		return query;
161
		return Index.createQuery(selection.toList());
191 162
	}
192 163
}
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_ru.properties (revision 731)
1 1

  
2
ProgressionDialog_0  = Параметры прогрессии 
3 2
ProgressionDialog_1  = Тип графа: 
4
ProgressionDialog_10 = Прогрессия: некорректное регулярное выражение: 
5 3
ProgressionDialog_11 = Масштаб полос
6
ProgressionDialog_13 = Опции вида
7 4
ProgressionDialog_14 = Различные стили строк
8 5
ProgressionDialog_15 = Повторять идентичные значения
9 6
ProgressionDialog_17 = Ошибка: мультипликатор полосы: 
......
13 10
ProgressionDialog_9  = добавить query
14 11

  
15 12
ProgressionPreferencePage_3 = Кумулятивный граф прогрессии
16
ProgressionPreferencePage_5 = Линии в одном стиле
17 13
ProgressionPreferencePage_6 = Повторять значения с свойств структур
18 14
ProgressionPreferencePage_7 = Масштаб границ структур
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties (revision 731)
1 1

  
2
ProgressionDialog_0  = Paramètres de la progression 
3 2
ProgressionDialog_1  = Type de graphe : 
4
ProgressionDialog_10 = Progression : mauvaise expression régulière : 
5 3
ProgressionDialog_11 = Échelle des bandeaux
6
ProgressionDialog_13 = Options d'affichage
7 4
ProgressionDialog_14 = Styles de ligne multiples
8 5
ProgressionDialog_15 = Répéter les valeurs identiques
9 6
ProgressionDialog_17 = Erreur : multiplicateur de bande : 
......
13 10
ProgressionDialog_9  = ajouter une requête
14 11

  
15 12
ProgressionPreferencePage_3 = Graphe de progression cumulatif
16
ProgressionPreferencePage_5 = Style de ligne unique
17 13
ProgressionPreferencePage_6 = Répéter les valeurs de propriétés de structures
18 14
ProgressionPreferencePage_7 = Échelle des limites de structures
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/ProgressionUIMessages.java (revision 731)
3 3
import org.eclipse.osgi.util.NLS;
4 4
import org.txm.utils.messages.Utf8NLS;
5 5

  
6
/**
7
 * Progression UI messages.
8
 * 
9
 * @author mdecorde
10
 * @author sjacquot
11
 *
12
 */
6 13
public class ProgressionUIMessages extends NLS {
7 14

  
8 15
	private static final String BUNDLE_NAME = "org.txm.progression.rcp.messages.messages"; //$NON-NLS-1$
9 16

  
10 17
	public static String ProgressionPreferencePage_3;
11
	public static String ProgressionPreferencePage_5;
12 18
	public static String ProgressionPreferencePage_6;
13 19
	public static String ProgressionPreferencePage_7;
14 20

  
15
	public static String ProgressionDialog_0;
16 21
	public static String ProgressionDialog_1;
17
	public static String ProgressionDialog_10;
18 22
	public static String ProgressionDialog_11;
19
	public static String ProgressionDialog_13;
20 23
	public static String ProgressionDialog_14;
21 24
	public static String ProgressionDialog_15;
22 25
	public static String ProgressionDialog_17;
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties (revision 731)
1 1

  
2
ProgressionDialog_0  = Progression Parameters
3 2
ProgressionDialog_1  = Graph type:
4
ProgressionDialog_10 = Progression dialog: wrong regular expression:
5 3
ProgressionDialog_11 = Bandewidth multiplier:
6
ProgressionDialog_13 = Display options
7 4
ProgressionDialog_14 = Multiple line styles
8 5
ProgressionDialog_15 = Repeat same values
9 6
ProgressionDialog_17 = Strip multiplier error:
......
13 10
ProgressionDialog_9  = add a query
14 11

  
15 12
ProgressionPreferencePage_3 = Default graph type is cumulative
16
ProgressionPreferencePage_5 = Single line style
17 13
ProgressionPreferencePage_6 = Repeat the values of the structure properties
18 14
ProgressionPreferencePage_7 = Bande size multiplier
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 731)
215 215
				@Override
216 216
				public void widgetSelected(SelectionEvent e) {
217 217
					bandeField.setEnabled(densityButton.getSelection());
218
					getResult().setChartType("density");					
218
					getResult().setChartType(Progression.DENSITY_CHART_TYPE);					
219 219
				}
220 220
				
221 221
				@Override
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 731)
29 29

  
30 30
import org.eclipse.core.commands.ExecutionEvent;
31 31
import org.eclipse.core.commands.ExecutionException;
32
import org.txm.chartsengine.core.ChartsEngine;
33
import org.txm.chartsengine.r.core.RChartsEngine;
34
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
32
import org.eclipse.core.runtime.preferences.InstanceScope;
35 33
import org.txm.chartsengine.rcp.editors.ChartEditor;
36
import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider;
37 34
import org.txm.core.preferences.TXMPreferences;
38
import org.txm.core.results.TXMResult;
39 35
import org.txm.progression.core.functions.Progression;
40 36
import org.txm.progression.core.messages.ProgressionCoreMessages;
41
import org.txm.progression.core.preferences.ProgressionPreferences;
42 37
import org.txm.rcp.handlers.BaseAbstractHandler;
43 38
import org.txm.rcp.views.corpora.CorporaView;
44 39
import org.txm.searchengine.cqp.corpus.Corpus;
......
46 41

  
47 42

  
48 43
/**
49
 * Open the ProgressionDialog, computes and opens the result editor part.
44
 * Computes a Progression and opens the result editor.
50 45
 * 
51 46
 * @author mdecorde
52 47
 * @author sjacquot
......
61 56
	
62 57
	
63 58
	
64
	/* (non-Javadoc)
65
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
66
	 */
67 59
	@Override
68 60
	public Object execute(ExecutionEvent event) throws ExecutionException {
69 61

  
62
		
70 63
		if(!this.checkStatsEngine() || !this.checkCorpusEngine()) {
71 64
			return false;
72 65
		}
73 66

  
74 67
		Object selection = this.getSelection(event);
68

  
69
		
75 70
		Progression progression = null;
76 71
		
77 72

  
......
89 84
				return null;
90 85
			}
91 86
			progression = new Progression(corpus);
87
		
88
			// FIXME: persistence tests from a file named "201805123_433f0b69-1083-4ed6-be1c-bcd48c73aeae"
89
//			progression = new Progression("201805123_433f0b69-1083-4ed6-be1c-bcd48c73aeae", corpus);
90

  
91
			
92 92
		}
93 93
		// Reopening an existing result
94 94
		else if (selection instanceof Progression)	{
95 95
			progression = (Progression) selection;
96 96
		}
97
		// Error
98
		else {
99
			this.logCanNotCompute(selection);
100
		}
97 101

  
98
		
99
		// FIXME: temporary force R/SVG version because the Progression density chart is not yet implemented in JFC mode
100
//		if(!progression.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE))	{
101
//			SVGSWTChartsComponentsProvider tmpSWTComponentsProvider = (SVGSWTChartsComponentsProvider) SWTChartsComponentsProvider.getComponentsProvider(SVGSWTChartsComponentsProvider.class);
102
//			RChartsEngine tmpChartsEngine = (RChartsEngine) ChartsEngine.getChartsEngine(RChartsEngine.class);									
103
//			tmpSWTComponentsProvider.setChartsEngine(tmpChartsEngine);
104
//			
105
//			// Create and open the chart editor
106
//			//ChartEditor.compute(progression, tmpSWTComponentsProvider);
107
//			
108
//		}
109
//		else	{
110
//			// Create and open the chart editor
111
//			//ChartEditor.compute(progression);
112
//		}
113

  
114 102
		ChartEditor.openEditor(progression);
115 103
		
116 104
		return null;
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 731)
77 77
	
78 78
	// local result preferences
79 79
	public final static String CHART_TYPE = PREFERENCES_PREFIX +  "chart_type"; //$NON-NLS-1$
80
	public final static String RESULT_DATA_TYPE = PREFERENCES_PREFIX +  "result_data_type"; //$NON-NLS-1$
81 80
	
82 81
	
83 82
	
......
96 95
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
97 96
		
98 97
		preferences.put(CURRENT_NAME, "jfreechart_charts_engine"); //$NON-NLS-1$
99
		preferences.put(DEFAULT_EXPORT_FORMAT, "svg");
98
		preferences.put(DEFAULT_EXPORT_FORMAT, "svg"); //$NON-NLS-1$
100 99

  
101 100
		
102 101
		initializeChartsEngineSharedPreferences(preferences);
......
104 103
	
105 104
	/**
106 105
	 * Initializes the charts engine default preferences.
107
	 * This method is also used to define the charts preference for each command.
106
	 * This method is also used to define the charts preference for each command using charts.
108 107
	 * @param preferences
109 108
	 */
110 109
	public static void initializeChartsEngineSharedPreferences(Preferences preferences)	{
110
		preferences.put(CHART_TYPE, DEFAULT_CHART_TYPE);
111 111
		preferences.putBoolean(SHOW_TITLE, true);
112 112
		preferences.putBoolean(SHOW_LEGEND, true);
113 113
		preferences.putBoolean(SHOW_GRID, true);
114 114
		preferences.putInt(RENDERING_COLORS_MODE, ChartsEngine.RENDERING_COLORS_MODE);
115 115
		preferences.put(MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$
116 116
		preferences.putBoolean(MULTIPLE_LINE_STROKES, false);
117

  
118 117
		
119
		
120
		preferences.put(CHART_TYPE, DEFAULT_CHART_TYPE);
121
		
122
		// FIXME: maybe need need to check here the target OS and set a default Unicode installed font
118
		// FIXME: maybe need to check here the target OS and set a default Unicode installed font
123 119
		preferences.put(FONT, DEFAULT_FONT);
124 120
		
125 121
	}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java (revision 731)
676 676
		return charset;
677 677
	}
678 678

  
679
	/* (non-Javadoc)
680
	 * @see org.txm.objects.TxmObject#getChildren()
681
	 */
682
	public List<? extends TxmObject> getChildren() {
683
		List<? extends TxmObject> ret = subcorpora;
684
		return ret;
685
	}
686 679

  
687 680
	/* (non-Javadoc)
688 681
	 * @see org.txm.searchengine.cqp.corpus.CqpObject#getCqpId()
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/StructuralUnitProperty.java (revision 731)
33 33
import java.util.UUID;
34 34

  
35 35
import org.txm.core.messages.TXMCoreMessages;
36
import org.txm.core.preferences.TXMPreferences;
36 37
import org.txm.searchengine.cqp.AbstractCqiClient;
37 38
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
38 39
import org.txm.searchengine.cqp.corpus.query.Query;
......
52 53
	/** The structural unit. */
53 54
	private StructuralUnit structuralUnit;
54 55

  
55
	public static List<StructuralUnitProperty> stringToStructuralUnitProperties(Corpus corpus, String v) {
56
		ArrayList<StructuralUnitProperty> structs = new ArrayList<StructuralUnitProperty>();
57
		if (v == null) return structs;
58
		if (v.length() == 0) return structs;
59 56

  
60
		String[] split = v.split("\t");
61
		for (String s : split) {
62
			String[] split2 = s.split("_", 2);
63
			if (split2.length != 2) continue;
64
			try {
65
				StructuralUnit struc = corpus.getStructuralUnit(split2[0]);
66
				StructuralUnitProperty struc_p = struc.getProperty(split2[1]);
67
				if (struc_p != null) {
68
					structs.add(struc_p);
69
				}
70
			} catch (CqiClientException e) {
71
				System.out.println("Error: "+v+" structure property not found in "+corpus);
72
				Log.printStackTrace(e);
73
				return null;
74
			}
75

  
76
		}
77
		return structs;
78
	}
79

  
80 57
	
81 58
	/**
82
	 * 
83
	 * @param corpus
84
	 * @param s the String to 'deserialize'. Each property is separated with 1 tabulation. Then calls fromString on each token
85
	 * @return a list of StructuralUnitProperty if the s param is well formed
86
	 * @throws CqiClientException 
87
	 */
88
	public static List<StructuralUnitProperty> fromStringToList(Corpus corpus, String s) {
89
		ArrayList<StructuralUnitProperty> properties = new ArrayList<StructuralUnitProperty>();
90
		if (s == null) return properties;
91

  
92
		String[] split = s.split("\t");
93
		for (String s2 : split) {
94
			try {
95
				StructuralUnitProperty sup = fromString(corpus, s2);
96
				if (sup != null) {
97
					properties.add(sup);
98
				}
99
			} catch (Exception e) {
100
				e.printStackTrace();
101
			}
102
		}
103
		return properties;
104
	}
105
	
106
	
107
	/**
108 59
	 * Instantiates a new structural unit property.
109 60
	 * 
110 61
	 * Not intended to be used directly. See
......
242 193
	 */
243 194
	public Integer getNumberOfValues(Corpus corpus) {
244 195
		try {
245
			QueryResult tmp = corpus.query(
246
					new Query("<" + this.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
196
			QueryResult tmp = corpus.query(new Query("<" + this.getFullName() + ">[]"), UUID.randomUUID().toString(), false); //$NON-NLS-1$ //$NON-NLS-2$
247 197
			int ret = tmp.getNMatch();
248 198
			tmp.drop();
249 199
			return ret;
......
254 204
	}
255 205

  
256 206
	/**
257
	 * 
207
	 * Converts the specified string to a list of StructuralUnitProperty from the specified Corpus.
258 208
	 * @param corpus
259
	 * @param s the String to 'deserialize'. Follows the structure_property syntax
209
	 * @param str
260 210
	 * @return
211
	 */
212
	public static List<StructuralUnitProperty> stringToProperties(Corpus corpus, String str) {
213
		ArrayList<StructuralUnitProperty> structs = new ArrayList<StructuralUnitProperty>();
214
		if (str == null || str.length() == 0) {
215
			return structs;
216
		}
217

  
218
		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
219
		for (String s : split) {
220
			String[] split2 = s.split("_", 2);
221
			if (split2.length != 2) {
222
				continue;
223
			}
224
			try {
225
				StructuralUnit struc = corpus.getStructuralUnit(split2[0]);
226
				StructuralUnitProperty struc_p = struc.getProperty(split2[1]);
227
				if (struc_p != null) {
228
					structs.add(struc_p);
229
				}
230
			} catch (CqiClientException e) {
231
				System.out.println("Error: " + str + " structure property not found in " + corpus);
232
				Log.printStackTrace(e);
233
				return null;
234
			}
235

  
236
		}
237
		return structs;
238
	}
239

  
240
	
241
	/**
242
	 * Converts the specified string to a StructuralUnitProperty.
243
	 * @param corpus
244
	 * @param str the String to 'deserialize'. Follows the structure_property syntax
245
	 * @return
261 246
	 * @throws CqiClientException
262 247
	 */
263
	public static StructuralUnitProperty fromString(Corpus corpus, String s) throws CqiClientException {
264
		if (s == null) return null;
248
	public static StructuralUnitProperty stringToStructuralUnitProperty(Corpus corpus, String str) throws CqiClientException {
249
		if (str == null) {
250
			return null;
251
		}
265 252

  
266
		String[] split = s.split("_", 2);
253
		String[] split = str.split("_", 2);
267 254
		if (split.length == 2) {
268 255
			StructuralUnit su = corpus.getStructuralUnit(split[0]);
269 256
			if (su == null) {
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 731)
159 159
		return this.size;
160 160
	}
161 161
	
162
	@Override
163
	public List<? extends TxmObject> getChildren() {
164
		List<? extends TxmObject> ret = super.getChildren();
165
		for (int i = 0 ; i < ret.size() ; i++) {
166
			Object element = ret.get(i);
167
			
168
			if (element instanceof Text || element instanceof SavedQuery) {
169
				ret.remove(i);
170
				i--;
171
			}
172
		}
173
		return ret;
174
	}
175 162

  
176 163
	/**
177 164
	 * Gets the properties available in this corpus.
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/WordProperty.java (revision 731)
4 4
import java.util.List;
5 5

  
6 6
import org.apache.commons.lang.StringUtils;
7
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
7
import org.txm.core.preferences.TXMPreferences;
8 8

  
9 9
/**
10 10
 * A CQP property at token/word level
......
14 14
 */
15 15
public class WordProperty extends Property {
16 16

  
17
	/**
18
	 * Creates a new WordProperty.
19
	 * @param name
20
	 * @param corpus
21
	 */
17 22
	protected WordProperty(String name, Corpus corpus) {
18 23
		super(name, corpus);
19 24
	}
......
23 28
		return getName();
24 29
	}
25 30

  
26
	/**
27
	 * 
28
	 * @param corpus
29
	 * @param s the String to 'deserialize'. Each property is separated with 1 tabulation. Then calls fromString on each token
30
	 * @return a list of StructuralUnitProperty if the s param is well formed
31
	 * @throws CqiClientException 
32
	 */
33
	public static List<Property> fromStringToList(Corpus corpus, String s) {
34
		ArrayList<Property> properties = new ArrayList<Property>();
35
		if (s == null) return properties;
36 31

  
37
		String[] split = s.split("\t");
38
		for (String s2 : split) {
39
			try {
40
				WordProperty p = corpus.getProperty(s2);
41
				if (p != null) {
42
					properties.add(p);
43
				}
44
			} catch (CqiClientException e) {
45
				// TODO Auto-generated catch block
46
				e.printStackTrace();
47
			}
48
		}
49
		return properties;
50
	}
51

  
52
	/**
53
	 * create a preference String value from a list of Word properties
54
	 * 
55
	 * @param pProperties the list of properties. May be null (return [])
56
	 * @return
57
	 */
58
	public static String fromListToPreferenceString(List<Property> pProperties) {
59
		if (pProperties == null){
60
			return "";
61
		}
62

  
63
		ArrayList<String> names = new ArrayList<String>();
64

  
65
		for (Property p : pProperties) {
66
			names.add(p.getName());
67
		}
68
		
69
		return StringUtils.join(names, "\t");
70
	}
32
	
71 33
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java (revision 731)
27 27
//
28 28
package org.txm.searchengine.cqp.corpus;
29 29

  
30
import java.util.ArrayList;
31
import java.util.List;
30 32

  
33
import org.apache.commons.lang.StringUtils;
34
import org.txm.core.preferences.TXMPreferences;
35
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
36

  
37

  
31 38
/**
32 39
 * An abstract CQP corpus property. Represents a <strong>type</strong>, not a the value for a specific unit.
33 40
 * 
......
116 123
	public int compareTo(Property p) {
117 124
		return (this.getQualifiedName().compareTo((p).getQualifiedName()));
118 125
	}
126
	
127
	
128
	/**
129
	 * Converts the specified string to a list of Property from the specified Corpus.
130
	 * @param corpus
131
	 * @param str the String to 'deserialize'. Each property is separated with 1 tabulation. Then calls fromString on each token
132
	 * @return a list of StructuralUnitProperty if the s param is well formed
133
	 * @throws CqiClientException 
134
	 */
135
	public static List<? extends Property> stringToProperties(Corpus corpus, String str) {
136
		ArrayList<Property> properties = new ArrayList<Property>();
137
		
138
		if (str == null) {
139
			return properties;
140
		}
141

  
142
		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
143
		for (String s : split) {
144
			try {
145
				Property p = corpus.getProperty(s);
146
				if (p != null) {
147
					properties.add(p);
148
				}
149
			} catch (CqiClientException e) {
150
				// TODO Auto-generated catch block
151
				e.printStackTrace();
152
			}
153
		}
154
		return properties;
155
	}
156

  
157

  
158
	/**
159
	 * Converts the specified list of Property to a string.
160
	 * 
161
	 * @param pProperties the list of properties. May be null (return "")
162
	 * @return
163
	 */
164
	public static String propertiesToString(List<? extends Property> pProperties) {
165
		if (pProperties == null){
166
			return ""; //$NON-NLS-1$
167
		}
168

  
169
		ArrayList<String> names = new ArrayList<String>();
170

  
171
		for (Property p : pProperties) {
172
			names.add(p.getName());
173
		}
174
		
175
		return StringUtils.join(names, TXMPreferences.LIST_SEPARATOR);
176
	}
177
	
119 178
}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Query.java (revision 731)
32 32
import java.util.regex.Matcher;
33 33
import java.util.regex.Pattern;
34 34

  
35
import org.txm.core.preferences.TXMPreferences;
36

  
35 37
/**
36 38
 * Implements a CQL query. Use fixQuery to use query sugar.
37 39
 * 
......
89 91
		else {
90 92
			this.queryString = "";
91 93
		}
92
		
93 94
	}
94 95

  
95 96
	/**
......
103 104
		if (str == null || str.length() == 0) {
104 105
			return queries;
105 106
		}
106
		String[] split = str.split("\t");
107
		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
107 108
		for (String s : split) {
108 109
			queries.add(new Query(s));
109 110
		}
......
113 114
	
114 115
	/**
115 116
	 * Converts the specified list of Query to a string.
116
	 * Queries are separated by a tabulation.
117
	 * Queries strings are separated by a tabulation.
117 118
	 * @param queries
118 119
	 * @return
119 120
	 */
......
121 122
		String str = "";
122 123
		for (int i = 0; i < queries.size(); i++) {
123 124
			if(i > 0)	{
124
				str += "\t";
125
				str += TXMPreferences.LIST_SEPARATOR;
125 126
			}
126 127
			str += queries.get(i).getQueryString();			
127 128
		}
tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java (revision 731)
161 161
				continue;
162 162
			
163 163
			//System.out.println("check "+container.getName());
164
			if (container.getResults().size() > 0
164
			if (container.getChildren().size() > 0
165 165
					//FIXME: commented by SJ for TXMResult implementation
166 166
					//|| container.getSubHasResults().size() > 0
167 167
					)
......
185 185
	 */
186 186
	protected boolean deepSearch(TXMResult container)
187 187
	{
188
		boolean own = hasSymbol(container.getResults());
188
		boolean own = hasSymbol(container.getChildren());
189 189
		if (own)
190 190
		{
191 191
			return true;
......
193 193
		else // continue deeper
194 194
		{
195 195
			
196
			for(TXMResult children : container.getResults())
196
			for(TXMResult children : container.getChildren())
197 197
			{
198 198
				boolean childrencontainer = deepSearch(children);
199 199
				if (childrencontainer)
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 731)
500 500
						this.syncExec(new Runnable() {
501 501
							@Override
502 502
							public void run() {
503
								
504
								// FIXME: file persistence flush tests
505
								//TXMPreferences.flush(currentEditor.getResult());
506
								
507 503
								currentEditor.refresh(update);
508 504
							}
509 505
						});
......
518 514
					return Status.CANCEL_STATUS;
519 515
				}
520 516
				catch (Exception e) {
521
					System.out.println(e.getLocalizedMessage());
522 517
					Log.printStackTrace(e);
523 518
				}
524 519
				finally {
......
621 616
			//MD commented 'if (!update) {...}'
622 617
			// SJ need to check all works, it also was dedicated to not refresh the Editor from result after a computing, it's not needed since the computing has been done
623 618
			// from fields themselves
624
			//if (!update) {
619
			if (!update) {
625 620
				// FIXME: debug
626 621
				System.err.println("TXMEditor.refresh(): auto updating editor from result.");
627 622
				this.autoUpdateEditorFieldsFromResult(update); // auto update from Parameter annotations
628 623
	
629 624
				// FIXME: debug
630
				System.err.println("TXMEditor.refresh():  updating subclass editor from result.");
625
				System.err.println("TXMEditor.refresh(): updating subclass editor (" + getClass().getSimpleName() + ") from result.");
631 626
				this.updateEditorFromResult(update); // subclasses manual settings
632
			//}
627
			}
633 628
				
634 629
				// FIXME: became useless?
635 630
			//this.__updateEditorFromResult(update); // essentially for ChartEditor
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedQueryWidget.java (revision 731)
133 133
	 * @param query the new text
134 134
	 */
135 135
	public void setText(String query) {
136
		
137
//		if(query.isEmpty())	{
138
//			query = ""; //$NON-NLS-1$
139
//		}
140
		
136 141
		querywidget.setText(query);
137 142
	}
138 143

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryWidget.java (revision 731)
66 66
	 */
67 67
	public String getQueryString() {
68 68
		String rawQuery;
69
		if (getSelectionIndex() < 0)
69
		if (getSelectionIndex() < 0) {
70 70
			rawQuery = getText();
71
		else
71
		}
72
		else {
72 73
			rawQuery = this.getItem(this.getSelectionIndex());
74
		}
73 75
		return Query.fixQuery(rawQuery);
74 76
	}
75 77

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 731)
854 854
				// the folders to copy from TXM install dir
855 855
				String copyfolders[] = {"css", "scripts", "xsl", "samples", "scripts", "schema"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
856 856
				for (String folder : copyfolders) {
857
					File ffile = new File(TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.INSTALL_DIR), folder);
857
					File ffile = new File(TXMPreferences.getString(TBXPreferences.INSTALL_DIR, TBXPreferences.PREFERENCES_NODE), folder);
858 858
					if (!ffile.exists()) {
859 859
						System.out.println(NLS.bind(TXMUIMessages.ApplicationWorkbenchAdvisor_39, ffile));
860 860
						continue;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 731)
226 226
					}
227 227
				} else if (o instanceof Partition) {
228 228
					Partition p = (Partition)o;
229
					for (int i = 0 ; i < p.getResults().size() ; i++) {
230
						deleted.addAll(delete(p.getResults().get(i)));
229
					for (int i = 0 ; i < p.getChildren().size() ; i++) {
230
						deleted.addAll(delete(p.getChildren().get(i)));
231 231
						i--;
232 232
					}
233 233
					if (!((TxmObject) o).delete()) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/TXMResultContentProvider.java (revision 731)
104 104
		}
105 105

  
106 106
		if (element instanceof TXMResult) {
107
			return ((TXMResult)element).getResults().toArray();
107
			return ((TXMResult)element).getChildren().toArray();
108 108
		}
109 109
		return new Object[0];
110 110
	}
......
136 136
			//System.out.println("corpora view content: "+elements);
137 137
			return elements.toArray();
138 138
		} else if (element instanceof TXMResult) {
139
			return ((TXMResult)element).getResults().toArray();
139
			return ((TXMResult)element).getChildren().toArray();
140 140
		}
141 141
		return new Object[0];
142 142
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/TXMResultDebugView.java (revision 731)
124 124
		buffer.append("Selected object = " + this.currentResult + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
125 125
		buffer.append("Node visible = " + this.currentResult.isVisible() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
126 126
		if (this.currentResult instanceof ChartResult) 	{
127
			buffer.append("Chart object = " + ((ChartResult)this.currentResult).getChart() + ", chart type = " + ((ChartResult)this.currentResult).getChartType() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
127
			buffer.append("Chart engine = " + ((ChartResult)this.currentResult).getChartsEngine() + ", chart object = " + ((ChartResult)this.currentResult).getChart() + ", chart type = " + ((ChartResult)this.currentResult).getChartType() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
128 128
		}
129 129
		buffer.append("Selection full path name = " + this.currentResult.getFullPathSimpleName() + " - " + this.currentResult.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
130
		buffer.append("Direct children count = " + this.currentResult.getResults().size() + ", direct visible children count = " + this.currentResult.getChildren(true).size() + ", children count = " + this.currentResult.getDeepChildren().size() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
130
		buffer.append("Direct children count = " + this.currentResult.getChildren().size() + ", direct visible children count = " + this.currentResult.getChildren(true).size() + ", children count = " + this.currentResult.getDeepChildren().size() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
131 131
		buffer.append("Root parent = " + this.currentResult.getRootParent() + ", main corpus parent = " + Corpus.getParentMainCorpus(this.currentResult) + ", first parent corpus = " + Corpus.getFirstParentCorpus(this.currentResult)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
132 132
		
133 133
		displayArea.setText(buffer.toString());
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/RCPPreferences.java (revision 731)
54 54
	/** The Constant RIGHT_CONTEXT_SIZE_DEFAULT. */
55 55
	public static final int RIGHT_CONTEXT_SIZE_DEFAULT = 15;
56 56

  
57
	
57 58
	@Override
58 59
	public void initializeDefaultPreferences() {
59 60
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/AdvancePreferencePage.java (revision 731)
111 111
		addField(new BooleanFieldEditor(TBXPreferences.EXPERT_USER, TXMUIMessages.AdvancePreferencePage_4, getFieldEditorParent()));
112 112
		
113 113
		// Show all result nodes in Corpora view
114

  
115
		// Expert mode
116 114
		addField(new BooleanFieldEditor(TBXPreferences.SHOW_ALL_RESULT_NODES, "Show all result nodes in Corpora view", getFieldEditorParent()));
117 115

  
116
		// Auto save each result after computing
117
		addField(new BooleanFieldEditor(TBXPreferences.AUTO_SAVE_RESULTS, "Auto save results", getFieldEditorParent()));
118

  
118 119
	}
119 120

  
120 121
	/* (non-Javadoc)
tmp/org.txm.rcp/OSGI-INF/l10n/bundle.properties (revision 731)
40 40

  
41 41
command.label.101 = Chart...
42 42

  
43
command.label.102 = Send to concordances
44

  
45 43
command.label.103 = Send to progression
46 44

  
47 45
command.label.105 = Merge lines
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 731)
24 24

  
25 25
command.label.101 = Экспорт SVG
26 26

  
27
command.label.102 = Отправить в конкорданс
28

  
29 27
command.label.103 = Отправить на прогрессию
30 28

  
31 29
command.label.105 = Объединить строки
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 731)
40 40

  
41 41
command.label.101 = Graphique...
42 42

  
43
command.label.102 = Envoyer vers concordances
44

  
45 43
command.label.103 = Envoyer vers progression
46 44

  
47 45
command.label.104 = Supprimer la ligne
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_ru_utf-8.properties (revision 731)
55 55
command.tooltip.32=Показать издание корпуса
56 56
command.label.103=Отправить на прогрессию
57 57
command.tooltip.30=Импортирует корпус из папки, содержащей исходный материал в формате Alceste
58
command.label.102=Отправить в конкорданс
59 58
command.label.101=Экспорт SVG
60 59
command.tooltip.29=Импортирует корпус из папки, содержащей исходный материал в формате Hyperbase
61 60
command.tooltip.28=Импортирует корпус из папки, содержащей файл csv и файлы cnr
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 731)
111 111
	Cooccurrence cooc;
112 112

  
113 113

  
114
	/** The props area. */
115
	PropertiesSelector<Property> propsArea;
116

  
117 114
	/** The empant panel. */
118 115
	EmpantWidget empantPanel;
119 116

  
......
157 154
	@Parameter(key=CooccurrencePreferences.QUERY)
158 155
	AssistedQueryWidget queryWidget;
159 156

  
157
	/** The props area. */
158
	@Parameter(key=CooccurrencePreferences.PROPERTIES)
159
	PropertiesSelector<Property> propertiesSelector;
160

  
160 161
	
161 162
	
162 163
	
163
	
164
	
165 164
	/**
166 165
	 * Instantiates a new cooccurrences editor.
167 166
	 */
......
197 196
	 */
198 197
	@Override
199 198
	public void _createPartControl(final Composite parent) {
200
//		super.createPartControl(parent);
201
		// FIXME: to do
202
		// super.createPartControl(parent);
203 199

  
204 200
		// FormLayout parentLayout = new FormLayout();
205 201
		// parent.setLayout(parentLayout);
......
232 228
		// infos.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
233 229
		// true));
234 230

  
231
		
232
		// Computing listeners
233
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
234
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
235

  
236
		
235 237
		Composite queryArea = new Composite(paramArea, SWT.NONE);
236 238

  
237 239
		FormData queryLayoutData = new FormData();
......
252 254
		layoutData.horizontalAlignment = GridData.FILL;
253 255
		layoutData.grabExcessHorizontalSpace = true;
254 256
		queryWidget.setLayoutData(layoutData);
255
		queryWidget.addKeyListener(new ComputeKeyListener(this));
257
		queryWidget.addKeyListener(computeKeyListener);
256 258
		
257 259
//		final Button go = new Button(queryArea, SWT.BOLD);
258 260
//		go.setText(CooccurrenceUIMessages.CooccurrencesEditor_2);
......
296 298
		filtercontrols.setLayout(layout);
297 299

  
298 300
		// | Properties: word_pos [Edit] |
299
		propsArea = new PropertiesSelector<Property>(filtercontrols, SWT.NONE);
300
		propsArea.setLayout(new GridLayout(4, false));
301
		propsArea.setCorpus(this.getCorpus());
302
		propsArea.setText(CooccurrenceUIMessages.CooccurrencesEditor_3);
303
		propsArea.addValueChangeListener(new ComputeListener(this));
301
		propertiesSelector = new PropertiesSelector<Property>(filtercontrols, SWT.NONE);
302
		propertiesSelector.setLayout(new GridLayout(4, false));
303
		propertiesSelector.setCorpus(this.getCorpus());
304
		propertiesSelector.setText(CooccurrenceUIMessages.CooccurrencesEditor_3);
305
		//propertiesSelector.addValueChangeListener(new ComputeListener(this));
306
		propertiesSelector.addSelectionListener(computeSelectionListener);
307

  
304 308
		/*
305 309
		 * FormData propsLayoutData = new FormData(); propsLayoutData.top = new
306 310
		 * FormAttachment (queryArea, 0); propsLayoutData.left = new
......
323 327
		TFreq.setMaximum(99999);
324 328
		TFreq.setIncrement(1);
325 329
		TFreq.setPageIncrement(100);
326
		TFreq.addSelectionListener(new ComputeSelectionListener(this));
330
		TFreq.addSelectionListener(computeSelectionListener);
327 331

  
328 332
		seuilLabel = new Label(filtercontrols, SWT.NONE);
329 333
		seuilLabel.setText(CooccurrenceUIMessages.CooccurrencesEditor_5);
......
332 336
		TCount.setMaximum(99999);
333 337
		TCount.setIncrement(1);
334 338
		TCount.setPageIncrement(100);
335
		TCount.addSelectionListener(new ComputeSelectionListener(this));
339
		TCount.addSelectionListener(computeSelectionListener);
336 340

  
337 341
		seuilLabel = new Label(filtercontrols, SWT.NONE);
338 342
		seuilLabel.setText(CooccurrenceUIMessages.CooccurrencesEditor_6);
339 343
		TScore = new Text(filtercontrols, SWT.BORDER);
340 344
		TScore.addSelectionListener(new ComputeSelectionListener(this));
341
		TScore.addKeyListener(new ComputeKeyListener(this));
345
		TScore.addKeyListener(computeKeyListener);
342 346
		// empant
343 347
		empantPanel = new EmpantWidget(paramArea, SWT.NONE, this.getCorpus());
344 348

  
......
348 352
		empantLayoutData.left = new FormAttachment(0);
349 353
		empantLayoutData.right = new FormAttachment(100);
350 354
		empantPanel.setLayoutData(empantLayoutData);
351
		empantPanel.addSelectionListener(new ComputeSelectionListener(this));
352
		// result
355
		empantPanel.addSelectionListener(computeSelectionListener);
356
		
357
		
358
		// result area
353 359
		Composite resultArea = this.getResultArea();
354 360
		// FormData resultLayoutData = new FormData();
355 361
		// resultLayoutData.top = new FormAttachment(scrollComposite, 0);
......
493 499
		currentComparator = new ScoreComparator();
494 500
		setColComparator(new ScoreComparator(), scoreColumn);
495 501
		sort();
496
		createContextMenu(viewer);
497 502
		
503
		// Register the context menu
504
		TXMEditor.initContextMenu(this.viewer.getTable(), this.getSite(), this.viewer);
505

  
506
		
498 507
		initializeFields();
499 508

  
500 509
		for (TableColumn col : viewer.getTable().getColumns()) {
......
552 561
	public TXMParameters getWidgetsParameters() {
553 562

  
554 563
		TXMParameters parameters = new TXMParameters();
555
		parameters.put(CooccurrencePreferences.QUERY, this.queryWidget.getQueryString());
556
		parameters.put(CooccurrencePreferences.PROPERTIES, new ArrayList<Property>(this.propsArea.getSelectedProperties()));
564
		parameters.put(CooccurrencePreferences.PROPERTIES, new ArrayList<Property>(this.propertiesSelector.getSelectedProperties()));
557 565
		parameters.put(CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT, this.empantPanel.getStruct());
558 566
		parameters.put(CooccurrencePreferences.MAX_LEFT, this.empantPanel.getMaxLeft() + 1);
559 567
		parameters.put(CooccurrencePreferences.MIN_LEFT, this.empantPanel.getMinLeft() + 1);
......
577 585
		return parameters;
578 586
	}
579 587

  
580
	@Override
581
	public void updateEditorFromResult(boolean update) {
582

  
583
		String txt = "tp " + cooc.getNumberOfKeyword() + ", vc " + cooc.getNumberOfDifferentCooccurrents() + ", tc " + cooc.getNumberOfCooccurrents(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
584
		try {
585
			txt += ", T " + cooc.getCorpus().getSize();} //$NON-NLS-1$
586
		catch (Exception e) {
587
			System.out.println(CooccurrenceUIMessages.CooccurrencesEditor_25);
588
		}
589
		String tooltip = "- " + txt.replaceAll(", ", "\n- "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
590

  
591
		empantPanel.setInfo(txt, tooltip);
592

  
593
		viewer.setInput(cooc.getLines());
594
		sort();
595

  
596
		// Pack the columns
597
		TXMEditor.packColumns(viewer);
598

  
599
		// FIXME: need to be done in another way with after the plugin split
600
		QueriesView.refresh();
601
		RVariablesView.refresh();
602

  
603
		viewer.getTable().setFocus();
604
	}
605

  
606 588
	/**
607 589
	 * Updates the parameters area from values from parameters, local result
608 590
	 * node or preferences.
609 591
	 */
610 592
	protected void initializeFields() {
611
		queryWidget.setText(this.getStringParameterValue(CooccurrencePreferences.QUERY));
612 593

  
613 594
		if (this.cooc.getProperties() != null) {
614 595
			List<Property> available;
615 596
			try {
616 597
				available = new ArrayList<Property>(this.cooc.getCorpus().getProperties());
617 598
				available.removeAll(cooc.getProperties());
618
				this.propsArea.setProperties(available, cooc.getProperties());
599
				this.propertiesSelector.setProperties(available, cooc.getProperties());
619 600
			} catch (Exception e) {
620 601
				// TODO Auto-generated catch block
621 602
				org.txm.rcp.utils.Logger.printStackTrace(e);
......
656 637
			currentComparator.initialize(cooc.getCorpus());
657 638
	}
658 639

  
659
	/**
660
	 * Creates the context menu.
661
	 *
662
	 * @param tableViewer
663
	 *            the table viewer
664
	 */
665
	private void createContextMenu(TableViewer tableViewer) {
666 640

  
667
		MenuManager menuManager = new MenuManager();
668
		Menu menu = menuManager.createContextMenu(tableViewer.getTable());
669

  
670
		// Set the MenuManager
671
		tableViewer.getTable().setMenu(menu);
672
		getSite().registerContextMenu(menuManager, tableViewer);
673
		// Make the selection available
674
		getSite().setSelectionProvider(tableViewer);
675
	}
676

  
677 641
	/**
678 642
	 * Gets the corpus.
679 643
	 *
......
719 683
		}
720 684
	}
721 685

  
686

  
722 687
	@Override
688
	public void updateEditorFromResult(boolean update) {
689

  
690
		String txt = "tp " + cooc.getNumberOfKeyword() + ", vc " + cooc.getNumberOfDifferentCooccurrents() + ", tc " + cooc.getNumberOfCooccurrents(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
691
		try {
692
			txt += ", T " + cooc.getCorpus().getSize();} //$NON-NLS-1$
693
		catch (Exception e) {
694
			System.out.println(CooccurrenceUIMessages.CooccurrencesEditor_25);
695
		}
696
		String tooltip = "- " + txt.replaceAll(", ", "\n- "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
697

  
698
		empantPanel.setInfo(txt, tooltip);
699

  
700
		viewer.setInput(cooc.getLines());
701
		sort();
702

  
703
		// Pack the columns
704
		TXMEditor.packColumns(viewer);
705

  
706
		// FIXME: need to be done in another way after the plugin split
707
		QueriesView.refresh();
708
		RVariablesView.refresh();
709

  
710
		viewer.getTable().setFocus();
711
	}
712

  
713
	
714
	@Override
723 715
	public void updateResultFromEditor() {
724
		this.getParametersGroupsComposite().getDisplay().syncExec(new Runnable() {
725
			@Override
726
			public void run() {
727
				TXMParameters parameters = getWidgetsParameters();
728
				cooc.setParameters(parameters);
729
			}
730
		});
716
		TXMParameters parameters = getWidgetsParameters();
717
		cooc.setParameters(parameters);
731 718
	}
732 719
}
tmp/org.txm.cooccurrence.rcp/OSGI-INF/l10n/bundle.properties (revision 731)
1 1

  
2
command.label.102 = Send to concordances
3

  
2 4
command.name = Cooccurrences
3 5

  
4 6
command.tooltip = Cooccurrences
tmp/org.txm.cooccurrence.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 731)
1 1

  
2
command.label.102 = Отправить в конкорданс
3

  
2 4
command.name = Совместная встречаемость
3 5

  
4 6
command.tooltip = Совместная встречаемость
tmp/org.txm.cooccurrence.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 731)
1 1

  
2
command.label.102 = Envoyer vers concordances
3

  
2 4
command.name = Cooccurrences
3 5

  
4 6
command.tooltip = Calculer les cooccurrents d'une requête
tmp/org.txm.cooccurrence.rcp/plugin.xml (revision 731)
92 92
         </command>
93 93
      </menuContribution>
94 94
      <menuContribution
95
            locationURI="popup:CooccurrencesEditor">
95
            locationURI="popup:org.txm.cooccurrence.rcp.editors.CooccurrencesEditor">
96 96
         <command
97 97
               commandId="org.txm.rcp.commands.link.CooccurrencesToConcordances"
98 98
               label="%command.label.102"
tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/DoInstallStep.java (revision 731)
1
package org.txm.libs.cqp;
2

  
3
import org.txm.PostInstallationStep;
4

  
5
public class DoInstallStep extends PostInstallationStep {
6
	
7
	protected String name = "corg.txm.libs.cqp.DoInstallStep"; //$NON-NLS-1$
8

  
9
	public DoInstallStep() {
10
		name = "CQP";
11
	}
12
	
13
	@Override
14
	public void install() {	
15
		// nothing to do
16
	}
17
	
18
	@Override
19
	public void preInstall() {
20
		
21
//		String CQPFRAGMENT = "org.txm.libs.cqp."+System.getProperty("osgi.os");
22
//		//TODO: fix preferneces logic between org.txm.cqp.lib et org.txm.searchengine.cqp
23
//		Log.info("CQP.DoInstallStep.preInstall()");
24
//		String saved = TXMPreferences.getString(CQPLibPreferences.VERSION, CQPLibPreferences.PREFERENCES_NODE);
25
//		Version currentVersion = BundleUtils.getBundleVersion(CQPFRAGMENT); // the CQPFRAGMENT plugin contains the right version
26
//		
27
//		if (saved != null && saved.length() > 0) {
28
//			Version savedVersion = new Version(saved);
29
//			if (currentVersion.compareTo(savedVersion) <= 0) {
30
//				Log.info("No post-installation of CQP to do");
31
//				return; // nothing to do
32
//			}
33
//		}
34
//		Log.info("Updating CWB preferences for CQP version="+currentVersion);
35
//		
36
//		String os = "win";
37
//		String ext = "";
38
//		if (Util.isWindows()) { //$NON-NLS-1$
39
//			if (System.getProperty("os.arch").contains("64")) { os = "win64"; } 
40
//			else { os = "win32"; }
41
//			ext = ".exe";
42
//		} else if (Util.isMac()) { //$NON-NLS-1$
43
//			os = "macosx";
44
//		} else {
45
//			os = "linux32";
46
//			if (System.getProperty("os.arch").contains("64")) 
47
//				os = "linux64";
48
//		}
49
//
50
//		File bundleDir = BundleUtils.getBundleFile(CQPFRAGMENT);
51
//		if (bundleDir == null) {
52
//			System.out.println("Error while retrieving TreeTaggerInstaller bundle directory.");
53
//			return;
54
//		}
55
//		File cwbDir = new File(bundleDir, "res");
56
//		File initFile = new File(cwbDir, "cqpserver.init");
57
//		File OSDir = new File(cwbDir, os);
58
//		
59
//		int n;
60
//		try { // extract all gz files
61
//			n = Utils.unGzipFilesInDirectory(OSDir);
62
//
63
//			if (n == 0) {
64
//				System.out.println("Error while extracting CQP files: no file extracted.");
65
//				return;
66
//			}
67
//		} catch (IOException e1) {
68
//			System.out.println("Error while extracting CQP files: "+e1);
69
//			return;
70
//		}
71
//		
72
//		File execFile = new File(OSDir, "cqpserver"+ext);
73
//
74
//		TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB, OSDir.getAbsolutePath());
75
//		TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_INIT_FILE, initFile.getAbsolutePath());
76
//		TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.CQI_SERVER_PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
77
//		if (!Util.isWindows()) { 
78
//			try {
79
//				Log.info("Setting execution file rights to: "+OSDir.getAbsolutePath());
80
//				Runtime.getRuntime().exec("chmod -R +x "+OSDir.getAbsolutePath()).waitFor();
81
//			} catch (Exception e) {
82
//				System.out.println("Error while setting execution file rights to: "+OSDir.getAbsolutePath());
83
//				e.printStackTrace();
84
//				return;
85
//			}
86
//		}
87
//	
88
//		if (!execFile.exists()) {
89
//			System.out.println("Cannot find CQP executable file: "+execFile);
90
//			return;
91
//		}
92
//		
93
//		if (!execFile.canExecute()) {
94
//			System.out.println("File right setting error, cannot execute: "+execFile);
95
//			return;
96
//		}
97
//		
98
//		Log.warning("SearchEngine preferences set with: "+OSDir.getAbsolutePath()+ ", "+initFile.getAbsolutePath()+ " and "+execFile.getAbsolutePath());
99
//		TXMPreferences.put(CQPLibPreferences.PREFERENCES_NODE, CQPLibPreferences.VERSION, currentVersion.toString());
100
	}
101
}
tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/___DoInstallStep.java (revision 731)
1
package org.txm.libs.cqp;
2

  
3
import org.txm.PostInstallationStep;
4

  
5
public class ___DoInstallStep extends PostInstallationStep {
6
	
7
	protected String name = "corg.txm.libs.cqp.DoInstallStep"; //$NON-NLS-1$
8

  
9
	public ___DoInstallStep() {
10
		name = "CQP";
11
	}
12
	
13
	@Override
14
	public void install() {	
15
		// nothing to do
16
	}
17
	
18
	@Override
19
	public void preInstall() {
20
		
21
//		String CQPFRAGMENT = "org.txm.libs.cqp."+System.getProperty("osgi.os");
22
//		//TODO: fix preferneces logic between org.txm.cqp.lib et org.txm.searchengine.cqp
23
//		Log.info("CQP.DoInstallStep.preInstall()");
24
//		String saved = TXMPreferences.getString(CQPLibPreferences.VERSION, CQPLibPreferences.PREFERENCES_NODE);
25
//		Version currentVersion = BundleUtils.getBundleVersion(CQPFRAGMENT); // the CQPFRAGMENT plugin contains the right version
26
//		
27
//		if (saved != null && saved.length() > 0) {
28
//			Version savedVersion = new Version(saved);
29
//			if (currentVersion.compareTo(savedVersion) <= 0) {
30
//				Log.info("No post-installation of CQP to do");
31
//				return; // nothing to do
32
//			}
33
//		}
34
//		Log.info("Updating CWB preferences for CQP version="+currentVersion);
35
//		
36
//		String os = "win";
37
//		String ext = "";
38
//		if (Util.isWindows()) { //$NON-NLS-1$
39
//			if (System.getProperty("os.arch").contains("64")) { os = "win64"; } 
40
//			else { os = "win32"; }
41
//			ext = ".exe";
42
//		} else if (Util.isMac()) { //$NON-NLS-1$
43
//			os = "macosx";
44
//		} else {
45
//			os = "linux32";
46
//			if (System.getProperty("os.arch").contains("64")) 
47
//				os = "linux64";
48
//		}
49
//
50
//		File bundleDir = BundleUtils.getBundleFile(CQPFRAGMENT);
51
//		if (bundleDir == null) {
52
//			System.out.println("Error while retrieving TreeTaggerInstaller bundle directory.");
53
//			return;
54
//		}
55
//		File cwbDir = new File(bundleDir, "res");
56
//		File initFile = new File(cwbDir, "cqpserver.init");
57
//		File OSDir = new File(cwbDir, os);
58
//		
59
//		int n;
60
//		try { // extract all gz files
61
//			n = Utils.unGzipFilesInDirectory(OSDir);
62
//
63
//			if (n == 0) {
64
//				System.out.println("Error while extracting CQP files: no file extracted.");
65
//				return;
66
//			}
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff