Revision 3459 org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.swing/org.gvsig.vcsgis.swing.impl/src/main/java/org/gvsig/vcsgis/swing/impl/export/VCSGisJExportImpl.java

View differences:

VCSGisJExportImpl.java
62 62
import org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController;
63 63
import static org.gvsig.vcsgis.swing.impl.VCSGisEntitySelectorController.REMOTE_ENTITIES;
64 64
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.notInSwingThreadInvokeLater;
65
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationsErrors;
65
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationErrors;
66
import static org.gvsig.vcsgis.swing.impl.VCSGisSwingCommons.showAuthenticationRequiredMessage;
66 67
import org.gvsig.vcsgis.swing.impl.revisions.VCSGisRevisionPickerControllerImpl;
67 68
import org.slf4j.LoggerFactory;
68 69

  
......
79 80

  
80 81
    private PickerController<VCSGisWorkspace> workspacePicker;
81 82
    private DatePickerController efectivePicker;
82
//    private FilteredListController filteredList;
83 83
    private VCSGisEntitySelectorController entitySelector;
84 84
    private VCSGisRevisionPickerControllerImpl revisionPicker;
85 85
    private boolean processing;
......
174 174
        });
175 175
        
176 176
        this.txtTableName.getDocument().addDocumentListener(new DocumentListener() {
177
            @Override
177 178
            public void changedUpdate(DocumentEvent e) {
178 179
                doUpdateEnableComponents();
179 180
            }
180 181

  
182
            @Override
181 183
            public void removeUpdate(DocumentEvent e) {
182 184
                doUpdateEnableComponents();
183 185
            }
184 186

  
187
            @Override
185 188
            public void insertUpdate(DocumentEvent e) {
186 189
                doUpdateEnableComponents();
187 190
            }
......
204 207
    }
205 208

  
206 209
    private void doChangeWorkspace() {
207
        VCSGisWorkspace workspace = workspacePicker.get();
208
        if (workspace == null) {
209
            return;
210
        try {
211
            VCSGisWorkspace ws = this.getWorkspace();
212
            if (ws == null) {
213
                this.entitySelector.setWorkspace(ws);
214
                this.revisionPicker.setWorkspace(ws);
215
                return;
216
            }
217
            if (ws.authenticate(null)) {
218
                this.entitySelector.setWorkspace(ws);
219
                this.revisionPicker.setWorkspace(ws);
220

  
221
                Thread task = new Thread(
222
                        () -> {
223
                            try {
224
                                LOGGER.info("Entro en el thread");
225
                                processing = true;
226
                                doUpdateEnableComponents();
227
                                ws.getRepositoryEntities();
228
                            } catch (Exception ex) {
229
                                LOGGER.warn("Can't retrieve repository entities", ex);
230
                            } finally {
231
                                LOGGER.info("Salgo del thread");
232
                                processing = false;
233
                                doUpdateEnableComponents();
234
                            }
235
                        },
236
                        "VCSGisExportGetRepositoryEntities"
237
                );
238
                this.processing = true;
239
                LOGGER.info("Creando thread");
240
                doUpdateEnableComponents();
241
                task.start();
242

  
243
                return;
244
            }
245
            showAuthenticationRequiredMessage("_VCS_Checkout");
246
            this.workspacePicker.set(null);
247
            doChangeWorkspace();
248
        } catch (VCSGisRuntimeException e1) {
249
            LOGGER.warn("Can't set workspace.", e1);
250
            if (showAuthenticationErrors("_VCS_Checkout", e1)) {
251
                this.workspacePicker.set(null);
252
                doChangeWorkspace();
253
            }
254
        } catch (Exception e2) {
255
            LOGGER.warn("Can't set workspace.", e2);
210 256
        }
211
        this.entitySelector.setWorkspace(workspace);
212
        this.revisionPicker.setWorkspace(workspace);
213 257

  
214
        Thread task = new Thread(
215
                () -> {
216
                    try {
217
                        LOGGER.info("Entro en el thread");
218
                        processing = true;
219
                        doUpdateEnableComponents();
220
                        workspace.getRepositoryEntities();
221
                    }catch (Exception ex){
222
                        LOGGER.warn("Can't retrieve repository entities", ex);
223
                    }finally{
224
                        LOGGER.info("Salgo del thread");
225
                        processing = false;
226
                        doUpdateEnableComponents();
227
                    }
228
                },
229
                "VCSGisExportGetRepositoryEntities"
230
        );
231
        this.processing = true;
232
        LOGGER.info("Creando thread");
233
        doUpdateEnableComponents();
234
        task.start();
258
        
259
        
260
        
261
//        VCSGisWorkspace workspace = this.getWorkspace();
262
//        if (workspace == null) {
263
//            return;
264
//        }
265
//        this.entitySelector.setWorkspace(workspace);
266
//        this.revisionPicker.setWorkspace(workspace);
267
//
268
//        Thread task = new Thread(
269
//                () -> {
270
//                    try {
271
//                        LOGGER.info("Entro en el thread");
272
//                        processing = true;
273
//                        doUpdateEnableComponents();
274
//                        workspace.getRepositoryEntities();
275
//                    }catch (Exception ex){
276
//                        LOGGER.warn("Can't retrieve repository entities", ex);
277
//                    }finally{
278
//                        LOGGER.info("Salgo del thread");
279
//                        processing = false;
280
//                        doUpdateEnableComponents();
281
//                    }
282
//                },
283
//                "VCSGisExportGetRepositoryEntities"
284
//        );
285
//        this.processing = true;
286
//        LOGGER.info("Creando thread");
287
//        doUpdateEnableComponents();
288
//        task.start();
235 289
    }
236 290

  
237 291
    private void doChangeTable() {
......
243 297

  
244 298
    private void doChangeTableName() {
245 299
        VCSGisEntity selectedTable = this.entitySelector.getSelectedEntity();
300
        if(selectedTable == null){
301
            this.txtTableName.setText("");
302
            return;
303
        }
246 304
        String suffix;
247 305
        Timestamp timestamp;
248 306
        if(rdbEffectiveDate.isSelected() && this.efectivePicker.get() != null){
......
351 409
            }
352 410
        } catch (VCSGisRuntimeException e1) {
353 411
            LOGGER.warn("Can't updating components.", e1);
354
            if (showAuthenticationsErrors("_VCS_Export", e1)) {
412
            if (showAuthenticationErrors("_VCS_Export", e1)) {
355 413
                this.workspacePicker.set(null);
356 414
                doChangeWorkspace();
357 415
                doUpdateEnableComponents();
......
387 445
                doUpdateEnableComponents();
388 446

  
389 447
                showMessage(i18n.getTranslation("_Processing"), null);
390
                int res = ERR_OK;
448
                int res; // = ERR_OK;
391 449
                String tableName = this.txtTableName.getText();
392 450

  
393 451
                res = workspace.export(entity.getEntityName(),
......
440 498
            if (!rdbDontAddToProject.isSelected()) {
441 499
                if (rdbAddLayerToView.isSelected()) {
442 500
                    if (isLayer(store)) {
443
//                        String layerName = store.getName();
444 501
                        String newLayerName = tableName;
445 502
                        services.addLayerToView(store, (LabeledValue) cboView.getSelectedItem(), newLayerName);
446 503
                    }
447 504
                }
448 505
                if (rdbAddTableToProject.isSelected()) {
449
//                    String layerName = store.getName();
450 506
                    String newLayerName = this.txtTableName.getText();
451 507
                    services.addTableToProject(workspace, store, newLayerName);
452 508
                }

Also available in: Unified diff