Révision 3441
trunk/org.txm.texts.rcp/src/org/txm/texts/rcp/TextsViewEditor.java (revision 3441) | ||
---|---|---|
18 | 18 |
import org.eclipse.swt.graphics.Image; |
19 | 19 |
import org.eclipse.swt.layout.GridData; |
20 | 20 |
import org.eclipse.swt.layout.GridLayout; |
21 |
import org.eclipse.swt.widgets.Label; |
|
21 | 22 |
import org.eclipse.swt.widgets.TableColumn; |
22 | 23 |
import org.txm.core.results.Parameter; |
23 | 24 |
import org.txm.edition.rcp.handlers.OpenEdition; |
... | ... | |
36 | 37 |
@Parameter(key = "columns") |
37 | 38 |
PropertiesSelector<StructuralUnitProperty> propertiesSelector; |
38 | 39 |
|
40 |
@Parameter(key = "negativeFilters") |
|
41 |
org.eclipse.swt.widgets.Text negativeFiltersText; |
|
42 |
|
|
39 | 43 |
TableViewer viewer; |
40 | 44 |
// HashMap<String, TableViewerColumn> columns = new HashMap<String, TableViewerColumn>(); |
41 | 45 |
|
... | ... | |
44 | 48 |
|
45 | 49 |
this.getParent().setLayout(new GridLayout(1, true)); |
46 | 50 |
|
51 |
this.getMainParametersComposite().getLayout().numColumns = 10; |
|
52 |
|
|
47 | 53 |
propertiesSelector = new PropertiesSelector<>(this.getMainParametersComposite()); |
48 | 54 |
ArrayList<StructuralUnitProperty> properties = new ArrayList<>(getResult().getCorpus().getStructuralUnitProperties("text")); |
49 | 55 |
for (int i = 0 ; i < properties.size() ; i++) { |
... | ... | |
56 | 62 |
ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this); |
57 | 63 |
propertiesSelector.addSelectionListener(computeSelectionListener); |
58 | 64 |
|
65 |
new Label(this.getMainParametersComposite(), SWT.NONE).setText("Negative filters (p1=v1;p2=v2)"); |
|
66 |
|
|
67 |
negativeFiltersText = new org.eclipse.swt.widgets.Text(this.getMainParametersComposite(), SWT.BORDER); |
|
68 |
negativeFiltersText.addSelectionListener(computeSelectionListener); |
|
69 |
GridData gdata = new GridData(GridData.FILL, GridData.CENTER, true, false); |
|
70 |
gdata.minimumWidth = 300; |
|
71 |
negativeFiltersText.setLayoutData(gdata); |
|
72 |
|
|
59 | 73 |
viewer = new TableViewer(this.getResultArea(), SWT.NONE); |
60 | 74 |
viewer.getTable().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
61 | 75 |
viewer.getTable().setHeaderVisible(true); |
... | ... | |
159 | 173 |
|
160 | 174 |
} |
161 | 175 |
// |
162 |
viewer.setInput(getResult().getCorpus().getProject().getTexts()); |
|
176 |
ArrayList<Text> texts = new ArrayList<>(); |
|
177 |
for (Text text : getResult().getCorpus().getProject().getTexts()) { |
|
178 |
if (this.getResult().getLines().containsKey(text.getName())) { |
|
179 |
texts.add(text); |
|
180 |
} |
|
181 |
} |
|
182 |
viewer.setInput(texts); |
|
163 | 183 |
|
164 | 184 |
viewer.addDoubleClickListener(new IDoubleClickListener() { |
165 | 185 |
|
trunk/org.txm.texts.core/src/org/txm/texts/core/TextsView.java (revision 3441) | ||
---|---|---|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.PrintWriter; |
5 | 5 |
import java.util.ArrayList; |
6 |
import java.util.Arrays; |
|
6 | 7 |
import java.util.LinkedHashMap; |
7 | 8 |
import java.util.List; |
8 | 9 |
|
... | ... | |
23 | 24 |
@Parameter(key = "columns") |
24 | 25 |
ArrayList<StructuralUnitProperty> pColumns; |
25 | 26 |
|
27 |
// @Parameter(key = "positiveFilters") |
|
28 |
// ArrayList<String> positiveFilters; |
|
29 |
|
|
30 |
@Parameter(key = "negativeFilters") |
|
31 |
String negativeFilters; |
|
32 |
|
|
26 | 33 |
private LinkedHashMap<String, ArrayList<String>> result; |
27 | 34 |
|
28 | 35 |
public MainCorpus getCorpus() { |
29 | 36 |
return (MainCorpus)parent; |
30 | 37 |
} |
31 |
|
|
38 |
|
|
32 | 39 |
public TextsView(MainCorpus corpus) { |
33 | 40 |
|
34 | 41 |
super(corpus); |
... | ... | |
40 | 47 |
} |
41 | 48 |
|
42 | 49 |
|
43 |
|
|
50 |
|
|
44 | 51 |
@Override |
45 | 52 |
public boolean saveParameters() throws Exception { |
46 | 53 |
|
47 | 54 |
this.saveParameter("columns", StringUtils.join(pColumns, "\t")); |
55 |
// this.saveParameter("positiveFilters", StringUtils.join(positiveFilters, "\t")); |
|
56 |
this.saveParameter("negativeFilters", negativeFilters); |
|
48 | 57 |
return true; |
49 | 58 |
} |
50 |
|
|
59 |
|
|
51 | 60 |
@Override |
52 | 61 |
public boolean loadParameters() throws Exception { |
53 | 62 |
|
... | ... | |
65 | 74 |
this.pColumns = new ArrayList(Property.stringToProperties(getCorpus(), v)); |
66 | 75 |
} |
67 | 76 |
|
77 |
v = this.getStringParameterValue("negativeFilters").toString(); |
|
78 |
if (v.contains("=")) { |
|
79 |
this.negativeFilters = v; |
|
80 |
} else { |
|
81 |
this.negativeFilters = ""; |
|
82 |
} |
|
83 |
|
|
84 |
// v = this.getStringParameterValue("positiveFilters").toString(); |
|
85 |
// if (v.contains("=")) { |
|
86 |
// this.positiveFilters = new ArrayList<>(Arrays.asList(v.split("\t"))); |
|
87 |
// } else { |
|
88 |
// this.positiveFilters = new ArrayList<>(); |
|
89 |
// } |
|
90 |
|
|
68 | 91 |
return pColumns != null; |
69 | 92 |
} |
70 |
|
|
93 |
|
|
71 | 94 |
@Override |
72 | 95 |
public boolean setParameters(TXMParameters parameters) throws Exception { |
73 | 96 |
|
74 |
|
|
75 |
|
|
76 | 97 |
if (parameters.get("columns") != null) { |
77 | 98 |
|
78 | 99 |
Object o = parameters.get("columns"); |
... | ... | |
90 | 111 |
} |
91 | 112 |
return false; |
92 | 113 |
} |
93 |
|
|
114 |
|
|
94 | 115 |
@Override |
95 | 116 |
public String getName() { |
96 | 117 |
|
97 | 118 |
return "Texts ("+pColumns.toString()+")"; |
98 | 119 |
} |
99 |
|
|
120 |
|
|
100 | 121 |
@Override |
101 | 122 |
public String getSimpleName() { |
102 | 123 |
|
103 | 124 |
return "Texts"; |
104 | 125 |
} |
105 |
|
|
126 |
|
|
106 | 127 |
@Override |
107 | 128 |
public String getDetails() { |
108 | 129 |
|
109 | 130 |
return getName(); |
110 | 131 |
} |
111 |
|
|
132 |
|
|
112 | 133 |
@Override |
113 | 134 |
public void clean() { |
114 | 135 |
|
115 | 136 |
} |
116 |
|
|
137 |
|
|
117 | 138 |
@Override |
118 | 139 |
public boolean canCompute() throws Exception { |
119 |
|
|
140 |
|
|
120 | 141 |
return pColumns != null; |
121 | 142 |
} |
122 |
|
|
143 |
|
|
123 | 144 |
@Override |
124 | 145 |
protected boolean _compute(TXMProgressMonitor monitor) throws Exception { |
125 | 146 |
|
... | ... | |
128 | 149 |
// preset arrays |
129 | 150 |
String[] texts = getCorpus().getCorpusTextIdsList(); |
130 | 151 |
for (String t : texts) { |
152 |
|
|
131 | 153 |
ArrayList<String> values = new ArrayList<String>(); |
132 | 154 |
result.put(t, values); |
133 | 155 |
|
... | ... | |
152 | 174 |
} |
153 | 175 |
} |
154 | 176 |
|
177 |
if (negativeFilters.length() > 0 && pColumns.size() > 0) { |
|
178 |
|
|
179 |
ArrayList<String> columnNames = new ArrayList<>(pColumns.size()); |
|
180 |
for (StructuralUnitProperty p : pColumns) columnNames.add(p.getName()); |
|
181 |
|
|
182 |
String[] filters = negativeFilters.split(";"); |
|
183 |
|
|
184 |
ArrayList<String> keys = new ArrayList<>(result.keySet()); |
|
185 |
for (String text : keys) { |
|
186 |
|
|
187 |
for (String negativeFilter : filters) { |
|
188 |
String[] split = negativeFilter.split("=", 2); |
|
189 |
if (split.length == 2 |
|
190 |
&& columnNames.contains(split[0]) |
|
191 |
&& result.get(text).get(columnNames.indexOf(split[0])).matches(split[1])) { |
|
192 |
// remove this line |
|
193 |
result.remove(text); |
|
194 |
break; |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
155 | 200 |
return true; |
156 | 201 |
} |
157 |
|
|
202 |
|
|
158 | 203 |
@Override |
159 | 204 |
protected boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception { |
160 | 205 |
|
... | ... | |
168 | 213 |
writer.close(); |
169 | 214 |
return false; |
170 | 215 |
} |
171 |
|
|
216 |
|
|
172 | 217 |
@Override |
173 | 218 |
public String getResultType() { |
174 | 219 |
return "TextView"; |
... | ... | |
177 | 222 |
public LinkedHashMap<String, ArrayList<String>> getLines() { |
178 | 223 |
return result; |
179 | 224 |
} |
180 |
|
|
225 |
|
|
181 | 226 |
public List<StructuralUnitProperty> getColumns() { |
182 | 227 |
|
183 | 228 |
return pColumns; |
TXM/trunk/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 3441) | ||
---|---|---|
138 | 138 |
command.label.26 = Renommer... |
139 | 139 |
command.label.27 = Supprimer |
140 | 140 |
command.label.28 = S\u00E9lectionner tout |
141 |
command.label.29 = Sauver sous...
|
|
141 |
command.label.29 = Enregistrer sous...
|
|
142 | 142 |
command.label.3 = XML Transcriber + CSV |
143 | 143 |
command.label.30 = Encodage des caract\u00E8res |
144 | 144 |
command.label.31 = Nils |
... | ... | |
292 | 292 |
command.name.64 = Changer le r\u00E9pertoire de travail... |
293 | 293 |
command.name.65 = Corpus au format XML-TXM (.xml)... |
294 | 294 |
command.name.66 = Ex\u00E9cuter un fichier Groovy |
295 |
command.name.67 = Sauver Sous
|
|
295 |
command.name.67 = Enregistrer Sous
|
|
296 | 296 |
command.name.68 = Supprimer fichier |
297 | 297 |
command.name.69 = Copier fichier |
298 | 298 |
command.name.7 = Cloner le r\u00E9sultat |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportSelectedText.java (revision 3441) | ||
---|---|---|
1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.commands; |
|
29 |
|
|
30 |
import java.io.BufferedOutputStream; |
|
31 |
import java.io.File; |
|
32 |
import java.io.FileOutputStream; |
|
33 |
import java.io.OutputStreamWriter; |
|
34 |
import java.io.Writer; |
|
35 |
import java.util.Arrays; |
|
36 |
import java.util.Locale; |
|
37 |
|
|
38 |
import org.eclipse.core.commands.AbstractHandler; |
|
39 |
import org.eclipse.core.commands.ExecutionEvent; |
|
40 |
import org.eclipse.core.commands.ExecutionException; |
|
41 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
42 |
import org.eclipse.osgi.util.NLS; |
|
43 |
import org.eclipse.swt.widgets.Shell; |
|
44 |
import org.txm.Toolbox; |
|
45 |
import org.txm.core.messages.TXMCoreMessages; |
|
46 |
import org.txm.core.preferences.TBXPreferences; |
|
47 |
import org.txm.objects.Project; |
|
48 |
import org.txm.objects.Workspace; |
|
49 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
|
50 |
import org.txm.rcp.messages.TXMUIMessages; |
|
51 |
import org.txm.searchengine.cqp.ReferencePattern; |
|
52 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
53 |
import org.txm.treetagger.core.preferences.TreeTaggerPreferences; |
|
54 |
import org.txm.utils.LangDetector; |
|
55 |
|
|
56 |
/** |
|
57 |
* Import the text in the Clipboard as a corpus. The loader used is the QuickLoader. |
|
58 |
* |
|
59 |
* The Clipboard is saved in the clipoard directory and then imported as TXT. |
|
60 |
* |
|
61 |
* @author mdecorde |
|
62 |
* |
|
63 |
*/ |
|
64 |
public class ImportSelectedText extends AbstractHandler { |
|
65 |
|
|
66 |
/** The nextclipcorpus. */ |
|
67 |
static public int nextclipcorpus = 1; |
|
68 |
|
|
69 |
/* (non-Javadoc) |
|
70 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
71 |
*/ |
|
72 |
@Override |
|
73 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
74 |
String result = org.txm.rcp.utils.IOClipboard.read(); |
|
75 |
if (result == null || result.length() == 0) { |
|
76 |
System.out.println("No copied text. Aborting."); |
|
77 |
return null; |
|
78 |
} |
|
79 |
System.out.println(TXMUIMessages.importClipboardText); |
|
80 |
|
|
81 |
try { |
|
82 |
String corpusName = TXMUIMessages.clipboard_2.toUpperCase()+(nextclipcorpus++); |
|
83 |
File wl = Toolbox.workspace.getLocation(); |
|
84 |
if (wl == null) { |
|
85 |
System.err.println("Error: Toolbox is not correctly initialized. Clipboard import aborted."); |
|
86 |
return null; |
|
87 |
} |
|
88 |
while (new File(wl, corpusName).exists()) { |
|
89 |
corpusName = TXMUIMessages.clipboard_2.toUpperCase()+(nextclipcorpus++); |
|
90 |
} |
|
91 |
importText(result, corpusName); |
|
92 |
|
|
93 |
} catch (Exception e) { |
|
94 |
// TODO Auto-generated catch block |
|
95 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
96 |
} |
|
97 |
return null; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Import text. |
|
102 |
* |
|
103 |
* @param text the text |
|
104 |
* @param corpusname the basename |
|
105 |
* @return the object |
|
106 |
* @throws Exception |
|
107 |
*/ |
|
108 |
public static Object importText(String text, String corpusname) throws Exception { |
|
109 |
corpusname = corpusname.toUpperCase(); |
|
110 |
if (text.length() == 0) { |
|
111 |
System.err.println(TXMUIMessages.clipboardIsEmpty); |
|
112 |
return null; |
|
113 |
} |
|
114 |
String txmhome = Toolbox.getTxmHomePath(); |
|
115 |
new File(txmhome, "clipboard").mkdir(); //$NON-NLS-1$ |
|
116 |
File clipboardDirectory = new File(txmhome, "clipboard/" + corpusname); //$NON-NLS-1$ |
|
117 |
|
|
118 |
if (CorpusManager.getCorpusManager().hasCorpus(clipboardDirectory.getName())) { |
|
119 |
Shell shell = new Shell(); |
|
120 |
boolean b = MessageDialog.openConfirm(shell, |
|
121 |
TXMUIMessages.confirm, NLS.bind(TXMUIMessages.theCorpusAndTheCorpusP0WillBeDeleted, clipboardDirectory.getName())); |
|
122 |
if (!b) |
|
123 |
return null; |
|
124 |
} |
|
125 |
|
|
126 |
org.txm.utils.DeleteDir.deleteDirectory(clipboardDirectory); |
|
127 |
clipboardDirectory.mkdirs(); |
|
128 |
|
|
129 |
File quicksrc = new File(clipboardDirectory, corpusname + ".txt"); //$NON-NLS-1$ |
|
130 |
try { |
|
131 |
Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(quicksrc)), "UTF-8"); //$NON-NLS-1$ |
|
132 |
writer.write(text.replace("\t", " ")); //$NON-NLS-1$ //$NON-NLS-2$ |
|
133 |
writer.close(); |
|
134 |
} catch (Exception e) { |
|
135 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
136 |
return null; |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
// configure project |
|
141 |
Workspace w = Toolbox.workspace; |
|
142 |
Project project = w.getProject(clipboardDirectory.getName()); |
|
143 |
if (project == null) { |
|
144 |
project = new Project(w, clipboardDirectory.getName()); |
|
145 |
} |
|
146 |
project.setSourceDirectory(clipboardDirectory.getAbsolutePath()); |
|
147 |
project.setImportModuleName("txt"); //$NON-NLS-1$ |
|
148 |
project.setEncoding("UTF-8"); //$NON-NLS-1$ |
|
149 |
project.getEditionDefinition("default").setBuildEdition(true); //$NON-NLS-1$ |
|
150 |
project.getCommandPreferences("concordance").set("view_reference_pattern", |
|
151 |
ReferencePattern.referenceToString(Arrays.asList("lbn"), null)); |
|
152 |
|
|
153 |
String lang = TBXPreferences.getInstance().getString(TBXPreferences.IMPORT_DEFAULT_LANG); |
|
154 |
if (lang.length() == 0) lang = Locale.getDefault().getLanguage(); |
|
155 |
if ("??".equals(lang)) { //$NON-NLS-1$ |
|
156 |
LangDetector detector = new LangDetector(quicksrc); |
|
157 |
lang = detector.getLang(); |
|
158 |
System.out.println(TXMCoreMessages.bind(TXMUIMessages.identifiedLanguage, lang)); |
|
159 |
} |
|
160 |
project.setLang(lang); //$NON-NLS-1$ |
|
161 |
System.out.println(TXMCoreMessages.bind(TXMUIMessages.usingLanguage, project.getLang())); |
|
162 |
|
|
163 |
String ttpath = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH); |
|
164 |
|
|
165 |
if (ttpath != null && ttpath.length() > 0 && new File(ttpath, "bin").isDirectory()) { |
|
166 |
project.setAnnotate(true); |
|
167 |
} |
|
168 |
|
|
169 |
ExecuteImportScript.executeScript(project); |
|
170 |
return null; |
|
171 |
} |
|
172 |
} |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/ImportClipboardText.java (revision 3441) | ||
---|---|---|
1 |
// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté |
|
2 |
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of |
|
3 |
// Lyon 2, University of Franche-Comté, University of Nice |
|
4 |
// Sophia Antipolis, University of Paris 3. |
|
5 |
// |
|
6 |
// The TXM platform is free software: you can redistribute it |
|
7 |
// and/or modify it under the terms of the GNU General Public |
|
8 |
// License as published by the Free Software Foundation, |
|
9 |
// either version 2 of the License, or (at your option) any |
|
10 |
// later version. |
|
11 |
// |
|
12 |
// The TXM platform is distributed in the hope that it will be |
|
13 |
// useful, but WITHOUT ANY WARRANTY; without even the implied |
|
14 |
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
15 |
// PURPOSE. See the GNU General Public License for more |
|
16 |
// details. |
|
17 |
// |
|
18 |
// You should have received a copy of the GNU General |
|
19 |
// Public License along with the TXM platform. If not, see |
|
20 |
// http://www.gnu.org/licenses. |
|
21 |
// |
|
22 |
// |
|
23 |
// |
|
24 |
// $LastChangedDate:$ |
|
25 |
// $LastChangedRevision:$ |
|
26 |
// $LastChangedBy:$ |
|
27 |
// |
|
28 |
package org.txm.rcp.commands; |
|
29 |
|
|
30 |
import java.io.BufferedOutputStream; |
|
31 |
import java.io.File; |
|
32 |
import java.io.FileOutputStream; |
|
33 |
import java.io.OutputStreamWriter; |
|
34 |
import java.io.Writer; |
|
35 |
import java.util.Arrays; |
|
36 |
import java.util.Locale; |
|
37 |
|
|
38 |
import org.eclipse.core.commands.AbstractHandler; |
|
39 |
import org.eclipse.core.commands.ExecutionEvent; |
|
40 |
import org.eclipse.core.commands.ExecutionException; |
|
41 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
42 |
import org.eclipse.osgi.util.NLS; |
|
43 |
import org.eclipse.swt.widgets.Shell; |
|
44 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
45 |
import org.txm.Toolbox; |
|
46 |
import org.txm.core.messages.TXMCoreMessages; |
|
47 |
import org.txm.core.preferences.TBXPreferences; |
|
48 |
import org.txm.objects.Project; |
|
49 |
import org.txm.objects.Workspace; |
|
50 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
|
51 |
import org.txm.rcp.messages.TXMUIMessages; |
|
52 |
import org.txm.rcp.swt.dialog.TextDialog; |
|
53 |
import org.txm.searchengine.cqp.ReferencePattern; |
|
54 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
|
55 |
import org.txm.treetagger.core.preferences.TreeTaggerPreferences; |
|
56 |
import org.txm.utils.LangDetector; |
|
57 |
|
|
58 |
/** |
|
59 |
* Import the text in the Clipboard as a corpus. The loader used is the QuickLoader. |
|
60 |
* |
|
61 |
* The Clipboard is saved in the clipoard directory and then imported as TXT. |
|
62 |
* |
|
63 |
* @author mdecorde |
|
64 |
* |
|
65 |
*/ |
|
66 |
public class ImportClipboardText extends AbstractHandler { |
|
67 |
|
|
68 |
/** The nextclipcorpus. */ |
|
69 |
static public int nextclipcorpus = 1; |
|
70 |
|
|
71 |
/* (non-Javadoc) |
|
72 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
|
73 |
*/ |
|
74 |
@Override |
|
75 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
76 |
String result = org.txm.rcp.utils.IOClipboard.read(); |
|
77 |
if (result == null || result.length() == 0) { |
|
78 |
System.out.println("No copied text. Aborting."); |
|
79 |
return null; |
|
80 |
} |
|
81 |
System.out.println(TXMUIMessages.importClipboardText); |
|
82 |
|
|
83 |
try { |
|
84 |
String corpusName = TXMUIMessages.clipboard_2.toUpperCase()+(nextclipcorpus++); |
|
85 |
File wl = Toolbox.workspace.getLocation(); |
|
86 |
if (wl == null) { |
|
87 |
System.err.println("Error: Toolbox is not correctly initialized. Clipboard import aborted."); |
|
88 |
return null; |
|
89 |
} |
|
90 |
while (new File(wl, corpusName).exists()) { |
|
91 |
corpusName = TXMUIMessages.clipboard_2.toUpperCase()+(nextclipcorpus++); |
|
92 |
} |
|
93 |
|
|
94 |
String lang = TBXPreferences.getInstance().getString(TBXPreferences.CLIPBOARD_IMPORT_DEFAULT_LANG); |
|
95 |
boolean askLang = TBXPreferences.getInstance().getBoolean(TBXPreferences.CLIPBOARD_IMPORT_ASK_LANG); |
|
96 |
TextDialog dialog = new TextDialog(HandlerUtil.getActiveShell(event), "Select the import language to use", "What language must be used to import the clipboard content?", lang); |
|
97 |
if (askLang) { |
|
98 |
if (dialog.open() == TextDialog.CANCEL) return null; |
|
99 |
lang = dialog.getText(); |
|
100 |
} |
|
101 |
importText(result, corpusName, lang); |
|
102 |
|
|
103 |
} catch (Exception e) { |
|
104 |
// TODO Auto-generated catch block |
|
105 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
106 |
} |
|
107 |
return null; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Import text. |
|
112 |
* |
|
113 |
* @param text the text |
|
114 |
* @param corpusname the basename |
|
115 |
* @return the object |
|
116 |
* @throws Exception |
|
117 |
*/ |
|
118 |
public static Object importText(String text, String corpusname, String lang) throws Exception { |
|
119 |
corpusname = corpusname.toUpperCase(); |
|
120 |
if (text.length() == 0) { |
|
121 |
System.err.println(TXMUIMessages.clipboardIsEmpty); |
|
122 |
return null; |
|
123 |
} |
|
124 |
String txmhome = Toolbox.getTxmHomePath(); |
|
125 |
new File(txmhome, "clipboard").mkdir(); //$NON-NLS-1$ |
|
126 |
File clipboardDirectory = new File(txmhome, "clipboard/" + corpusname); //$NON-NLS-1$ |
|
127 |
|
|
128 |
if (CorpusManager.getCorpusManager().hasCorpus(clipboardDirectory.getName())) { |
|
129 |
Shell shell = new Shell(); |
|
130 |
boolean b = MessageDialog.openConfirm(shell, |
|
131 |
TXMUIMessages.confirm, NLS.bind(TXMUIMessages.theCorpusAndTheCorpusP0WillBeDeleted, clipboardDirectory.getName())); |
|
132 |
if (!b) { |
|
133 |
return null; |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
org.txm.utils.DeleteDir.deleteDirectory(clipboardDirectory); |
|
138 |
clipboardDirectory.mkdirs(); |
|
139 |
|
|
140 |
File quicksrc = new File(clipboardDirectory, corpusname + ".txt"); //$NON-NLS-1$ |
|
141 |
try { |
|
142 |
Writer writer = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(quicksrc)), "UTF-8"); //$NON-NLS-1$ |
|
143 |
writer.write(text.replace("\t", " ")); //$NON-NLS-1$ //$NON-NLS-2$ |
|
144 |
writer.close(); |
|
145 |
} catch (Exception e) { |
|
146 |
org.txm.utils.logger.Log.printStackTrace(e); |
|
147 |
return null; |
|
148 |
} |
|
149 |
|
|
150 |
// configure project |
|
151 |
Workspace w = Toolbox.workspace; |
|
152 |
Project project = w.getProject(clipboardDirectory.getName()); |
|
153 |
if (project == null) { |
|
154 |
project = new Project(w, clipboardDirectory.getName()); |
|
155 |
} |
|
156 |
project.setSourceDirectory(clipboardDirectory.getAbsolutePath()); |
|
157 |
project.setImportModuleName("txt"); //$NON-NLS-1$ |
|
158 |
project.setEncoding("UTF-8"); //$NON-NLS-1$ |
|
159 |
project.getEditionDefinition("default").setBuildEdition(true); //$NON-NLS-1$ |
|
160 |
project.getCommandPreferences("concordance").set("view_reference_pattern", |
|
161 |
ReferencePattern.referenceToString(Arrays.asList("lbn"), null)); |
|
162 |
|
|
163 |
if (lang.length() == 0) lang = Locale.getDefault().getLanguage(); |
|
164 |
if ("??".equals(lang)) { //$NON-NLS-1$ |
|
165 |
LangDetector detector = new LangDetector(quicksrc); |
|
166 |
lang = detector.getLang(); |
|
167 |
System.out.println(TXMCoreMessages.bind(TXMUIMessages.identifiedLanguage, lang)); |
|
168 |
} |
|
169 |
project.setLang(lang); //$NON-NLS-1$ |
|
170 |
System.out.println(TXMCoreMessages.bind(TXMUIMessages.usingLanguage, project.getLang())); |
|
171 |
|
|
172 |
String ttpath = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH); |
|
173 |
|
|
174 |
if (ttpath != null && ttpath.length() > 0 && new File(ttpath, "bin").isDirectory()) { |
|
175 |
project.setAnnotate(true); |
|
176 |
} |
|
177 |
|
|
178 |
ExecuteImportScript.executeScript(project); |
|
179 |
return null; |
|
180 |
} |
|
181 |
} |
|
0 | 182 |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java (revision 3441) | ||
---|---|---|
9 | 9 |
import org.eclipse.core.runtime.IProgressMonitor; |
10 | 10 |
import org.eclipse.core.runtime.IStatus; |
11 | 11 |
import org.eclipse.core.runtime.Status; |
12 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
13 | 12 |
import org.eclipse.jface.viewers.ISelection; |
14 | 13 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 |
import org.eclipse.jface.window.Window; |
|
15 | 15 |
import org.eclipse.osgi.util.NLS; |
16 | 16 |
import org.eclipse.swt.widgets.Display; |
17 | 17 |
import org.eclipse.ui.handlers.HandlerUtil; |
18 | 18 |
import org.txm.core.preferences.TBXPreferences; |
19 | 19 |
import org.txm.objects.Project; |
20 | 20 |
import org.txm.rcp.commands.CloseEditorsUsing; |
21 |
import org.txm.rcp.commands.OpenImportForm; |
|
21 | 22 |
import org.txm.rcp.commands.RestartTXM; |
23 |
import org.txm.rcp.swt.dialog.UpdateCorpusDialog; |
|
22 | 24 |
import org.txm.rcp.utils.JobHandler; |
23 | 25 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
24 | 26 |
import org.txm.utils.logger.Log; |
... | ... | |
40 | 42 |
} |
41 | 43 |
MainCorpus corpus = (MainCorpus) s; |
42 | 44 |
|
43 |
boolean updateEdition = false; |
|
45 |
UpdateCorpusDialog dialog = new UpdateCorpusDialog(HandlerUtil.getActiveShell(event)); |
|
46 |
dialog.setDoUpdateEdition(TBXPreferences.getInstance().getBoolean(TBXPreferences.UPDATEEDITIONS)); |
|
47 |
dialog.setDoForceUpdate("true".equals(event.getParameter("org.txm.rcp.commands.workspace.UpdateCorpus.force"))); |
|
44 | 48 |
|
45 |
// force corpus to be recomputed |
|
46 |
String forceDirty = event.getParameter("org.txm.rcp.commands.workspace.UpdateCorpus.force"); //$NON-NLS-1$ |
|
47 |
if ("true".equals(forceDirty)) { |
|
48 |
corpus.getProject().setDirty(); |
|
49 |
updateEdition = true; |
|
49 |
if (dialog.open() != Window.OK) { |
|
50 |
return null; |
|
51 |
} |
|
52 |
|
|
53 |
if (dialog.getDoOpenCorpusParameters()) { |
|
54 |
|
|
55 |
corpus.getProject().setDoUpdate(true, dialog.getDoUpdateEdition()); |
|
56 |
if (dialog.getDoForceUpdate()) { |
|
57 |
corpus.getProject().setDirty(); |
|
58 |
} |
|
59 |
OpenImportForm.open(null, true); |
|
50 | 60 |
} else { |
51 |
if (corpus.getProject().getBuiltEditionNames().size() > 0) { |
|
52 |
updateEdition = MessageDialog.openQuestion(HandlerUtil.getActiveShell(event), "Update editions", "Do you want to update the edition pages as well ?"); |
|
53 |
} else { |
|
54 |
updateEdition = false; // no edition to do, skip the pager step when updating |
|
55 |
} |
|
61 |
|
|
62 |
update(corpus, dialog.getDoForceUpdate(), dialog.getDoUpdateEdition()); |
|
56 | 63 |
} |
57 | 64 |
|
58 |
update(corpus, updateEdition); |
|
59 |
|
|
60 | 65 |
return corpus; |
61 | 66 |
} |
62 | 67 |
|
63 | 68 |
public static JobHandler update(final MainCorpus corpus) { |
64 |
return update(corpus, TBXPreferences.getInstance().getBoolean(TBXPreferences.UPDATEEDITIONS)); |
|
69 |
return update(corpus, false, TBXPreferences.getInstance().getBoolean(TBXPreferences.UPDATEEDITIONS));
|
|
65 | 70 |
} |
66 | 71 |
|
67 |
public static JobHandler update(final MainCorpus corpus, boolean updateEdition) { |
|
72 |
public static JobHandler update(final MainCorpus corpus, boolean forceUpdate, boolean updateEdition) {
|
|
68 | 73 |
|
69 | 74 |
final Project project = corpus.getProject(); |
70 | 75 |
if (project == null) return null; |
71 | 76 |
|
77 |
if (forceUpdate) { |
|
78 |
project.setDirty(); |
|
79 |
} |
|
80 |
|
|
72 | 81 |
// String iname = project.getImportModuleName(); |
73 | 82 |
// if (!iname.matches("xtz|txt|hyperbase|discours|cnr|alceste|xml|xmltxm")) { |
74 | 83 |
// System.out.println("Can't update a CQP corpus not imported with one of the XTZ, TXT, XML, XML-TXM, CNRS, Alceste, Hyperbase import modules."); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenImportForm.java (revision 3441) | ||
---|---|---|
39 | 39 |
import org.txm.rcp.editors.imports.ImportFormEditor; |
40 | 40 |
import org.txm.rcp.editors.input.ImportFormEditorInput; |
41 | 41 |
|
42 |
// TODO: Auto-generated Javadoc |
|
43 | 42 |
/** |
44 |
* Open a file in the TxtEditor @ author mdecorde. |
|
43 |
* Open the import form |
|
44 |
* |
|
45 |
* @author mdecorde. |
|
45 | 46 |
*/ |
46 | 47 |
public class OpenImportForm extends AbstractHandler { |
47 | 48 |
|
... | ... | |
54 | 55 |
@Override |
55 | 56 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
56 | 57 |
|
57 |
String filename = event.getParameter("org.txm.rcp.commands.importscript"); //$NON-NLS-1$ |
|
58 |
openfile(filename); |
|
58 |
File script = null; |
|
59 |
if (event.getParameters().containsKey("org.txm.rcp.commands.importscript")) { |
|
60 |
String filename = event.getParameter("org.txm.rcp.commands.importscript"); //$NON-NLS-1$ |
|
61 |
script = new File (filename); |
|
62 |
} |
|
63 |
Boolean updateMode = "true".equals(event.getParameter("org.txm.rcp.commands.importupdatemode")); //$NON-NLS-1$ |
|
64 |
open(script, updateMode); |
|
59 | 65 |
return null; |
60 | 66 |
} |
61 | 67 |
|
... | ... | |
64 | 70 |
* |
65 | 71 |
* @param filepath the filepath |
66 | 72 |
*/ |
67 |
static public void openfile(String filepath) {
|
|
73 |
static public void open(File scriptname, boolean updateMode) {
|
|
68 | 74 |
try { |
69 |
ImportFormEditorInput editorInput = new ImportFormEditorInput(new File(filepath)); |
|
75 |
ImportFormEditorInput editorInput = new ImportFormEditorInput(scriptname); |
|
76 |
editorInput.setUpdateMode(updateMode); |
|
70 | 77 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
71 | 78 |
IWorkbenchPage page = window.getActivePage(); |
72 | 79 |
IEditorPart a = page.openEditor(editorInput, ImportFormEditor.ID, true); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 3441) | ||
---|---|---|
74 | 74 |
import org.eclipse.ui.part.ViewPart; |
75 | 75 |
import org.txm.Toolbox; |
76 | 76 |
import org.txm.core.results.TXMResult; |
77 |
import org.txm.objects.CorpusBuild; |
|
77 | 78 |
import org.txm.objects.Project; |
78 | 79 |
import org.txm.objects.Workspace; |
79 | 80 |
import org.txm.rcp.CorporaSourceProvider; |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java (revision 3441) | ||
---|---|---|
86 | 86 |
@Override |
87 | 87 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
88 | 88 |
String filename = null, filepath = null; |
89 |
if (event.getParameters().containsKey("org.txm.rcp.commands.commandParameter3")) { |
|
90 |
filename = event.getParameter("org.txm.rcp.commands.commandParameter3"); //$NON-NLS-1$ |
|
89 |
File script = null; |
|
90 |
Boolean updateMode = false; |
|
91 |
if (event.getParameters().containsKey("org.txm.rcp.commands.importscript")) { |
|
92 |
filename = event.getParameter("org.txm.rcp.commands.importscript"); //$NON-NLS-1$ |
|
91 | 93 |
filepath = "scripts/groovy/user/org/txm/scripts/importer/" + filename; //$NON-NLS-1$ |
92 | 94 |
} |
95 |
else if (event.getParameters().containsKey("org.txm.rcp.commands.usecorporaselection")) { |
|
96 |
boolean useCorporaSelection = "true".equals(event.getParameter("org.txm.rcp.commands.usecorporaselection")); //$NON-NLS-1$ |
|
97 |
//filepath = "scripts/groovy/user/org/txm/scripts/importer/" + filename; //$NON-NLS-1$ |
|
98 |
} |
|
93 | 99 |
else { |
94 | 100 |
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); |
95 | 101 |
FileDialog dialog = new FileDialog(shell, SWT.SAVE); |
96 | 102 |
dialog.setFilterPath(Toolbox.getTxmHomePath() + "/scripts/groovy/user/org/txm/scripts/importer"); |
97 | 103 |
filepath = dialog.open(); |
104 |
|
|
105 |
if (filepath == null) { |
|
106 |
Log.warning("No Groovy entry point script selected. Aborted.);"); |
|
107 |
return null; |
|
108 |
} |
|
109 |
script = new File(filepath); |
|
98 | 110 |
} |
99 | 111 |
|
100 |
if (filepath == null) return null; |
|
112 |
if (event.getParameters().containsKey("org.txm.rcp.commands.importupdatemode")) { |
|
113 |
updateMode = "true".equals(event.getParameter("org.txm.rcp.commands.importupdatemode")); |
|
114 |
} |
|
101 | 115 |
|
102 |
OpenImportForm.openfile(filepath);
|
|
116 |
OpenImportForm.open(script, updateMode);
|
|
103 | 117 |
return null; |
104 | 118 |
} |
105 | 119 |
|
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/ImportPreferencePage.java (revision 3441) | ||
---|---|---|
57 | 57 |
/** The txtseparators. */ |
58 | 58 |
private ComboFieldEditor txtseparators; |
59 | 59 |
|
60 |
private BooleanFieldEditor askdefaultlang; |
|
61 |
|
|
60 | 62 |
private StringFieldEditor defaultlang; |
61 | 63 |
|
62 | 64 |
private StringFieldEditor empty_code; |
... | ... | |
135 | 137 |
rlayout.marginHeight = 5; |
136 | 138 |
langGroup.setLayout(rlayout); |
137 | 139 |
|
138 |
defaultlang = new StringFieldEditor(TBXPreferences.IMPORT_DEFAULT_LANG, TXMUIMessages.defaultLanguage, langGroup); |
|
140 |
defaultlang = new StringFieldEditor(TBXPreferences.CLIPBOARD_IMPORT_DEFAULT_LANG, TXMUIMessages.defaultLanguage, langGroup);
|
|
139 | 141 |
defaultlang.setEmptyStringAllowed(false); |
140 | 142 |
|
143 |
askdefaultlang = new BooleanFieldEditor(TBXPreferences.CLIPBOARD_IMPORT_ASK_LANG, "Ask lang when importing from clipboard", langGroup); |
|
144 |
|
|
141 | 145 |
Label l = new Label(langGroup, SWT.NONE); |
142 | 146 |
l.setText(TXMUIMessages.noteColonUseValueToGuess); |
143 | 147 |
GridData ldata = new GridData(SWT.FILL, SWT.FILL, true, false); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/RCPPreferences.java (revision 3441) | ||
---|---|---|
38 | 38 |
* To auto compute result and refresh editor when a form computing parameter is modified. |
39 | 39 |
*/ |
40 | 40 |
public static final String AUTO_UPDATE_EDITOR = "auto_update_editor"; //$NON-NLS-1$ |
41 |
|
|
42 |
public static final String AUTO_UPDATE_SUBRESULTS = "auto_update_subresults"; //$NON-NLS-1$ |
|
41 | 43 |
// public static final String AUTO_COMPUTE_ON_EDITOR_OPEN = "auto_compute_editor"; //$NON-NLS-1$ |
42 | 44 |
|
43 | 45 |
public static final String SHOW_SEVERE_DIALOG = "show_severe_dialog"; |
... | ... | |
88 | 90 |
preferences.put(UPDATE_LEVEL, "STABLE"); //$NON-NLS-1$ |
89 | 91 |
|
90 | 92 |
preferences.putBoolean(AUTO_UPDATE_EDITOR, false); |
93 |
preferences.putBoolean(AUTO_UPDATE_SUBRESULTS, false); |
|
91 | 94 |
// preferences.putBoolean(AUTO_COMPUTE_ON_EDITOR_OPEN, true); |
92 | 95 |
preferences.putBoolean(SHOW_SEVERE_DIALOG, false); |
93 | 96 |
preferences.putBoolean(USER_ALERT_DELETE, false); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/preferences/UserPreferencePage.java (revision 3441) | ||
---|---|---|
58 | 58 |
this.addField(new BooleanFieldEditor(RCPPreferences.AUTO_UPDATE_EDITOR, TXMUIMessages.automaticRecomputingWhenChangingAParameter, BooleanFieldEditor.SEPARATE_LABEL, this |
59 | 59 |
.getFieldEditorParent())); |
60 | 60 |
|
61 |
// Auto compute the result when a parameter changes |
|
62 |
this.addField(new BooleanFieldEditor(RCPPreferences.AUTO_UPDATE_SUBRESULTS, "Automatically update sub-results", BooleanFieldEditor.SEPARATE_LABEL, this.getFieldEditorParent())); |
|
63 |
|
|
61 | 64 |
// this.addField(new BooleanFieldEditor(RCPPreferences.AUTO_COMPUTE_ON_EDITOR_OPEN, "Compute when opening its window", BooleanFieldEditor.SEPARATE_LABEL, this.getFieldEditorParent())); |
62 | 65 |
|
63 | 66 |
// Auto save each result after computing and auto load them at startup |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 3441) | ||
---|---|---|
85 | 85 |
|
86 | 86 |
allCriteria = Tous les critères ensembles (&&) |
87 | 87 |
|
88 |
alwaysSaveBeforeLaunching = Toujours sauvegarder avant de lancer
|
|
88 |
alwaysSaveBeforeLaunching = Toujours enregistrer avant de lancer
|
|
89 | 89 |
|
90 | 90 |
ampContextsDisplayOptions = Options d'affichage des &contextes |
91 | 91 |
|
... | ... | |
149 | 149 |
|
150 | 150 |
cannotReadTheFileP0 = ** Impossible de lire le fichier {0}. |
151 | 151 |
|
152 |
cannotSaveImportConfigurationNoSourceFolderSelected = ** Impossible de sauvegarder les paramètres d'import : pas de dossier source sélectionné.
|
|
152 |
cannotSaveImportConfigurationNoSourceFolderSelected = ** Impossible d'enregistrer les paramètres d'import : pas de dossier source sélectionné.
|
|
153 | 153 |
|
154 | 154 |
cannotStartImportConfigurationNoSourceFolderSelected = ** Impossible de commencer l'import : pas de dossier source sélectionné. |
155 | 155 |
|
... | ... | |
231 | 231 |
|
232 | 232 |
copiedLinesColon = Lignes copiées : \n{0} |
233 | 233 |
|
234 |
corporaBackupedColonP0 = Corpus sauvegardés dans : {0}.
|
|
234 |
corporaBackupedColonP0 = Corpus enregistré dans : {0}.
|
|
235 | 235 |
|
236 | 236 |
corporaOfPreviousTXMP0 = Corpus de la version précédente de TXM {0} |
237 | 237 |
|
... | ... | |
249 | 249 |
|
250 | 250 |
corpusNameOnlyCapsAndNoDigitAtBeginning = Nom du corpus* (majuscules, pas de chiffre au début) |
251 | 251 |
|
252 |
couldNotCreateBackupDirectoryColon = ** Échec : le dossier de sauvegarde des corpus {0} n''a pas pu être créé.
|
|
252 |
couldNotCreateBackupDirectoryColon = ** Échec : le dossier d'enregistrement des corpus {0} n''a pas pu être créé.
|
|
253 | 253 |
|
254 | 254 |
couldNotFindDirectoryColonP0 = ** Répertoire {0} introuvable |
255 | 255 |
|
... | ... | |
331 | 331 |
|
332 | 332 |
doneTheCreatedBinaryFileIsP0 = Terminé, le fichier binaire créé est {0} |
333 | 333 |
|
334 |
dontSaveAndRun = Ne pas sauver et lancer
|
|
334 |
dontSaveAndRun = Ne pas enregistrer et lancer
|
|
335 | 335 |
|
336 | 336 |
downloading = Téléchargement en cours... |
337 | 337 |
|
... | ... | |
349 | 349 |
|
350 | 350 |
elisionCharacters = Caractères d'élision |
351 | 351 |
|
352 |
enableAutomaticSaveOfAllResultsPersistence = Sauvegarder tous les résultats par défaut (persistance)
|
|
352 |
enableAutomaticSaveOfAllResultsPersistence = Enregistrer tous les résultats par défaut (persistance)
|
|
353 | 353 |
|
354 | 354 |
endOfColumnMerge = Fin de la fusion des colonnes. |
355 | 355 |
|
... | ... | |
459 | 459 |
|
460 | 460 |
extractingBinaryCorpus = Extraction du corpus binaire |
461 | 461 |
|
462 |
failedToBackupExistingCorporaColon = ** Impossible de sauvegarder les corpus existants : {0}.
|
|
462 |
failedToBackupExistingCorporaColon = ** Impossible d'enregistrer les corpus existants : {0}.
|
|
463 | 463 |
|
464 | 464 |
failedToCancel = Impossible d'annuler |
465 | 465 |
|
... | ... | |
491 | 491 |
|
492 | 492 |
failedToRename = ** Échec du renommage |
493 | 493 |
|
494 |
failedToSaveAs = ** Échec de la sauvegarde du fichier {0} (erreur : {1}).
|
|
494 |
failedToSaveAs = ** Échec de l'enregistrement du fichier {0} (erreur : {1}).
|
|
495 | 495 |
|
496 |
failedToSavePreferencesColonP0 = ** Échec de la sauvegarde des préférences : {0}.
|
|
496 |
failedToSavePreferencesColonP0 = ** Échec de l'enregistrement des préférences : {0}.
|
|
497 | 497 |
|
498 | 498 |
fileColon = Fichier : |
499 | 499 |
|
... | ... | |
853 | 853 |
|
854 | 854 |
sampleCorporaOfCurrentTXMP0 = Corpus exemples de la version courante de TXM {0} |
855 | 855 |
|
856 |
saveAndRun = Sauver et lancer
|
|
856 |
saveAndRun = Enregistrer et lancer
|
|
857 | 857 |
|
858 | 858 |
saveBeforeExecution = Enregistrer avant l'exécution ? |
859 | 859 |
|
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportFormEditor.java (revision 3441) | ||
---|---|---|
42 | 42 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
43 | 43 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
44 | 44 |
import org.txm.Toolbox; |
45 |
import org.txm.objects.CorpusBuild; |
|
46 |
import org.txm.objects.Project; |
|
45 | 47 |
import org.txm.rcp.editors.input.ImportFormEditorInput; |
46 | 48 |
import org.txm.rcp.messages.TXMUIMessages; |
49 |
import org.txm.rcp.views.corpora.CorporaView; |
|
47 | 50 |
|
48 | 51 |
/** |
49 | 52 |
* display&edit the import parameters |
... | ... | |
54 | 57 |
/** The Constant ID. */ |
55 | 58 |
public static final String ID = "org.txm.rcp.editors.imports.ImportFormEditor"; //$NON-NLS-1$ |
56 | 59 |
|
57 |
/** The groovyscript. */
|
|
58 |
private File groovyscript;
|
|
60 |
/** The import Name to run. */
|
|
61 |
private String importName;
|
|
59 | 62 |
|
60 | 63 |
/** The toolkit. */ |
61 | 64 |
private FormToolkit toolkit; |
... | ... | |
70 | 73 |
MetadataPage meta; |
71 | 74 |
|
72 | 75 |
private ImportFormEditorInput finput; |
76 |
|
|
77 |
private Boolean updateMode; |
|
73 | 78 |
|
79 |
protected Project project; |
|
80 |
|
|
74 | 81 |
/** |
75 | 82 |
* Instantiates a new import form editor. |
76 | 83 |
*/ |
... | ... | |
129 | 136 |
setInput(input); |
130 | 137 |
finput = ((ImportFormEditorInput) input); |
131 | 138 |
String txmhome = Toolbox.getTxmHomePath(); |
139 |
|
|
132 | 140 |
File f = finput.getGroovyFile(); |
133 |
String filepath = f.getPath(); |
|
134 |
this.setGroovyscript(new File(txmhome, filepath)); |
|
141 |
if (f != null) { |
|
142 |
String filepath = f.getPath(); |
|
143 |
String importName = ImportModuleCustomization.getName(new File(txmhome, filepath).getName()); |
|
144 |
this.setImportName(importName); |
|
145 |
} else { // use the corpora view selection |
|
146 |
|
|
147 |
Object o = CorporaView.getFirstSelectedObject(); |
|
148 |
|
|
149 |
if (o instanceof CorpusBuild) { |
|
150 |
o = ((CorpusBuild)o).getProject(); |
|
151 |
} |
|
152 |
|
|
153 |
if (o instanceof Project) { |
|
154 |
Project p = (Project)o; |
|
155 |
this.setImportName(p.getImportModuleName()); |
|
156 |
this.project = p; |
|
157 |
} |
|
158 |
} |
|
135 | 159 |
|
160 |
this.setUpdateMode(finput.getUpdateMode()); |
|
161 |
|
|
162 |
|
|
163 |
|
|
136 | 164 |
//ExecuteImportScript.getImportScriptFromToolboxPlugin(getGroovyscript()); // always update if script from Toolbox is more recent |
137 | 165 |
|
138 |
if (!getGroovyscript().exists()) // just a warning message |
|
139 |
System.out.println(NLS.bind(TXMUIMessages.warningColonTheImportScriptIsMissingColonP0, getGroovyscript())); |
|
166 |
// if (!getGroovyscript().exists()) // just a warning message
|
|
167 |
// System.out.println(NLS.bind(TXMUIMessages.warningColonTheImportScriptIsMissingColonP0, getGroovyscript()));
|
|
140 | 168 |
} |
141 | 169 |
|
170 |
public void setUpdateMode(Boolean updateMode) { |
|
171 |
|
|
172 |
this.updateMode = updateMode; |
|
173 |
} |
|
174 |
|
|
175 |
public Boolean getUpdateMode() { |
|
176 |
|
|
177 |
return this.updateMode; |
|
178 |
} |
|
179 |
|
|
142 | 180 |
/** |
143 | 181 |
* Checks if is dirty. |
144 | 182 |
* |
... | ... | |
191 | 229 |
*/ |
192 | 230 |
@Override |
193 | 231 |
public String getPartName() { |
194 |
if (main != null && main.getProject() != null) { |
|
195 |
return TXMUIMessages.bind(TXMUIMessages.p0ImportWithP1,main.getProject().getName(),ImportModuleCustomization.getName(groovyscript.getName())); |
|
232 |
|
|
233 |
if (main != null && project != null) { |
|
234 |
if (updateMode) { |
|
235 |
return TXMUIMessages.bind("Update {0} ({1} import)", project.getName(), importName); |
|
236 |
} else { |
|
237 |
return TXMUIMessages.bind(TXMUIMessages.p0ImportWithP1, project.getName(), importName); |
|
238 |
} |
|
196 | 239 |
} else { |
197 |
return TXMUIMessages.bind(TXMUIMessages.p0Import,ImportModuleCustomization.getName(groovyscript.getName()));
|
|
240 |
return TXMUIMessages.bind(TXMUIMessages.p0Import, importName);
|
|
198 | 241 |
} |
199 | 242 |
} |
200 | 243 |
|
... | ... | |
223 | 266 |
return meta; |
224 | 267 |
} |
225 | 268 |
|
226 |
/** |
|
227 |
* Gets the groovy script. |
|
228 |
* |
|
229 |
* @return the groovy script |
|
230 |
*/ |
|
231 |
public File getGroovyScript() { |
|
232 |
return getGroovyscript(); |
|
269 |
public String getImportName() { |
|
270 |
return importName; |
|
233 | 271 |
} |
234 |
|
|
235 |
/** |
|
236 |
* @return the groovyscript |
|
237 |
*/ |
|
238 |
public File getGroovyscript() { |
|
239 |
return groovyscript; |
|
272 |
|
|
273 |
public void setImportName(String importName) { |
|
274 |
this.importName = importName; |
|
240 | 275 |
} |
241 |
|
|
242 |
/** |
|
243 |
* @param groovyscript the groovyscript to set |
|
244 |
*/ |
|
245 |
public void setGroovyscript(File groovyscript) { |
|
246 |
this.groovyscript = groovyscript; |
|
247 |
} |
|
248 | 276 |
} |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/CommandsSection.java (revision 3441) | ||
---|---|---|
122 | 122 |
} |
123 | 123 |
} |
124 | 124 |
else { |
125 |
if ("txtLoader.groovy".equals(editor.getGroovyscript().getName())) {
|
|
125 |
if ("txt".equals(editor.getImportName())) {
|
|
126 | 126 |
referencePatternText.setText("text_id,l_n"); |
127 | 127 |
referencePatternProperties.setText("%s, %s"); |
128 | 128 |
} else { |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/sections/EditionSection.java (revision 3441) | ||
---|---|---|
57 | 57 |
* @param stylesave |
58 | 58 |
* |
59 | 59 |
* @param moduleParams |
60 |
* @param scriptName temporary parameter to detect if import module is xtzLoader.groovy
|
|
60 |
* @param importName temporary parameter to detect if import module is xtzLoader.groovy
|
|
61 | 61 |
*/ |
62 |
public EditionSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style, HashMap<String, Boolean> moduleParams, String scriptName) {
|
|
62 |
public EditionSection(ImportFormEditor editor, FormToolkit toolkit2, ScrolledForm form2, Composite parent, int style, HashMap<String, Boolean> moduleParams, String importName) {
|
|
63 | 63 |
super(editor, toolkit2, form2, parent, style, "edition"); |
64 | 64 |
|
65 | 65 |
this.section.setText(TXMUIMessages.editions); |
... | ... | |
128 | 128 |
pageBreakText.setLayoutData(gdata); |
129 | 129 |
} |
130 | 130 |
|
131 |
if (scriptName.startsWith("xtz")) {
|
|
131 |
if (importName.startsWith("xtz")) {
|
|
132 | 132 |
|
133 | 133 |
Label tmpLabel3 = toolkit.createLabel(sectionClient, "Note elements"); |
134 | 134 |
tmpLabel3.setToolTipText("Note elements that encodes ponctual notes"); |
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 3441) | ||
---|---|---|
60 | 60 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
61 | 61 |
import org.txm.objects.Project; |
62 | 62 |
import org.txm.rcp.IImageKeys; |
63 |
import org.txm.rcp.commands.workspace.UpdateCorpus; |
|
63 | 64 |
import org.txm.rcp.corpuswizard.ImportWizard; |
64 | 65 |
import org.txm.rcp.editors.imports.sections.CommandsSection; |
65 | 66 |
import org.txm.rcp.editors.imports.sections.EditionSection; |
... | ... | |
76 | 77 |
import org.txm.rcp.handlers.scripts.ExecuteImportScript; |
77 | 78 |
import org.txm.rcp.messages.TXMUIMessages; |
78 | 79 |
import org.txm.rcp.utils.SWTEditorsUtils; |
80 |
import org.txm.searchengine.cqp.corpus.MainCorpus; |
|
79 | 81 |
import org.txm.utils.logger.Log; |
80 | 82 |
import org.xml.sax.SAXException; |
81 | 83 |
|
... | ... | |
146 | 148 |
|
147 | 149 |
TableViewer pattributesViewer; |
148 | 150 |
|
149 |
private Project project; |
|
151 |
//private Project project;
|
|
150 | 152 |
|
151 | 153 |
/** |
152 | 154 |
* Instantiates a new main page. |
... | ... | |
160 | 162 |
} |
161 | 163 |
|
162 | 164 |
private int createEditionsSection() { |
163 |
editionSection = new EditionSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams, editor.getGroovyScript().getName());
|
|
165 |
editionSection = new EditionSection(editor, toolkit, form, form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, moduleParams, editor.getImportName());
|
|
164 | 166 |
return editionSection.getSectionSize(); |
165 | 167 |
} |
166 | 168 |
|
... | ... | |
199 | 201 |
|
200 | 202 |
createToolbar(); |
201 | 203 |
|
202 |
String importName = editor.getGroovyscript().getName();
|
|
204 |
String importName = editor.getImportName();
|
|
203 | 205 |
moduleParams = ImportModuleCustomization.getParameters(importName); |
204 | 206 |
|
205 | 207 |
// CREATE THE SECTIONS |
... | ... | |
263 | 265 |
|
264 | 266 |
form.layout(true); |
265 | 267 |
managedForm.reflow(true); |
268 |
|
|
269 |
if (editor.project != null) { // the project is already set, all the select sources widget are disable |
|
270 |
initializeProjectSettings(); |
|
271 |
} |
|
266 | 272 |
} |
267 | 273 |
|
268 | 274 |
private int createTextualPlansSection() { |
... | ... | |
281 | 287 |
} |
282 | 288 |
|
283 | 289 |
private int createAdditionalSection() { |
284 |
String importName = editor.getGroovyscript().getName(); |
|
290 |
String importName = editor.getImportName(); |
|
291 |
|
|
285 | 292 |
if (ImportModuleCustomization.getAdditionalSection(importName) != null) { |
286 | 293 |
Class<? extends ImportEditorSection> clazz = ImportModuleCustomization.getAdditionalSection(importName); |
287 | 294 |
|
... | ... | |
733 | 740 |
|
734 | 741 |
Label titleLabel = toolkit.createLabel(hyperlinks, "", SWT.WRAP); //$NON-NLS-1$ |
735 | 742 |
titleLabel.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP)); |
736 |
titleLabel.setText(NLS.bind(TXMUIMessages.importParametersOfP0, |
|
737 |
ImportModuleCustomization.getName(editor.getGroovyScript().getName()))); |
|
743 |
titleLabel.setText(NLS.bind(TXMUIMessages.importParametersOfP0, editor.getImportName())); |
|
738 | 744 |
FontData[] fD = titleLabel.getFont().getFontData(); |
739 | 745 |
fD[0].setHeight(16); |
740 | 746 |
titleLabel.setFont(new Font(titleLabel.getDisplay(), fD[0])); |
741 | 747 |
|
742 |
HyperlinkAdapter selectDirHListener = new HyperlinkAdapter() { |
|
743 |
|
|
744 |
@Override |
|
745 |
public void linkActivated(HyperlinkEvent e) { |
|
746 |
// System.out.println("Opening..."); |
|
747 |
selectSourceDir(); |
|
748 |
} |
|
749 |
}; |
|
748 |
HyperlinkAdapter selectDirHListener = null; |
|
749 |
if (editor.project == null) { |
|
750 |
selectDirHListener = new HyperlinkAdapter() { |
|
751 |
|
|
752 |
@Override |
|
753 |
public void linkActivated(HyperlinkEvent e) { |
|
754 |
// System.out.println("Opening..."); |
|
755 |
selectSourceDir(); |
|
756 |
} |
|
757 |
}; |
|
758 |
} |
|
750 | 759 |
|
751 | 760 |
HyperlinkAdapter saveHListener = new HyperlinkAdapter() { |
752 | 761 |
|
753 | 762 |
@Override |
754 | 763 |
public void linkActivated(HyperlinkEvent e) { |
755 |
if (project != null) { |
|
764 |
if (editor.project != null) {
|
|
756 | 765 |
saveConfig(); |
757 | 766 |
} |
758 | 767 |
else { |
... | ... | |
766 | 775 |
@Override |
767 | 776 |
public void linkActivated(HyperlinkEvent e) { |
768 | 777 |
// System.out.println("Starting..."); |
769 |
if (project != null) { |
|
770 |
project.setDirty(); |
|
778 |
if (editor.project != null) {
|
|
779 |
editor.project.setDirty();
|
|
771 | 780 |
if (saveConfig()) { |
772 | 781 |
startImport(); |
773 | 782 |
} |
... | ... | |
778 | 787 |
} |
779 | 788 |
}; |
780 | 789 |
|
781 |
ImageHyperlink openImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
|
782 |
openImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
|
783 |
openImportLink.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
|
784 |
openImportLink.addHyperlinkListener(selectDirHListener); |
|
790 |
if (editor.project == null) { |
|
791 |
ImageHyperlink openImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
|
792 |
openImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
|
793 |
openImportLink.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
|
794 |
openImportLink.addHyperlinkListener(selectDirHListener); |
|
795 |
} |
|
785 | 796 |
|
786 | 797 |
ImageHyperlink saveImportLink = toolkit.createImageHyperlink(hyperlinks, SWT.NULL); |
787 | 798 |
saveImportLink.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); |
... | ... | |
793 | 804 |
startImportLink.setImage(IImageKeys.getImage(IImageKeys.START)); |
794 | 805 |
startImportLink.addHyperlinkListener(startImportListener); |
795 | 806 |
|
807 |
int n = 1; |
|
808 |
if (editor.project == null) { |
|
809 |
|
|
810 |
Composite line1 = toolkit.createComposite(form.getBody()); |
|
811 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
|
812 |
gdata.colspan = 2; |
|
813 |
line1.setLayoutData(gdata); |
|
814 |
RowLayout hLayout = new RowLayout(); |
|
815 |
hLayout.center = true; |
|
816 |
line1.setLayout(hLayout); |
|
817 |
toolkit.createLabel(line1, ""+(n++)+".", SWT.WRAP); |
|
818 |
|
|
819 |
Hyperlink hyperlink1 = toolkit.createHyperlink(line1, TXMUIMessages.selectTheSourceDirectory, SWT.WRAP); |
|
820 |
hyperlink1.addHyperlinkListener(selectDirHListener); |
|
821 |
|
|
822 |
ImageHyperlink openImportLink2 = toolkit.createImageHyperlink(line1, SWT.WRAP); |
|
823 |
openImportLink2.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
|
824 |
openImportLink2.addHyperlinkListener(selectDirHListener); |
|
825 |
} |
|
796 | 826 |
|
797 |
Composite line1 = toolkit.createComposite(form.getBody()); |
|
798 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
|
799 |
gdata.colspan = 2; |
|
800 |
line1.setLayoutData(gdata); |
|
801 |
RowLayout hLayout = new RowLayout(); |
|
802 |
hLayout.center = true; |
|
803 |
line1.setLayout(hLayout); |
|
804 |
toolkit.createLabel(line1, TXMUIMessages._1, SWT.WRAP); |
|
805 |
|
|
806 |
Hyperlink hyperlink1 = toolkit.createHyperlink(line1, TXMUIMessages.selectTheSourceDirectory, SWT.WRAP); |
|
807 |
hyperlink1.addHyperlinkListener(selectDirHListener); |
|
808 |
|
|
809 |
ImageHyperlink openImportLink2 = toolkit.createImageHyperlink(line1, SWT.WRAP); |
|
810 |
openImportLink2.setImage(IImageKeys.getImage(IImageKeys.FOLDER)); |
|
811 |
openImportLink2.addHyperlinkListener(selectDirHListener); |
|
812 |
|
|
813 | 827 |
Composite line2 = toolkit.createComposite(form.getBody()); |
814 | 828 |
gdata = new TableWrapData(TableWrapData.LEFT, TableWrapData.FILL, 2, 1); |
815 | 829 |
gdata.colspan = 2; |
816 | 830 |
line2.setLayoutData(gdata); |
817 |
hLayout = new RowLayout(); |
|
831 |
RowLayout hLayout = new RowLayout();
|
|
818 | 832 |
hLayout.center = true; |
819 | 833 |
line2.setLayout(hLayout); |
820 |
toolkit.createLabel(line2, TXMUIMessages._2, SWT.WRAP);
|
|
834 |
toolkit.createLabel(line2, ""+(n++)+".", SWT.WRAP);
|
|
821 | 835 |
toolkit.createLabel(line2, TXMUIMessages.setImportParametersInTheSectionsBelow, SWT.WRAP); |
822 | 836 |
|
823 | 837 |
Composite line4 = toolkit.createComposite(form.getBody()); |
... | ... | |
827 | 841 |
hLayout = new RowLayout(); |
828 | 842 |
hLayout.center = true; |
829 | 843 |
line4.setLayout(hLayout); |
830 |
toolkit.createLabel(line4, TXMUIMessages._3);
|
|
844 |
toolkit.createLabel(line4, ""+(n++)+".", SWT.WRAP);
|
|
831 | 845 |
Hyperlink hyperlink3 = toolkit.createHyperlink(line4, TXMUIMessages.startCorpusImport, SWT.WRAP); |
832 | 846 |
hyperlink3.addHyperlinkListener(startImportListener); |
833 | 847 |
ImageHyperlink startImportLink2 = toolkit.createImageHyperlink(line4, SWT.NULL); |
... | ... | |
851 | 865 |
public void loadParams() throws ParserConfigurationException, SAXException, IOException { |
852 | 866 |
|
853 | 867 |
Log.fine(NLS.bind(TXMUIMessages.moduleUIParametersColonP0, moduleParams)); |
854 |
this.setPartName(project.getName()); |
|
868 |
this.setPartName(editor.project.getName());
|
|
855 | 869 |
|
856 | 870 |
if (infosSection != null && !infosSection.isDisposed()) { |
857 | 871 |
infosSection.setEnabled(true); |
858 |
infosSection.update(project); |
|
872 |
infosSection.update(editor.project);
|
|
859 | 873 |
} |
860 | 874 |
if (langSection != null && !langSection.isDisposed()) { |
861 | 875 |
langSection.setEnabled(true); |
862 |
langSection.update(project); |
|
876 |
langSection.update(editor.project);
|
|
863 | 877 |
} |
864 | 878 |
if (xsltSection != null && !xsltSection.isDisposed()) { |
865 | 879 |
xsltSection.setEnabled(true); |
866 |
xsltSection.update(project); |
|
880 |
xsltSection.update(editor.project);
|
|
867 | 881 |
} |
868 | 882 |
if (tokenizerSection != null && !tokenizerSection.isDisposed()) { |
869 | 883 |
tokenizerSection.setEnabled(true); |
870 |
tokenizerSection.update(project); |
|
884 |
tokenizerSection.update(editor.project);
|
|
871 | 885 |
} |
872 | 886 |
if (uiSection != null && !uiSection.isDisposed()) { |
873 | 887 |
uiSection.setEnabled(true); |
874 |
uiSection.update(project); |
|
888 |
uiSection.update(editor.project);
|
|
875 | 889 |
} |
876 | 890 |
if (encodingSection != null && !encodingSection.isDisposed()) { |
877 | 891 |
encodingSection.setEnabled(true); |
878 |
encodingSection.update(project); |
|
892 |
encodingSection.update(editor.project);
|
|
879 | 893 |
} |
880 | 894 |
if (editionSection != null && !editionSection.isDisposed()) { |
881 | 895 |
editionSection.setEnabled(true); |
882 |
editionSection.update(project); |
|
896 |
editionSection.update(editor.project);
|
|
883 | 897 |
} |
884 | 898 |
if (fontSection != null && !fontSection.isDisposed()) { |
885 | 899 |
fontSection.setEnabled(true); |
886 |
fontSection.update(project); |
|
900 |
fontSection.update(editor.project);
|
|
887 | 901 |
} |
888 | 902 |
if (textualPlansSection != null && !textualPlansSection.isDisposed()) { |
889 | 903 |
textualPlansSection.setEnabled(true); |
890 |
textualPlansSection.update(project); |
|
904 |
textualPlansSection.update(editor.project);
|
|
891 | 905 |
} |
892 | 906 |
|
893 | 907 |
if (structuresSection != null && !structuresSection.isDisposed()) { |
894 | 908 |
structuresSection.setEnabled(true); |
895 |
structuresSection.update(project); |
|
909 |
structuresSection.update(editor.project);
|
|
896 | 910 |
} |
897 | 911 |
|
898 | 912 |
if (optionsSection != null && !optionsSection.isDisposed()) { |
899 | 913 |
optionsSection.setEnabled(true); |
900 |
optionsSection.update(project); |
|
914 |
optionsSection.update(editor.project);
|
|
901 | 915 |
} |
902 | 916 |
|
903 | 917 |
if (additionalSection != null && !additionalSection.isDisposed()) { |
904 | 918 |
additionalSection.setEnabled(true); |
905 |
additionalSection.update(project); |
|
919 |
additionalSection.update(editor.project);
|
|
906 | 920 |
} |
907 | 921 |
|
908 | 922 |
/* |
... | ... | |
932 | 946 |
public boolean saveConfig() { |
933 | 947 |
Log.info(TXMUIMessages.savingImportParameters); |
934 | 948 |
|
935 |
if (project == null || project.getRCPProject() == null || !project.getRCPProject().exists()) {
|
|
949 |
if (editor.project == null || editor.project.getRCPProject() == null || !editor.project.getRCPProject().exists()) {
|
|
936 | 950 |
Log.warning("The corpus has been deleted since. Please re-open the import form."); |
937 | 951 |
this.getEditor().close(false); |
938 | 952 |
return false; |
... | ... | |
991 | 1005 |
// SAVE ALL SECTIONS |
992 | 1006 |
boolean successfulSave = true; |
993 | 1007 |
if (infosSection != null && !infosSection.isDisposed()) { |
994 |
successfulSave = successfulSave & infosSection.save(project); |
|
1008 |
successfulSave = successfulSave & infosSection.save(editor.project);
|
|
995 | 1009 |
} |
996 | 1010 |
if (langSection != null && !langSection.isDisposed()) { |
997 |
successfulSave = successfulSave & langSection.save(project); |
|
1011 |
successfulSave = successfulSave & langSection.save(editor.project);
|
|
998 | 1012 |
} |
999 | 1013 |
if (xsltSection != null && !xsltSection.isDisposed()) { |
1000 |
successfulSave = successfulSave & xsltSection.save(project); |
|
1014 |
successfulSave = successfulSave & xsltSection.save(editor.project);
|
|
1001 | 1015 |
} |
1002 | 1016 |
if (tokenizerSection != null && !tokenizerSection.isDisposed()) { |
1003 |
successfulSave = successfulSave & tokenizerSection.save(project); |
|
1017 |
successfulSave = successfulSave & tokenizerSection.save(editor.project);
|
|
1004 | 1018 |
} |
1005 | 1019 |
if (uiSection != null && !uiSection.isDisposed()) { |
1006 |
successfulSave = successfulSave & uiSection.save(project); |
|
1020 |
successfulSave = successfulSave & uiSection.save(editor.project);
|
|
1007 | 1021 |
} |
1008 | 1022 |
if (encodingSection != null && !encodingSection.isDisposed()) { |
1009 |
successfulSave = successfulSave & encodingSection.save(project); |
|
1023 |
successfulSave = successfulSave & encodingSection.save(editor.project);
|
|
1010 | 1024 |
} |
1011 | 1025 |
if (editionSection != null && !editionSection.isDisposed()) { |
1012 |
successfulSave = successfulSave & editionSection.save(project); |
|
1026 |
successfulSave = successfulSave & editionSection.save(editor.project);
|
|
1013 | 1027 |
} |
1014 | 1028 |
if (fontSection != null && !fontSection.isDisposed()) { |
1015 |
successfulSave = successfulSave & fontSection.save(project); |
|
1029 |
successfulSave = successfulSave & fontSection.save(editor.project);
|
|
1016 | 1030 |
} |
1017 | 1031 |
if (textualPlansSection != null && !textualPlansSection.isDisposed()) { |
1018 |
successfulSave = successfulSave & textualPlansSection.save(project); |
|
1032 |
successfulSave = successfulSave & textualPlansSection.save(editor.project);
|
|
1019 | 1033 |
} |
1020 | 1034 |
if (structuresSection != null && !structuresSection.isDisposed()) { |
1021 |
successfulSave = successfulSave & structuresSection.save(project); |
|
1035 |
successfulSave = successfulSave & structuresSection.save(editor.project);
|
|
1022 | 1036 |
} |
1023 | 1037 |
if (optionsSection != null && !optionsSection.isDisposed()) { |
1024 |
successfulSave = successfulSave & optionsSection.save(project); |
|
1038 |
successfulSave = successfulSave & optionsSection.save(editor.project);
|
|
1025 | 1039 |
} |
1026 | 1040 |
if (additionalSection != null && !additionalSection.isDisposed()) { |
1027 |
successfulSave = successfulSave & additionalSection.save(project); |
|
1041 |
successfulSave = successfulSave & additionalSection.save(editor.project);
|
|
1028 | 1042 |
} |
1029 | 1043 |
|
1030 | 1044 |
if (successfulSave) { |
1031 | 1045 |
try { |
1032 |
project.save(); |
|
1046 |
editor.project.save();
|
|
1033 | 1047 |
// DomUtils.save(params.root.getOwnerDocument(), paramFile); |
1034 | 1048 |
} |
1035 | 1049 |
catch (Exception e1) { |
... | ... | |
1052 | 1066 |
WizardDialog wdialog = new WizardDialog(this.getEditor().getSite().getShell(), wiz); |
1053 | 1067 |
wdialog.open(); |
1054 | 1068 |
|
1055 |
project = wiz.getProject(); |
|
1056 |
if (project == null) { |
|
1069 |
editor.project = wiz.getProject(); |
|
1070 |
|
|
1071 |
initializeProjectSettings(); |
|
1072 |
} |
|
1073 |
|
Formats disponibles : Unified diff