Changeset 6180 in josm


Ignore:
Timestamp:
2013-08-23T03:11:41+02:00 (8 years ago)
Author:
Don-vip
Message:

MainMenu: make changesetManager entry public + javadoc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r6130 r6180  
    124124
    125125    /* File menu */
     126    /** File -> New Layer **/
    126127    public final NewAction newAction = new NewAction();
     128    /** File -> Open... **/
    127129    public final OpenFileAction openFile = new OpenFileAction();
     130    /** File -> Open Recent > **/
    128131    public final RecentlyOpenedFilesMenu recentlyOpened = new RecentlyOpenedFilesMenu();
     132    /** File -> Open Location... **/
    129133    public final OpenLocationAction openLocation = new OpenLocationAction();
    130     public final JosmAction save = SaveAction.getInstance();
    131     public final JosmAction saveAs = SaveAsAction.getInstance();
    132     public JosmAction sessionLoad;
    133     public JosmAction sessionSaveAs;
    134     public final JosmAction gpxExport = new GpxExportAction();
     134    /** File -> Save **/
     135    public final SaveAction save = SaveAction.getInstance();
     136    /** File -> Save As... **/
     137    public final SaveAsAction saveAs = SaveAsAction.getInstance();
     138    /** File -> Session > Load Session **/
     139    public SessionLoadAction sessionLoad;
     140    /** File -> Session > Save Session As... **/
     141    public SessionSaveAsAction sessionSaveAs;
     142    /** File -> Export to GPX... **/
     143    public final GpxExportAction gpxExport = new GpxExportAction();
     144    /** File -> Download from OSM... **/
    135145    public final DownloadAction download = new DownloadAction();
     146    /** File -> Download object... **/
    136147    public final DownloadPrimitiveAction downloadPrimitive = new DownloadPrimitiveAction();
     148    /** File -> Download parent ways/relations... **/
    137149    public final DownloadReferrersAction downloadReferrers = new DownloadReferrersAction();
     150    /** File -> Close open changesets... **/
    138151    public final CloseChangesetAction closeChangesetAction = new CloseChangesetAction();
     152    /** File -> Update data **/
    139153    public final JosmAction update = new UpdateDataAction();
     154    /** File -> Update selection **/
    140155    public final JosmAction updateSelection = new UpdateSelectionAction();
     156    /** File -> Update modified **/
    141157    public final JosmAction updateModified = new UpdateModifiedAction();
     158    /** File -> Upload data **/
    142159    public final JosmAction upload = new UploadAction();
     160    /** File -> Upload selection **/
    143161    public final JosmAction uploadSelection = new UploadSelectionAction();
    144     public final JosmAction restart = new RestartAction();
    145     public final JosmAction exit = new ExitAction();
     162    /** File -> Restart **/
     163    public final RestartAction restart = new RestartAction();
     164    /** File -> Exit **/
     165    public final ExitAction exit = new ExitAction();
    146166
    147167    /* Edit menu */
     168    /** Edit -> Undo... */
    148169    public final UndoAction undo = new UndoAction();
     170    /** Edit -> Redo */
    149171    public final RedoAction redo = new RedoAction();
    150     public final JosmAction copy = new CopyAction();
     172    /** Edit -> Copy */
     173    public final CopyAction copy = new CopyAction();
     174    /** Edit -> Copy Coordinates */
    151175    public final JosmAction copyCoordinates = new CopyCoordinatesAction();
     176    /** Edit -> Paste */
    152177    public final PasteAction paste = new PasteAction();
    153     public final JosmAction pasteTags = new PasteTagsAction();
    154     public final JosmAction duplicate = new DuplicateAction();
    155     public final JosmAction delete = new DeleteAction();
     178    /** Edit -> Paste Tags */
     179    public final PasteTagsAction pasteTags = new PasteTagsAction();
     180    /** Edit -> Duplicate */
     181    public final DuplicateAction duplicate = new DuplicateAction();
     182    /** Edit -> Delete */
     183    public final DeleteAction delete = new DeleteAction();
     184    /** Edit -> Purge... */
    156185    public final JosmAction purge = new PurgeAction();
    157     public final JosmAction merge = new MergeLayerAction();
    158     public final JosmAction mergeSelected = new MergeSelectionAction();
    159     public final JosmAction selectAll = new SelectAllAction();
    160     public final JosmAction unselectAll = new UnselectAllAction();
    161     public final JosmAction search = new SearchAction();
    162     public final JosmAction preferences = new PreferencesAction();
     186    /** Edit -> Merge layer */
     187    public final MergeLayerAction merge = new MergeLayerAction();
     188    /** Edit -> Merge selection */
     189    public final MergeSelectionAction mergeSelected = new MergeSelectionAction();
     190    /** Edit -> Search... */
     191    public final SearchAction search = new SearchAction();
     192    /** Edit -> Preferences */
     193    public final PreferencesAction preferences = new PreferencesAction();
    163194
    164195    /* View menu */
     196    /** View -> Wireframe View */
    165197    public final WireframeToggleAction wireFrameToggleAction = new WireframeToggleAction();
    166198    public final JosmAction toggleGPXLines = new ToggleGPXLinesAction();
     199    /** View -> Advanced info */
    167200    public final InfoAction info = new InfoAction();
     201    /** View -> Advanced info (web) */
    168202    public final InfoWebAction infoweb = new InfoWebAction();
     203    /** View -> History */
    169204    public final HistoryInfoAction historyinfo = new HistoryInfoAction();
     205    /** View -> History (web) */
    170206    public final HistoryInfoWebAction historyinfoweb = new HistoryInfoWebAction();
     207    /** View -> "Zoom to"... actions */
    171208    public final Map<String, AutoScaleAction> autoScaleActions = new HashMap<String, AutoScaleAction>();
    172209
     
    192229    public final JosmAction createMultipolygon = new CreateMultipolygonAction();
    193230
     231    /* Selection menu */
     232    /** Selection -> Select All */
     233    public final SelectAllAction selectAll = new SelectAllAction();
     234    /** Selection -> Unselect All */
     235    public final UnselectAllAction unselectAll = new UnselectAllAction();
     236
    194237    /* Audio menu */
    195238    public final JosmAction audioPlayPause = new AudioPlayPauseAction();
     
    201244    public final JosmAction audioSlower = new AudioSlowerAction();
    202245
     246    /* Windows Menu */
     247    /** Windows -> Changeset Manager */
     248    public final ChangesetManagerToggleAction changesetManager = new ChangesetManagerToggleAction();
     249   
    203250    /* Help menu */
     251    /** Help -> Help */
    204252    public final HelpAction help = new HelpAction();
    205     public final JosmAction about = new AboutAction();
    206     public final JosmAction statusreport = new ShowStatusReportAction();
    207 
     253    /** Help -> About */
     254    public final AboutAction about = new AboutAction();
     255    /** Help -> Show Status Report */
     256    public final ShowStatusReportAction statusreport = new ShowStatusReportAction();
     257
     258    /**
     259     * fileMenu contains I/O actions
     260     */
    208261    public final JMenu fileMenu = addMenu(marktr("File"), KeyEvent.VK_F, 0, ht("/Menu/File"));
    209     public final JMenu sessionMenu = new JMenu(tr("Session")); // submenu of the file menu
     262    /**
     263     * sessionMenu is a submenu of File menu containing all session actions
     264     */
     265    public final JMenu sessionMenu = new JMenu(tr("Session"));
     266    /**
     267     * editMenu contains editing actions
     268     */
    210269    public final JMenu editMenu = addMenu(marktr("Edit"), KeyEvent.VK_E, 1, ht("/Menu/Edit"));
     270    /**
     271     * viewMenu contains display actions (zoom, map styles, etc.)
     272     */
    211273    public final JMenu viewMenu = addMenu(marktr("View"), KeyEvent.VK_V, 2, ht("/Menu/View"));
    212274    /**
     
    226288     */   
    227289    public final JMenu dataMenu = addMenu(marktr("Data"), KeyEvent.VK_D, 5, ht("/Menu/Data"));
    228      /**
     290    /**
    229291     * selectionMenu contains all actions related to selecting different objects
    230292     * @since 6082 (moved from Utilsplugin2)
    231293     */
    232294    public final JMenu selectionMenu = addMenu(marktr("Selection"), KeyEvent.VK_N, 6, ht("/Menu/Selection"));
     295    /**
     296     * presetsMenu contains presets actions (search, presets tree)
     297     */
    233298    public final JMenu presetsMenu = addMenu(marktr("Presets"), KeyEvent.VK_P, 7, ht("/Menu/Presets"));
    234299    /**
     
    237302     */
    238303    public final JMenu imagerySubMenu = new JMenu(tr("More..."));
    239     public final ImageryMenu imageryMenu =
    240         (ImageryMenu)addMenu(new ImageryMenu(imagerySubMenu), marktr("Imagery"), KeyEvent.VK_I, 8, ht("/Menu/Imagery"));
    241      /**
     304    /**
     305     * imageryMenu contains all imagery-related actions
     306     */
     307    public final ImageryMenu imageryMenu = addMenu(new ImageryMenu(imagerySubMenu), marktr("Imagery"), KeyEvent.VK_I, 8, ht("/Menu/Imagery"));
     308    /**
    242309     * gpsMenu contains all plugin actions that are related
    243310     * to using GPS data, including opening, uploading and real-time tracking
     
    253320    public static enum WINDOW_MENU_GROUP { ALWAYS, TOGGLE_DIALOG, VOLATILE }
    254321
     322    /**
     323     * audioMenu contains all audio-related actions. Be careful, this menu is not guaranteed to be displayed at all
     324     */
    255325    public JMenu audioMenu = null;
     326    /**
     327     * helpMenu contains JOSM general actions (Help, About, etc.)
     328     */
    256329    public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
    257330
     
    395468     * @param group the item should be added to. Groups are split by a separator.
    396469     *        0 is the first group, -1 will add the item to the end.
     470     * @return The created menu item
    397471     */
    398472    public static <E extends Enum<E>> JMenuItem add(JMenu menu, JosmAction action, Enum<E> group) {
     
    416490     *        one of the enums that are defined for some of the menus to tell in which
    417491     *        group the item should go.
     492     * @return The created menu item
    418493     */
    419494    public static <E extends Enum<E>> JCheckBoxMenuItem addWithCheckbox(JMenu menu, JosmAction action, Enum<E> group) {
     
    459534    }
    460535
    461     public JMenu addMenu(JMenu menu, String name, int mnemonicKey, int position, String relativeHelpTopic) {
     536    public <T extends JMenu> T addMenu(T menu, String name, int mnemonicKey, int position, String relativeHelpTopic) {
    462537        Shortcut.registerShortcut("menu:" + name, tr("Menu: {0}", tr(name)), mnemonicKey,
    463538                Shortcut.MNEMONIC).setMnemonic(menu);
     
    467542    }
    468543
     544    /**
     545     * Constructs a new {@code MainMenu}.
     546     */
    469547    public MainMenu() {
    470548        JMenuItem current;
     
    614692
    615693        // -- changeset manager toggle action
    616         ChangesetManagerToggleAction changesetManagerToggleAction = new ChangesetManagerToggleAction();
    617         final JCheckBoxMenuItem mi = MainMenu.addWithCheckbox(windowMenu, changesetManagerToggleAction,
     694        final JCheckBoxMenuItem mi = MainMenu.addWithCheckbox(windowMenu, changesetManager,
    618695                MainMenu.WINDOW_MENU_GROUP.ALWAYS);
    619         changesetManagerToggleAction.addButtonModel(mi.getModel());
     696        changesetManager.addButtonModel(mi.getModel());
    620697
    621698        if (!Main.pref.getBoolean("audio.menuinvisible", false)) {
Note: See TracChangeset for help on using the changeset viewer.