svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.swing / org.gvsig.exportto.swing.prov / org.gvsig.exportto.swing.prov.jdbc / src / main / java / org / gvsig / exportto / swing / prov / jdbc / panel / SelectTableNamePanel.java @ 43920
History | View | Annotate | Download (16.2 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
6 | 41486 | jjdelcerro | * This program is free software; you can redistribute it and/or modify it under
|
7 | * the terms of the GNU General Public License as published by the Free Software
|
||
8 | * Foundation; either version 3 of the License, or (at your option) any later
|
||
9 | * version.
|
||
10 | 40435 | jjdelcerro | *
|
11 | 41486 | jjdelcerro | * This program is distributed in the hope that it will be useful, but WITHOUT
|
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||
14 | * details.
|
||
15 | 40435 | jjdelcerro | *
|
16 | 41486 | jjdelcerro | * You should have received a copy of the GNU General Public License along with
|
17 | * this program; if not, write to the Free Software Foundation, Inc., 51
|
||
18 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
19 | 40435 | jjdelcerro | *
|
20 | 41486 | jjdelcerro | * For any additional information, do not hesitate to contact us at info AT
|
21 | * gvsig.com, or visit our website www.gvsig.com.
|
||
22 | 40435 | jjdelcerro | */
|
23 | package org.gvsig.exportto.swing.prov.jdbc.panel; |
||
24 | |||
25 | 41486 | jjdelcerro | import java.awt.event.ActionEvent; |
26 | import java.awt.event.ActionListener; |
||
27 | import java.util.Iterator; |
||
28 | import java.util.List; |
||
29 | |||
30 | import javax.swing.DefaultListModel; |
||
31 | import javax.swing.JComponent; |
||
32 | 41598 | jjdelcerro | import javax.swing.JOptionPane; |
33 | 41534 | jjdelcerro | import javax.swing.ListModel; |
34 | 41492 | jjdelcerro | import javax.swing.SwingUtilities; |
35 | import javax.swing.event.AncestorEvent; |
||
36 | import javax.swing.event.AncestorListener; |
||
37 | 41486 | jjdelcerro | import org.apache.commons.lang3.StringUtils; |
38 | 41632 | jjdelcerro | //import org.gvsig.app.ApplicationLocator;
|
39 | //import org.gvsig.app.ApplicationManager;
|
||
40 | 41492 | jjdelcerro | import org.gvsig.exportto.swing.ExporttoSwingLocator; |
41 | import org.gvsig.exportto.swing.ExporttoSwingManager; |
||
42 | 41598 | jjdelcerro | import org.gvsig.exportto.swing.prov.jdbc.ExporttoJDBCOptions; |
43 | 40435 | jjdelcerro | import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
44 | 41486 | jjdelcerro | import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
45 | import org.gvsig.fmap.dal.DALLocator; |
||
46 | import org.gvsig.fmap.dal.DataManager; |
||
47 | 43355 | jjdelcerro | import org.gvsig.fmap.dal.SQLBuilder; |
48 | 41486 | jjdelcerro | import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorer; |
49 | import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
||
50 | import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
||
51 | import org.gvsig.tools.ToolsLocator; |
||
52 | import org.gvsig.tools.i18n.I18nManager; |
||
53 | 43377 | jjdelcerro | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
54 | import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
||
55 | 41492 | jjdelcerro | import org.gvsig.tools.task.AbstractMonitorableTask; |
56 | import org.gvsig.tools.task.SimpleTaskStatus; |
||
57 | 41486 | jjdelcerro | import org.slf4j.Logger; |
58 | import org.slf4j.LoggerFactory; |
||
59 | 40435 | jjdelcerro | |
60 | /**
|
||
61 | * @author gvSIG Team
|
||
62 | * @version $Id$
|
||
63 | 41486 | jjdelcerro | *
|
64 | 40435 | jjdelcerro | */
|
65 | 41486 | jjdelcerro | public class SelectTableNamePanel extends SelectTableNamePanelLayout implements ExporttoSwingProviderPanel { |
66 | 41534 | jjdelcerro | |
67 | 41486 | jjdelcerro | private static final Logger logger = LoggerFactory.getLogger(SelectTableNamePanel.class); |
68 | 41534 | jjdelcerro | |
69 | 40435 | jjdelcerro | private static final long serialVersionUID = 6269512983586358017L; |
70 | 43920 | jjdelcerro | private final ExporttoJDBCOptions options; |
71 | 41534 | jjdelcerro | |
72 | 41492 | jjdelcerro | private FillTablesListTask task = null; |
73 | 43355 | jjdelcerro | private SQLBuilder sqlbuilder;
|
74 | 41534 | jjdelcerro | |
75 | 41486 | jjdelcerro | private static class TableItem { |
76 | 41534 | jjdelcerro | |
77 | 41486 | jjdelcerro | private JDBCStoreParameters params;
|
78 | private String label; |
||
79 | 41534 | jjdelcerro | |
80 | 41486 | jjdelcerro | public TableItem(String label, JDBCStoreParameters params) { |
81 | this.params = params;
|
||
82 | this.label = label;
|
||
83 | } |
||
84 | 41534 | jjdelcerro | |
85 | 41486 | jjdelcerro | public TableItem(JDBCStoreParameters params) {
|
86 | 43355 | jjdelcerro | this( StringUtils.isEmpty(params.getSchema())?
|
87 | params.getTable() : params.getSchema() + "." + params.getTable(),
|
||
88 | params); |
||
89 | 41486 | jjdelcerro | } |
90 | 41534 | jjdelcerro | |
91 | 43031 | jjdelcerro | @Override
|
92 | 41486 | jjdelcerro | public String toString() { |
93 | return this.label; |
||
94 | } |
||
95 | 41534 | jjdelcerro | |
96 | 41486 | jjdelcerro | public JDBCStoreParameters getParams() {
|
97 | return this.params; |
||
98 | } |
||
99 | } |
||
100 | 41534 | jjdelcerro | |
101 | 43920 | jjdelcerro | @SuppressWarnings("OverridableMethodCallInConstructor") |
102 | public SelectTableNamePanel(ExporttoJDBCOptions options) {
|
||
103 | this.options = options;
|
||
104 | 41488 | jjdelcerro | initComponents(); |
105 | 41492 | jjdelcerro | this.addAncestorListener(new AncestorListener() { |
106 | 41534 | jjdelcerro | |
107 | 43031 | jjdelcerro | @Override
|
108 | 41492 | jjdelcerro | public void ancestorAdded(AncestorEvent ae) { |
109 | } |
||
110 | 41534 | jjdelcerro | |
111 | 43031 | jjdelcerro | @Override
|
112 | 41492 | jjdelcerro | public void ancestorRemoved(AncestorEvent ae) { |
113 | cancelTask(); |
||
114 | } |
||
115 | 41534 | jjdelcerro | |
116 | 43031 | jjdelcerro | @Override
|
117 | 41492 | jjdelcerro | public void ancestorMoved(AncestorEvent ae) { |
118 | } |
||
119 | }); |
||
120 | 41486 | jjdelcerro | } |
121 | 41534 | jjdelcerro | |
122 | 41486 | jjdelcerro | private void initComponents() { |
123 | this.rdoCreateTable.addActionListener(new ActionListener() { |
||
124 | 43031 | jjdelcerro | @Override
|
125 | 41486 | jjdelcerro | public void actionPerformed(ActionEvent e) { |
126 | onChangeRadioSelecion(); |
||
127 | } |
||
128 | }); |
||
129 | this.rdoInsert.addActionListener(new ActionListener() { |
||
130 | 43031 | jjdelcerro | @Override
|
131 | 41486 | jjdelcerro | public void actionPerformed(ActionEvent e) { |
132 | onChangeRadioSelecion(); |
||
133 | } |
||
134 | }); |
||
135 | 41488 | jjdelcerro | this.rdoCreateTable.setSelected(true); |
136 | 41492 | jjdelcerro | this.rdoInsert.setEnabled(false); |
137 | this.lstTables.setEnabled(false); |
||
138 | try {
|
||
139 | 43920 | jjdelcerro | this.txtTableName.setText(this.options.getSourceFeatureStore().getName()); |
140 | 41492 | jjdelcerro | } catch (Exception ex) { |
141 | logger.warn("Can't set the default value for the table name", ex);
|
||
142 | } |
||
143 | 41560 | jjdelcerro | |
144 | 41534 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
145 | this.lblHeader.setText(i18nManager.getTranslation("_Indique_donde_desea_insertar_los_datos")); |
||
146 | this.lblWarningUseExistingTable.setText(
|
||
147 | 41560 | jjdelcerro | "<html>\n"
|
148 | + i18nManager.getTranslation("_Los_datos_se_insertaran_usando_los_nombres_de_columna_que_coincidan_con_la_tabla_origen_dejandose_al_valor_por_defecto_para_los_que_no_haya_valores_en_la_tabla_origen")
|
||
149 | + "\n</html>"
|
||
150 | 41534 | jjdelcerro | ); |
151 | this.rdoInsert.setText(i18nManager.getTranslation("_Insertar_registros_en_una_tabla_existente")); |
||
152 | this.lblSelectTableName.setText(i18nManager.getTranslation("_Seleccione_la_tabla_a_usar")); |
||
153 | this.rdoCreateTable.setText(i18nManager.getTranslation("_Crear_una_tabla_nueva")); |
||
154 | this.lblSchema.setText(i18nManager.getTranslation("_Indique_el_esquema_en_el_que_desea_crear_la_tabla")); |
||
155 | this.lblTableName.setText(i18nManager.getTranslation("_Indique_el_nombre_de_la_tabla")); |
||
156 | 41486 | jjdelcerro | } |
157 | 41534 | jjdelcerro | |
158 | 41492 | jjdelcerro | private void cancelTask() { |
159 | 41534 | jjdelcerro | if (task != null) { |
160 | 41492 | jjdelcerro | task.cancelRequest(); |
161 | task.getSimpleTaskStatus().remove(); |
||
162 | task = null;
|
||
163 | 41534 | jjdelcerro | } |
164 | 41492 | jjdelcerro | } |
165 | 41534 | jjdelcerro | |
166 | 41486 | jjdelcerro | public boolean canCreateTable() { |
167 | return this.rdoCreateTable.isSelected(); |
||
168 | } |
||
169 | 41534 | jjdelcerro | |
170 | 41486 | jjdelcerro | public String getSchema() { |
171 | 41534 | jjdelcerro | if (this.canCreateTable()) { |
172 | 41486 | jjdelcerro | return StringUtils.defaultIfBlank(this.txtSchema.getText(), null); |
173 | } |
||
174 | 41509 | jjdelcerro | TableItem item = (TableItem) this.lstTables.getSelectedValue();
|
175 | JDBCStoreParameters tableParameter = item.getParams(); |
||
176 | 41534 | jjdelcerro | if (tableParameter == null) { |
177 | 41486 | jjdelcerro | return null; |
178 | } |
||
179 | 41509 | jjdelcerro | return tableParameter.getSchema();
|
180 | 41486 | jjdelcerro | } |
181 | 41534 | jjdelcerro | |
182 | 41486 | jjdelcerro | public String getTableName() { |
183 | 41534 | jjdelcerro | if (this.canCreateTable()) { |
184 | 41492 | jjdelcerro | return StringUtils.defaultIfBlank(this.txtTableName.getText(), null); |
185 | 41486 | jjdelcerro | } |
186 | 41509 | jjdelcerro | TableItem item = (TableItem) this.lstTables.getSelectedValue();
|
187 | 41560 | jjdelcerro | if (item == null) { |
188 | return null; |
||
189 | } |
||
190 | 41509 | jjdelcerro | JDBCStoreParameters tableParameter = item.getParams(); |
191 | 41534 | jjdelcerro | |
192 | if (tableParameter == null) { |
||
193 | 41486 | jjdelcerro | return null; |
194 | } |
||
195 | 41509 | jjdelcerro | return tableParameter.getTable();
|
196 | 41486 | jjdelcerro | } |
197 | 41534 | jjdelcerro | |
198 | 43031 | jjdelcerro | @Override
|
199 | 40435 | jjdelcerro | public String getPanelTitle() { |
200 | 41486 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
201 | 41534 | jjdelcerro | return i18nManager.getTranslation("_Tablename"); |
202 | 40435 | jjdelcerro | } |
203 | 41534 | jjdelcerro | |
204 | 43031 | jjdelcerro | @Override
|
205 | 40435 | jjdelcerro | public boolean isValidPanel() throws ExporttoPanelValidationException { |
206 | 41534 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
207 | String tablename = this.getTableName(); |
||
208 | 41560 | jjdelcerro | if (tablename == null) { |
209 | 40435 | jjdelcerro | throw new ExporttoPanelValidationException( |
210 | 41560 | jjdelcerro | i18nManager.getTranslation( |
211 | "_The_name_of_table_cannot_be_empty"
|
||
212 | ) |
||
213 | 41534 | jjdelcerro | ); |
214 | 40435 | jjdelcerro | } |
215 | 41534 | jjdelcerro | String schema = this.getSchema(); |
216 | 43355 | jjdelcerro | if( sqlbuilder.supportSchemas() ) {
|
217 | if (schema == null) { |
||
218 | throw new ExporttoPanelValidationException( |
||
219 | i18nManager.getTranslation( |
||
220 | "_The_name_of_schema_cannot_be_empty"
|
||
221 | ) |
||
222 | ); |
||
223 | } |
||
224 | 41486 | jjdelcerro | } |
225 | 41560 | jjdelcerro | if (this.rdoCreateTable.isSelected()) { |
226 | 41598 | jjdelcerro | String tablename_tr = tablename;
|
227 | 43920 | jjdelcerro | if( this.options.getTranslateIdentifiersToLowerCase() ) { |
228 | 41598 | jjdelcerro | tablename_tr = tablename_tr.toLowerCase(); |
229 | } |
||
230 | 43920 | jjdelcerro | if( this.options.getTranslateHyphens()) { |
231 | 43377 | jjdelcerro | tablename_tr = tablename_tr.replace("-", "_"); |
232 | 43637 | jjdelcerro | tablename_tr = tablename_tr.replace(".", "_"); |
233 | 43377 | jjdelcerro | } |
234 | 43920 | jjdelcerro | if( this.options.getRemoveSpacesInIdentifiers() ) { |
235 | 41598 | jjdelcerro | tablename_tr = StringUtils.normalizeSpace(tablename_tr).replace(" ", "_"); |
236 | } |
||
237 | if( !tablename_tr.equals(tablename) ) {
|
||
238 | String msg = i18nManager.getTranslation(
|
||
239 | "Ha_utilizado_espacios_en_blanco_o_mayusculas_en_el_nombre_de_la_tabla_Desea_que_se_corrija_de_forma_automatica"
|
||
240 | ); |
||
241 | 43377 | jjdelcerro | ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
242 | int resp = dialogs.confirmDialog(
|
||
243 | 43031 | jjdelcerro | msg, |
244 | 41598 | jjdelcerro | i18nManager.getTranslation("_Warning"),
|
245 | JOptionPane.YES_NO_OPTION,
|
||
246 | 43377 | jjdelcerro | JOptionPane.WARNING_MESSAGE,
|
247 | "Exportto_Table_name_with_spaces_or_mixed_case"
|
||
248 | 41598 | jjdelcerro | ); |
249 | if( resp != JOptionPane.YES_OPTION ) { |
||
250 | msg = i18nManager.getTranslation( |
||
251 | "El_nombre_de_tabla_contiene_caracteres no_validos"
|
||
252 | ); |
||
253 | throw new ExporttoPanelValidationException(msg); |
||
254 | } |
||
255 | tablename = tablename_tr; |
||
256 | this.txtTableName.setText(tablename);
|
||
257 | } |
||
258 | 41560 | jjdelcerro | ListModel model = this.lstTables.getModel(); |
259 | for (int i = 0; i < model.getSize(); i++) { |
||
260 | TableItem item = (TableItem) model.getElementAt(i); |
||
261 | 43355 | jjdelcerro | if ( StringUtils.equals(schema,item.getParams().getSchema())
|
262 | && StringUtils.equals(tablename,item.getParams().getTable())) { |
||
263 | 41560 | jjdelcerro | String msg = i18nManager.getTranslation(
|
264 | "_La_tabla_{0}_{1}_ya_existe_en_la_base_de_datos_Seleccione_la_opcion_de_insertar_registros_en_una_tabla_existente_para_a?adir_los_datos_a_esta_o_indique_otro_nombre",
|
||
265 | new String[]{schema, tablename} |
||
266 | ); |
||
267 | throw new ExporttoPanelValidationException(msg); |
||
268 | } |
||
269 | 41534 | jjdelcerro | } |
270 | } |
||
271 | 43920 | jjdelcerro | this.options.setSchema(this.getSchema()); |
272 | this.options.setTableName(this.getTableName()); |
||
273 | 40435 | jjdelcerro | return true; |
274 | } |
||
275 | 41534 | jjdelcerro | |
276 | 43031 | jjdelcerro | @Override
|
277 | 41488 | jjdelcerro | public void enterPanel() { |
278 | 43920 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = options.getExplorerParameters(); |
279 | 43355 | jjdelcerro | if (explorerParameters != null) { |
280 | try {
|
||
281 | DataManager dataManager = DALLocator.getDataManager(); |
||
282 | JDBCServerExplorer explorer = (JDBCServerExplorer) dataManager.openServerExplorer( |
||
283 | explorerParameters.getExplorerName(), |
||
284 | explorerParameters |
||
285 | ); |
||
286 | this.sqlbuilder = explorer.createSQLBuilder();
|
||
287 | } catch (Exception ex) { |
||
288 | throw new RuntimeException("Can't retrieve the sqlbuilder", ex); |
||
289 | } |
||
290 | } |
||
291 | 41488 | jjdelcerro | this.fillTablesList();
|
292 | } |
||
293 | 41534 | jjdelcerro | |
294 | 43031 | jjdelcerro | @Override
|
295 | 41486 | jjdelcerro | public JComponent asJComponent() { |
296 | return this; |
||
297 | } |
||
298 | 41534 | jjdelcerro | |
299 | 41486 | jjdelcerro | public void onChangeRadioSelecion() { |
300 | 41534 | jjdelcerro | if (this.rdoCreateTable.isSelected()) { |
301 | 41486 | jjdelcerro | this.txtSchema.setEnabled(true); |
302 | this.txtTableName.setEnabled(true); |
||
303 | this.lstTables.setEnabled(false); |
||
304 | } else {
|
||
305 | this.txtSchema.setEnabled(false); |
||
306 | this.txtTableName.setEnabled(false); |
||
307 | this.lstTables.setEnabled(true); |
||
308 | } |
||
309 | } |
||
310 | 41534 | jjdelcerro | |
311 | 41486 | jjdelcerro | private void fillTablesList() { |
312 | 41534 | jjdelcerro | |
313 | 43920 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = this.options.getExplorerParameters();
|
314 | 41534 | jjdelcerro | if (explorerParameters == null) { |
315 | 41486 | jjdelcerro | return;
|
316 | } |
||
317 | 41492 | jjdelcerro | cancelTask(); |
318 | this.task = new FillTablesListTask(); |
||
319 | task.setDaemon(true);
|
||
320 | task.start(); |
||
321 | } |
||
322 | 41534 | jjdelcerro | |
323 | 41492 | jjdelcerro | private class FillTablesListTask extends AbstractMonitorableTask { |
324 | 41534 | jjdelcerro | |
325 | 41492 | jjdelcerro | public FillTablesListTask() {
|
326 | super("Export"); |
||
327 | } |
||
328 | 41534 | jjdelcerro | |
329 | 43031 | jjdelcerro | @Override
|
330 | 41492 | jjdelcerro | protected SimpleTaskStatus getSimpleTaskStatus() {
|
331 | return (SimpleTaskStatus) this.getTaskStatus(); |
||
332 | } |
||
333 | 41534 | jjdelcerro | |
334 | 43031 | jjdelcerro | @Override
|
335 | 41492 | jjdelcerro | public void run() { |
336 | 41534 | jjdelcerro | |
337 | 43920 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = options.getExplorerParameters(); |
338 | if (options.getExplorerParameters() == null) { |
||
339 | 41492 | jjdelcerro | return;
|
340 | 41486 | jjdelcerro | } |
341 | 41492 | jjdelcerro | final SimpleTaskStatus status = this.getSimpleTaskStatus(); |
342 | try {
|
||
343 | status.setAutoremove(true);
|
||
344 | 41534 | jjdelcerro | |
345 | 41492 | jjdelcerro | DataManager dataManager = DALLocator.getDataManager(); |
346 | 41534 | jjdelcerro | |
347 | 41492 | jjdelcerro | this.getSimpleTaskStatus().message("Connecting server"); |
348 | explorerParameters.setShowInformationDBTables(false);
|
||
349 | 43020 | jjdelcerro | final JDBCServerExplorer explorer = (JDBCServerExplorer) dataManager.openServerExplorer(
|
350 | 41492 | jjdelcerro | explorerParameters.getExplorerName(), |
351 | explorerParameters |
||
352 | ); |
||
353 | 43031 | jjdelcerro | SwingUtilities.invokeAndWait(new Runnable() { |
354 | 41534 | jjdelcerro | |
355 | 43031 | jjdelcerro | @Override
|
356 | public void run() { |
||
357 | 43355 | jjdelcerro | if( sqlbuilder.supportSchemas() ) {
|
358 | txtSchema.setText(sqlbuilder.default_schema()); |
||
359 | } else {
|
||
360 | txtSchema.setText("");
|
||
361 | txtSchema.setEnabled(false);
|
||
362 | } |
||
363 | 43031 | jjdelcerro | } |
364 | }); |
||
365 | |||
366 | 41492 | jjdelcerro | this.getSimpleTaskStatus().message("Retrieving tables"); |
367 | final List<JDBCStoreParameters> tables = explorer.list(); |
||
368 | 41534 | jjdelcerro | |
369 | 41492 | jjdelcerro | this.getSimpleTaskStatus().message("Add tables"); |
370 | 41534 | jjdelcerro | |
371 | 41492 | jjdelcerro | SwingUtilities.invokeAndWait(new Runnable() { |
372 | 43031 | jjdelcerro | @Override
|
373 | 41492 | jjdelcerro | public void run() { |
374 | DefaultListModel lmodel = new DefaultListModel(); |
||
375 | Iterator<JDBCStoreParameters> it = tables.iterator();
|
||
376 | 41534 | jjdelcerro | while (it.hasNext()) {
|
377 | if (status.isCancelled()) {
|
||
378 | 41492 | jjdelcerro | status.cancel(); |
379 | break;
|
||
380 | } |
||
381 | JDBCStoreParameters table = it.next(); |
||
382 | lmodel.addElement(new TableItem(table));
|
||
383 | } |
||
384 | lstTables.setModel(lmodel); |
||
385 | 41509 | jjdelcerro | //lstTables.setEnabled(true);
|
386 | 41492 | jjdelcerro | rdoInsert.setEnabled(true);
|
387 | } |
||
388 | }); |
||
389 | 41534 | jjdelcerro | |
390 | 41492 | jjdelcerro | status.message("finish");
|
391 | status.terminate(); |
||
392 | 41534 | jjdelcerro | |
393 | 41492 | jjdelcerro | } catch (final Exception ex) { |
394 | logger.warn("Fail to fill tables list", ex);
|
||
395 | 41534 | jjdelcerro | if (status.isCancellationRequested()) {
|
396 | 41492 | jjdelcerro | status.cancel(); |
397 | } |
||
398 | 41534 | jjdelcerro | if (status.isRunning()) {
|
399 | 41492 | jjdelcerro | try {
|
400 | SwingUtilities.invokeAndWait(new Runnable() { |
||
401 | 43031 | jjdelcerro | @Override
|
402 | 41492 | jjdelcerro | public void run() { |
403 | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
||
404 | ExporttoSwingManager manager = ExporttoSwingLocator.getSwingManager(); |
||
405 | 41534 | jjdelcerro | |
406 | 41492 | jjdelcerro | manager.showMessage( |
407 | i18nManager.getTranslation("_Warning"),
|
||
408 | i18nManager.getTranslation("_There_have_been_problems_filling_data_in_panel")
|
||
409 | + " (" + getPanelTitle() + ")", |
||
410 | ex, |
||
411 | null
|
||
412 | ); |
||
413 | } |
||
414 | }); |
||
415 | } catch (Exception ex2) { |
||
416 | logger.warn("Can't show error message", ex2);
|
||
417 | } |
||
418 | } |
||
419 | } finally {
|
||
420 | status.terminate(); |
||
421 | status.remove(); |
||
422 | } |
||
423 | 41534 | jjdelcerro | |
424 | 41486 | jjdelcerro | } |
425 | 41534 | jjdelcerro | |
426 | 41486 | jjdelcerro | } |
427 | 41534 | jjdelcerro | |
428 | 40435 | jjdelcerro | } |