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 @ 43377
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 | 43355 | jjdelcerro | import java.util.logging.Level; |
30 | 41486 | jjdelcerro | |
31 | import javax.swing.DefaultListModel; |
||
32 | import javax.swing.JComponent; |
||
33 | 41598 | jjdelcerro | import javax.swing.JOptionPane; |
34 | 41534 | jjdelcerro | import javax.swing.ListModel; |
35 | 41492 | jjdelcerro | import javax.swing.SwingUtilities; |
36 | import javax.swing.event.AncestorEvent; |
||
37 | import javax.swing.event.AncestorListener; |
||
38 | 41486 | jjdelcerro | import org.apache.commons.lang3.StringUtils; |
39 | 41632 | jjdelcerro | //import org.gvsig.app.ApplicationLocator;
|
40 | //import org.gvsig.app.ApplicationManager;
|
||
41 | 41492 | jjdelcerro | import org.gvsig.exportto.swing.ExporttoSwingLocator; |
42 | import org.gvsig.exportto.swing.ExporttoSwingManager; |
||
43 | 41598 | jjdelcerro | import org.gvsig.exportto.swing.prov.jdbc.ExporttoJDBCOptions; |
44 | 40435 | jjdelcerro | import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
45 | 41486 | jjdelcerro | import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
46 | import org.gvsig.fmap.dal.DALLocator; |
||
47 | import org.gvsig.fmap.dal.DataManager; |
||
48 | 43355 | jjdelcerro | import org.gvsig.fmap.dal.SQLBuilder; |
49 | import org.gvsig.fmap.dal.exception.InitializeException; |
||
50 | import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
||
51 | import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
||
52 | 41486 | jjdelcerro | import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorer; |
53 | import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
||
54 | import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
||
55 | import org.gvsig.tools.ToolsLocator; |
||
56 | import org.gvsig.tools.i18n.I18nManager; |
||
57 | 43377 | jjdelcerro | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
58 | import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
||
59 | 41492 | jjdelcerro | import org.gvsig.tools.task.AbstractMonitorableTask; |
60 | import org.gvsig.tools.task.SimpleTaskStatus; |
||
61 | 41486 | jjdelcerro | import org.slf4j.Logger; |
62 | import org.slf4j.LoggerFactory; |
||
63 | 40435 | jjdelcerro | |
64 | /**
|
||
65 | * @author gvSIG Team
|
||
66 | * @version $Id$
|
||
67 | 41486 | jjdelcerro | *
|
68 | 40435 | jjdelcerro | */
|
69 | 41486 | jjdelcerro | public class SelectTableNamePanel extends SelectTableNamePanelLayout implements ExporttoSwingProviderPanel { |
70 | 41534 | jjdelcerro | |
71 | 41486 | jjdelcerro | private static final Logger logger = LoggerFactory.getLogger(SelectTableNamePanel.class); |
72 | 41534 | jjdelcerro | |
73 | 40435 | jjdelcerro | private static final long serialVersionUID = 6269512983586358017L; |
74 | 41598 | jjdelcerro | private final ExporttoJDBCOptions provider; |
75 | 41534 | jjdelcerro | |
76 | 41492 | jjdelcerro | private FillTablesListTask task = null; |
77 | 43355 | jjdelcerro | private SQLBuilder sqlbuilder;
|
78 | 41534 | jjdelcerro | |
79 | 41486 | jjdelcerro | private static class TableItem { |
80 | 41534 | jjdelcerro | |
81 | 41486 | jjdelcerro | private JDBCStoreParameters params;
|
82 | private String label; |
||
83 | 41534 | jjdelcerro | |
84 | 41486 | jjdelcerro | public TableItem(String label, JDBCStoreParameters params) { |
85 | this.params = params;
|
||
86 | this.label = label;
|
||
87 | } |
||
88 | 41534 | jjdelcerro | |
89 | 41486 | jjdelcerro | public TableItem(JDBCStoreParameters params) {
|
90 | 43355 | jjdelcerro | this( StringUtils.isEmpty(params.getSchema())?
|
91 | params.getTable() : params.getSchema() + "." + params.getTable(),
|
||
92 | params); |
||
93 | 41486 | jjdelcerro | } |
94 | 41534 | jjdelcerro | |
95 | 43031 | jjdelcerro | @Override
|
96 | 41486 | jjdelcerro | public String toString() { |
97 | return this.label; |
||
98 | } |
||
99 | 41534 | jjdelcerro | |
100 | 41486 | jjdelcerro | public JDBCStoreParameters getParams() {
|
101 | return this.params; |
||
102 | } |
||
103 | } |
||
104 | 41534 | jjdelcerro | |
105 | 41598 | jjdelcerro | public SelectTableNamePanel(ExporttoJDBCOptions provider) {
|
106 | 41486 | jjdelcerro | this.provider = provider;
|
107 | 41488 | jjdelcerro | initComponents(); |
108 | 41492 | jjdelcerro | this.addAncestorListener(new AncestorListener() { |
109 | 41534 | jjdelcerro | |
110 | 43031 | jjdelcerro | @Override
|
111 | 41492 | jjdelcerro | public void ancestorAdded(AncestorEvent ae) { |
112 | } |
||
113 | 41534 | jjdelcerro | |
114 | 43031 | jjdelcerro | @Override
|
115 | 41492 | jjdelcerro | public void ancestorRemoved(AncestorEvent ae) { |
116 | cancelTask(); |
||
117 | } |
||
118 | 41534 | jjdelcerro | |
119 | 43031 | jjdelcerro | @Override
|
120 | 41492 | jjdelcerro | public void ancestorMoved(AncestorEvent ae) { |
121 | } |
||
122 | }); |
||
123 | 41486 | jjdelcerro | } |
124 | 41534 | jjdelcerro | |
125 | 41486 | jjdelcerro | private void initComponents() { |
126 | this.rdoCreateTable.addActionListener(new ActionListener() { |
||
127 | 43031 | jjdelcerro | @Override
|
128 | 41486 | jjdelcerro | public void actionPerformed(ActionEvent e) { |
129 | onChangeRadioSelecion(); |
||
130 | } |
||
131 | }); |
||
132 | this.rdoInsert.addActionListener(new ActionListener() { |
||
133 | 43031 | jjdelcerro | @Override
|
134 | 41486 | jjdelcerro | public void actionPerformed(ActionEvent e) { |
135 | onChangeRadioSelecion(); |
||
136 | } |
||
137 | }); |
||
138 | 41488 | jjdelcerro | this.rdoCreateTable.setSelected(true); |
139 | 41492 | jjdelcerro | this.rdoInsert.setEnabled(false); |
140 | this.lstTables.setEnabled(false); |
||
141 | try {
|
||
142 | this.txtTableName.setText(this.provider.getSource().getName()); |
||
143 | } catch (Exception ex) { |
||
144 | logger.warn("Can't set the default value for the table name", ex);
|
||
145 | } |
||
146 | 41560 | jjdelcerro | |
147 | 41534 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
148 | this.lblHeader.setText(i18nManager.getTranslation("_Indique_donde_desea_insertar_los_datos")); |
||
149 | this.lblWarningUseExistingTable.setText(
|
||
150 | 41560 | jjdelcerro | "<html>\n"
|
151 | + 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")
|
||
152 | + "\n</html>"
|
||
153 | 41534 | jjdelcerro | ); |
154 | this.rdoInsert.setText(i18nManager.getTranslation("_Insertar_registros_en_una_tabla_existente")); |
||
155 | this.lblSelectTableName.setText(i18nManager.getTranslation("_Seleccione_la_tabla_a_usar")); |
||
156 | this.rdoCreateTable.setText(i18nManager.getTranslation("_Crear_una_tabla_nueva")); |
||
157 | this.lblSchema.setText(i18nManager.getTranslation("_Indique_el_esquema_en_el_que_desea_crear_la_tabla")); |
||
158 | this.lblTableName.setText(i18nManager.getTranslation("_Indique_el_nombre_de_la_tabla")); |
||
159 | 41486 | jjdelcerro | } |
160 | 41534 | jjdelcerro | |
161 | 41492 | jjdelcerro | private void cancelTask() { |
162 | 41534 | jjdelcerro | if (task != null) { |
163 | 41492 | jjdelcerro | task.cancelRequest(); |
164 | task.getSimpleTaskStatus().remove(); |
||
165 | task = null;
|
||
166 | 41534 | jjdelcerro | } |
167 | 41492 | jjdelcerro | } |
168 | 41534 | jjdelcerro | |
169 | 41486 | jjdelcerro | public boolean canCreateTable() { |
170 | return this.rdoCreateTable.isSelected(); |
||
171 | } |
||
172 | 41534 | jjdelcerro | |
173 | 41486 | jjdelcerro | public String getSchema() { |
174 | 41534 | jjdelcerro | if (this.canCreateTable()) { |
175 | 41486 | jjdelcerro | return StringUtils.defaultIfBlank(this.txtSchema.getText(), null); |
176 | } |
||
177 | 41509 | jjdelcerro | TableItem item = (TableItem) this.lstTables.getSelectedValue();
|
178 | JDBCStoreParameters tableParameter = item.getParams(); |
||
179 | 41534 | jjdelcerro | if (tableParameter == null) { |
180 | 41486 | jjdelcerro | return null; |
181 | } |
||
182 | 41509 | jjdelcerro | return tableParameter.getSchema();
|
183 | 41486 | jjdelcerro | } |
184 | 41534 | jjdelcerro | |
185 | 41486 | jjdelcerro | public String getTableName() { |
186 | 41534 | jjdelcerro | if (this.canCreateTable()) { |
187 | 41492 | jjdelcerro | return StringUtils.defaultIfBlank(this.txtTableName.getText(), null); |
188 | 41486 | jjdelcerro | } |
189 | 41509 | jjdelcerro | TableItem item = (TableItem) this.lstTables.getSelectedValue();
|
190 | 41560 | jjdelcerro | if (item == null) { |
191 | return null; |
||
192 | } |
||
193 | 41509 | jjdelcerro | JDBCStoreParameters tableParameter = item.getParams(); |
194 | 41534 | jjdelcerro | |
195 | if (tableParameter == null) { |
||
196 | 41486 | jjdelcerro | return null; |
197 | } |
||
198 | 41509 | jjdelcerro | return tableParameter.getTable();
|
199 | 41486 | jjdelcerro | } |
200 | 41534 | jjdelcerro | |
201 | 43031 | jjdelcerro | @Override
|
202 | 40435 | jjdelcerro | public String getPanelTitle() { |
203 | 41486 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
204 | 41534 | jjdelcerro | return i18nManager.getTranslation("_Tablename"); |
205 | 40435 | jjdelcerro | } |
206 | 41534 | jjdelcerro | |
207 | 43031 | jjdelcerro | @Override
|
208 | 40435 | jjdelcerro | public boolean isValidPanel() throws ExporttoPanelValidationException { |
209 | 41534 | jjdelcerro | I18nManager i18nManager = ToolsLocator.getI18nManager(); |
210 | String tablename = this.getTableName(); |
||
211 | 41560 | jjdelcerro | if (tablename == null) { |
212 | 40435 | jjdelcerro | throw new ExporttoPanelValidationException( |
213 | 41560 | jjdelcerro | i18nManager.getTranslation( |
214 | "_The_name_of_table_cannot_be_empty"
|
||
215 | ) |
||
216 | 41534 | jjdelcerro | ); |
217 | 40435 | jjdelcerro | } |
218 | 41534 | jjdelcerro | String schema = this.getSchema(); |
219 | 43355 | jjdelcerro | if( sqlbuilder.supportSchemas() ) {
|
220 | if (schema == null) { |
||
221 | throw new ExporttoPanelValidationException( |
||
222 | i18nManager.getTranslation( |
||
223 | "_The_name_of_schema_cannot_be_empty"
|
||
224 | ) |
||
225 | ); |
||
226 | } |
||
227 | 41486 | jjdelcerro | } |
228 | 41560 | jjdelcerro | if (this.rdoCreateTable.isSelected()) { |
229 | 41598 | jjdelcerro | String tablename_tr = tablename;
|
230 | if( this.provider.getTranslateIdentifiersToLowerCase() ) { |
||
231 | tablename_tr = tablename_tr.toLowerCase(); |
||
232 | } |
||
233 | 43377 | jjdelcerro | if( this.provider.getTranslateHyphens()) { |
234 | tablename_tr = tablename_tr.replace("-", "_"); |
||
235 | } |
||
236 | 41598 | jjdelcerro | if( this.provider.getRemoveSpacesInIdentifiers() ) { |
237 | tablename_tr = StringUtils.normalizeSpace(tablename_tr).replace(" ", "_"); |
||
238 | } |
||
239 | if( !tablename_tr.equals(tablename) ) {
|
||
240 | String msg = i18nManager.getTranslation(
|
||
241 | "Ha_utilizado_espacios_en_blanco_o_mayusculas_en_el_nombre_de_la_tabla_Desea_que_se_corrija_de_forma_automatica"
|
||
242 | ); |
||
243 | 43377 | jjdelcerro | ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
244 | int resp = dialogs.confirmDialog(
|
||
245 | 43031 | jjdelcerro | msg, |
246 | 41598 | jjdelcerro | i18nManager.getTranslation("_Warning"),
|
247 | JOptionPane.YES_NO_OPTION,
|
||
248 | 43377 | jjdelcerro | JOptionPane.WARNING_MESSAGE,
|
249 | "Exportto_Table_name_with_spaces_or_mixed_case"
|
||
250 | 41598 | jjdelcerro | ); |
251 | if( resp != JOptionPane.YES_OPTION ) { |
||
252 | msg = i18nManager.getTranslation( |
||
253 | "El_nombre_de_tabla_contiene_caracteres no_validos"
|
||
254 | ); |
||
255 | throw new ExporttoPanelValidationException(msg); |
||
256 | } |
||
257 | tablename = tablename_tr; |
||
258 | this.txtTableName.setText(tablename);
|
||
259 | } |
||
260 | 41560 | jjdelcerro | ListModel model = this.lstTables.getModel(); |
261 | for (int i = 0; i < model.getSize(); i++) { |
||
262 | TableItem item = (TableItem) model.getElementAt(i); |
||
263 | 43355 | jjdelcerro | if ( StringUtils.equals(schema,item.getParams().getSchema())
|
264 | && StringUtils.equals(tablename,item.getParams().getTable())) { |
||
265 | 41560 | jjdelcerro | String msg = i18nManager.getTranslation(
|
266 | "_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",
|
||
267 | new String[]{schema, tablename} |
||
268 | ); |
||
269 | throw new ExporttoPanelValidationException(msg); |
||
270 | } |
||
271 | 41534 | jjdelcerro | } |
272 | } |
||
273 | 40435 | jjdelcerro | return true; |
274 | } |
||
275 | 41534 | jjdelcerro | |
276 | 43031 | jjdelcerro | @Override
|
277 | 41488 | jjdelcerro | public void enterPanel() { |
278 | 43355 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = provider.getExplorerParameters(); |
279 | 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 | 41486 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = this.provider.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 | 41492 | jjdelcerro | JDBCServerExplorerParameters explorerParameters = provider.getExplorerParameters(); |
338 | 41534 | jjdelcerro | if (provider.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 | } |