48 |
48 |
import org.txm.cooccurrence.core.functions.Cooccurrence;
|
49 |
49 |
import org.txm.core.preferences.TBXPreferences;
|
50 |
50 |
import org.txm.core.preferences.TXMPreferences;
|
51 |
|
import org.txm.functions.Function;
|
|
51 |
import org.txm.functions.TXMCommand;
|
52 |
52 |
import org.txm.functions.referencer.Referencer;
|
53 |
53 |
import org.txm.index.core.functions.Index;
|
54 |
54 |
import org.txm.lexicaltable.core.functions.LexicalTable;
|
... | ... | |
94 |
94 |
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
|
95 |
95 |
|
96 |
96 |
String extensions[] = {"*.csv"}; //$NON-NLS-1$
|
97 |
|
if (s instanceof Function) {
|
98 |
|
extensions = ((Function)s).getExportTXTExtensions(); //$NON-NLS-1$
|
|
97 |
if (s instanceof TXMCommand) {
|
|
98 |
extensions = ((TXMCommand)s).getExportTXTExtensions(); //$NON-NLS-1$
|
99 |
99 |
}
|
100 |
100 |
dialog.setFilterExtensions(extensions);
|
101 |
101 |
|
... | ... | |
126 |
126 |
return null;
|
127 |
127 |
}
|
128 |
128 |
|
129 |
|
final String encoding = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPORT_ENCODING); //$NON-NLS-1$
|
130 |
|
String _colseparator = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPORT_COLSEPARATOR);
|
|
129 |
final String encoding = TXMPreferences.getString(TBXPreferences.EXPORT_ENCODING, TBXPreferences.PREFERENCES_NODE);
|
|
130 |
String _colseparator = TXMPreferences.getString(TBXPreferences.EXPORT_COLSEPARATOR, TBXPreferences.PREFERENCES_NODE);
|
131 |
131 |
final String colseparator = _colseparator;
|
132 |
|
String _txtseparator = TXMPreferences.getString(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPORT_TXTSEPARATOR);
|
|
132 |
String _txtseparator = TXMPreferences.getString(TBXPreferences.EXPORT_TXTSEPARATOR, TBXPreferences.PREFERENCES_NODE);
|
133 |
133 |
final String txtseparator = _txtseparator;
|
134 |
134 |
|
135 |
135 |
JobHandler jobhandler = new JobHandler(Messages.ExportResult_0) {
|
... | ... | |
139 |
139 |
this.runInit(monitor);
|
140 |
140 |
monitor.beginTask(Messages.ExportResult_1, 100);
|
141 |
141 |
|
142 |
|
if (s instanceof Function)
|
143 |
|
((Function)s).setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
|
|
142 |
if (s instanceof TXMCommand)
|
|
143 |
((TXMCommand)s).setCurrentMonitor(this); // Allows Functions to protect themselves from interruption
|
144 |
144 |
|
145 |
145 |
if (s instanceof SpecificitesResult)
|
146 |
146 |
((SpecificitesResult) s).toTxt(outfile, encoding, colseparator, txtseparator);
|
... | ... | |
164 |
164 |
((CAH) s).toTxt(outfile, encoding);
|
165 |
165 |
} else if (s instanceof Progression) {
|
166 |
166 |
((Progression) s).toTxt(outfile, encoding);
|
167 |
|
} else if (s instanceof Function) {
|
168 |
|
((Function)s).toTxt(outfile, encoding, colseparator, txtseparator);
|
|
167 |
} else if (s instanceof TXMCommand) {
|
|
168 |
((TXMCommand)s).toTxt(outfile, encoding, colseparator, txtseparator);
|
169 |
169 |
}
|
170 |
170 |
|
171 |
171 |
if (outfile.exists()) {
|
172 |
172 |
// Open internal editor in the UI thread
|
173 |
|
if(TXMPreferences.getBoolean(TBXPreferences.PREFERENCES_NODE, TBXPreferences.EXPORT_SHOW)) {
|
|
173 |
if(TXMPreferences.getBoolean(TBXPreferences.EXPORT_SHOW, TBXPreferences.PREFERENCES_NODE)) {
|
174 |
174 |
this.syncExec(new Runnable() {
|
175 |
175 |
@Override
|
176 |
176 |
public void run() {
|
... | ... | |
184 |
184 |
System.out.println(NLS.bind(Messages.ExportResult_6, outfile.getAbsolutePath()));
|
185 |
185 |
}
|
186 |
186 |
} catch (ThreadDeath td) {
|
187 |
|
if (s instanceof Function)
|
188 |
|
((Function)s).clean();
|
|
187 |
if (s instanceof TXMCommand)
|
|
188 |
((TXMCommand)s).clean();
|
189 |
189 |
return Status.CANCEL_STATUS;
|
190 |
190 |
} catch (Exception e) {
|
191 |
191 |
System.out.println(NLS.bind(Messages.ExportResult_6, s, e));
|
192 |
192 |
org.txm.rcp.utils.Logger.printStackTrace(e);
|
193 |
193 |
return Status.CANCEL_STATUS;
|
194 |
194 |
} finally {
|
195 |
|
if (s instanceof Function)
|
196 |
|
((Function)s).setCurrentMonitor(null);
|
|
195 |
if (s instanceof TXMCommand)
|
|
196 |
((TXMCommand)s).setCurrentMonitor(null);
|
197 |
197 |
monitor.done();
|
198 |
198 |
JobsTimer.stopAndPrint();
|
199 |
199 |
}
|