Révision 783
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngines.java (revision 783) | ||
---|---|---|
1 |
package org.txm.searchengine.core; |
|
2 |
|
|
3 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
4 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
5 |
import org.eclipse.core.runtime.Platform; |
|
6 |
import org.txm.Engine; |
|
7 |
import org.txm.EngineType; |
|
8 |
import org.txm.EnginesManager; |
|
9 |
import org.txm.Toolbox; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author mdecorde |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class SearchEngines extends EnginesManager<SearchEngine> { |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @return |
|
21 |
*/ |
|
22 |
public static SearchEngine getCQPEngine() { |
|
23 |
return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP"); |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* |
|
28 |
* @return |
|
29 |
*/ |
|
30 |
public static SearchEngine getTIGERSearchEngine() { |
|
31 |
return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("TIGERSearch"); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
protected boolean fetchEngines() { |
|
36 |
|
|
37 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(SearchEngine.EXTENSION_POINT_ID); |
|
38 |
//System.out.println("search engine contributions: "+SearchEngine.EXTENSION_POINT_ID); |
|
39 |
for (int i = 0; i < contributions.length; i++) { |
|
40 |
try { |
|
41 |
SearchEngine e = (SearchEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
42 |
if (e.initialize()) { |
|
43 |
engines.put(e.getName(), e); |
|
44 |
} |
|
45 |
else { |
|
46 |
System.out.println("Fail to initialize " + e.getName() + " search engine."); |
|
47 |
} |
|
48 |
} catch(Exception e) { |
|
49 |
System.err.println("Error: fail to instanciate " + contributions[i].getName() + ": " + e.getLocalizedMessage()); |
|
50 |
e.printStackTrace(); |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
return engines.size() > 0; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public EngineType getEnginesType() { |
|
59 |
return EngineType.SEARCH; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public boolean startEngines(IProgressMonitor monitor) { |
|
64 |
|
|
65 |
for (Engine e : engines.values()) { |
|
66 |
SearchEngine se = (SearchEngine)e; |
|
67 |
//System.out.println("Starting "+ se.getName()+" searchengine."); |
|
68 |
if (monitor != null) { |
|
69 |
monitor.subTask("Starting " + se.getName() + " searchengine."); |
|
70 |
} |
|
71 |
try { |
|
72 |
se.start(monitor); |
|
73 |
} catch (Exception e2) { |
|
74 |
System.err.println("Error: fail to start SearchEngine: " + se.getName() + ": " + e2.getLocalizedMessage()); |
|
75 |
e2.printStackTrace(); |
|
76 |
} |
|
77 |
} |
|
78 |
return true; |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
public boolean stopEngines() { |
|
83 |
|
|
84 |
for (Engine e : engines.values()) { |
|
85 |
|
|
86 |
SearchEngine se = (SearchEngine)e; |
|
87 |
System.out.println("Stopping "+ se.getName()+" searchengine."); |
|
88 |
try { |
|
89 |
se.stop(); |
|
90 |
} catch (Exception e2) { |
|
91 |
System.err.println("Error: fail to stop SearchEngine: " + se.getName() + ": " + e2.getLocalizedMessage()); |
|
92 |
e2.printStackTrace(); |
|
93 |
} |
|
94 |
} |
|
95 |
return true; |
|
96 |
} |
|
97 |
} |
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java (revision 783) | ||
---|---|---|
1 |
package org.txm.searchengine.core; |
|
2 |
|
|
3 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
4 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
5 |
import org.eclipse.core.runtime.Platform; |
|
6 |
import org.txm.Engine; |
|
7 |
import org.txm.EngineType; |
|
8 |
import org.txm.EnginesManager; |
|
9 |
import org.txm.Toolbox; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author mdecorde |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class SearchEnginesManager extends EnginesManager<SearchEngine> { |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @return |
|
21 |
*/ |
|
22 |
public static SearchEngine getCQPEngine() { |
|
23 |
return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP"); |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* |
|
28 |
* @return |
|
29 |
*/ |
|
30 |
public static SearchEngine getTIGERSearchEngine() { |
|
31 |
return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("TIGERSearch"); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
protected boolean fetchEngines() { |
|
36 |
|
|
37 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(SearchEngine.EXTENSION_POINT_ID); |
|
38 |
//System.out.println("search engine contributions: "+SearchEngine.EXTENSION_POINT_ID); |
|
39 |
for (int i = 0; i < contributions.length; i++) { |
|
40 |
try { |
|
41 |
SearchEngine e = (SearchEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
42 |
|
|
43 |
System.out.println("Initializing engine: " + e); |
|
44 |
|
|
45 |
if (e.initialize()) { |
|
46 |
engines.put(e.getName(), e); |
|
47 |
} |
|
48 |
else { |
|
49 |
System.err.println("Failed to initialize " + e.getName() + " search engine."); |
|
50 |
} |
|
51 |
} catch(Exception e) { |
|
52 |
System.err.println("Error: failed to instantiate " + contributions[i].getName() + ": " + e.getLocalizedMessage()); |
|
53 |
e.printStackTrace(); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
return engines.size() > 0; |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public EngineType getEnginesType() { |
|
62 |
return EngineType.SEARCH; |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public boolean startEngines(IProgressMonitor monitor) { |
|
67 |
|
|
68 |
for (Engine e : engines.values()) { |
|
69 |
SearchEngine se = (SearchEngine)e; |
|
70 |
//System.out.println("Starting "+ se.getName()+" searchengine."); |
|
71 |
if (monitor != null) { |
|
72 |
monitor.subTask("Starting " + se.getName() + " searchengine."); |
|
73 |
} |
|
74 |
try { |
|
75 |
se.start(monitor); |
|
76 |
} catch (Exception e2) { |
|
77 |
System.err.println("Error: failed to start SearchEngine: " + se.getName() + ": " + e2.getLocalizedMessage()); |
|
78 |
e2.printStackTrace(); |
|
79 |
} |
|
80 |
} |
|
81 |
return true; |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public boolean stopEngines() { |
|
86 |
|
|
87 |
for (Engine e : engines.values()) { |
|
88 |
|
|
89 |
SearchEngine se = (SearchEngine)e; |
|
90 |
System.out.println("Stopping "+ se.getName()+" searchengine."); |
|
91 |
try { |
|
92 |
se.stop(); |
|
93 |
} catch (Exception e2) { |
|
94 |
System.err.println("Error: failed to stop SearchEngine: " + se.getName() + ": " + e2.getLocalizedMessage()); |
|
95 |
e2.printStackTrace(); |
|
96 |
} |
|
97 |
} |
|
98 |
return true; |
|
99 |
} |
|
100 |
} |
|
0 | 101 |
tmp/org.txm.searchengine.core/plugin.xml (revision 783) | ||
---|---|---|
5 | 5 |
<extension |
6 | 6 |
point="org.txm.EnginesManager"> |
7 | 7 |
<EngineManager |
8 |
class="org.txm.searchengine.core.SearchEngines" |
|
8 |
class="org.txm.searchengine.core.SearchEnginesManager"
|
|
9 | 9 |
description="Manage the search engines" |
10 | 10 |
name="org.txm.searchengine.core.SearchEngines"> |
11 | 11 |
</EngineManager> |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 783) | ||
---|---|---|
180 | 180 |
|
181 | 181 |
try { |
182 | 182 |
// Query: |
183 |
getMinimalParametersComposite().getLayout().numColumns = 2;
|
|
183 |
getMainParametersComposite().getLayout().numColumns = 2;
|
|
184 | 184 |
// make |
185 |
getMinimalParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
185 |
getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
186 | 186 |
|
187 |
Label queryLabel = new Label(getMinimalParametersComposite(), SWT.NONE);
|
|
187 |
Label queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
|
|
188 | 188 |
queryLabel.setText("Add query"); |
189 | 189 |
queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
190 | 190 |
|
191 | 191 |
// [ (v)] |
192 | 192 |
// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN); |
193 |
queryWidget = new AssistedQueryWidget(getMinimalParametersComposite(), SWT.DROP_DOWN, getResult().getCorpus());
|
|
193 |
queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, getResult().getCorpus());
|
|
194 | 194 |
queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
195 | 195 |
queryWidget.addKeyListener(new ComputeKeyListener(this) { |
196 | 196 |
@Override |
... | ... | |
204 | 204 |
}); |
205 | 205 |
|
206 | 206 |
// System.out.println(parent.getLayout()); |
207 |
Composite mainPanel = this.getCommandParametersGroup();
|
|
207 |
Composite mainPanel = this.getExtendedParametersComposite();
|
|
208 | 208 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true); |
209 | 209 |
mainPanel.setLayoutData(gridData); |
210 | 210 |
GridLayout glayout = new GridLayout(2, false); |
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 783) | ||
---|---|---|
349 | 349 |
@Override |
350 | 350 |
public void _createPartControl(Composite parent) { |
351 | 351 |
|
352 |
Composite controlArea = getCommandParametersGroup();
|
|
352 |
Composite controlArea = getExtendedParametersComposite();
|
|
353 | 353 |
|
354 | 354 |
try { |
355 | 355 |
composeControlArea(controlArea); |
... | ... | |
954 | 954 |
// | Query: [ (v)] [Search] | |
955 | 955 |
|
956 | 956 |
// Query: |
957 |
getMinimalParametersComposite().getLayout().numColumns = 2;
|
|
957 |
getMainParametersComposite().getLayout().numColumns = 2;
|
|
958 | 958 |
// make |
959 |
getMinimalParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
959 |
getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
960 | 960 |
|
961 |
queryLabel = new Label(getMinimalParametersComposite(), SWT.NONE);
|
|
961 |
queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
|
|
962 | 962 |
queryLabel.setText(TXMUIMessages.CreateSubcorpusDialog_10); |
963 | 963 |
queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); |
964 | 964 |
|
965 | 965 |
// [ (v)] |
966 | 966 |
// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN); |
967 |
queryWidget = new AssistedQueryWidget(getMinimalParametersComposite(), SWT.DROP_DOWN, concordance.getCorpus());
|
|
967 |
queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, concordance.getCorpus());
|
|
968 | 968 |
queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
969 | 969 |
queryWidget.addKeyListener(new ComputeKeyListener(this)); |
970 | 970 |
|
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 783) | ||
---|---|---|
102 | 102 |
|
103 | 103 |
try { |
104 | 104 |
|
105 |
// Main parameters |
|
106 |
GLComposite mainParametersArea = this.getMainParametersComposite(); |
|
107 |
mainParametersArea.getLayout().numColumns = 2; |
|
105 | 108 |
|
106 | 109 |
// unit property |
107 |
GLComposite minimalParametersArea = this.getMinimalParametersComposite(); |
|
108 |
minimalParametersArea.getLayout().numColumns = 2; |
|
109 |
|
|
110 |
new Label(minimalParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property); |
|
111 |
this.unitPropertyComboViewer = new PropertiesComboViewer(minimalParametersArea, this, true, |
|
110 |
new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property); |
|
111 |
this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true, |
|
112 | 112 |
Corpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(), |
113 | 113 |
this.getResult().getUnitProperty(), true); |
114 | 114 |
|
115 | 115 |
|
116 |
// Extended parameters |
|
117 |
Composite extendedParametersArea = this.getExtendedParametersComposite(); |
|
118 |
|
|
116 | 119 |
// max score |
117 |
Composite parametersArea = this.getCommandParametersGroup(); |
|
118 |
new Label(parametersArea, SWT.NONE).setText("Maximum score"); |
|
119 |
this.maxScore = new Spinner(parametersArea, SWT.BORDER); |
|
120 |
new Label(extendedParametersArea, SWT.NONE).setText("Maximum score"); |
|
121 |
this.maxScore = new Spinner(extendedParametersArea, SWT.BORDER); |
|
120 | 122 |
this.maxScore.setToolTipText("The maximum score to display"); |
121 | 123 |
this.maxScore.setMinimum(0); |
122 | 124 |
|
... | ... | |
156 | 158 |
specificitesTable = viewer.getTable(); |
157 | 159 |
specificitesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2)); |
158 | 160 |
|
159 |
// create 1st column |
|
161 |
// create 1st column: Unit
|
|
160 | 162 |
TableColumn typeNameColumn = new TableColumn(specificitesTable, SWT.NONE); |
161 | 163 |
typeNameColumn.setText(TXMCoreMessages.common_units); |
162 | 164 |
typeNameColumn.setToolTipText(TXMCoreMessages.common_units); |
... | ... | |
166 | 168 |
viewerComparator.addSelectionAdapter(viewer, typeNameColumn, 0); |
167 | 169 |
|
168 | 170 |
|
169 |
// create 2nd column |
|
171 |
// create 2nd column: Frequency
|
|
170 | 172 |
this.typeFrequencyColumn = new TableColumn(viewer.getTable(), SWT.NONE); |
173 |
this.typeFrequencyColumn.setAlignment(SWT.RIGHT); |
|
174 |
this.typeFrequencyColumn.setText(TXMCoreMessages.common_frequency); |
|
175 |
|
|
171 | 176 |
viewerComparator.addSelectionAdapter(viewer, typeFrequencyColumn, 1); |
172 | 177 |
|
173 | 178 |
|
174 |
// add a separator column |
|
179 |
// add a separator empty column
|
|
175 | 180 |
TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE); |
176 | 181 |
separatorColumn.setResizable(false); |
177 | 182 |
|
... | ... | |
205 | 210 |
@Override |
206 | 211 |
public void updateEditorFromResult(boolean update) { |
207 | 212 |
try { |
213 |
|
|
214 |
|
|
208 | 215 |
if(!update) { |
209 |
typeFrequencyColumn.setText(TXMCoreMessages.common_frequency + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); //$NON-NLS-1$ //$NON-NLS-2$ |
|
210 |
typeFrequencyColumn.setToolTipText(typeFrequencyColumn.getText()); |
|
211 |
typeFrequencyColumn.setAlignment(SWT.RIGHT); |
|
212 |
typeFrequencyColumn.pack(); |
|
213 |
|
|
214 | 216 |
String[] partNames = null; |
215 | 217 |
int[] partSize = null; |
216 | 218 |
try { |
217 | 219 |
partNames = this.getResult().getPartShortNames(); |
218 | 220 |
partSize = this.getResult().getPartSizes(); |
219 |
} catch (StatException e) {
|
|
221 |
} catch (Exception e) { |
|
220 | 222 |
System.err.println(NLS.bind(RCoreMessages.error_unexpectedErrorInRStatisticsEngine, e)); |
221 | 223 |
Log.printStackTrace(e); |
222 | 224 |
return; |
223 | 225 |
} |
226 |
|
|
224 | 227 |
// System.out.println("partnames: "+Arrays.toString(partNames)); |
225 | 228 |
for (int i = 0, columnIndex = 2; i < partNames.length ; i++) { // for each part |
226 | 229 |
|
... | ... | |
248 | 251 |
} |
249 | 252 |
|
250 | 253 |
|
251 |
// units |
|
252 |
String[] typeNames = this.getResult().getTypeNames(); |
|
253 |
// units' total freq |
|
254 |
int[] typeFreq = this.getResult().getFormFrequencies(); |
|
255 |
// units' index fr each part |
|
256 |
double[][] specIndex = this.getResult().getSpecificitesIndex(); |
|
257 |
int[][] specFreqs = this.getResult().getFrequency(); |
|
254 |
|
|
258 | 255 |
|
259 |
// units' total in parts |
|
260 |
//final int[] sortedPartIndexes = specificitesResult.getSortedPartIndexes(); |
|
256 |
if(this.getResult().canCompute()) { |
|
257 |
|
|
258 |
typeFrequencyColumn.setText(TXMCoreMessages.common_frequency + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); //$NON-NLS-1$ //$NON-NLS-2$ |
|
259 |
typeFrequencyColumn.setToolTipText(typeFrequencyColumn.getText()); |
|
260 |
typeFrequencyColumn.pack(); |
|
261 | 261 |
|
262 |
// Create an array of lines to fill the tables |
|
263 |
// System.out.println("len types: "+typeNames.length); |
|
264 |
// System.out.println("len freq: "+typeFreq.length); |
|
265 |
// System.out.println("len spec: "+specFreqs.length); |
|
266 |
// System.out.println("len specidx: "+specIndex.length); |
|
267 |
Object[] tableLines = new Object[typeNames.length]; |
|
268 |
for (int j = 0; j < tableLines.length; j++) { |
|
269 |
tableLines[j] = new Object[] { typeNames[j], new Integer(typeFreq[j]), specFreqs[j], specIndex[j] }; |
|
262 |
// units |
|
263 |
String[] typeNames = this.getResult().getTypeNames(); |
|
264 |
// units' total freq |
|
265 |
int[] typeFreq = this.getResult().getFormFrequencies(); |
|
266 |
// units' index fr each part |
|
267 |
double[][] specIndex = this.getResult().getSpecificitesIndex(); |
|
268 |
int[][] specFreqs = this.getResult().getFrequency(); |
|
269 |
|
|
270 |
// units' total in parts |
|
271 |
//final int[] sortedPartIndexes = specificitesResult.getSortedPartIndexes(); |
|
272 |
|
|
273 |
// Create an array of lines to fill the tables |
|
274 |
// System.out.println("len types: "+typeNames.length); |
|
275 |
// System.out.println("len freq: "+typeFreq.length); |
|
276 |
// System.out.println("len spec: "+specFreqs.length); |
|
277 |
// System.out.println("len specidx: "+specIndex.length); |
|
278 |
Object[] tableLines = new Object[typeNames.length]; |
|
279 |
for (int j = 0; j < tableLines.length; j++) { |
|
280 |
tableLines[j] = new Object[] { typeNames[j], new Integer(typeFreq[j]), specFreqs[j], specIndex[j] }; |
|
281 |
} |
|
282 |
viewer.setInput(tableLines); |
|
270 | 283 |
} |
271 |
viewer.setInput(tableLines); |
|
272 | 284 |
|
273 | 285 |
// Pack the columns so the label of the sort column is not truncated due of the sorting order arrow display |
274 | 286 |
TXMEditor.packColumns(viewer); |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 783) | ||
---|---|---|
47 | 47 |
|
48 | 48 |
|
49 | 49 |
// Banality |
50 |
Label label = new Label(this.getCommandParametersGroup(), SWT.NONE);
|
|
50 |
Label label = new Label(this.getExtendedParametersComposite(), SWT.NONE);
|
|
51 | 51 |
label.setText("Banality:"); |
52 | 52 |
|
53 |
banality = new FloatSpinner(this.getCommandParametersGroup(), SWT.BORDER);
|
|
53 |
banality = new FloatSpinner(this.getExtendedParametersComposite(), SWT.BORDER);
|
|
54 | 54 |
banality.setToolTipText("Banality threshold"); |
55 | 55 |
banality.setMaximumAsFloat(2); |
56 | 56 |
banality.addSelectionListener(new ComputeSelectionListener(this)); |
tmp/org.txm.information.rcp/src/org/txm/information/rcp/editors/InformationEditor.java (revision 783) | ||
---|---|---|
44 | 44 |
@Override |
45 | 45 |
public void _createPartControl(Composite parent) { |
46 | 46 |
|
47 |
Composite parametersArea = this.getCommandParametersGroup();
|
|
47 |
Composite parametersArea = this.getExtendedParametersComposite();
|
|
48 | 48 |
|
49 | 49 |
// label |
50 | 50 |
new Label(parametersArea, SWT.NONE).setText("V max"); |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 783) | ||
---|---|---|
140 | 140 |
@Override |
141 | 141 |
protected boolean _compute() throws Exception { |
142 | 142 |
try { |
143 |
// clear cache |
|
144 |
this.colnames = null; |
|
145 |
this.coltitles = null; |
|
146 |
this.coltabledata = null; |
|
147 |
this.rownames = null; |
|
148 |
this.rowtitles = null; |
|
149 |
this.rowtabledata = null; |
|
150 |
|
|
151 |
|
|
143 | 152 |
if (this.useFactoMineR) { |
144 | 153 |
this.r_ca = new FactoMineRCA(this.getLexicalTable().getData()); |
145 | 154 |
} |
... | ... | |
149 | 158 |
|
150 | 159 |
this.r_ca.compute(); |
151 | 160 |
|
152 |
// in case the lexical table changes |
|
153 |
this.getColNames(); |
|
154 |
// in case the lexical table changes |
|
155 |
this.getRowNames(); |
|
156 |
|
|
157 | 161 |
return true; |
158 | 162 |
} catch(Exception e) { |
159 |
System.out.println("Error: CA not computed: "+e);
|
|
163 |
Log.severe("Failed to compute CA.");
|
|
160 | 164 |
Log.printStackTrace(e); |
161 | 165 |
return false; |
162 | 166 |
} |
... | ... | |
687 | 691 |
|
688 | 692 |
@Override |
689 | 693 |
public String getSimpleName() { |
690 |
return getParent().getSimpleName() + " (" + this.firstDimension + "," + this.secondDimension + ")"; |
|
694 |
return this.getParent().getSimpleName() + " (" + this.firstDimension + "," + this.secondDimension + ")";
|
|
691 | 695 |
} |
692 | 696 |
|
693 | 697 |
@Override |
... | ... | |
697 | 701 |
|
698 | 702 |
@Override |
699 | 703 |
public String getName() { |
700 |
return this.getParent().getSimpleName() + ": " + this.getSimpleName();
|
|
704 |
return this.getSimpleName(); |
|
701 | 705 |
} |
702 | 706 |
|
703 | 707 |
|
704 |
|
|
705 | 708 |
/** |
706 | 709 |
* Get the singular values as array. |
707 | 710 |
* |
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 783) | ||
---|---|---|
45 | 45 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
46 | 46 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
47 | 47 |
import org.txm.searchengine.cqp.corpus.Corpus; |
48 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
48 | 49 |
import org.txm.searchengine.cqp.corpus.Property; |
49 | 50 |
import org.txm.specificities.core.messages.SpecificitiesCoreMessages; |
50 | 51 |
import org.txm.specificities.core.preferences.SpecificitiesPreferences; |
... | ... | |
185 | 186 |
@Override |
186 | 187 |
protected boolean _compute() throws Exception { |
187 | 188 |
|
188 |
|
|
189 | 189 |
// recompute the lexical table |
190 | 190 |
if(this.hasParameterChanged(SpecificitiesPreferences.UNIT_PROPERTY)) { |
191 | 191 |
this.lexicalTable.setUnitProperty(this.unitProperty); |
192 |
this.lexicalTable.compute(); |
|
192 |
this.lexicalTable.compute(this, false);
|
|
193 | 193 |
} |
194 | 194 |
|
195 |
SpecificitiesR rSpecificities = new SpecificitiesR(this.lexicalTable.getData()); |
|
196 |
double[][] specIndex = rSpecificities.getScores(); |
|
197 |
|
|
195 |
// essentially for cascade computing from the parent lexical table |
|
196 |
this.unitProperty = this.lexicalTable.getProperty(); |
|
198 | 197 |
|
199 |
if (lexicalTable.getPartition() != null) { |
|
200 |
init(symbol, specIndex, this.unitProperty.getName()); |
|
198 |
if(this.lexicalTable.hasBeenComputedOnce()) { |
|
199 |
SpecificitiesR rSpecificities = new SpecificitiesR(this.lexicalTable.getData()); |
|
200 |
double[][] specIndex = rSpecificities.getScores(); |
|
201 |
|
|
202 |
|
|
203 |
if (this.lexicalTable.getPartition() != null) { |
|
204 |
init(symbol, specIndex, this.unitProperty.getName()); |
|
205 |
} |
|
206 |
else { |
|
207 |
init(rSpecificities.getSymbol(), specIndex, "TLNONAME: " + this.unitProperty.getName()); //$NON-NLS-1$ |
|
208 |
} |
|
201 | 209 |
} |
202 |
else { |
|
203 |
init(rSpecificities.getSymbol(), specIndex, "TLNONAME: " + this.unitProperty.getName()); //$NON-NLS-1$ |
|
204 |
} |
|
205 | 210 |
return true; |
206 | 211 |
} |
207 | 212 |
|
... | ... | |
378 | 383 |
* partShortNames.length; i++) { partShortNames[i] = |
379 | 384 |
* parts.get(i).getShortName(); } |
380 | 385 |
*/ |
381 |
return lexicalTable.getColNames().asStringsArray(); |
|
386 |
try { |
|
387 |
return lexicalTable.getColNames().asStringsArray(); |
|
388 |
} |
|
389 |
catch (Exception e) { |
|
390 |
return ((Partition)this.lexicalTable.getParent()).getPartShortNames().toArray(new String[0]); |
|
391 |
} |
|
382 | 392 |
} else if (this.subCorpus != null) { |
383 | 393 |
return new String[] { this.subCorpus.getName(), this.corpus.getName() + " \\ " + this.subCorpus.getName() }; //$NON-NLS-1$ |
384 | 394 |
} |
... | ... | |
448 | 458 |
* |
449 | 459 |
* @return the part size |
450 | 460 |
* @throws StatException the stat exception |
461 |
* @throws CqiClientException |
|
451 | 462 |
*/ |
452 |
public int[] getPartSizes() throws StatException { |
|
463 |
public int[] getPartSizes() throws StatException, CqiClientException {
|
|
453 | 464 |
if (lexicalTable != null) { |
454 |
Vector partsize = lexicalTable.getColMarginsVector(); |
|
455 |
if (colindex != null) { |
|
456 |
partsize = partsize.get(colindex); |
|
465 |
|
|
466 |
try { |
|
467 |
Vector partsize = lexicalTable.getColMarginsVector(); |
|
468 |
if (colindex != null) { |
|
469 |
partsize = partsize.get(colindex); |
|
470 |
} |
|
471 |
return partsize.asIntArray(); |
|
457 | 472 |
} |
458 |
return partsize.asIntArray(); |
|
473 |
catch (Exception e) { |
|
474 |
return ((Partition)this.lexicalTable.getParent()).getPartSizes(); |
|
475 |
} |
|
476 |
|
|
477 |
|
|
459 | 478 |
} else { |
460 | 479 |
return new int[] { subLexicon.nbrOfToken(), |
461 | 480 |
lexicon.nbrOfToken() - subLexicon.nbrOfToken() }; |
... | ... | |
608 | 627 |
// } else { |
609 | 628 |
// setPartName(specificitiesResult.getName()); |
610 | 629 |
// } |
611 |
return name; |
|
630 |
// FIXME: to define |
|
631 |
if(name != null) { |
|
632 |
return name; |
|
633 |
} |
|
634 |
else { |
|
635 |
return this.getEmptyName(); |
|
636 |
} |
|
637 |
|
|
638 |
|
|
612 | 639 |
} |
613 | 640 |
|
614 | 641 |
|
... | ... | |
629 | 656 |
public boolean canCompute() { |
630 | 657 |
|
631 | 658 |
if (this.lexicalTable == null) { |
632 |
Log.severe("Specificities.canCompute(): Can not compute without a lexical table.");
|
|
659 |
Log.severe("Specificities.canCompute(): can not compute without a lexical table.");
|
|
633 | 660 |
return false; |
634 | 661 |
} |
662 |
else if(this.unitProperty == null) { |
|
663 |
Log.severe("Specificities.canCompute(): can not compute with no unit property."); //$NON-NLS-1$ |
|
664 |
return false; |
|
665 |
} |
|
635 | 666 |
|
636 | 667 |
// if (this.lexicalTable.getNColumns() < 2) { |
637 | 668 |
// Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS); |
tmp/org.txm.statsengine.core/schema/org.txm.statengine.exsd (revision 783) | ||
---|---|---|
1 |
<?xml version='1.0' encoding='UTF-8'?> |
|
2 |
<!-- Schema file written by PDE --> |
|
3 |
<schema targetNamespace="org.txm.statsengine.core" xmlns="http://www.w3.org/2001/XMLSchema"> |
|
4 |
<annotation> |
|
5 |
<appinfo> |
|
6 |
<meta.schema plugin="org.txm.statsengine.core" id="org.txm.statsengine.core.StatEngine" name="Stat Engine"/> |
|
7 |
</appinfo> |
|
8 |
<documentation> |
|
9 |
A stat engine allow to call statistical R methods |
|
10 |
</documentation> |
|
11 |
</annotation> |
|
12 |
|
|
13 |
<element name="extension"> |
|
14 |
<annotation> |
|
15 |
<appinfo> |
|
16 |
<meta.element /> |
|
17 |
</appinfo> |
|
18 |
</annotation> |
|
19 |
<complexType> |
|
20 |
<choice minOccurs="1" maxOccurs="unbounded"> |
|
21 |
<element ref="StatEngine"/> |
|
22 |
</choice> |
|
23 |
<attribute name="point" type="string" use="required"> |
|
24 |
<annotation> |
|
25 |
<documentation> |
|
26 |
|
|
27 |
</documentation> |
|
28 |
</annotation> |
|
29 |
</attribute> |
|
30 |
<attribute name="id" type="string"> |
|
31 |
<annotation> |
|
32 |
<documentation> |
|
33 |
|
|
34 |
</documentation> |
|
35 |
</annotation> |
|
36 |
</attribute> |
|
37 |
<attribute name="name" type="string"> |
|
38 |
<annotation> |
|
39 |
<documentation> |
|
40 |
|
|
41 |
</documentation> |
|
42 |
<appinfo> |
|
43 |
<meta.attribute translatable="true"/> |
|
44 |
</appinfo> |
|
45 |
</annotation> |
|
46 |
</attribute> |
|
47 |
</complexType> |
|
48 |
</element> |
|
49 |
|
|
50 |
<element name="StatEngine"> |
|
51 |
<complexType> |
|
52 |
<attribute name="class" type="string"> |
|
53 |
<annotation> |
|
54 |
<documentation> |
|
55 |
|
|
56 |
</documentation> |
|
57 |
<appinfo> |
|
58 |
<meta.attribute kind="java" basedOn="org.txm.statsengine.core.StatEngine:"/> |
|
59 |
</appinfo> |
|
60 |
</annotation> |
|
61 |
</attribute> |
|
62 |
</complexType> |
|
63 |
</element> |
|
64 |
|
|
65 |
<annotation> |
|
66 |
<appinfo> |
|
67 |
<meta.section type="since"/> |
|
68 |
</appinfo> |
|
69 |
<documentation> |
|
70 |
[Enter the first release in which this extension point appears.] |
|
71 |
</documentation> |
|
72 |
</annotation> |
|
73 |
|
|
74 |
<annotation> |
|
75 |
<appinfo> |
|
76 |
<meta.section type="examples"/> |
|
77 |
</appinfo> |
|
78 |
<documentation> |
|
79 |
[Enter extension point usage example here.] |
|
80 |
</documentation> |
|
81 |
</annotation> |
|
82 |
|
|
83 |
<annotation> |
|
84 |
<appinfo> |
|
85 |
<meta.section type="apiinfo"/> |
|
86 |
</appinfo> |
|
87 |
<documentation> |
|
88 |
[Enter API information here.] |
|
89 |
</documentation> |
|
90 |
</annotation> |
|
91 |
|
|
92 |
<annotation> |
|
93 |
<appinfo> |
|
94 |
<meta.section type="implementation"/> |
|
95 |
</appinfo> |
|
96 |
<documentation> |
|
97 |
[Enter information about supplied implementation of this extension point.] |
|
98 |
</documentation> |
|
99 |
</annotation> |
|
100 |
|
|
101 |
|
|
102 |
</schema> |
tmp/org.txm.statsengine.core/schema/org.txm.statsengine.exsd (revision 783) | ||
---|---|---|
1 |
<?xml version='1.0' encoding='UTF-8'?> |
|
2 |
<!-- Schema file written by PDE --> |
|
3 |
<schema targetNamespace="org.txm.statsengine.core" xmlns="http://www.w3.org/2001/XMLSchema"> |
|
4 |
<annotation> |
|
5 |
<appinfo> |
|
6 |
<meta.schema plugin="org.txm.statsengine.core" id="org.txm.statsengine.core.StatsEngine" name="Stats Engine"/> |
|
7 |
</appinfo> |
|
8 |
<documentation> |
|
9 |
A stats engine allow to call statistical commands. |
|
10 |
</documentation> |
|
11 |
</annotation> |
|
12 |
|
|
13 |
<element name="extension"> |
|
14 |
<annotation> |
|
15 |
<appinfo> |
|
16 |
<meta.element /> |
|
17 |
</appinfo> |
|
18 |
</annotation> |
|
19 |
<complexType> |
|
20 |
<choice minOccurs="1" maxOccurs="unbounded"> |
|
21 |
<element ref="StatsEngine"/> |
|
22 |
</choice> |
|
23 |
<attribute name="point" type="string" use="required"> |
|
24 |
<annotation> |
|
25 |
<documentation> |
|
26 |
|
|
27 |
</documentation> |
|
28 |
</annotation> |
|
29 |
</attribute> |
|
30 |
<attribute name="id" type="string"> |
|
31 |
<annotation> |
|
32 |
<documentation> |
|
33 |
|
|
34 |
</documentation> |
|
35 |
</annotation> |
|
36 |
</attribute> |
|
37 |
<attribute name="name" type="string"> |
|
38 |
<annotation> |
|
39 |
<documentation> |
|
40 |
|
|
41 |
</documentation> |
|
42 |
<appinfo> |
|
43 |
<meta.attribute translatable="true"/> |
|
44 |
</appinfo> |
|
45 |
</annotation> |
|
46 |
</attribute> |
|
47 |
</complexType> |
|
48 |
</element> |
|
49 |
|
|
50 |
<element name="StatsEngine"> |
|
51 |
<complexType> |
|
52 |
<attribute name="class" type="string"> |
|
53 |
<annotation> |
|
54 |
<documentation> |
|
55 |
|
|
56 |
</documentation> |
|
57 |
<appinfo> |
|
58 |
<meta.attribute kind="java" basedOn="org.txm.statsengine.core.StatsEngine:"/> |
|
59 |
</appinfo> |
|
60 |
</annotation> |
|
61 |
</attribute> |
|
62 |
</complexType> |
|
63 |
</element> |
|
64 |
|
|
65 |
<annotation> |
|
66 |
<appinfo> |
|
67 |
<meta.section type="since"/> |
|
68 |
</appinfo> |
|
69 |
<documentation> |
|
70 |
[Enter the first release in which this extension point appears.] |
|
71 |
</documentation> |
|
72 |
</annotation> |
|
73 |
|
|
74 |
<annotation> |
|
75 |
<appinfo> |
|
76 |
<meta.section type="examples"/> |
|
77 |
</appinfo> |
|
78 |
<documentation> |
|
79 |
[Enter extension point usage example here.] |
|
80 |
</documentation> |
|
81 |
</annotation> |
|
82 |
|
|
83 |
<annotation> |
|
84 |
<appinfo> |
|
85 |
<meta.section type="apiinfo"/> |
|
86 |
</appinfo> |
|
87 |
<documentation> |
|
88 |
[Enter API information here.] |
|
89 |
</documentation> |
|
90 |
</annotation> |
|
91 |
|
|
92 |
<annotation> |
|
93 |
<appinfo> |
|
94 |
<meta.section type="implementation"/> |
|
95 |
</appinfo> |
|
96 |
<documentation> |
|
97 |
[Enter information about supplied implementation of this extension point.] |
|
98 |
</documentation> |
|
99 |
</annotation> |
|
100 |
|
|
101 |
|
|
102 |
</schema> |
|
0 | 103 |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatEngine.java (revision 783) | ||
---|---|---|
1 |
package org.txm.statsengine.core; |
|
2 |
|
|
3 |
import org.txm.Engine; |
|
4 |
|
|
5 |
public abstract class StatEngine implements Engine { |
|
6 |
|
|
7 |
public static final String EXTENSION_POINT_ID = StatEngine.class.getCanonicalName(); |
|
8 |
|
|
9 |
@Override |
|
10 |
public abstract String getName(); |
|
11 |
} |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatEngines.java (revision 783) | ||
---|---|---|
1 |
package org.txm.statsengine.core; |
|
2 |
|
|
3 |
import org.eclipse.core.runtime.CoreException; |
|
4 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
5 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
6 |
import org.eclipse.core.runtime.Platform; |
|
7 |
import org.txm.Engine; |
|
8 |
import org.txm.EngineType; |
|
9 |
import org.txm.EnginesManager; |
|
10 |
import org.txm.Toolbox; |
|
11 |
|
|
12 |
public class StatEngines extends EnginesManager<StatEngine> { |
|
13 |
|
|
14 |
public static StatEngine getREngine() { |
|
15 |
return (StatEngine) Toolbox.getEngineManager(EngineType.STAT).getEngine("R"); |
|
16 |
} |
|
17 |
|
|
18 |
@Override |
|
19 |
protected boolean fetchEngines() { |
|
20 |
|
|
21 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(StatEngine.EXTENSION_POINT_ID); |
|
22 |
|
|
23 |
for (int i = 0; i < contributions.length; i++) { |
|
24 |
try { |
|
25 |
StatEngine e = (StatEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
26 |
// register something with the SearchEngine ? |
|
27 |
engines.put(e.getName(), e); |
|
28 |
} catch(CoreException e) { |
|
29 |
e.printStackTrace(); |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
return engines.size() > 0; |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public EngineType getEnginesType() { |
|
38 |
return EngineType.STAT; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public boolean startEngines(IProgressMonitor monitor) { |
|
43 |
//System.out.println("StatEngines.startEngines: "+engines); |
|
44 |
for (Engine e : engines.values()) { |
|
45 |
|
|
46 |
StatEngine se = (StatEngine)e; |
|
47 |
if (monitor != null) monitor.subTask("Starting "+se.getName()+" statengine..."); |
|
48 |
try { |
|
49 |
se.start(monitor); |
|
50 |
} catch (Exception e2) { |
|
51 |
System.err.println("Error: fail to start StatEngine: "+se.getName()+": "+e2.getLocalizedMessage()); |
|
52 |
e2.printStackTrace(); |
|
53 |
} |
|
54 |
|
|
55 |
} |
|
56 |
return true; |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public boolean stopEngines() { |
|
61 |
|
|
62 |
for (Engine e : engines.values()) { |
|
63 |
|
|
64 |
StatEngine se = (StatEngine)e; |
|
65 |
System.out.println("Stoping "+se.getName()+" statengine..."); |
|
66 |
try { |
|
67 |
se.stop(); |
|
68 |
} catch (Exception e2) { |
|
69 |
System.err.println("Error: fail to stop StatEngine: "+se.getName()+": "+e2.getLocalizedMessage()); |
|
70 |
e2.printStackTrace(); |
|
71 |
} |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
} |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEnginesManager.java (revision 783) | ||
---|---|---|
1 |
package org.txm.statsengine.core; |
|
2 |
|
|
3 |
import org.eclipse.core.runtime.CoreException; |
|
4 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
5 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
6 |
import org.eclipse.core.runtime.Platform; |
|
7 |
import org.txm.Engine; |
|
8 |
import org.txm.EngineType; |
|
9 |
import org.txm.EnginesManager; |
|
10 |
import org.txm.Toolbox; |
|
11 |
import org.txm.utils.logger.Log; |
|
12 |
|
|
13 |
public class StatsEnginesManager extends EnginesManager<StatsEngine> { |
|
14 |
|
|
15 |
public static StatsEngine getREngine() { |
|
16 |
return (StatsEngine) Toolbox.getEngineManager(EngineType.STATS).getEngine("R"); |
|
17 |
} |
|
18 |
|
|
19 |
@Override |
|
20 |
protected boolean fetchEngines() { |
|
21 |
|
|
22 |
IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(StatsEngine.EXTENSION_POINT_ID); |
|
23 |
|
|
24 |
Log.finest("Looking for stats engines contributions with extension point id " + StatsEngine.EXTENSION_POINT_ID + "."); |
|
25 |
|
|
26 |
Log.finest(contributions.length + " stats engines found."); |
|
27 |
|
|
28 |
for (int i = 0; i < contributions.length; i++) { |
|
29 |
try { |
|
30 |
StatsEngine e = (StatsEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$ |
|
31 |
// register something with the SearchEngine ? |
|
32 |
engines.put(e.getName(), e); |
|
33 |
} catch(CoreException e) { |
|
34 |
e.printStackTrace(); |
|
35 |
} |
|
36 |
} |
|
37 |
|
|
38 |
return engines.size() > 0; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public EngineType getEnginesType() { |
|
43 |
return EngineType.STATS; |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public boolean startEngines(IProgressMonitor monitor) { |
|
48 |
//System.out.println("StatEngines.startEngines: "+engines); |
|
49 |
for (Engine e : engines.values()) { |
|
50 |
|
|
51 |
StatsEngine se = (StatsEngine)e; |
|
52 |
if (monitor != null) monitor.subTask("Starting " + se.getName() + " statengine..."); |
|
53 |
try { |
|
54 |
se.start(monitor); |
|
55 |
} catch (Exception e2) { |
|
56 |
System.err.println("Error: fail to start stats engine: "+se.getName()+": "+e2.getLocalizedMessage()); |
|
57 |
e2.printStackTrace(); |
|
58 |
} |
|
59 |
|
|
60 |
} |
|
61 |
return true; |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public boolean stopEngines() { |
|
66 |
|
|
67 |
for (Engine e : engines.values()) { |
|
68 |
|
|
69 |
StatsEngine se = (StatsEngine)e; |
|
70 |
System.out.println("Stopping " + se.getName() + " stats engine..."); |
|
71 |
try { |
|
72 |
se.stop(); |
|
73 |
} catch (Exception e2) { |
|
74 |
System.err.println("Error: failed to stop stats engine: " + se.getName() + ": " + e2.getLocalizedMessage()); |
|
75 |
e2.printStackTrace(); |
|
76 |
} |
|
77 |
} |
|
78 |
return true; |
|
79 |
} |
|
80 |
} |
|
0 | 81 |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/StatsEngine.java (revision 783) | ||
---|---|---|
1 |
package org.txm.statsengine.core; |
|
2 |
|
|
3 |
import org.txm.Engine; |
|
4 |
|
|
5 |
public abstract class StatsEngine implements Engine { |
|
6 |
|
|
7 |
public static final String EXTENSION_POINT_ID = "org.txm.statsengine.core.StatsEngine"; //$NON-NLS-1$ |
|
8 |
|
|
9 |
@Override |
|
10 |
public abstract String getName(); |
|
11 |
} |
|
0 | 12 |
tmp/org.txm.statsengine.core/plugin.xml (revision 783) | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<?eclipse version="3.4"?> |
3 | 3 |
<plugin> |
4 |
<extension-point id="org.txm.statsengine.core.StatEngine" name="Stat Engine" schema="schema/org.txm.statengine.exsd"/>
|
|
4 |
<extension-point id="org.txm.statsengine.core.StatsEngine" name="Stats Engine" schema="schema/org.txm.statsengine.exsd"/>
|
|
5 | 5 |
<extension |
6 | 6 |
point="org.txm.EnginesManager"> |
7 | 7 |
<EngineManager |
8 |
class="org.txm.statsengine.core.StatEngines"
|
|
9 |
description="Stat engines manager" |
|
8 |
class="org.txm.statsengine.core.StatsEnginesManager"
|
|
9 |
description="Stats engines manager"
|
|
10 | 10 |
name="org.txm.statsengine.core.StatEngines"> |
11 | 11 |
</EngineManager> |
12 | 12 |
</extension> |
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 783) | ||
---|---|---|
63 | 63 |
import org.txm.rcp.editors.TXMEditor; |
64 | 64 |
import org.txm.rcp.editors.TableKeyListener; |
65 | 65 |
import org.txm.rcp.messages.TXMUIMessages; |
66 |
import org.txm.rcp.swt.GLComposite; |
|
66 | 67 |
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer; |
67 | 68 |
import org.txm.rcp.views.QueriesView; |
68 | 69 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
... | ... | |
114 | 115 |
boolean reverse = DEFAULTREVERSE; |
115 | 116 |
|
116 | 117 |
|
118 |
private Label infoLine; |
|
119 |
|
|
120 |
|
|
117 | 121 |
|
122 |
|
|
118 | 123 |
/** |
119 | 124 |
* Unit property. |
120 | 125 |
*/ |
... | ... | |
130 | 135 |
// @Parameter(key=LexicalTablePreferences.V_MAX) |
131 | 136 |
protected Spinner vMax; |
132 | 137 |
|
133 |
private Label infoLine; |
|
134 | 138 |
|
135 |
|
|
136 | 139 |
|
137 | 140 |
|
138 | 141 |
|
... | ... | |
148 | 151 |
try { |
149 | 152 |
lexicalTable = (LexicalTable) this.getResult(); |
150 | 153 |
|
151 |
Composite parametersArea = this.getCommandParametersGroup(); |
|
152 | 154 |
|
155 |
// Main parameters |
|
156 |
GLComposite mainParametersArea = this.getMainParametersComposite(); |
|
157 |
mainParametersArea.getLayout().numColumns = 2; |
|
158 |
|
|
159 |
// unit property |
|
160 |
new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property); |
|
161 |
this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true, |
|
162 |
Corpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(), |
|
163 |
this.getResult().getProperty(), false); |
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
// Extended parameters |
|
168 |
Composite extendedParametersArea = this.getExtendedParametersComposite(); |
|
169 |
|
|
153 | 170 |
// Apply button |
154 |
Button keepTop = new Button(parametersArea, SWT.PUSH);
|
|
171 |
Button keepTop = new Button(extendedParametersArea, SWT.PUSH);
|
|
155 | 172 |
keepTop.setText(LexicalTableUIMessages.LexicalTableEditor_4); |
156 | 173 |
keepTop.addSelectionListener(new SelectionListener() { |
157 | 174 |
@Override |
... | ... | |
182 | 199 |
}); |
183 | 200 |
|
184 | 201 |
// Number of lines |
185 |
Label nLines = new Label(parametersArea, SWT.NONE);
|
|
202 |
Label nLines = new Label(extendedParametersArea, SWT.NONE);
|
|
186 | 203 |
nLines.setText(TXMCoreMessages.common_numberOfLines); |
187 |
vMax = new Spinner(parametersArea, SWT.BORDER);
|
|
204 |
vMax = new Spinner(extendedParametersArea, SWT.BORDER);
|
|
188 | 205 |
|
189 | 206 |
// Fmin |
190 |
Label fmin = new Label(parametersArea, SWT.NONE);
|
|
207 |
Label fmin = new Label(extendedParametersArea, SWT.NONE);
|
|
191 | 208 |
fmin.setText(TXMCoreMessages.common_fMin); |
192 |
fMin = new Spinner(parametersArea, SWT.BORDER);
|
|
209 |
fMin = new Spinner(extendedParametersArea, SWT.BORDER);
|
|
193 | 210 |
|
194 |
// unit property |
|
195 |
new Label(parametersArea, SWT.NONE).setText(TXMCoreMessages.common_property); |
|
196 |
this.unitPropertyComboViewer = new PropertiesComboViewer(parametersArea, this, true, |
|
197 |
Corpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(), |
|
198 |
this.getResult().getProperty(), false); |
|
199 |
|
|
200 | 211 |
|
201 |
|
|
202 | 212 |
// Merge or delete columns button |
203 |
Button fusionCol = new Button(parametersArea, SWT.PUSH);
|
|
213 |
Button fusionCol = new Button(extendedParametersArea, SWT.PUSH);
|
|
204 | 214 |
fusionCol.setText(LexicalTableUIMessages.LexicalTableEditor_10); |
205 | 215 |
fusionCol.addSelectionListener(new SelectionListener() { |
206 | 216 |
@Override |
... | ... | |
293 | 303 |
}); |
294 | 304 |
|
295 | 305 |
// Merge or delete lines button |
296 |
Button mergeDeleteRows = new Button(parametersArea, SWT.PUSH);
|
|
306 |
Button mergeDeleteRows = new Button(extendedParametersArea, SWT.PUSH);
|
|
297 | 307 |
mergeDeleteRows.setText(LexicalTableUIMessages.LexicalTableEditor_13); |
298 | 308 |
mergeDeleteRows.addSelectionListener(new SelectionListener() { |
299 | 309 |
@Override |
... | ... | |
440 | 450 |
*/ |
441 | 451 |
public void refreshTable(boolean update) { |
442 | 452 |
|
443 |
// if(!update) {
|
|
453 |
if(this.lexicalTable.hasBeenComputedOnce()) {
|
|
444 | 454 |
|
445 |
formColumn.getColumn().setText(this.lexicalTable.getProperty().getName());
|
|
455 |
formColumn.getColumn().setText(this.lexicalTable.getProperty().getName()); |
|
446 | 456 |
|
447 | 457 |
collist = new ArrayList<Object>(); |
448 | 458 |
Vector colnames = lexicalTable.getColNames(); |
... | ... | |
466 | 476 |
org.txm.rcp.utils.Logger.printStackTrace(e1); |
467 | 477 |
return; |
468 | 478 |
} |
469 |
// } |
|
470 | 479 |
|
471 | 480 |
|
472 |
LineLabelProvider labelprovider = new LineLabelProvider(this.lexicalTable); |
|
473 |
this.viewer.setLabelProvider(labelprovider); |
|
474 |
this.cols = labelprovider.getCols(); |
|
475 |
this.rows = labelprovider.getRows(); |
|
476 |
//this.freqs = labelprovider.getFreqs(); |
|
481 |
LineLabelProvider labelprovider = new LineLabelProvider(this.lexicalTable); |
|
482 |
this.viewer.setLabelProvider(labelprovider); |
|
483 |
this.cols = labelprovider.getCols(); |
|
484 |
this.rows = labelprovider.getRows(); |
|
485 |
//this.freqs = labelprovider.getFreqs(); |
|
486 |
|
|
477 | 487 |
|
478 |
|
|
488 |
} |
|
489 |
|
|
479 | 490 |
// Refresh and pack the columns |
480 | 491 |
TXMEditor.packColumns(this.viewer); |
481 | 492 |
|
482 | 493 |
this.viewer.getTable().deselectAll(); |
483 | 494 |
this.viewer.getTable().setFocus(); |
495 |
|
|
496 |
|
|
484 | 497 |
} |
485 | 498 |
|
486 | 499 |
|
... | ... | |
631 | 644 |
@Override |
632 | 645 |
public void updateEditorFromResult(boolean update) { |
633 | 646 |
vMax.setMinimum(1); |
634 |
vMax.setMaximum(lexicalTable.getData().getNRows()); |
|
635 |
vMax.setSelection(lexicalTable.getData().getNRows()); |
|
636 |
fMin.setMinimum(lexicalTable.getData().getFMin()); |
|
637 |
fMin.setMaximum(lexicalTable.getData().getFMax()); |
|
647 |
if(lexicalTable.getData() != null) { |
|
648 |
vMax.setMaximum(lexicalTable.getData().getNRows()); |
|
649 |
vMax.setSelection(lexicalTable.getData().getNRows()); |
|
650 |
fMin.setMinimum(lexicalTable.getData().getFMin()); |
|
651 |
fMin.setMaximum(lexicalTable.getData().getFMax()); |
|
652 |
|
|
653 |
this.refreshTable(update); |
|
654 |
this.refreshInfos(); |
|
655 |
} |
|
638 | 656 |
|
639 |
this.refreshTable(update); |
|
640 |
this.refreshInfos(); |
|
641 | 657 |
|
642 | 658 |
QueriesView.refresh(); |
643 | 659 |
RVariablesView.refresh(); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 783) | ||
---|---|---|
77 | 77 |
*/ |
78 | 78 |
public final static String TOP_TOOLBAR_ID = "TXMEditorTopToolBar"; //$NON-NLS-1$ |
79 | 79 |
public final static String BOTTOM_TOOLBAR_ID = "TXMEditorBottomToolBar"; //$NON-NLS-1$ |
80 |
public final static String COMPUTING_PARAMETERS_GROUP_ID = "Parameters"; |
|
80 |
public final static String COMPUTING_PARAMETERS_GROUP_ID = "Parameters"; //$NON-NLS-1$
|
|
81 | 81 |
|
82 | 82 |
/** |
83 | 83 |
* The editor main tool bar, positioned at the top of the editor. |
... | ... | |
97 | 97 |
/** |
98 | 98 |
* the parameters groups are added to this composite. contains the sub widgets of the default Top toolbar |
99 | 99 |
*/ |
100 |
private GLComposite parametersGroupsComposite;
|
|
100 |
private GLComposite extendedParametersGroupsComposite;
|
|
101 | 101 |
|
102 |
|
|
102 | 103 |
/** |
103 |
* The command parameters composite that can be hidden. To add main parameters.
|
|
104 |
* Command main parameters that are always visible in the toolbar.
|
|
104 | 105 |
*/ |
105 |
protected Composite computingParametersGroup;
|
|
106 |
protected GLComposite mainParametersComposite;
|
|
106 | 107 |
|
108 |
|
|
107 | 109 |
/** |
110 |
* Command extended parameters composite that can be hidden. |
|
111 |
*/ |
|
112 |
protected Composite extendedParametersComposite; |
|
113 |
|
|
114 |
/** |
|
108 | 115 |
* |
109 | 116 |
*/ |
110 | 117 |
Composite parent; |
... | ... | |
126 | 133 |
* contains bottom toolbar subwidgets (installed grouped, etc.) |
127 | 134 |
*/ |
128 | 135 |
private GLComposite bottomSubWidgetsComposite; |
129 |
private GLComposite minimalParametersComposite; |
|
130 | 136 |
private GLComposite firstLineComposite; |
131 | 137 |
private boolean createPartControlDoneSucessfully = true; // for now... muahahaha |
132 | 138 |
|
... | ... | |
147 | 153 |
* |
148 | 154 |
* @return the composite displayed before the toptoolbar, containing the minimal parameters widgets |
149 | 155 |
*/ |
150 |
public GLComposite getMinimalParametersComposite() {
|
|
151 |
return minimalParametersComposite;
|
|
156 |
public GLComposite getMainParametersComposite() {
|
|
157 |
return mainParametersComposite;
|
|
152 | 158 |
} |
153 | 159 |
|
154 | 160 |
/** |
... | ... | |
161 | 167 |
try { |
162 | 168 |
this.parent = parent; |
163 | 169 |
|
164 |
// to hide and display the command parameters composite
|
|
170 |
// to hide and display the extended parameters composite
|
|
165 | 171 |
this.initParentLayout(parent, 1); |
166 | 172 |
|
167 | 173 |
// contains the minimal panels and top toolbars |
... | ... | |
169 | 175 |
this.firstLineComposite.getLayout().numColumns = 2; |
170 | 176 |
this.firstLineComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
171 | 177 |
|
172 |
this.minimalParametersComposite = new GLComposite(firstLineComposite, SWT.NONE);
|
|
173 |
this.minimalParametersComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
|
|
174 |
this.minimalParametersComposite.getLayout().horizontalSpacing = 5;
|
|
178 |
this.mainParametersComposite = new GLComposite(firstLineComposite, SWT.NONE);
|
|
179 |
this.mainParametersComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
|
|
180 |
this.mainParametersComposite.getLayout().horizontalSpacing = 5;
|
|
175 | 181 |
|
176 |
|
|
177 | 182 |
// create the top tool bar |
178 | 183 |
this.topToolBarContainer = new Composite(firstLineComposite, SWT.NONE); |
179 | 184 |
this.topToolBarContainer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); |
... | ... | |
183 | 188 |
rl.center = true; |
184 | 189 |
this.topToolBarContainer.setLayout(rl); |
185 | 190 |
|
186 |
this.parametersGroupsComposite = new GLComposite(parent, SWT.NONE);
|
|
191 |
this.extendedParametersGroupsComposite = new GLComposite(parent, SWT.NONE);
|
|
187 | 192 |
if (parent.getLayout() instanceof GridLayout) { |
188 |
this.parametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
193 |
this.extendedParametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
|
|
189 | 194 |
} |
190 | 195 |
|
191 |
this.topToolBar = new TXMEditorToolBar(this, this.topToolBarContainer, this.parametersGroupsComposite, SWT.FLAT | SWT.RIGHT, TOP_TOOLBAR_ID);
|
|
196 |
this.topToolBar = new TXMEditorToolBar(this, this.topToolBarContainer, this.extendedParametersGroupsComposite, SWT.FLAT | SWT.RIGHT, TOP_TOOLBAR_ID);
|
|
192 | 197 |
// FIXME: debug tests for see why there is an empty area at bottom of the toolbar |
193 | 198 |
//this.topToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); |
194 | 199 |
|
200 |
|
|
201 |
|
|
195 | 202 |
// computing parameters components |
196 |
boolean showComputingParameters = false;
|
|
203 |
boolean showExtendedParameters = false;
|
|
197 | 204 |
// only show the area if the result can not compute and is dirty |
198 |
if(!this.getResult().canCompute() && this.getResult().isDirty()) { |
|
199 |
showComputingParameters = true; |
|
200 |
} |
|
201 |
this.computingParametersGroup = this.topToolBar.installGroup(COMPUTING_PARAMETERS_GROUP_ID, "Show/Hide command parameters", |
|
205 |
// FIXME: to discuss if when hiding or showing the extended parameters |
|
206 |
// if(!this.getResult().canCompute() && this.getResult().isDirty()) { |
|
207 |
// showExtendedParameters = true; |
|
208 |
// } |
|
209 |
this.extendedParametersComposite = this.topToolBar.installGroup(COMPUTING_PARAMETERS_GROUP_ID, "Show/Hide command parameters", |
|
202 | 210 |
"icons/show_computing_parameters.png", |
203 | 211 |
"icons/hide_computing_parameters.png", |
204 |
showComputingParameters);
|
|
212 |
showExtendedParameters);
|
|
205 | 213 |
|
214 |
//extendedParametersComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); |
|
206 | 215 |
|
216 |
|
|
217 |
|
|
207 | 218 |
// display main area |
208 | 219 |
this.resultArea = new Composite(parent, SWT.NONE); |
209 | 220 |
this.resultArea.setLayoutData(new GridData(GridData.FILL_BOTH)); |
... | ... | |
217 | 228 |
//rl.justify = true; |
218 | 229 |
this.bottomToolBarContainer.setLayout(rl); |
219 | 230 |
|
231 |
|
|
220 | 232 |
this.bottomSubWidgetsComposite = new GLComposite(parent, SWT.NONE); |
221 | 233 |
if (parent.getLayout() instanceof GridLayout) { |
222 | 234 |
this.bottomSubWidgetsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); |
223 | 235 |
} |
224 | 236 |
|
237 |
|
|
225 | 238 |
this.bottomToolBar = new TXMEditorToolBar(this, this.bottomToolBarContainer, this.bottomSubWidgetsComposite, SWT.FLAT, "bottom"); |
226 | 239 |
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
227 | 244 |
this._createPartControl(parent); // child editor create its parameters and display widgets |
228 | 245 |
|
229 | 246 |
|
... | ... | |
240 | 257 |
} |
241 | 258 |
|
242 | 259 |
// uninstall parameters group if not used |
243 |
if (computingParametersGroup.getChildren().length == 0) {
|
|
260 |
if (extendedParametersComposite.getChildren().length == 0) {
|
|
244 | 261 |
this.topToolBar.unInstallGroup(COMPUTING_PARAMETERS_GROUP_ID); |
245 | 262 |
} |
246 | 263 |
} |
247 | 264 |
catch(Throwable e) { |
248 |
System.err.println("TXMEditor.createPartControl(): can not create the editor."); |
|
265 |
System.err.println("TXMEditor.createPartControl(): can not create the editor for result " + this.getResult() + ".");
|
|
249 | 266 |
e.printStackTrace(); |
250 |
createPartControlDoneSucessfully = false;
|
|
267 |
createPartControlDoneSucessfully = false; |
|
251 | 268 |
} |
252 | 269 |
} |
253 | 270 |
|
... | ... | |
319 | 336 |
/** |
320 | 337 |
* @return the commandParametersComposite. Put here you main parameter widgets |
321 | 338 |
*/ |
322 |
public Composite getCommandParametersGroup() {
|
|
323 |
return this.computingParametersGroup;
|
|
339 |
public Composite getExtendedParametersComposite() {
|
|
340 |
return this.extendedParametersComposite;
|
|
324 | 341 |
} |
325 | 342 |
|
326 | 343 |
@Override |
... | ... | |
340 | 357 |
public boolean isDirty() { |
341 | 358 |
if (this.getResult() != null) { |
342 | 359 |
// if the result has never been computed, the editor is not dirty -> no * shown |
343 |
return this.getResult().isDirty() && this.getResult().getHasBeenComputedOnce();
|
|
360 |
return this.getResult().isDirty() && this.getResult().hasBeenComputedOnce();
|
|
344 | 361 |
} |
345 | 362 |
|
346 | 363 |
return false; |
... | ... | |
440 | 457 |
*/ |
441 | 458 |
public JobHandler compute(final boolean update) { |
442 | 459 |
|
443 |
|
|
444 | 460 |
StatusLine.setMessage("Computing " + this.getResult().getName()); |
445 | 461 |
|
446 | 462 |
JobHandler job = new JobHandler("Computing " + this.getResult().getName()) { |
... | ... | |
958 | 974 |
* @return the composite that contains the <b>default Top</b> TXMEditorToolBar parameters panels |
959 | 975 |
*/ |
960 | 976 |
public GLComposite getParametersGroupsComposite() { |
961 |
return parametersGroupsComposite;
|
|
977 |
return extendedParametersGroupsComposite;
|
|
962 | 978 |
} |
963 | 979 |
|
964 | 980 |
/** |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java (revision 783) | ||
---|---|---|
45 | 45 |
private HashMap<String, Composite> groups = new HashMap<String, Composite>(); |
46 | 46 |
|
47 | 47 |
private GLComposite subWidgetComposite; |
48 |
|
|
48 | 49 |
/** |
49 | 50 |
* Contains references to installed groups to ToolItem. |
50 | 51 |
*/ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 783) | ||
---|---|---|
101 | 101 |
import org.txm.rcp.swt.dialog.CGUMessageDialog; |
102 | 102 |
import org.txm.rcp.utils.JobHandler; |
103 | 103 |
import org.txm.rcp.views.corpora.CorporaView; |
104 |
import org.txm.searchengine.core.SearchEngines; |
|
104 |
import org.txm.searchengine.core.SearchEnginesManager;
|
|
105 | 105 |
import org.txm.searchengine.cqp.CQPEngine; |
106 | 106 |
import org.txm.utils.BundleUtils; |
107 | 107 |
import org.txm.utils.DeleteDir; |
... | ... | |
266 | 266 |
@Override |
267 | 267 |
public void run() { |
268 | 268 |
try { |
269 |
SearchEngines.getCQPEngine().stop(); |
|
270 |
SearchEngines.getCQPEngine().start(monitor); |
Formats disponibles : Unified diff