source: josm/trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

Last change on this file was 18466, checked in by taylor.smock, 23 months ago

Fix #21813: Improve marker handling in sessions and #21923: Improve session workflow/Add "save session" (patch by Bjoeni)

  • Allow saving a previously saved session
  • Add "File" -> "Save Session"
  • Add shortcuts for saving sessions
  • Add warning if a layer in a session is being removed when saving over the session
  • Improve GPX marker handling
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.gui.MainApplication;
11import org.openstreetmap.josm.tools.Logging;
12import org.openstreetmap.josm.tools.Shortcut;
13import org.openstreetmap.josm.tools.UserCancelException;
14
15/**
16 * Saves a JOSM session to a new file
17 * @since 4685
18 */
19public class SessionSaveAsAction extends SessionSaveAction {
20
21 /**
22 * Constructs a new {@code SessionSaveAsAction}.
23 */
24 public SessionSaveAsAction() {
25 this(true, false);
26 updateEnabledState();
27 }
28
29 /**
30 * Constructs a new {@code SessionSaveAsAction}.
31 * @param toolbar Register this action for the toolbar preferences?
32 * @param installAdapters False, if you don't want to install layer changed and selection changed adapters
33 */
34 protected SessionSaveAsAction(boolean toolbar, boolean installAdapters) {
35
36 super(tr("Save Session As..."), "session", tr("Save the current session to a new file."),
37 Shortcut.registerShortcut("system:savesessionas", tr("File: {0}", tr("Save Session As...")),
38 KeyEvent.VK_S, Shortcut.ALT_CTRL_SHIFT),
39 toolbar, "save_as-session", installAdapters);
40
41 setHelpId(ht("/Action/SessionSaveAs"));
42 }
43
44 @Override
45 public void actionPerformed(ActionEvent e) {
46 try {
47 saveSession(true, false);
48 } catch (UserCancelException ignore) {
49 Logging.trace(ignore);
50 }
51 }
52
53 @Override
54 protected void addListeners() {
55 MainApplication.addMapFrameListener(this);
56 }
57
58 @Override
59 protected void removeListeners() {
60 MainApplication.removeMapFrameListener(this);
61 }
62}
Note: See TracBrowser for help on using the repository browser.