Révision 3750
TXM/trunk/bundles/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 3750) | ||
---|---|---|
1283 | 1283 |
else if (f.getType().isAssignableFrom(File.class)) { |
1284 | 1284 |
value = this.getFileParameterValue(key); |
1285 | 1285 |
} |
1286 |
|
|
1286 | 1287 |
// FIXME: test to automate other type creation as Property => problem here is that org.txm.core doesn't know the plug-in org.txm.searchengine.cqp.core |
1287 | 1288 |
// could be done using reflection. Get the field runtime class, then get and call the constructor |
1288 | 1289 |
// else if (f.getType().isAssignableFrom(Property.class)) { |
TXM/trunk/bundles/org.txm.core/src/java/org/txm/objects/Project.java (revision 3750) | ||
---|---|---|
37 | 37 |
import java.net.MalformedURLException; |
38 | 38 |
import java.util.ArrayList; |
39 | 39 |
import java.util.Arrays; |
40 |
import java.util.Collections; |
|
41 |
import java.util.Comparator; |
|
40 | 42 |
import java.util.Date; |
41 | 43 |
import java.util.HashMap; |
42 | 44 |
import java.util.HashSet; |
... | ... | |
926 | 928 |
|
927 | 929 |
// write the <text> elements |
928 | 930 |
|
929 |
for (Text t : this.getTexts()) { |
|
931 |
ArrayList<Text> texts = new ArrayList<Text>(this.getTexts()); |
|
932 |
Collections.sort(texts, new Comparator<Text>() { |
|
933 |
|
|
934 |
@Override |
|
935 |
public int compare(Text o1, Text o2) { |
|
936 |
return o1.getName().compareTo(o2.getName()); |
|
937 |
} |
|
938 |
}); |
|
939 |
|
|
940 |
for (Text t : texts) { |
|
930 | 941 |
Element elementT = bp.addText(corpusElem, t.getName(), t.getSource()); |
931 | 942 |
|
932 |
|
|
933 | 943 |
for (Edition e : t.getEditions()) { |
934 | 944 |
Element elementE = bp.addEdition(elementT, e.getName(), e.getHtmlDir().getPath(), "html"); |
935 | 945 |
for (int i = 0; i < e.getNumPages(); i++) { |
... | ... | |
941 | 951 |
|
942 | 952 |
// write the <preBuild>, <partition> and <subcorpus> elements |
943 | 953 |
for (CorpusBuild corpus : this.getChildren(CorpusBuild.class)) { |
954 |
corpus.getImportMetadata(); |
|
944 | 955 |
|
945 |
writeSubcorpusandPartitionsInOldBaseParameters(corpus, corpusElem, bp); |
|
956 |
BaseOldParameters.writeSubcorpusandPartitionsInOldBaseParameters(corpus, corpusElem, bp);
|
|
946 | 957 |
} |
947 | 958 |
|
948 |
|
|
949 | 959 |
bp.getKeyValueParameters().put("lang", this.getLang()); |
950 | 960 |
|
951 | 961 |
bp.save(); |
... | ... | |
1048 | 1058 |
return false; |
1049 | 1059 |
} |
1050 | 1060 |
|
1051 |
private void writeSubcorpusandPartitionsInOldBaseParameters(CorpusBuild corpus, Element corpusElem, BaseOldParameters bp) { |
|
1052 |
|
|
1053 |
for (Partition p : corpus.getChildren(Partition.class)) { |
|
1054 |
|
|
1055 |
String[] queries = new String[p.getParts().size()]; |
|
1056 |
String[] names = new String[p.getParts().size()]; |
|
1057 |
int i = 0; |
|
1058 |
for (CorpusBuild part : p.getParts()) { |
|
1059 |
names[i] = part.getName(); |
|
1060 |
queries[i] = part.getStringParameterValue(TBXPreferences.QUERY); |
|
1061 |
i++; |
|
1062 |
} |
|
1063 |
bp.addPartition(corpusElem, p.getSimpleName(), queries, names); |
|
1064 |
} |
|
1065 |
|
|
1066 |
for (CorpusBuild s : corpus.getChildren(CorpusBuild.class)) { |
|
1067 |
Element e = bp.addSubcorpus(corpusElem, s.getSimpleName(), s.getStringParameterValue(TBXPreferences.QUERY), ""); |
|
1068 |
|
|
1069 |
writeSubcorpusandPartitionsInOldBaseParameters(s, e, bp); |
|
1070 |
} |
|
1071 |
} |
|
1072 |
|
|
1073 | 1061 |
/** |
1074 | 1062 |
* Gets the base directory. |
1075 | 1063 |
* |
TXM/trunk/bundles/org.txm.core/src/java/org/txm/objects/Partition.java (revision 3750) | ||
---|---|---|
27 | 27 |
// |
28 | 28 |
package org.txm.objects; |
29 | 29 |
|
30 |
import java.util.List; |
|
31 |
|
|
30 | 32 |
import org.txm.core.results.TXMResult; |
31 | 33 |
|
32 | 34 |
/** |
... | ... | |
62 | 64 |
public boolean isInternalPersistable() { |
63 | 65 |
return true; |
64 | 66 |
} |
67 |
|
|
68 |
public abstract List<? extends org.txm.objects.CorpusBuild> getParts(); |
|
65 | 69 |
} |
TXM/trunk/bundles/org.txm.core/src/java/org/txm/objects/CorpusBuild.java (revision 3750) | ||
---|---|---|
528 | 528 |
// } |
529 | 529 |
|
530 | 530 |
/** |
531 |
* |
|
531 | 532 |
* Gets the import metadata. |
532 | 533 |
* |
533 | 534 |
* @return the import metadata |
TXM/trunk/bundles/org.txm.core/src/java/org/txm/objects/BaseOldParameters.java (revision 3750) | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import org.eclipse.osgi.util.NLS; |
20 | 20 |
import org.txm.core.messages.TXMCoreMessages; |
21 |
import org.txm.core.preferences.TBXPreferences; |
|
21 | 22 |
import org.txm.utils.logger.Log; |
22 | 23 |
import org.txm.utils.xml.DomUtils; |
23 | 24 |
import org.w3c.dom.*; |
... | ... | |
124 | 125 |
System.out.println(p.toString()); |
125 | 126 |
} |
126 | 127 |
|
128 |
/** |
|
129 |
* fill the preBuild Element given a Corpus or subcorpus object and its XML Element |
|
130 |
* @param corpus |
|
131 |
* @param corpusElem |
|
132 |
* @param bp |
|
133 |
*/ |
|
134 |
public static void writeSubcorpusandPartitionsInOldBaseParameters(CorpusBuild corpus, Element corpusElem, BaseOldParameters bp) { |
|
135 |
|
|
136 |
for (Partition p : corpus.getChildren(Partition.class)) { |
|
137 |
|
|
138 |
String[] queries = new String[p.getParts().size()]; |
|
139 |
String[] names = new String[p.getParts().size()]; |
|
140 |
int i = 0; |
|
141 |
for (CorpusBuild part : p.getParts()) { |
|
142 |
names[i] = part.getName(); |
|
143 |
queries[i] = part.getStringParameterValue(TBXPreferences.QUERY); |
|
144 |
i++; |
|
145 |
} |
|
146 |
bp.addPartition(corpusElem, p.getSimpleName(), queries, names); |
|
147 |
} |
|
148 |
|
|
149 |
for (CorpusBuild s : corpus.getChildren(CorpusBuild.class)) { |
|
150 |
Element e = bp.addSubcorpus(corpusElem, s.getSimpleName(), s.getStringParameterValue(TBXPreferences.QUERY), ""); |
|
151 |
|
|
152 |
writeSubcorpusandPartitionsInOldBaseParameters(s, e, bp); |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
127 | 156 |
public HashMap<String, Element> getCorpora() { |
128 | 157 |
return corpora; |
129 | 158 |
} |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/views/fileexplorer/MacroTreeLabelProvider.java (revision 3750) | ||
---|---|---|
90 | 90 |
} |
91 | 91 |
} |
92 | 92 |
|
93 |
@Override |
|
94 |
public void dispose() { |
|
95 |
if (imageTable != null) { |
|
96 |
for (ImageDescriptor k : imageTable.keySet()) { |
|
97 |
imageTable.get(k).dispose(); |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
93 | 101 |
/* |
94 | 102 |
* (non-Javadoc) |
95 | 103 |
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/InfosSection.java (revision 3750) | ||
---|---|---|
69 | 69 |
|
70 | 70 |
@Override |
71 | 71 |
public void updateFields(Project project) { |
72 |
section.setText(NLS.bind(TXMUIMessages.descriptionOfTheP0CorpusP1, project.getName(), project.getSrcdir())); |
|
72 |
if (project.getSrcdir().exists()) { |
|
73 |
section.setText(NLS.bind(TXMUIMessages.descriptionOfTheP0CorpusP1, project.getName(), project.getSrcdir())); |
|
74 |
} else { |
|
75 |
section.setText(NLS.bind(TXMUIMessages.descriptionOfTheP0CorpusP1, project.getName(), "...")); |
|
76 |
} |
|
73 | 77 |
|
74 | 78 |
String descContent = project.getDescription(); |
75 | 79 |
descContent = descContent.replace("<pre><br/>", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 3750) | ||
---|---|---|
79 | 79 |
import org.txm.rcp.editors.imports.sections.WordsSection; |
80 | 80 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
81 | 81 |
import org.txm.rcp.messages.TXMUIMessages; |
82 |
import org.txm.rcp.preferences.RCPPreferences; |
|
82 | 83 |
import org.txm.rcp.utils.SWTEditorsUtils; |
83 | 84 |
import org.txm.rcp.views.fileexplorer.Explorer; |
84 | 85 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
... | ... | |
90 | 91 |
* set corpus parameters |
91 | 92 |
*/ |
92 | 93 |
public class CorpusPage extends FormPage { |
93 |
|
|
94 |
|
|
94 | 95 |
private static String lastOpenedSrcDir; |
95 |
|
|
96 |
|
|
96 | 97 |
ImportFormEditor editor; |
97 |
|
|
98 |
|
|
98 | 99 |
ScrolledForm form; |
99 |
|
|
100 |
|
|
100 | 101 |
FormToolkit toolkit; |
101 |
|
|
102 |
|
|
102 | 103 |
HashMap<String, Boolean> moduleParams; // the import sections configuration depends on the import module selected |
103 |
|
|
104 |
|
|
104 | 105 |
// All the sections that populate the import parameter file |
105 | 106 |
Section pattrSection; |
106 |
|
|
107 |
|
|
107 | 108 |
Section preBuildSection; |
108 |
|
|
109 |
|
|
109 | 110 |
Section querySection; |
110 |
|
|
111 |
|
|
111 | 112 |
Section sattrSection; |
112 |
|
|
113 |
|
|
113 | 114 |
ImportEditorSection uiSection; |
114 |
|
|
115 |
|
|
115 | 116 |
ImportEditorSection xsltSection; |
116 |
|
|
117 |
|
|
117 | 118 |
ImportEditorSection tokenizerSection; |
118 |
|
|
119 |
|
|
119 | 120 |
ImportEditorSection editionSection; |
120 |
|
|
121 |
|
|
121 | 122 |
ImportEditorSection encodingSection; |
122 |
|
|
123 |
|
|
123 | 124 |
ImportEditorSection fontSection; |
124 |
|
|
125 |
|
|
125 | 126 |
ImportEditorSection infosSection; |
126 |
|
|
127 |
|
|
127 | 128 |
ImportEditorSection langSection; |
128 |
|
|
129 |
|
|
129 | 130 |
ImportEditorSection textualPlansSection; |
130 |
|
|
131 |
|
|
131 | 132 |
ImportEditorSection structuresSection; |
132 |
|
|
133 |
|
|
133 | 134 |
ImportEditorSection optionsSection; |
134 |
|
|
135 |
|
|
135 | 136 |
/** |
136 | 137 |
* Import module custom import section, see ImportModuleCustomization.getAdditionalSection(name) |
137 | 138 |
*/ |
138 | 139 |
ImportEditorSection additionalSection; |
139 |
|
|
140 |
|
|
140 | 141 |
// old widgets to be moved/deleted |
141 | 142 |
TableViewer preBuildViewer; |
142 |
|
|
143 |
|
|
143 | 144 |
TreeViewer preBuildViewer2; |
144 |
|
|
145 |
|
|
145 | 146 |
TableViewer queriesViewer; |
146 |
|
|
147 |
|
|
147 | 148 |
TableViewer sattributesViewer; |
148 |
|
|
149 |
|
|
149 | 150 |
TableViewer editionsViewer; |
150 |
|
|
151 |
|
|
151 | 152 |
TableViewer viewer; |
152 |
|
|
153 |
|
|
153 | 154 |
TableViewer pattributesViewer; |
154 |
|
|
155 |
|
|
155 | 156 |
//private Project project; |
156 |
|
|
157 |
|
|
157 | 158 |
/** |
158 | 159 |
* Instantiates a new main page. |
159 | 160 |
* |
... | ... | |
164 | 165 |
super(editor, TXMUIMessages.parameters, TXMUIMessages.parameters); |
165 | 166 |
this.editor = editor; |
166 | 167 |
} |
167 |
|
|
168 |
|
|
168 | 169 |
private int createEditionsSection() { |
169 | 170 |
editionSection = new EditionSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams, editor.getImportName()); |
170 | 171 |
return editionSection.getSectionSize(); |
171 | 172 |
} |
172 |
|
|
173 |
|
|
173 | 174 |
private int createEmptyCell() { |
174 | 175 |
Label l = toolkit.createLabel(form.getBody(), "", SWT.NONE); //$NON-NLS-1$ |
175 | 176 |
TableWrapData td = new TableWrapData(); |
176 | 177 |
td.colspan = 1; |
177 | 178 |
l.setLayoutData(td); |
178 |
|
|
179 |
|
|
179 | 180 |
return 1; |
180 | 181 |
} |
181 |
|
|
182 |
|
|
182 | 183 |
private int createEncodingSection() { |
183 | 184 |
encodingSection = new EncodingSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
184 | 185 |
return encodingSection.getSectionSize(); |
185 | 186 |
} |
186 |
|
|
187 |
|
|
187 | 188 |
private int createFontSection() { |
188 | 189 |
fontSection = new FontSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
189 | 190 |
return fontSection.getSectionSize(); |
190 | 191 |
} |
191 |
|
|
192 |
|
|
192 | 193 |
/* |
193 | 194 |
* (non-Javadoc) |
194 | 195 |
* @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm) |
... | ... | |
200 | 201 |
TableWrapLayout layout = new TableWrapLayout(); |
201 | 202 |
layout.numColumns = 2; |
202 | 203 |
layout.makeColumnsEqualWidth = false; |
203 |
|
|
204 |
|
|
204 | 205 |
form.getBody().setLayout(layout); |
205 |
|
|
206 |
|
|
206 | 207 |
createToolbar(); |
207 |
|
|
208 |
|
|
208 | 209 |
String importName = editor.getImportName(); |
209 | 210 |
moduleParams = ImportModuleCustomization.getParameters(importName); |
210 |
|
|
211 |
|
|
211 | 212 |
// CREATE THE SECTIONS |
212 | 213 |
int N_SECTIONS = 0; |
213 | 214 |
N_SECTIONS += createInfosSection(); // mandatory |
214 |
|
|
215 |
|
|
215 | 216 |
if (moduleParams.get(ImportModuleCustomization.ENCODING)) { |
216 | 217 |
N_SECTIONS += createEncodingSection(); |
217 | 218 |
} |
218 |
|
|
219 |
|
|
219 | 220 |
if (moduleParams.get(ImportModuleCustomization.LANG)) { |
220 | 221 |
N_SECTIONS += createLangSection(); |
221 | 222 |
} |
222 |
|
|
223 |
|
|
223 | 224 |
if (moduleParams.get(ImportModuleCustomization.WORDS)) { |
224 | 225 |
N_SECTIONS += createTokenizerSection(); |
225 | 226 |
} |
226 |
|
|
227 |
|
|
227 | 228 |
if (moduleParams.get(ImportModuleCustomization.XSLT)) { |
228 | 229 |
if (N_SECTIONS % 2 != 0) { // needs 2 cells to draw |
229 | 230 |
N_SECTIONS += createEmptyCell(); |
230 | 231 |
} |
231 | 232 |
N_SECTIONS += createFrontXSLTSection(); |
232 | 233 |
} |
233 |
|
|
234 |
|
|
234 | 235 |
if (moduleParams.get(ImportModuleCustomization.EDITIONS_PAGEELEMENT) || moduleParams.get(ImportModuleCustomization.EDITIONS_WORDSPERPAGE)) { |
235 | 236 |
N_SECTIONS += createEditionsSection(); |
236 | 237 |
} |
237 |
|
|
238 |
|
|
238 | 239 |
N_SECTIONS += createFontSection(); |
239 |
|
|
240 |
|
|
240 | 241 |
if (moduleParams.get(ImportModuleCustomization.UI)) { |
241 | 242 |
N_SECTIONS += createUIsSection(); |
242 | 243 |
} |
243 |
|
|
244 |
|
|
244 | 245 |
if (moduleParams.get(ImportModuleCustomization.TEXTUALPLANS)) { |
245 | 246 |
N_SECTIONS += createTextualPlansSection(); |
246 | 247 |
} |
... | ... | |
250 | 251 |
if (moduleParams.get(ImportModuleCustomization.OPTIONS)) { |
251 | 252 |
N_SECTIONS += createOptionsSection(); |
252 | 253 |
} |
253 |
|
|
254 |
|
|
254 | 255 |
N_SECTIONS += createAdditionalSection(); |
255 |
|
|
256 |
|
|
256 | 257 |
// END OF SECTIONS CREATION, ENSURE THAT THE NUMBER OF CELL is %2 |
257 | 258 |
if (N_SECTIONS % 2 != 0) N_SECTIONS += createEmptyCell(); |
258 |
|
|
259 |
|
|
259 | 260 |
// create notes messages |
260 | 261 |
Label separatorLabel = toolkit.createLabel(form.getBody(), "", SWT.SEPARATOR | SWT.HORIZONTAL); //$NON-NLS-1$ |
261 | 262 |
TableWrapData gdata = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE, 2, 1); |
262 | 263 |
gdata.colspan = 2; |
263 | 264 |
separatorLabel.setLayoutData(gdata); |
264 |
|
|
265 |
|
|
265 | 266 |
Label mandatoryLabel = toolkit.createLabel(form.getBody(), TXMUIMessages.dDotMandatoryField, SWT.WRAP); |
266 | 267 |
gdata = new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE, 2, 1); |
267 | 268 |
gdata.colspan = 2; |
268 | 269 |
mandatoryLabel.setLayoutData(gdata); |
269 |
|
|
270 |
|
|
270 | 271 |
form.layout(true); |
271 | 272 |
managedForm.reflow(true); |
272 |
|
|
273 |
|
|
273 | 274 |
if (editor.project != null) { // the project is already set, all the select sources widget are disable |
274 | 275 |
initializeProjectSettings(); |
275 | 276 |
} |
276 | 277 |
} |
277 |
|
|
278 |
|
|
278 | 279 |
private int createTextualPlansSection() { |
279 | 280 |
textualPlansSection = new TextualPlansSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
280 | 281 |
return textualPlansSection.getSectionSize(); |
281 | 282 |
} |
282 |
|
|
283 |
|
|
283 | 284 |
private int createStructuresSection() { |
284 | 285 |
structuresSection = new StructuresSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
285 | 286 |
return structuresSection.getSectionSize(); |
286 | 287 |
} |
287 |
|
|
288 |
|
|
288 | 289 |
private int createOptionsSection() { |
289 | 290 |
optionsSection = new OptionsSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
290 | 291 |
return optionsSection.getSectionSize(); |
291 | 292 |
} |
292 |
|
|
293 |
|
|
293 | 294 |
private int createAdditionalSection() { |
294 | 295 |
String importName = editor.getImportName(); |
295 |
|
|
296 |
|
|
296 | 297 |
if (ImportModuleCustomization.getAdditionalSection(importName) != null) { |
297 | 298 |
Class<? extends ImportEditorSection> clazz = ImportModuleCustomization.getAdditionalSection(importName); |
298 |
|
|
299 |
|
|
299 | 300 |
try { |
300 | 301 |
Constructor<? extends ImportEditorSection> c = clazz.getConstructor(ImportFormEditor.class, FormToolkit.class, ScrolledForm.class, Composite.class, int.class); |
301 | 302 |
additionalSection = c.newInstance(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
... | ... | |
307 | 308 |
} |
308 | 309 |
return 0; |
309 | 310 |
} |
310 |
|
|
311 |
|
|
311 | 312 |
private int createInfosSection() { |
312 | 313 |
infosSection = new InfosSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
313 | 314 |
return infosSection.getSectionSize(); |
314 | 315 |
} |
315 |
|
|
316 |
|
|
316 | 317 |
/** |
317 | 318 |
* Creates the front xslt section. |
318 | 319 |
*/ |
... | ... | |
320 | 321 |
xsltSection = new FrontXSLSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
321 | 322 |
return xsltSection.getSectionSize(); |
322 | 323 |
} |
323 |
|
|
324 |
|
|
324 | 325 |
/** |
325 | 326 |
* Creates the lang section. |
326 | 327 |
*/ |
... | ... | |
328 | 329 |
langSection = new LangSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
329 | 330 |
return langSection.getSectionSize(); |
330 | 331 |
} |
331 |
|
|
332 |
|
|
332 | 333 |
private void createPAttributesSection() { |
333 | 334 |
/* |
334 | 335 |
* pattrSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE); |
... | ... | |
414 | 415 |
* } |
415 | 416 |
*/ |
416 | 417 |
} |
417 |
|
|
418 |
|
|
418 | 419 |
private void createPreBuildSection() { |
419 | 420 |
/* |
420 | 421 |
* preBuildSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE); |
... | ... | |
560 | 561 |
* } |
561 | 562 |
*/ |
562 | 563 |
} |
563 |
|
|
564 |
|
|
564 | 565 |
private void createQueriesSection() { |
565 | 566 |
/* |
566 | 567 |
* querySection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE); |
... | ... | |
635 | 636 |
* } |
636 | 637 |
*/ |
637 | 638 |
} |
638 |
|
|
639 |
|
|
639 | 640 |
private void createSAttributesSection() { |
640 | 641 |
/* |
641 | 642 |
* sattrSection = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR|ExpandableComposite.TWISTIE); |
... | ... | |
722 | 723 |
* } |
723 | 724 |
*/ |
724 | 725 |
} |
725 |
|
|
726 |
|
|
726 | 727 |
/** |
727 | 728 |
* Creates the tokenizer section. |
728 | 729 |
*/ |
... | ... | |
730 | 731 |
tokenizerSection = new WordsSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams); |
731 | 732 |
return tokenizerSection.getSectionSize(); |
732 | 733 |
} |
733 |
|
|
734 |
|
|
734 | 735 |
private void createToolbar() { |
735 | 736 |
Composite hyperlinks = toolkit.createComposite(form.getBody()); |
736 | 737 |
TableWrapData gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
737 | 738 |
gdata.colspan = 2; |
738 | 739 |
hyperlinks.setLayoutData(gdata); |
739 |
|
|
740 |
|
|
740 | 741 |
TableWrapLayout layout = new TableWrapLayout(); |
741 | 742 |
layout.numColumns = 5; |
742 | 743 |
layout.makeColumnsEqualWidth = false; |
743 | 744 |
hyperlinks.setLayout(layout); |
744 |
|
|
745 |
|
|
745 | 746 |
Label titleLabel = toolkit.createLabel(hyperlinks, "", SWT.WRAP); //$NON-NLS-1$ |
746 | 747 |
titleLabel.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP)); |
747 | 748 |
|
... | ... | |
750 | 751 |
} else { |
751 | 752 |
titleLabel.setText(NLS.bind(TXMUIMessages.UpdateParametersForTheP0ImportModule, ImportModuleCustomization.getName(editor.getImportName()))); |
752 | 753 |
} |
753 |
|
|
754 |
|
|
754 | 755 |
FontData[] fD = titleLabel.getFont().getFontData(); |
755 | 756 |
fD[0].setHeight(16); |
756 | 757 |
titleLabel.setFont(new Font(titleLabel.getDisplay(), fD[0])); |
757 |
|
|
758 |
|
|
758 | 759 |
HyperlinkAdapter selectDirHListener = null; |
759 | 760 |
if (editor.project == null) { |
760 | 761 |
selectDirHListener = new HyperlinkAdapter() { |
761 |
|
|
762 |
|
|
762 | 763 |
@Override |
763 | 764 |
public void linkActivated(HyperlinkEvent e) { |
764 | 765 |
// System.out.println("Opening..."); |
... | ... | |
766 | 767 |
} |
767 | 768 |
}; |
768 | 769 |
} |
769 |
|
|
770 |
|
|
770 | 771 |
HyperlinkAdapter saveHListener = new HyperlinkAdapter() { |
771 |
|
|
772 |
|
|
772 | 773 |
@Override |
773 | 774 |
public void linkActivated(HyperlinkEvent e) { |
774 | 775 |
if (editor.project != null) { |
... | ... | |
779 | 780 |
} |
780 | 781 |
} |
781 | 782 |
}; |
782 |
|
|
783 |
|
|
783 | 784 |
HyperlinkAdapter startImportListener = new HyperlinkAdapter() { |
784 |
|
|
785 |
|
|
785 | 786 |
@Override |
786 | 787 |
public void linkActivated(HyperlinkEvent e) { |
787 | 788 |
// System.out.println("Starting..."); |
... | ... | |
796 | 797 |
} |
797 | 798 |
} |
798 | 799 |
}; |
799 |
|
|
800 |
|
|
800 | 801 |
HyperlinkAdapter editImporScriptstListener = new HyperlinkAdapter() { |
801 |
|
|
802 |
|
|
802 | 803 |
@Override |
803 | 804 |
public void linkActivated(HyperlinkEvent e) { |
804 | 805 |
String scriptPath = editor.getImportName(); |
... | ... | |
807 | 808 |
Explorer.open(scriptDir); |
808 | 809 |
} |
809 | 810 |
}; |
810 |
|
|
811 |
|
|
811 | 812 |
if (editor.project == null) { |
812 | 813 |
ImageHyperlink openImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
813 | 814 |
openImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
... | ... | |
815 | 816 |
openImportLink.setToolTipText("Select the import source directory"); |
816 | 817 |
openImportLink.addHyperlinkListener(selectDirHListener); |
817 | 818 |
} |
818 |
|
|
819 |
|
|
819 | 820 |
ImageHyperlink saveImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
820 | 821 |
saveImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
821 | 822 |
saveImportLink.setImage(IImageKeys.getImage(IImageKeys.SAVE)); |
822 |
saveImportLink.setToolTipText("Save the improt parameter");
|
|
823 |
saveImportLink.setToolTipText("Save parameters");
|
|
823 | 824 |
saveImportLink.addHyperlinkListener(saveHListener); |
824 |
|
|
825 |
|
|
825 | 826 |
ImageHyperlink startImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
826 | 827 |
startImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
827 | 828 |
startImportLink.setImage(IImageKeys.getImage(IImageKeys.START)); |
828 |
startImportLink.setToolTipText("Start the import");
|
|
829 |
startImportLink.setToolTipText("Start import"); |
|
829 | 830 |
startImportLink.addHyperlinkListener(startImportListener); |
830 |
|
|
831 |
ImageHyperlink scriptImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
|
832 |
scriptImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
|
833 |
scriptImportLink.setImage(IImageKeys.getImage(IImageKeys.SCRIPT)); |
|
834 |
scriptImportLink.setToolTipText("Show the import Groovy scripts"); |
|
835 |
scriptImportLink.addHyperlinkListener(editImporScriptstListener); |
|
836 |
|
|
831 |
|
|
832 |
if (RCPPreferences.getInstance().getBoolean(RCPPreferences.EXPERT_USER)) { |
|
833 |
ImageHyperlink scriptImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
|
834 |
scriptImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
|
835 |
scriptImportLink.setImage(IImageKeys.getImage(IImageKeys.SCRIPT)); |
|
836 |
scriptImportLink.setToolTipText("Show module scripts"); |
|
837 |
scriptImportLink.addHyperlinkListener(editImporScriptstListener); |
|
838 |
} |
|
837 | 839 |
int n = 1; |
838 | 840 |
if (editor.project == null) { |
839 |
|
|
841 |
|
|
840 | 842 |
Composite line1 = toolkit.createComposite(form.getBody()); |
841 | 843 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
842 | 844 |
gdata.colspan = 2; |
... | ... | |
845 | 847 |
hLayout.center = true; |
846 | 848 |
line1.setLayout(hLayout); |
847 | 849 |
toolkit.createLabel(line1, ""+(n++)+".", SWT.WRAP); //$NON-NLS-1$ //$NON-NLS-2$ |
848 |
|
|
850 |
|
|
849 | 851 |
Hyperlink hyperlink1 = toolkit.createHyperlink(line1, TXMUIMessages.selectTheSourceDirectory, SWT.WRAP); |
850 | 852 |
hyperlink1.addHyperlinkListener(selectDirHListener); |
851 | 853 |
|
... | ... | |
853 | 855 |
openImportLink2.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
854 | 856 |
openImportLink2.addHyperlinkListener(selectDirHListener); |
855 | 857 |
} |
856 |
|
|
858 |
|
|
857 | 859 |
Composite line2 = toolkit.createComposite(form.getBody()); |
858 | 860 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
859 | 861 |
gdata.colspan = 2; |
... | ... | |
863 | 865 |
line2.setLayout(hLayout); |
864 | 866 |
toolkit.createLabel(line2, ""+(n++)+".", SWT.WRAP); //$NON-NLS-1$ //$NON-NLS-2$ |
865 | 867 |
toolkit.createLabel(line2, TXMUIMessages.setImportParametersInTheSectionsBelow, SWT.WRAP); |
866 |
|
|
868 |
|
|
867 | 869 |
Composite line4 = toolkit.createComposite(form.getBody()); |
868 | 870 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
869 | 871 |
gdata.colspan = 2; |
... | ... | |
877 | 879 |
hyperlink3.setText(TXMUIMessages.StartCorpusUpdate); |
878 | 880 |
} |
879 | 881 |
hyperlink3.addHyperlinkListener(startImportListener); |
880 |
|
|
882 |
|
|
881 | 883 |
ImageHyperlink startImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL); |
882 | 884 |
startImportLink2.setImage(IImageKeys.getImage(IImageKeys.START)); |
883 | 885 |
startImportLink2.addHyperlinkListener(startImportListener); |
884 |
// |
|
885 |
// ImageHyperlink scriptImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL); |
|
886 |
// scriptImportLink2.setImage(IImageKeys.getImage(IImageKeys.SCRIPT)); |
|
887 |
// scriptImportLink2.addHyperlinkListener(editImporScriptstListener); |
|
886 |
//
|
|
887 |
// ImageHyperlink scriptImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL);
|
|
888 |
// scriptImportLink2.setImage(IImageKeys.getImage(IImageKeys.SCRIPT));
|
|
889 |
// scriptImportLink2.addHyperlinkListener(editImporScriptstListener);
|
|
888 | 890 |
} |
889 |
|
|
891 |
|
|
890 | 892 |
private int createUIsSection() { |
891 | 893 |
uiSection = new CommandsSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); |
892 | 894 |
return uiSection.getSectionSize(); |
893 | 895 |
} |
894 |
|
|
896 |
|
|
895 | 897 |
/** |
896 | 898 |
* Called by "selectSourceDir". |
897 | 899 |
* Theparameter file is read to fill the section fields. |
... | ... | |
901 | 903 |
* @throws IOException |
902 | 904 |
*/ |
903 | 905 |
public void loadParams() throws ParserConfigurationException, SAXException, IOException { |
904 |
|
|
906 |
|
|
905 | 907 |
Log.fine(NLS.bind(TXMUIMessages.moduleUIParametersColonP0, moduleParams)); |
906 | 908 |
this.setPartName(editor.getImportName()); |
907 |
|
|
909 |
|
|
908 | 910 |
if (infosSection != null && !infosSection.isDisposed()) { |
909 | 911 |
infosSection.setEnabled(true); |
910 | 912 |
infosSection.update(editor.project); |
... | ... | |
941 | 943 |
textualPlansSection.setEnabled(true); |
942 | 944 |
textualPlansSection.update(editor.project); |
943 | 945 |
} |
944 |
|
|
946 |
|
|
945 | 947 |
if (structuresSection != null && !structuresSection.isDisposed()) { |
946 | 948 |
structuresSection.setEnabled(true); |
947 | 949 |
structuresSection.update(editor.project); |
948 | 950 |
} |
949 |
|
|
951 |
|
|
950 | 952 |
if (optionsSection != null && !optionsSection.isDisposed()) { |
951 | 953 |
optionsSection.setEnabled(true); |
952 | 954 |
optionsSection.update(editor.project); |
953 | 955 |
} |
954 |
|
|
956 |
|
|
955 | 957 |
if (additionalSection != null && !additionalSection.isDisposed()) { |
956 | 958 |
additionalSection.setEnabled(true); |
957 | 959 |
additionalSection.update(editor.project); |
958 | 960 |
} |
959 |
|
|
961 |
|
|
960 | 962 |
/* |
961 | 963 |
* if (sattrSection != null && !sattrSection.isDisposed()) { |
962 | 964 |
* sattrSection.setEnabled(true); |
... | ... | |
975 | 977 |
* } |
976 | 978 |
*/ |
977 | 979 |
} |
978 |
|
|
980 |
|
|
979 | 981 |
/** |
980 | 982 |
* Called by "startImport". Save the field values in the Parameter file |
981 | 983 |
* |
... | ... | |
983 | 985 |
*/ |
984 | 986 |
public boolean saveConfig() { |
985 | 987 |
Log.info(TXMUIMessages.savingImportParameters); |
986 |
|
|
988 |
|
|
987 | 989 |
if (editor.project == null || editor.project.getRCPProject() == null || !editor.project.getRCPProject().exists()) { |
988 | 990 |
Log.warning(TXMUIMessages.TheCorpushasBeenDeletedSincePleaseReOpenTheImportForm); |
989 | 991 |
this.getEditor().close(false); |
990 | 992 |
return false; |
991 | 993 |
} |
992 |
|
|
994 |
|
|
993 | 995 |
// params.rootDir = project.getSrcdir().getAbsolutePath(); |
994 | 996 |
// project.scriptFile = editor.getGroovyScript().getName(); |
995 |
|
|
997 |
|
|
996 | 998 |
// params.getCorpusElement().setAttribute("name", params.name); //$NON-NLS-1$ |
997 | 999 |
// params.getCorpusElement().setAttribute("desc", params.description); //$NON-NLS-1$ |
998 | 1000 |
// params.getCorpusElement().setAttribute("cqpid", params.name.toUpperCase()+new Date().getTime()); //$NON-NLS-1$ |
999 |
|
|
1001 |
|
|
1000 | 1002 |
// TEST ALL SECTIONS |
1001 | 1003 |
boolean doSave = true; |
1002 | 1004 |
if (infosSection != null && !infosSection.isDisposed()) { |
... | ... | |
1039 | 1041 |
System.out.println(TXMUIMessages.SomeFieldsAreNotCorrectlyFilled); |
1040 | 1042 |
return false; |
1041 | 1043 |
} |
1042 |
|
|
1044 |
|
|
1043 | 1045 |
// SAVE ALL SECTIONS |
1044 | 1046 |
boolean successfulSave = true; |
1045 | 1047 |
if (infosSection != null && !infosSection.isDisposed()) { |
... | ... | |
1078 | 1080 |
if (additionalSection != null && !additionalSection.isDisposed()) { |
1079 | 1081 |
successfulSave = successfulSave & additionalSection.save(editor.project); |
1080 | 1082 |
} |
1081 |
|
|
1083 |
|
|
1082 | 1084 |
if (successfulSave) { |
1083 | 1085 |
try { |
1084 | 1086 |
editor.project.save(); |
... | ... | |
1087 | 1089 |
catch (Exception e1) { |
1088 | 1090 |
org.txm.utils.logger.Log.printStackTrace(e1); |
1089 | 1091 |
} |
1090 |
|
|
1092 |
|
|
1091 | 1093 |
return true; |
1092 | 1094 |
} |
1093 | 1095 |
System.out.println(TXMUIMessages.ErrorWhileSavingParameters); |
1094 | 1096 |
return false; |
1095 |
|
|
1097 |
|
|
1096 | 1098 |
} |
1097 |
|
|
1099 |
|
|
1098 | 1100 |
/** |
1099 | 1101 |
* Called by the "folder" button |
1100 | 1102 |
*/ |
1101 | 1103 |
public void selectSourceDir() { |
1102 |
|
|
1104 |
|
|
1103 | 1105 |
ImportWizard wiz = new ImportWizard(); |
1104 | 1106 |
WizardDialog wdialog = new WizardDialog(this.getEditor().getSite().getShell(), wiz); |
1105 | 1107 |
wdialog.open(); |
1106 |
|
|
1108 |
|
|
1107 | 1109 |
editor.project = wiz.getProject(); |
1108 |
|
|
1110 |
|
|
1109 | 1111 |
initializeProjectSettings(); |
1110 | 1112 |
} |
1111 |
|
|
1113 |
|
|
1112 | 1114 |
private void initializeProjectSettings() { |
1113 |
|
|
1115 |
|
|
1114 | 1116 |
if (editor.project == null) { |
1115 | 1117 |
// System.out.println("Error: no project created"); |
1116 | 1118 |
return; |
1117 | 1119 |
} |
1118 |
|
|
1120 |
|
|
1119 | 1121 |
editor.project.setImportModuleName(editor.getImportName()); |
1120 |
|
|
1122 |
|
|
1121 | 1123 |
try { |
1122 | 1124 |
loadParams(); |
1123 |
|
|
1125 |
|
|
1124 | 1126 |
this.editor.getMetaPage().reload(); |
1125 | 1127 |
this.editor.firePropertyChange(IEditorPart.PROP_TITLE); |
1126 | 1128 |
} |
... | ... | |
1128 | 1130 |
org.txm.utils.logger.Log.printStackTrace(e1); |
1129 | 1131 |
} |
1130 | 1132 |
} |
1131 |
|
|
1133 |
|
|
1132 | 1134 |
public void startImport() { |
1133 | 1135 |
// TODO: test all sections here |
1134 | 1136 |
editor.project.setDirty(); |
... | ... | |
1137 | 1139 |
} else { |
1138 | 1140 |
editor.project.setDoUpdate(false, false); |
1139 | 1141 |
editor.project.setNeedToBuild(); |
1140 |
|
|
1142 |
|
|
1141 | 1143 |
if (editor.project.getChildren().size() > 0) { |
1142 | 1144 |
boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.warning, NLS.bind(TXMUIMessages.theP0CorpusDirectoryAlreadyExistsDoYouWantToReplaceIt, editor.project.getName())); |
1143 | 1145 |
if (!b) { |
... | ... | |
1145 | 1147 |
return; |
1146 | 1148 |
} |
1147 | 1149 |
} |
1148 |
|
|
1150 |
|
|
1149 | 1151 |
SWTEditorsUtils.closeEditors(editor.project, true); |
1150 |
|
|
1152 |
|
|
1151 | 1153 |
ExecuteImportScript.executeScript(editor.project); |
1152 | 1154 |
} |
1153 |
|
|
1154 |
|
|
1155 |
|
|
1156 |
|
|
1155 | 1157 |
} |
1156 |
|
|
1158 |
|
|
1157 | 1159 |
// private void updateEditionsSection() { |
1158 | 1160 |
// |
1159 | 1161 |
// } |
... | ... | |
1224 | 1226 |
if (editor.project.getSrcdir() == null) return null; |
1225 | 1227 |
return editor.project.getSrcdir().getAbsolutePath(); |
1226 | 1228 |
} |
1227 |
|
|
1228 |
// public Project getProject() { |
|
1229 |
// return project; |
|
1230 |
// } |
|
1229 |
|
|
1230 |
// public Project getProject() {
|
|
1231 |
// return project;
|
|
1232 |
// }
|
|
1231 | 1233 |
} |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/MultipleValueDialog.java (revision 3750) | ||
---|---|---|
109 | 109 |
*/ |
110 | 110 |
@Override |
111 | 111 |
protected void okPressed() { |
112 |
for (String name : values.keySet()) |
|
112 |
for (String name : values.keySet()) {
|
|
113 | 113 |
values.put(name, widgets.get(name).getText()); |
114 |
} |
|
114 | 115 |
super.okPressed(); |
115 | 116 |
} |
116 | 117 |
|
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/dialog/SinglePropertySelectionDialog.java (revision 3750) | ||
---|---|---|
35 | 35 |
import org.eclipse.swt.SWT; |
36 | 36 |
import org.eclipse.swt.events.MouseAdapter; |
37 | 37 |
import org.eclipse.swt.events.MouseEvent; |
38 |
import org.eclipse.swt.events.SelectionAdapter; |
|
39 |
import org.eclipse.swt.events.SelectionEvent; |
|
40 | 38 |
import org.eclipse.swt.layout.GridData; |
41 | 39 |
import org.eclipse.swt.layout.GridLayout; |
42 |
import org.eclipse.swt.widgets.Button; |
|
43 | 40 |
import org.eclipse.swt.widgets.Composite; |
44 | 41 |
import org.eclipse.swt.widgets.Control; |
45 | 42 |
import org.eclipse.swt.widgets.Shell; |
... | ... | |
48 | 45 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
49 | 46 |
import org.txm.searchengine.cqp.corpus.VirtualProperty; |
50 | 47 |
|
51 |
// TODO: Auto-generated Javadoc |
|
52 | 48 |
/** |
53 | 49 |
* The dialog box called to select the view properties. |
54 | 50 |
* |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java (revision 3750) | ||
---|---|---|
125 | 125 |
if (SearchEnginePreferences.getInstance().getBoolean(SearchEnginePreferences.SHOW_SEARCH_ENGINES)) { |
126 | 126 |
|
127 | 127 |
settingsButton = new Button(this, SWT.PUSH); |
128 |
settingsButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
|
|
129 |
settingsButton.setImage(IImageKeys.getImage(IImageKeys.ACTION_SEARCH_SETTINGS));
|
|
128 |
settingsButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
|
|
129 |
settingsButton.setImage(IImageKeys.getImage("platform:/plugin/org.eclipse.jface/org/eclipse/jface/dialogs/images/popup_menu.png"));
|
|
130 | 130 |
settingsButton.setToolTipText("Query options"); |
131 | 131 |
settingsButton.addSelectionListener(new SelectionListener() { |
132 | 132 |
|
133 | 133 |
@Override |
134 | 134 |
public void widgetSelected(SelectionEvent e) { |
135 | 135 |
|
136 |
QueryOptionsDialog dialog = new QueryOptionsDialog(e.display.getActiveShell(), corpus, engines, querywidget.getSearchEngine()); //$NON-NLS-1$
|
|
136 |
QueryOptionsDialog dialog = new QueryOptionsDialog(settingsButton, corpus, engines, querywidget.getSearchEngine()); //$NON-NLS-1$
|
|
137 | 137 |
if (dialog.open() == ComboDialog.OK) { |
138 | 138 |
SearchEngine se = dialog.getSelectedEngine(); |
139 | 139 |
if (se != null && !se.getName().equals(querywidget.getSearchEngine().getName())) { |
... | ... | |
184 | 184 |
setMagicEnabled("CQP".equals(se.getName()) || "CQP".equals(se.getOptionForSearchengine())); //$NON-NLS-1$ |
185 | 185 |
|
186 | 186 |
String defaultEngineName = SearchEnginePreferences.getInstance().getString(SearchEnginePreferences.DEFAULT_SEARCH_ENGINE); |
187 |
if (defaultEngineName.equals(se.getName())) { |
|
187 |
if (defaultEngineName.equals(se.getName()) || defaultEngineName.equals(se.getOptionForSearchengine())) {
|
|
188 | 188 |
selectedEngineLabel.setText(""); //$NON-NLS-1$ |
189 | 189 |
} |
190 | 190 |
else if (se.getOptionNameForSearchengine() != null) { |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryOptionsDialog.java (revision 3750) | ||
---|---|---|
40 | 40 |
import org.eclipse.swt.SWT; |
41 | 41 |
import org.eclipse.swt.events.SelectionEvent; |
42 | 42 |
import org.eclipse.swt.events.SelectionListener; |
43 |
import org.eclipse.swt.graphics.Point; |
|
43 | 44 |
import org.eclipse.swt.layout.GridData; |
44 | 45 |
import org.eclipse.swt.layout.GridLayout; |
45 | 46 |
import org.eclipse.swt.widgets.Button; |
46 | 47 |
import org.eclipse.swt.widgets.Combo; |
47 | 48 |
import org.eclipse.swt.widgets.Composite; |
48 | 49 |
import org.eclipse.swt.widgets.Control; |
50 |
import org.eclipse.swt.widgets.Display; |
|
49 | 51 |
import org.eclipse.swt.widgets.Group; |
50 | 52 |
import org.eclipse.swt.widgets.Label; |
51 | 53 |
import org.eclipse.swt.widgets.Shell; |
54 |
import org.txm.rcp.messages.TXMUIMessages; |
|
52 | 55 |
import org.txm.rcp.swt.provider.SimpleLabelProvider; |
53 | 56 |
import org.txm.searchengine.core.SearchEngine; |
54 | 57 |
import org.txm.searchengine.core.SearchEnginesManager; |
... | ... | |
80 | 83 |
/** The default value. */ |
81 | 84 |
private SearchEngine defaultValue; |
82 | 85 |
|
83 |
/** The title. */ |
|
84 |
private String title; |
|
85 |
|
|
86 | 86 |
CQPCorpus corpus; |
87 | 87 |
List<SearchEngine> engines; |
88 | 88 |
|
... | ... | |
90 | 90 |
|
91 | 91 |
private Label selectOptionsLabel; |
92 | 92 |
|
93 |
private Button noneOption; |
|
94 |
|
|
95 | 93 |
private Group optionsGroup; |
96 | 94 |
|
97 |
public QueryOptionsDialog(Shell parentShell, CQPCorpus corpus, List<SearchEngine> engines2, SearchEngine defaultValue) { |
|
98 |
super(parentShell); |
|
95 |
private Button button; |
|
96 |
public QueryOptionsDialog(Button settingsButton, CQPCorpus corpus, List<SearchEngine> engines2, SearchEngine defaultValue) { |
|
97 |
super(settingsButton.getDisplay().getActiveShell()); |
|
99 | 98 |
|
99 |
this.button = settingsButton; |
|
100 | 100 |
this.corpus = corpus; |
101 | 101 |
this.engines = engines2; |
102 |
this.parentShell = parentShell;
|
|
103 |
this.setShellStyle(this.getShellStyle());
|
|
102 |
this.parentShell = settingsButton.getDisplay().getActiveShell();
|
|
103 |
this.setShellStyle(SWT.NONE | SWT.APPLICATION_MODAL);
|
|
104 | 104 |
|
105 | 105 |
this.values = new ArrayList<SearchEngine>(); |
106 | 106 |
for (SearchEngine se : engines2) { |
... | ... | |
117 | 117 |
} |
118 | 118 |
} |
119 | 119 |
this.defaultValue = defaultValue; |
120 |
this.title = "Query options"; |
|
121 | 120 |
} |
122 | 121 |
|
123 | 122 |
/* (non-Javadoc) |
... | ... | |
126 | 125 |
@Override |
127 | 126 |
protected void configureShell(Shell newShell) { |
128 | 127 |
super.configureShell(newShell); |
129 |
newShell.setText(title); |
|
130 |
newShell.setSize(400, 400); |
|
128 |
|
|
129 |
//newShell.addListener( SWT.Deactivate, event -> newShell.close() ); // don't work when the combo opens its menu |
|
130 |
|
|
131 |
newShell.setSize(400, 300); |
|
132 |
|
|
133 |
newShell.setLocation(Display.getCurrent().map(button, null, 0,button.getSize().y)); |
|
134 |
//newShell.setLocation(button.getLocation().x, button.getLocation().y + button.getSize().y); |
|
135 |
//System.out.println("L: "+button.getLocation()); |
|
136 |
//newShell.setBounds(button.setL().x, button.getBounds().y, 400, 400); |
|
131 | 137 |
} |
132 | 138 |
|
133 | 139 |
@Override |
140 |
protected Point getInitialLocation(Point initialSize) { |
|
141 |
return new Point(500,200); |
|
142 |
} |
|
143 |
|
|
144 |
|
|
145 |
@Override |
|
134 | 146 |
protected boolean isResizable() { |
135 | 147 |
return true; |
136 | 148 |
} |
137 | 149 |
|
150 |
Composite p; |
|
138 | 151 |
/* (non-Javadoc) |
139 | 152 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) |
140 | 153 |
*/ |
141 | 154 |
@Override |
142 | 155 |
protected Control createDialogArea(Composite p) { |
156 |
|
|
157 |
this.p = p; |
|
158 |
|
|
143 | 159 |
//System.out.println(p.getLayout()); |
144 | 160 |
GridLayout layout = (GridLayout) p.getLayout(); |
145 | 161 |
layout.verticalSpacing = 5; |
... | ... | |
149 | 165 |
layout.marginRight = 5; |
150 | 166 |
|
151 | 167 |
Label l = new Label(p, SWT.NONE); |
152 |
l.setText("Select between the following engines");
|
|
168 |
l.setText(TXMUIMessages.selectEngine);
|
|
153 | 169 |
l.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); |
154 | 170 |
combo = new ComboViewer(new Combo(p, SWT.READ_ONLY | SWT.SINGLE)); |
155 | 171 |
combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); |
... | ... | |
180 | 196 |
combo.setContentProvider(new ArrayContentProvider()); |
181 | 197 |
combo.setInput(values); |
182 | 198 |
|
199 |
if (defaultValue != null) { |
|
200 |
selectValue(defaultValue); |
|
201 |
} |
|
183 | 202 |
|
184 | 203 |
optionsGroup = new Group(p, SWT.BORDER); |
185 | 204 |
optionsGroup.setLayout(new GridLayout(1, true)); |
186 |
optionsGroup.setText("Options");
|
|
205 |
optionsGroup.setText(TXMUIMessages.Options);
|
|
187 | 206 |
optionsGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1)); |
188 | 207 |
|
189 |
noneOption = new Button(optionsGroup, SWT.RADIO); |
|
190 |
|
|
191 |
if (defaultValue != null) { |
|
192 |
selectValue(defaultValue); |
|
193 |
} |
|
194 |
|
|
195 |
|
|
196 | 208 |
updateOptions(); |
197 | 209 |
|
198 | 210 |
return p; |
199 | 211 |
} |
212 |
|
|
213 |
// @Override |
|
214 |
// public Control createButtonBar(Composite parentShell) { |
|
215 |
// return null; |
|
216 |
// } |
|
200 | 217 |
|
201 | 218 |
public void updateOptions() { |
202 | 219 |
|
... | ... | |
208 | 225 |
return; // nothing to do |
209 | 226 |
} |
210 | 227 |
|
211 |
for (Control c : optionsGroup.getChildren()) { |
|
212 |
c.dispose(); |
|
228 |
if (optionsGroup != null) { |
|
229 |
for (Control c : optionsGroup.getChildren()) { |
|
230 |
c.dispose(); |
|
231 |
} |
|
213 | 232 |
} |
214 | 233 |
|
215 |
noneOption = new Button(optionsGroup, SWT.RADIO); |
|
216 |
noneOption.setText("No option"); |
|
217 |
noneOption.setSelection(true); |
|
234 |
selectedEngine = (SearchEngine)o; |
|
218 | 235 |
|
219 |
selectedEngine = (SearchEngine)o; |
|
220 | 236 |
if (options.containsKey(selectedEngine.getName())) { |
237 |
|
|
238 |
GridData data = ((GridData)optionsGroup.getLayoutData()); |
|
239 |
|
|
221 | 240 |
for (final SearchEngine se : options.get(selectedEngine.getName())) { |
222 |
Button option = new Button(optionsGroup, SWT.RADIO); |
|
223 |
option.setText(se.getOptionNameForSearchengine()+ " : " + se.getOptionDescriptionForSearchengine()); |
|
241 |
|
|
242 |
Button option = new Button(optionsGroup, SWT.CHECK); |
|
243 |
option.setText(se.getOptionNameForSearchengine()+ " : " + se.getOptionDescriptionForSearchengine()); //$NON-NLS-1$ |
|
224 | 244 |
if (se.equals(defaultValue)) { |
225 | 245 |
option.setSelection(true); |
226 |
noneOption.setSelection(false); |
|
227 | 246 |
selectedEngine = defaultValue; |
228 | 247 |
} |
229 | 248 |
|
... | ... | |
231 | 250 |
|
232 | 251 |
@Override |
233 | 252 |
public void widgetSelected(SelectionEvent e) { |
234 |
selectedEngine = se; |
|
253 |
|
|
254 |
Button b = (Button)e.widget; |
|
255 |
if (b.getSelection()) { |
|
256 |
selectedEngine = se; |
|
257 |
} else { |
|
258 |
selectedEngine = (SearchEngine) combo.getStructuredSelection().getFirstElement(); |
|
259 |
} |
|
235 | 260 |
} |
236 | 261 |
|
237 | 262 |
@Override |
... | ... | |
239 | 264 |
}); |
240 | 265 |
|
241 | 266 |
} |
267 |
|
|
268 |
|
|
242 | 269 |
} |
243 | 270 |
optionsGroup.layout(); |
271 |
|
|
272 |
|
|
273 |
//this.getShell().redraw(); |
|
274 |
//this.getShell().pack(); |
|
275 |
//this.getShell().layout(true); |
|
244 | 276 |
} |
245 | 277 |
|
246 | 278 |
/** |
... | ... | |
266 | 298 |
if (optionedengine != null) { |
267 | 299 |
combo.setSelection(new StructuredSelection(optionedengine)); |
268 | 300 |
} else { |
269 |
System.out.println("ERROR: engine not found: "+e.getOptionForSearchengine()); |
|
301 |
System.out.println("ERROR: engine not found: "+e.getOptionForSearchengine()); //$NON-NLS-1$
|
|
270 | 302 |
} |
271 | 303 |
} |
272 | 304 |
} |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/Application.java (revision 3750) | ||
---|---|---|
63 | 63 |
import org.txm.core.engines.EnginesManager; |
64 | 64 |
import org.txm.core.messages.TXMCoreMessages; |
65 | 65 |
import org.txm.core.preferences.TBXPreferences; |
66 |
import org.txm.core.results.TXMParameters; |
|
67 |
import org.txm.functions.CommandsAPI; |
|
66 | 68 |
import org.txm.objects.Project; |
67 | 69 |
import org.txm.objects.Workspace; |
68 | 70 |
import org.txm.rcp.commands.workspace.Load080BinaryCorpus; |
... | ... | |
444 | 446 |
System.err.println("No target path parameter provided. Ex: corpus path /VOEUX , concordance name /VOEUX/myconc"); |
445 | 447 |
ret = -1; |
446 | 448 |
} else { |
447 |
System.out.println("DO: "+name+ " WITH "+path); |
|
449 |
System.out.println("CALL: "+name+ " WITH "+path); |
|
450 |
CommandsAPI api = new CommandsAPI(); |
|
451 |
api.call(name, Workspace.getResult(path), new TXMParameters()); |
|
452 |
|
|
448 | 453 |
} |
449 | 454 |
return ret; |
450 | 455 |
} |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 3750) | ||
---|---|---|
20 | 20 |
advanced=Avancé |
21 | 21 |
advancedUserMode=Mode avancé |
22 | 22 |
allCriteria=Tous les critères ensembles (&&) |
23 |
AllEditorsUsingThisCorpusWillBeClosedandtheCorpusWillBeUpdatedContinue=Tous les résultats de ce corpus seront fermés et le corpus sera mis à jour. Continuer ?
|
|
23 |
AllEditorsUsingThisCorpusWillBeClosedandtheCorpusWillBeUpdatedContinue=Toutes les fenêtres de résultat de ce corpus seront fermés et le corpus sera mis à jour. Continuer ?
|
|
24 | 24 |
alwaysSaveBeforeLaunching=Toujours enregistrer avant de lancer |
25 | 25 |
ampContextsDisplayOptions=Options d'affichage des &contextes |
26 | 26 |
ampMultipleSort=&Tri multiple |
... | ... | |
308 | 308 |
forceLoggin=Activation de tous les journaux... |
309 | 309 |
common_all=tous |
310 | 310 |
allTexts=tous les textes |
311 |
withModifications=ceux avec des modifications
|
|
311 |
withModifications=modifiés
|
|
312 | 312 |
corpusToProcess=Cospus à traiter |
313 | 313 |
textsToProcess=Textes à traiter |
314 | 314 |
form=Forme |
... | ... | |
562 | 562 |
setDefaultTheme=Définir le thème par défaut |
563 | 563 |
setImportParametersInTheSectionsBelow=Régler les paramètres d'import dans les sections ci-dessous. |
564 | 564 |
settingStatusLineAndConfiguringActionSets=Récupération de la ligne de statut et réglage des menus et barres d'outils |
565 |
selectEngine=Choisir le moteur |
|
565 | 566 |
shouldNotHappen=Ne devrait pas se produire |
566 | 567 |
ShowADialogBoxWhenASevereErrorOccurs=Afficher une boîte de dialogue lorsqu'une erreur grave se produit |
567 | 568 |
showAllResultNodesInCorporaView=Afficher tous les noeuds de résultats dans la vue Corpus |
568 | 569 |
showExportResultInTheTextEditor=Afficher le résultat de l'export dans un éditeur de texte |
569 | 570 |
showHiddenFiles=Afficher les fichiers cachés |
570 | 571 |
showHideCommandParameters=Afficher/Masquer les paramètres de commande |
571 |
ShowMoreUpdateParametersBeforeUpdating=Définir plus de paramètres de mise à jour
|
|
572 |
ShowMoreUpdateParametersBeforeUpdating=Modifier les paramètres de mise à jour
|
|
572 | 573 |
simple=Simple |
573 | 574 |
SomeAnnotationsAreNotSaved=Certaines annotations n'ont pas été sauvegardées |
574 | 575 |
SomeAnnotationsAreNotSavedAndWillBeLostAfterTXMIsClosed=Certaines annotations n'ont pas été sauvegardées et seront perdues si TXM est fermé \: |
... | ... | |
698 | 699 |
updateDone=Mise à jour terminée. |
699 | 700 |
UpdateEditionsWhenUpdatingACorpus=Mettre à jour les éditions lors de la mise à jour d'un corpus |
700 | 701 |
updateLevel=Niveau de mise à jour |
701 |
UpdateP0P1Import=Mise à jour de {0} (schéma d''import {1})
|
|
702 |
UpdateParametersForTheP0ImportModule=Mise à jour des paramètres pour le module d''import {0}
|
|
702 |
UpdateP0P1Import=Mise à jour de {0} (import {1}) |
|
703 |
UpdateParametersForTheP0ImportModule=Mise à jour des paramètres du module d''import {0}
|
|
703 | 704 |
UpdateSiteAddress=Adresse du site de mises à jour |
704 | 705 |
UpdateSiteIsNotReachableP0P1Aborting=Le site de mises à jour n''est pas accessible ({0}) \: {1}. Abandon. |
705 | 706 |
UpdateTheCorpusFromItsXMLTXMFiles=Mise à jour du corpus à partir de ses fichiers XML-TXM |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 3750) | ||
---|---|---|
1496 | 1496 |
public static String pageProperties; |
1497 | 1497 |
|
1498 | 1498 |
public static String textLanguage; |
1499 |
|
|
1500 |
public static String selectEngine; |
|
1499 | 1501 |
|
1500 | 1502 |
static { |
1501 | 1503 |
// initialize resource bundle |
TXM/trunk/bundles/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 3750) | ||
---|---|---|
20 | 20 |
advanced=Advanced |
21 | 21 |
advancedUserMode=Advanced user mode |
22 | 22 |
allCriteria=All criteria (&&) |
23 |
AllEditorsUsingThisCorpusWillBeClosedandtheCorpusWillBeUpdatedContinue=All this corpus results will be closed and the corpus will be updated. Continue?
|
|
23 |
AllEditorsUsingThisCorpusWillBeClosedandtheCorpusWillBeUpdatedContinue=All this corpus resul windows will be closed and the corpus will be updated. Continue?
|
|
24 | 24 |
alwaysSaveBeforeLaunching=Always save before launching |
25 | 25 |
ampContextsDisplayOptions=&Contexts display options |
26 | 26 |
ampMultipleSort=&Multiple Sort |
... | ... | |
307 | 307 |
forceLoggin=Enabling all logs… |
308 | 308 |
common_all=all |
309 | 309 |
allTexts=all the texts |
310 |
withModifications=texts with modifications
|
|
310 |
withModifications=modified
|
|
311 | 311 |
corpusToProcess=Cospus to process |
312 | 312 |
textsToProcess=Texts to process |
313 | 313 |
form=Form |
... | ... | |
555 | 555 |
SelectTheSourceDirectory=Select the source texts folder |
556 | 556 |
selectValuesToAssignColon=Select the values to assign\: |
557 | 557 |
selectWorkingDirectory=Working folder |
558 |
selectEngine=Select engine |
|
558 | 559 |
separatedByAtLeast0Word=may be separated by some words |
559 | 560 |
separatedByAtLeast1Word=separated by some words |
560 | 561 |
separatorCharacters=Separator characters |
... | ... | |
567 | 568 |
showExportResultInTheTextEditor=Show the result of the export in a text editor |
568 | 569 |
showHiddenFiles=Show hidden files |
569 | 570 |
showHideCommandParameters=Show/Hide command parameters |
570 |
ShowMoreUpdateParametersBeforeUpdating=Set more update parameters
|
|
571 |
ShowMoreUpdateParametersBeforeUpdating=Modify update parameters
|
|
571 | 572 |
simple=Simple |
572 | 573 |
SomeAnnotationsAreNotSaved=Some annotations have not been saved |
573 | 574 |
SomeAnnotationsAreNotSavedAndWillBeLostAfterTXMIsClosed=Some annotations have not been saved and will be lost if TXM is closed\: |
... | ... | |
697 | 698 |
updateDone=Update done. |
698 | 699 |
UpdateEditionsWhenUpdatingACorpus=Update editions when updating a corpus |
699 | 700 |
updateLevel=Update level |
700 |
UpdateP0P1Import=Update of {0} ({1} import scheme)
|
|
701 |
UpdateParametersForTheP0ImportModule=Update parameters for the {0} import module
|
|
701 |
UpdateP0P1Import=Update of {0} ({1} import) |
|
702 |
UpdateParametersForTheP0ImportModule=Update parameters of the {0} import module
|
|
702 | 703 |
UpdateSiteAddress=Update site address |
703 | 704 |
UpdateSiteIsNotReachableP0P1Aborting=Update site is not reachable ({0})\: {1}. Aborting. |
704 | 705 |
UpdateTheCorpusFromItsXMLTXMFiles=Update the corpus from its XML-TXM files |
Formats disponibles : Unified diff