Revision 37781 branches/v2_0_0_prep/extensions/org.gvsig.exportto.app/org.gvsig.exportto.app.extension/src/main/java/org/gvsig/exportto/app/extension/LoadLayerAction.java

View differences:

LoadLayerAction.java
36 36
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
37 37
import org.gvsig.fmap.mapcontext.layers.FLayer;
38 38

  
39

  
40 39
/**
41 40
 * @author gvSIG Team
42 41
 * @version $Id$
43
 *
42
 * 
44 43
 */
45
public class LoadLayerAction implements ExporttoServiceFinishAction{
46
    private static final Logger LOG = LoggerFactory.getLogger(LoadLayerAction.class);
47
    private static final MapContextManager MAP_CONTEXT_MANAGER = MapContextLocator.getMapContextManager();    
48
    
44
public class LoadLayerAction implements ExporttoServiceFinishAction {
45

  
46
    private static final Logger LOG = LoggerFactory
47
        .getLogger(LoadLayerAction.class);
48
    private static final MapContextManager MAP_CONTEXT_MANAGER =
49
        MapContextLocator.getMapContextManager();
50

  
49 51
    private MapContext mapContext = null;
50 52

  
51 53
    public LoadLayerAction(MapContext mapContext) {
......
53 55
        this.mapContext = mapContext;
54 56
    }
55 57

  
56
    public void finished(String layerName, DataStoreParameters dataStoreParameters) {
58
    public void finished(String layerName,
59
        DataStoreParameters dataStoreParameters) {
57 60
        try {
58
            int res = JOptionPane.showConfirmDialog((JComponent) PluginServices.getMDIManager()
59
                .getActiveWindow(),
60
                PluginServices.getText(this,
61
                    "insertar_en_la_vista_la_capa_creada"),
61
            int res =
62
                JOptionPane.showConfirmDialog((JComponent) PluginServices
63
                    .getMDIManager().getActiveWindow(), PluginServices.getText(
64
                    this, "insertar_en_la_vista_la_capa_creada"),
62 65
                    PluginServices.getText(this, "insertar_capa"),
63 66
                    JOptionPane.YES_NO_OPTION);
64 67

  
65
            if (res == JOptionPane.YES_OPTION) {               
66
                FLayer layer = MAP_CONTEXT_MANAGER.createLayer(layerName, dataStoreParameters);
67
                mapContext.getLayers().addLayer(layer);           
68
            if (res == JOptionPane.YES_OPTION) {
69
                FLayer layer =
70
                    MAP_CONTEXT_MANAGER.createLayer(layerName,
71
                        dataStoreParameters);
72
                mapContext.getLayers().addLayer(layer);
68 73
            }
69 74

  
70 75
        } catch (LoadLayerException e) {
71 76
            LOG.error("Error loading the exported layer", e);
72
        }        
77
        }
73 78
    }
74 79
}

Also available in: Unified diff