Changeset 5429 in osm


Ignore:
Timestamp:
2007-11-10T12:46:57+01:00 (17 years ago)
Author:
ulf
Message:

add icons and keyboard shortcuts to the menu items

Location:
applications/editors/josm/plugins/surveyor
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java

    r4277 r5429  
    44 */
    55package at.dallermassl.josm.plugin.surveyor;
     6
     7import static org.openstreetmap.josm.tools.I18n.tr;
    68
    79import java.awt.event.ActionEvent;
     
    1315import javax.swing.AbstractAction;
    1416import javax.swing.AbstractButton;
     17import java.awt.event.KeyEvent;
    1518
    1619import at.dallermassl.josm.plugin.surveyor.action.SetWaypointAction;
     20import org.openstreetmap.josm.actions.JosmAction;
    1721
    1822import livegps.LiveGpsLayer;
     
    2226 *
    2327 */
    24 public class AutoSaveAction extends AbstractAction {
     28public class AutoSaveAction extends JosmAction {
    2529    private static final long serialVersionUID = -8608679323231116043L;
    2630    private static final long AUTO_SAVE_PERIOD_SEC = 60; // once a minute
     
    3135   
    3236   
    33     public AutoSaveAction(String name) {
    34         super(name);
     37    public AutoSaveAction() {
     38                super(tr("AutoSave LiveData"), "autosave.png", tr("Save captured data to file every minute."), KeyEvent.VK_S, KeyEvent.CTRL_MASK | KeyEvent.ALT_MASK, true);
    3539        // <FIXXME date="23.06.2007" author="cdaller">
    3640        // TODO set accelerator key
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java

    r4522 r5429  
    1515import javax.swing.JOptionPane;
    1616import javax.swing.KeyStroke;
     17import java.awt.event.KeyEvent;
    1718
    1819import livegps.LiveGpsPlugin;
     
    7576            throw new IllegalStateException("SurveyorPlugin needs LiveGpsPlugin, but could not find it!");
    7677        }
    77         SurveyorShowAction surveyorAction = new SurveyorShowAction("Surveyor", gpsPlugin);
     78        SurveyorShowAction surveyorAction = new SurveyorShowAction(gpsPlugin);
    7879        JMenuItem surveyorMenuItem = new JMenuItem(surveyorAction);
    79         surveyorAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt S"));
    80 //        surveyorMenuItem.addActionListener(new ActionListener() {
     80        surveyorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.VK_ALT));
     81
    8182        gpsPlugin.getLgpsMenu().addSeparator();
    8283        gpsPlugin.getLgpsMenu().add(surveyorMenuItem);
    8384       
    84         AutoSaveAction autoSaveAction = new AutoSaveAction(tr("AutoSave LiveData"));
    85         autoSaveAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt ctrl S"));
     85        AutoSaveAction autoSaveAction = new AutoSaveAction();
    8686        JCheckBoxMenuItem autoSaveMenu = new JCheckBoxMenuItem(autoSaveAction);
    8787        gpsPlugin.getLgpsMenu().add(autoSaveMenu); 
     88        autoSaveMenu.setAccelerator(autoSaveAction.shortCut);
    8889    }
    8990
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java

    r4522 r5429  
    2727import org.openstreetmap.josm.Main;
    2828import org.openstreetmap.josm.tools.XmlObjectParser;
     29import org.openstreetmap.josm.actions.JosmAction;
    2930import org.xml.sax.SAXException;
    3031
     
    3536 *
    3637 */
    37 public class SurveyorShowAction extends AbstractAction {
     38public class SurveyorShowAction extends JosmAction {
    3839    private static final long serialVersionUID = 2184570223633094734L;
    3940    private static final String DEFAULT_SOURCE = "resource://surveyor.xml";
     
    4243
    4344    public SurveyorShowAction(LiveGpsPlugin gpsPlugin) {
    44         this(null, gpsPlugin);
    45     }
    46    
    47     public SurveyorShowAction(String name, LiveGpsPlugin gpsPlugin) {
    48         super(name);
     45        super(tr("Surveyor ..."), "surveyormenu.png", tr("Open surveyor tool."), KeyEvent.VK_S, KeyEvent.CTRL_MASK, true);
    4946        this.gpsPlugin = gpsPlugin;
    5047    }
     
    107104            surveyorFrame.pack();
    108105            surveyorFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    109             surveyorFrame.setTitle((String)getValue(AbstractAction.NAME));
     106            //surveyorFrame.setTitle((String)getValue(AbstractAction.NAME));
     107            surveyorFrame.setTitle(tr("Surveyor"));
    110108            // <FIXXME date="28.04.2007" author="cdaller">
    111109            // TODO get old pos of frame from properties
Note: See TracChangeset for help on using the changeset viewer.