Révision 3704
TXM/trunk/bundles/org.txm.conllu.rcp/src/org/txm/conllu/rcp/commands/CoNLLUCorpusPreferences.java (revision 3704) | ||
---|---|---|
75 | 75 |
InputDialog dialog = new InputDialog(HandlerUtil.getActiveShell(event), "CoNLL-U Corpus preferences", "Prefix of the CQP properties encoding the UD fields", udPrefix, null); |
76 | 76 |
|
77 | 77 |
if (dialog.open() == InputDialog.OK) { |
78 |
|
|
78 |
if (dialog.getValue().length() == 0) { |
|
79 |
Log.warning("UD prefix cannot be empty"); |
|
80 |
return null; |
|
81 |
} |
|
79 | 82 |
customNode.put(UDPreferences.UDPREFIX, dialog.getValue()); |
80 | 83 |
Log.info("Set "+c.getName()+" prefix to "+dialog.getValue()); |
81 | 84 |
return s; |
TXM/trunk/bundles/org.txm.conllu.rcp/src/org/txm/conllu/rcp/preferences/CoNLLUPreferencePage.java (revision 3704) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
4 | 4 |
import org.eclipse.jface.preference.StringFieldEditor; |
5 |
import org.eclipse.jface.util.PropertyChangeEvent; |
|
5 | 6 |
import org.eclipse.ui.IWorkbench; |
6 | 7 |
import org.txm.conllu.core.preferences.UDPreferences; |
7 | 8 |
import org.txm.rcp.IImageKeys; |
8 | 9 |
import org.txm.rcp.preferences.TXMPreferencePage; |
9 | 10 |
import org.txm.rcp.preferences.TXMPreferenceStore; |
11 |
import org.txm.utils.logger.Log; |
|
10 | 12 |
|
11 | 13 |
/** |
12 | 14 |
* UD preferences page |
... | ... | |
16 | 18 |
*/ |
17 | 19 |
public class CoNLLUPreferencePage extends TXMPreferencePage { |
18 | 20 |
|
21 |
private StringFieldEditor udPrefixField; |
|
22 |
|
|
19 | 23 |
@Override |
20 | 24 |
public void createFieldEditors() { |
21 | 25 |
|
... | ... | |
23 | 27 |
this.addField(new BooleanFieldEditor(UDPreferences.IMPORT_BUILD_TIGERSEARCH_INDEXES, "Build TIGERSearch indexes as well", this.getFieldEditorParent())); |
24 | 28 |
|
25 | 29 |
this.addField(new BooleanFieldEditor(UDPreferences.KEEP_CONTRACTIONS, "Keep word contractions when importing CoNLL-U files", this.getFieldEditorParent())); |
26 |
this.addField(new StringFieldEditor(UDPreferences.UDPREFIX, "UD properties prefix", this.getFieldEditorParent())); |
|
30 |
udPrefixField = new StringFieldEditor(UDPreferences.UDPREFIX, "UD properties prefix", this.getFieldEditorParent()); |
|
31 |
this.addField(udPrefixField); |
|
27 | 32 |
this.addField(new StringFieldEditor(UDPreferences.IMPORT_HEAD_TO_PROJECT, "UD head properties to project (comma separated list)", this.getFieldEditorParent())); |
28 | 33 |
this.addField(new StringFieldEditor(UDPreferences.IMPORT_DEPS_TO_PROJECT, "UD deps properties to project (comma separated list)", this.getFieldEditorParent())); |
29 | 34 |
} |
30 | 35 |
|
36 |
@Override |
|
37 |
public void propertyChange(PropertyChangeEvent event) { |
|
38 |
if (udPrefixField.getStringValue().length() == 0) { |
|
39 |
setErrorMessage("UD prefix cannot be empty"); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public boolean performOk() { |
|
45 |
|
|
46 |
return super.performOk(); |
|
47 |
} |
|
48 |
|
|
31 | 49 |
/* |
32 | 50 |
* (non-Javadoc) |
33 | 51 |
* |
TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDSearch.java (revision 3704) | ||
---|---|---|
18 | 18 |
import org.txm.searchengine.cqp.corpus.CQPCorpus; |
19 | 19 |
import org.txm.searchengine.cqp.corpus.QueryResult; |
20 | 20 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
21 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
21 | 22 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
22 | 23 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
23 | 24 |
import org.txm.searchengine.cqp.corpus.query.Match; |
... | ... | |
30 | 31 |
|
31 | 32 |
protected boolean ready = false; |
32 | 33 |
|
33 |
CQPCorpus udSentences;
|
|
34 |
Subcorpus udSentences;
|
|
34 | 35 |
|
35 | 36 |
private QueryResult matches; |
36 | 37 |
|
... | ... | |
313 | 314 |
udSentences = corpus.getSubcorpusByName(corpus.getName()+"/ud-sentences"); |
314 | 315 |
if (udSentences != null) udSentences.compute(); |
315 | 316 |
|
317 |
CQLQuery sentencesQuery = new CQLQuery("["+prefix+"id=\"1\"] ["+prefix+"id !=\"1\"]+ [:"+prefix+"id=\"1|__UNDEF__\":]"); |
|
316 | 318 |
if (udSentences == null) { |
317 |
udSentences = corpus.createSubcorpus(new CQLQuery("["+prefix+"id=\"1\"] ["+prefix+"id !=\"1\"]+ [:"+prefix+"id=\"1|__UNDEF__\":]"), "ud-sentences");
|
|
319 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-sentences");
|
|
318 | 320 |
udSentences.setVisible(false); |
319 | 321 |
} |
320 |
|
|
322 |
if (!udSentences.getQuery().equals(sentencesQuery)) { |
|
323 |
udSentences = corpus.createSubcorpus(sentencesQuery, "ud-sentences"); |
|
324 |
udSentences.setVisible(false); |
|
325 |
} |
|
326 |
|
|
321 | 327 |
matches = udSentences.query((CQLQuery)pQuery, "matches", false); |
322 | 328 |
|
323 | 329 |
return matches.getNMatch() > 0; |
TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/preferences/CQPPreferencePage.java (revision 3704) | ||
---|---|---|
200 | 200 |
boolean useNetwork = false; |
201 | 201 |
boolean serverIsRemote = false; |
202 | 202 |
boolean update = false; |
203 |
if (((FieldEditor) event.getSource()).getPreferenceName().equals( |
|
204 |
CQPLibPreferences.CQI_SERVER_IS_REMOTE)) { |
|
203 |
if (((FieldEditor) event.getSource()).getPreferenceName().equals(CQPLibPreferences.CQI_SERVER_IS_REMOTE)) { |
|
205 | 204 |
useNetwork = cqi_use_network.getBooleanValue(); |
206 | 205 |
serverIsRemote = (Boolean) event.getNewValue(); |
207 | 206 |
update = true; |
208 |
} else if (((FieldEditor) event.getSource()).getPreferenceName().equals( |
|
209 |
CQPLibPreferences.CQI_NETWORK_MODE)) { |
|
207 |
} else if (((FieldEditor) event.getSource()).getPreferenceName().equals(CQPLibPreferences.CQI_NETWORK_MODE)) { |
|
210 | 208 |
useNetwork = (Boolean) event.getNewValue(); |
211 | 209 |
serverIsRemote = cqi_server_is_remote.getBooleanValue(); |
212 | 210 |
update = true; |
213 | 211 |
} |
214 |
if (update) |
|
212 |
if (update) {
|
|
215 | 213 |
updateFieldsState(useNetwork, serverIsRemote); |
214 |
} |
|
216 | 215 |
} |
217 | 216 |
} |
TXM/trunk/bundles/org.txm.treesearch.rcp/src/org/txm/treesearch/editor/TreeSearchEditor.java (revision 3704) | ||
---|---|---|
331 | 331 |
|
332 | 332 |
sentCounterLabel = new Label(navigationAreaComposite, SWT.NONE); |
333 | 333 |
gdata = new GridData(SWT.FILL, SWT.CENTER, false, false); |
334 |
gdata.minimumWidth = 100; |
|
334 | 335 |
sentCounterLabel.setLayoutData(gdata); |
335 | 336 |
|
336 | 337 |
new Label(navigationAreaComposite, SWT.NONE); |
... | ... | |
487 | 488 |
// return; |
488 | 489 |
// } |
489 | 490 |
|
491 |
sentCounterLabel.getParent().layout(); |
|
490 | 492 |
getMainParametersComposite().getParent().layout(); |
493 |
|
|
491 | 494 |
} |
492 | 495 |
|
493 | 496 |
/** |
TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 3704) | ||
---|---|---|
1335 | 1335 |
* the name |
1336 | 1336 |
* @return the subcorpus by name |
1337 | 1337 |
*/ |
1338 |
public CQPCorpus getSubcorpusByName(String name) {
|
|
1338 |
public Subcorpus getSubcorpusByName(String name) {
|
|
1339 | 1339 |
List<Subcorpus> subcorpora = getSubcorpora(); |
1340 |
for (CQPCorpus corpus : subcorpora) {
|
|
1340 |
for (Subcorpus corpus : subcorpora) {
|
|
1341 | 1341 |
if (corpus.getName().equals(name)) { |
1342 | 1342 |
return corpus; |
1343 | 1343 |
} |
Formats disponibles : Unified diff