Ignore:
Timestamp:
2013-09-30T02:51:34+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #9116 - Remember active layer in session

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r6245 r6271  
    6767        private final boolean zip;
    6868        private List<Layer> layers;
     69        private Layer active;
    6970        private List<Runnable> postLoadTasks;
    7071        private ViewportData viewport;
     
    122123                            if (canceled) return;
    123124                            Main.main.addLayer(l);
     125                        }
     126                        if (active != null) {
     127                            Main.map.mapView.setActiveLayer(active);
    124128                        }
    125129                        if (noMap) {
     
    158162                    reader.loadSession(file, zip, monitor);
    159163                    layers = reader.getLayers();
     164                    active = reader.getActive();
    160165                    postLoadTasks = reader.getPostLoadTasks();
    161166                    viewport = reader.getViewport();
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r6267 r6271  
    123123            layersOut.add(layer);
    124124        }
    125 
    126         SessionWriter sw = new SessionWriter(layersOut, exporters, dependencies, zip);
     125       
     126        int active = -1;
     127        Layer activeLayer = Main.map.mapView.getActiveLayer();
     128        if (activeLayer != null) {
     129            active = layersOut.indexOf(activeLayer);
     130        }
     131
     132        SessionWriter sw = new SessionWriter(layersOut, active, exporters, dependencies, zip);
    127133        try {
    128134            sw.write(file);
     
    157163        }
    158164
     165        /**
     166         * Initializes action.
     167         */
    159168        public void initialize() {
    160169            layers = new ArrayList<Layer>(Main.map.mapView.getAllLayersAsList());
     
    196205        }
    197206
    198         public Component build() {
     207        protected Component build() {
    199208            JPanel p = new JPanel(new GridBagLayout());
    200209            JPanel ip = new JPanel(new GridBagLayout());
Note: See TracChangeset for help on using the changeset viewer.