Changeset 155 in josm


Ignore:
Timestamp:
2006-10-08T17:29:58+02:00 (15 years ago)
Author:
imi
Message:
  • added online help system
Location:
src/org/openstreetmap/josm
Files:
2 added
1 deleted
20 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/Main.java

    r154 r155  
    88import java.awt.Toolkit;
    99import java.awt.event.ActionEvent;
     10import java.awt.event.KeyEvent;
    1011import java.io.File;
    1112import java.net.URI;
     
    2223import javax.swing.AbstractAction;
    2324import javax.swing.Action;
     25import javax.swing.JComponent;
    2426import javax.swing.JMenu;
    2527import javax.swing.JMenuBar;
     
    2830import javax.swing.JSeparator;
    2931import javax.swing.JToolBar;
    30 import javax.swing.SwingUtilities;
     32import javax.swing.KeyStroke;
    3133import javax.swing.UIManager;
    3234
     
    3739import org.openstreetmap.josm.actions.ExternalToolsAction;
    3840import org.openstreetmap.josm.actions.GpxExportAction;
     41import org.openstreetmap.josm.actions.HelpAction;
    3942import org.openstreetmap.josm.actions.OpenAction;
    4043import org.openstreetmap.josm.actions.PreferencesAction;
     
    104107         */
    105108        public static PleaseWaitDialog pleaseWaitDlg;
     109        /**
     110         * The access to the help subsystem
     111         */
     112        public HelpAction help;
    106113
    107114
     
    192199                final Action exitAction = new ExitAction();
    193200                final Action preferencesAction = new PreferencesAction();
     201                help = new HelpAction();
    194202                final Action aboutAction = new AboutAction();
    195203
     
    235243                final JMenu helpMenu = new JMenu(tr("Help"));
    236244                helpMenu.setMnemonic('H');
     245                helpMenu.add(help);
     246                helpMenu.add(aboutAction);
     247                helpMenu.addSeparator();
    237248                helpMenu.add(annotationTesterAction);
    238                 helpMenu.addSeparator();
    239                 helpMenu.add(aboutAction);
    240249                mainMenu.add(helpMenu);
    241250
     
    256265                contentPane.add(toolBar, BorderLayout.NORTH);
    257266
     267        contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "Help");
     268        contentPane.getActionMap().put("Help", help);
     269
    258270                contentPane.updateUI();
    259 
    260                 // Plugins
    261                 if (Main.pref.hasKey("plugins")) {
     271        }
     272
     273        /**
     274         * Load all plugins specified in preferences. Has to be called after the complete
     275         * GUI has been set up. (post-constructor)
     276         */
     277        public void loadPlugins() {
     278            if (Main.pref.hasKey("plugins")) {
    262279                        for (String pluginName : Main.pref.get("plugins").split(",")) {
    263280                                try {
     
    273290                        }
    274291                }
    275 
    276                 SwingUtilities.updateComponentTreeUI(parent);
    277                 for (DownloadTask task : downloadAction.downloadTasks)
    278                         task.getCheckBox().updateUI();
    279         }
     292    }
    280293
    281294        /**
  • src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r113 r155  
    2727
    2828        private static final String[] modes = {
    29                 marktr("data"), 
     29                marktr("data"),
    3030                marktr("selection"),
    3131                marktr("layer"),
     
    3939                public Action(String mode) {
    4040                        super(tr("Auto Scale: {0}", tr(mode)), ImageProvider.get("dialogs/autoscale/"+mode));
     41                        String modeHelp = Character.toUpperCase(mode.charAt(0))+mode.substring(1);
     42                        putValue("help", "Action/AutoScale/"+modeHelp);
    4143                        putValue(SHORT_DESCRIPTION, tr("Auto zoom the view (to {0}. Disabled if the view is moved)", tr(mode)));
    4244                        this.mode = mode;
     
    7375                } else if (mode.equals("layer"))
    7476                        mapFrame.mapView.getActiveLayer().visitBoundingBox(v);
    75                 else if (mode.equals("selection") || mode.equals("conflict")) { 
     77                else if (mode.equals("selection") || mode.equals("conflict")) {
    7678                        Collection<OsmPrimitive> sel = mode.equals("selection") ? Main.ds.getSelected() : mapFrame.conflictDialog.conflicts.keySet();
    7779                        for (OsmPrimitive osm : sel)
  • src/org/openstreetmap/josm/actions/JosmAction.java

    r113 r155  
    1818        /**
    1919         * Construct the action as menu action entry.
    20          * 
     20         *
    2121         * @param name          Name of the action (entry name in menu)
    2222         * @param iconName      Name of the icon (without extension)
     
    3333        public JosmAction(String name, String iconName, String tooltip, int shortCut, int modifier) {
    3434                super(name, ImageProvider.get(iconName));
     35                setHelpId();
    3536                putValue(SHORT_DESCRIPTION, "<html>"+tooltip+" <font size='-2'>"+ShortCutLabel.name(shortCut, modifier)+"</font>&nbsp;</html>");
    36                 //Main.panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(shortCut, name);
    37         //Main.panel.getActionMap().put(name, this);
    3837        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, modifier), name);
    3938        Main.contentPane.getActionMap().put(name, this);
     
    4140
    4241        public JosmAction() {
     42                setHelpId();
     43        }
     44
     45
     46        private void setHelpId() {
     47                String helpId = "Action/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
     48                if (helpId.endsWith("Action"))
     49                        helpId = helpId.substring(0, helpId.length()-6);
     50                putValue("help", helpId);
    4351        }
    4452}
  • src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java

    r137 r155  
    2929 * This mode adds a new node to the dataset. The user clicks on a place to add
    3030 * and there is it. Nothing more, nothing less.
    31  * 
    32  * Newly created nodes are selected. Shift modifier does not cancel the old 
     31 *
     32 * Newly created nodes are selected. Shift modifier does not cancel the old
    3333 * selection as usual.
    34  * 
     34 *
    3535 * @author imi
    3636 *
     
    4444                public AddNodeGroup(MapFrame mf) {
    4545                        super(KeyEvent.VK_N,0);
     46                        putValue("help", "Action/AddNode");
    4647                        actions.add(new AddNodeAction(mf,tr("Add node"), Mode.node, tr("Add a new node to the map")));
    4748                        actions.add(new AddNodeAction(mf, tr("Add node into segment"), Mode.nodesegment,tr( "Add a node into an existing segment")));
     
    5354                super(name, "node/"+mode, desc, mapFrame, ImageProvider.getCursor("crosshair", "node"));
    5455                this.mode = mode;
     56                putValue("help", "Action/AddNode/"+Character.toUpperCase(mode.toString().charAt(0))+mode.toString().substring(1));
    5557        }
    5658
     
    7072         * If user clicked with the left button, add a node at the current mouse
    7173         * position.
    72          * 
     74         *
    7375         * If in nodesegment mode, add the node to the line segment by splitting the
    7476         * segment. The new created segment will be inserted in every way the segment
     
    102104                                n.coor = Main.proj.eastNorth2latlon(n.eastNorth);
    103105                        }
    104                        
     106
    105107                        Collection<Command> cmds = new LinkedList<Command>();
    106108                        cmds.add(c);
  • src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java

    r151 r155  
    2424/**
    2525 * This MapMode enables the user to easy make a selection of different objects.
    26  * 
     26 *
    2727 * The selected objects are drawn in a different style.
    28  * 
    29  * Holding and dragging the left mouse button draws an selection rectangle. 
    30  * When releasing the left mouse button, all objects within the rectangle get 
    31  * selected. 
    32  * 
     28 *
     29 * Holding and dragging the left mouse button draws an selection rectangle.
     30 * When releasing the left mouse button, all objects within the rectangle get
     31 * selected.
     32 *
    3333 * When releasing the left mouse button while the right mouse button pressed,
    3434 * nothing happens (the selection rectangle will be cleared, however).
     
    3636 * When releasing the mouse button and one of the following keys was hold:
    3737 *
    38  * If Alt key was hold, select all objects that are touched by the 
    39  * selection rectangle. If the Alt key was not hold, select only those objects 
    40  * completly within (e.g. for ways mean: only if all nodes of the way are 
    41  * within). 
     38 * If Alt key was hold, select all objects that are touched by the
     39 * selection rectangle. If the Alt key was not hold, select only those objects
     40 * completly within (e.g. for ways mean: only if all nodes of the way are
     41 * within).
    4242 *
    4343 * If Shift key was hold, the objects are added to the current selection. If
    4444 * Shift key wasn't hold, the current selection get replaced.
    45  * 
     45 *
    4646 * If Ctrl key was hold, remove all objects under the current rectangle from
    4747 * the active selection (if there were any). Nothing is added to the current
     
    5151 * If both are pressed, nothing happens when releasing the mouse button.
    5252 *
    53  * The user can also only click on the map. All total movements of 2 or less 
     53 * The user can also only click on the map. All total movements of 2 or less
    5454 * pixel are considered "only click". If that happens, the nearest Node will
    5555 * be selected if there is any within 10 pixel range. If there is no Node within
    5656 * 10 pixel, the nearest Segment (or Street, if user hold down the Alt-Key)
    5757 * within 10 pixel range is selected. If there is no Segment within 10 pixel
    58  * and the user clicked in or 10 pixel away from an area, this area is selected. 
    59  * If there is even no area, nothing is selected. Shift and Ctrl key applies to 
     58 * and the user clicked in or 10 pixel away from an area, this area is selected.
     59 * If there is even no area, nothing is selected. Shift and Ctrl key applies to
    6060 * this as usual. For more, @see MapView#getNearest(Point, boolean)
    6161 *
     
    7070                public Group(MapFrame mf) {
    7171                        super(KeyEvent.VK_S,0);
     72                        putValue("help", "Action/Selection");
    7273                        actions.add(new SelectionAction(mf, tr("Selection"), Mode.select, tr("Select objects by dragging or clicking.")));
    7374                        actions.add(new SelectionAction(mf, tr("Straight line"), Mode.straight, tr("Select objects in a straight line.")));
     
    9697                super(name, "selection/"+mode, desc, mapFrame, ImageProvider.getCursor("normal", "selection"));
    9798                this.mode = mode;
     99                putValue("help", "Action/Selection/"+Character.toUpperCase(mode.toString().charAt(0))+mode.toString().substring(1));
    98100                this.selectionManager = new SelectionManager(this, false, mapFrame.mapView);
    99101        }
     
    149151                        curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old.
    150152                else
    151                         curSel = Main.ds.getSelected(); 
     153                        curSel = Main.ds.getSelected();
    152154
    153155                Collection<OsmPrimitive> selectionList = selectionManager.getObjectsInRectangle(r,alt);
     
    196198
    197199        /**
    198          * Get the shortest path by stepping through the node with a common segment with start 
     200         * Get the shortest path by stepping through the node with a common segment with start
    199201         * and nearest to the end (greedy algorithm).
    200202         */
  • src/org/openstreetmap/josm/gui/MainApplication.java

    r153 r155  
    172172                Main.parent = mainFrame;
    173173                Main main = new MainApplication(mainFrame);
     174                main.loadPlugins();
    174175
    175176                mainFrame.setVisible(true);
  • src/org/openstreetmap/josm/gui/MapFrame.java

    r128 r155  
    2929import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    3030import org.openstreetmap.josm.gui.dialogs.HistoryDialog;
    31 import org.openstreetmap.josm.gui.dialogs.LayerList;
     31import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    3232import org.openstreetmap.josm.gui.dialogs.PropertiesDialog;
    3333import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
     
    118118                toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS));
    119119
    120                 addIconToggle(toggleDialogs, new LayerList(this));
     120                addIconToggle(toggleDialogs, new LayerListDialog(this));
    121121                addIconToggle(toggleDialogs, new PropertiesDialog(this));
    122122                addIconToggle(toggleDialogs, new HistoryDialog());
  • src/org/openstreetmap/josm/gui/MapScaler.java

    r116 r155  
    77
    88import org.openstreetmap.josm.Main;
     9import org.openstreetmap.josm.actions.HelpAction.Helpful;
    910import org.openstreetmap.josm.tools.ColorHelper;
    1011
    11 public class MapScaler extends JComponent {
     12public class MapScaler extends JComponent implements Helpful {
    1213
    1314        private final MapView mv;
     
    2930                g.drawString(text, (int)(50-bound.getWidth()/2), 23);
    3031    }
     32
     33        public String helpTopic() {
     34            return "MapView/Scaler";
     35    }
    3136}
  • src/org/openstreetmap/josm/gui/MapSlider.java

    r115 r155  
    1010import javax.swing.event.ChangeListener;
    1111
     12import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1213import org.openstreetmap.josm.data.coor.EastNorth;
    1314
    14 class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener {
     15class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener, Helpful {
    1516       
    1617    private final MapView mv;
     
    4950                        this.mv.zoomTo(this.mv.center, pos.north()*2/(this.mv.getHeight()-20));
    5051        }
     52
     53        public String helpTopic() {
     54            return "MapView/Slider";
     55    }
    5156}
  • src/org/openstreetmap/josm/gui/MapStatus.java

    r142 r155  
    2727
    2828import org.openstreetmap.josm.Main;
     29import org.openstreetmap.josm.actions.HelpAction.Helpful;
    2930import org.openstreetmap.josm.data.coor.LatLon;
    3031import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3637 * It keeps a status line below the map up to date and displays some tooltip
    3738 * information if the user hold the mouse long enough at some point.
    38  * 
     39 *
    3940 * All this is done in background to not disturb other processes.
    40  * 
     41 *
    4142 * The background thread does not alter any data of the map (read only thread).
    4243 * Also it is rather fail safe. In case of some error in the data, it just do
    4344 * nothing instead of whining and complaining.
    44  * 
     45 *
    4546 * @author imi
    4647 */
    47 public class MapStatus extends JPanel {
    48 
    49         /**
    50          * The MapView this status belongs. 
     48public class MapStatus extends JPanel implements Helpful {
     49
     50        /**
     51         * The MapView this status belongs.
    5152         */
    5253        final MapView mv;
     
    6364         * The collector class that waits for notification and then update
    6465         * the display objects.
    65          * 
     66         *
    6667         * @author imi
    6768         */
     
    107108                                // This try/catch is a hack to stop the flooding bug reports about this.
    108109                                // The exception needed to handle with in the first place, means that this
    109                                 // access to the data need to be restarted, if the main thread modifies 
     110                                // access to the data need to be restarted, if the main thread modifies
    110111                                // the data.
    111112                                try {
     
    242243                }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
    243244        }
     245
     246        public String helpTopic() {
     247            return "Statusline";
     248    }
    244249}
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r104 r155  
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1011import org.openstreetmap.josm.data.coor.EastNorth;
    1112import org.openstreetmap.josm.data.coor.LatLon;
     
    1920 * An component that can be navigated by a mapmover. Used as map view and for the
    2021 * zoomer in the download dialog.
    21  * 
     22 *
    2223 * @author imi
    2324 */
    24 public class NavigatableComponent extends JComponent {
     25public class NavigatableComponent extends JComponent implements Helpful {
    2526
    2627
     
    2930        /**
    3031         * The scale factor in x or y-units per pixel. This means, if scale = 10,
    31          * every physical pixel on screen are 10 x or 10 y units in the 
     32         * every physical pixel on screen are 10 x or 10 y units in the
    3233         * northing/easting space of the projection.
    3334         */
     
    5354                return 32;
    5455        }
    55        
     56
    5657        /**
    5758         * Return the current scale value.
     
    7374         * @param x X-Pixelposition to get coordinate from
    7475         * @param y Y-Pixelposition to get coordinate from
    75          * 
     76         *
    7677         * @return Geographic coordinates from a specific pixel coordination
    7778         *              on the screen.
     
    8687         * @param x X-Pixelposition to get coordinate from
    8788         * @param y Y-Pixelposition to get coordinate from
    88          * 
     89         *
    8990         * @return Geographic unprojected coordinates from a specific pixel coordination
    9091         *              on the screen.
     
    164165                                        minPrimitive = w;
    165166                                }
    166                         }                       
     167                        }
    167168                }
    168169                return minPrimitive;
     
    195196        /**
    196197         * Return the object, that is nearest to the given screen point.
    197          * 
     198         *
    198199         * First, a node will be searched. If a node within 10 pixel is found, the
    199200         * nearest node is returned.
    200          * 
     201         *
    201202         * If no node is found, search for pending segments.
    202          * 
    203          * If no such segment is found, and a non-pending segment is 
    204          * within 10 pixel to p, this segment is returned, except when 
    205          * <code>wholeWay</code> is <code>true</code>, in which case the 
     203         *
     204         * If no such segment is found, and a non-pending segment is
     205         * within 10 pixel to p, this segment is returned, except when
     206         * <code>wholeWay</code> is <code>true</code>, in which case the
    206207         * corresponding Way is returned.
    207          * 
     208         *
    208209         * If no segment is found and the point is within an area, return that
    209210         * area.
    210          * 
     211         *
    211212         * If no area is found, return <code>null</code>.
    212          * 
     213         *
    213214         * @param p                              The point on screen.
    214215         * @param segmentInsteadWay Whether the segment (true) or only the whole
     
    226227
    227228        /**
    228          * @return A list of all objects that are nearest to 
    229          * the mouse. To do this, first the nearest object is 
     229         * @return A list of all objects that are nearest to
     230         * the mouse. To do this, first the nearest object is
    230231         * determined.
    231          * 
     232         *
    232233         * If its a node, return all segments and
    233234         * streets the node is part of, as well as all nodes
    234235         * (with their segments and ways) with the same
    235236         * location.
    236          * 
    237          * If its a segment, return all ways this segment 
     237         *
     238         * If its a segment, return all ways this segment
    238239         * belongs to as well as all segments that are between
    239240         * the same nodes (in both direction) with all their ways.
    240          * 
     241         *
    241242         * @return A collection of all items or <code>null</code>
    242243         *              if no item under or near the point. The returned
     
    258259                                if (!ls.deleted && !ls.incomplete && (c.contains(ls.from) || c.contains(ls.to)))
    259260                                        c.add(ls);
    260                 } 
     261                }
    261262                if (osm instanceof Segment) {
    262263                        Segment line = (Segment)osm;
     
    286287                return Main.proj;
    287288        }
     289
     290        public String helpTopic() {
     291            String n = getClass().getName();
     292            return n.substring(n.lastIndexOf('.')+1);
     293    }
    288294}
  • src/org/openstreetmap/josm/gui/WorldChooser.java

    r116 r155  
    4444         */
    4545        private double scaleMax;
    46        
     46
    4747        /**
    4848         * Mark this rectangle (lat/lon values) when painting.
     
    5151
    5252        private Projection projection;
    53        
     53
    5454        /**
    5555         * Create the chooser component.
  • src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r119 r155  
    6868                        }
    6969                });
     70                button.putClientProperty("help", "Dialog/Conflict/Resolve");
    7071                buttonPanel.add(button);
    7172
     
    8081                        }
    8182                });
     83                button.putClientProperty("help", "Dialog/Conflict/Select");
    8284                buttonPanel.add(button);
    8385
     
    132134                                model.addElement(osm);
    133135        }
    134        
     136
    135137        public final void add(Map<OsmPrimitive, OsmPrimitive> conflicts) {
    136138                this.conflicts.putAll(conflicts);
     
    139141
    140142        /**
    141          * Paint all conflicts that can be expressed on the main window. 
     143         * Paint all conflicts that can be expressed on the main window.
    142144         */
    143145        public void paintConflicts(final Graphics g, final NavigatableComponent nc) {
  • src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r143 r155  
    3838/**
    3939 * History dialog works like follows:
    40  * 
     40 *
    4141 * There is a history cache hold in the back for primitives of the last refresh.
    4242 * When the user refreshes, this cache is cleared and all currently selected items
    4343 * are reloaded.
    44  * If the user has selected at least one primitive not in the cache, the list 
     44 * If the user has selected at least one primitive not in the cache, the list
    4545 * is not displayed. Elsewhere, the list of all changes of all currently selected
    4646 * objects are displayed.
    47  * 
     47 *
    4848 * @author imi
    4949 */
     
    130130                });
    131131                reloadButton.setToolTipText(tr("Reload all currently selected objects and refresh the list."));
     132                reloadButton.putClientProperty("help", "Dialog/History/Reload");
    132133                revertButton.addActionListener(new ActionListener(){
    133134                        public void actionPerformed(ActionEvent e) {
     
    136137                });
    137138                revertButton.setToolTipText(tr("Revert the state of all currently selected objects to the version selected in the history list."));
     139                revertButton.putClientProperty("help", "Dialog/History/Revert");
    138140        }
    139141
  • src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r153 r155  
    4242 * @author imi
    4343 */
    44 public class LayerList extends ToggleDialog implements LayerChangeListener {
     44public class LayerListDialog extends ToggleDialog implements LayerChangeListener {
    4545
    4646        /**
     
    5757                        super(tr("Delete"), ImageProvider.get("dialogs", "delete"));
    5858                        putValue(SHORT_DESCRIPTION, tr("Delete the selected layer."));
     59                        putValue("help", "Dialog/LayerList/Delete");
    5960                        this.layer = layer;
    6061                }
     
    7980                        super(tr("Show/Hide"), ImageProvider.get("dialogs", "showhide"));
    8081                        putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the selected layer."));
     82                        putValue("help", "Dialog/LayerList/ShowHide");
    8183                        this.layer = layer;
    8284                }
     
    9698        /**
    9799         * The merge action. This is only called, if the current selection and its
    98          * item below are editable datasets and the merge button is clicked. 
     100         * item below are editable datasets and the merge button is clicked.
    99101         */
    100102        private final JButton mergeButton = new JButton(ImageProvider.get("dialogs", "mergedown"));
     
    115117         * Create an layerlist and attach it to the given mapView.
    116118         */
    117         public LayerList(MapFrame mapFrame) {
     119        public LayerListDialog(MapFrame mapFrame) {
    118120                super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100);
    119121                instance = new JList(model);
     
    123125                        @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    124126                                Layer layer = (Layer)value;
    125                                 JLabel label = (JLabel)super.getListCellRendererComponent(list, 
     127                                JLabel label = (JLabel)super.getListCellRendererComponent(list,
    126128                                                layer.name, index, isSelected, cellHasFocus);
    127129                                Icon icon = layer.getIcon();
     
    158160                                Layer layer = (Layer)instance.getModel().getElementAt(index);
    159161                                LayerListPopup menu = new LayerListPopup(instance, layer);
    160                                 menu.show(LayerList.this, e.getX(), e.getY());
     162                                menu.show(LayerListDialog.this, e.getX(), e.getY());
    161163                        }
    162164                        @Override public void mousePressed(MouseEvent e) {
     
    191193                upButton.addActionListener(upDown);
    192194                upButton.setActionCommand("up");
     195                upButton.putClientProperty("help", "Dialog/LayerList/Up");
    193196                buttonPanel.add(upButton);
    194197
     
    196199                downButton.addActionListener(upDown);
    197200                downButton.setActionCommand("down");
     201                downButton.putClientProperty("help", "Dialog/LayerList/Down");
    198202                buttonPanel.add(downButton);
    199203
     
    215219                                mapView.removeLayer(lFrom);
    216220                        }
    217                 });             
     221                });
     222                mergeButton.putClientProperty("help", "Dialog/LayerList/Merge");
    218223                buttonPanel.add(mergeButton);
    219224
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r144 r155  
    5454/**
    5555 * This dialog displays the properties of the current selected primitives.
    56  * 
    57  * If no object is selected, the dialog list is empty. 
     56 *
     57 * If no object is selected, the dialog list is empty.
    5858 * If only one is selected, all properties of this object are selected.
    5959 * If more than one object are selected, the sum of all properties are displayed. If the
     
    6161 * different values, all of them are put in a combo box and the string "&lt;different&gt;"
    6262 * is displayed in italic.
    63  * 
    64  * Below the list, the user can click on an add, modify and delete property button to 
     63 *
     64 * Below the list, the user can click on an add, modify and delete property button to
    6565 * edit the table selection value.
    66  * 
     66 *
    6767 * The command is applied to all selected entries.
    68  * 
     68 *
    6969 * @author imi
    7070 */
     
    9191        /**
    9292         * Edit the value in the table row
    93          * @param row   The row of the table, from which the value is edited. 
     93         * @param row   The row of the table, from which the value is edited.
    9494         */
    9595        void edit(int row) {
     
    138138                if (value == null)
    139139                        selectionChanged(sel); // update whole table
    140                
     140
    141141                Main.parent.repaint(); // repaint all - drawing could have been changed
    142142        }
     
    330330                b.setToolTipText(tooltip);
    331331                b.setMnemonic(mnemonic);
     332                b.putClientProperty("help", "Dialog/Properties/"+name);
    332333                return b;
    333334        }
  • src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r153 r155  
    126126                JPanel buttonPanel = new JPanel(new GridLayout(1,2));
    127127
    128                 JButton button = new JButton(tr("Select"), ImageProvider.get("mapmode/selection/select"));
    129                 button.setToolTipText(tr("Set the selected elements on the map to the selected items in the list above."));
    130                 button.addActionListener(new ActionListener(){
     128                buttonPanel.add(createButton("Select", "mapmode/selection/select", "Set the selected elements on the map to the selected items in the list above.", new ActionListener(){
    131129                        public void actionPerformed(ActionEvent e) {
    132130                                updateMap();
    133131                        }
    134                 });
    135                 buttonPanel.add(button);
    136 
    137                 button = new JButton(tr("Reload"), ImageProvider.get("dialogs", "refresh"));
    138                 button.setToolTipText(tr("Refresh the selection list."));
    139                 button.addActionListener(new ActionListener(){
     132                }));
     133
     134                buttonPanel.add(createButton("Reload", "dialogs/refresh", "Refresh the selection list.", new ActionListener(){
    140135                        public void actionPerformed(ActionEvent e) {
    141136                                selectionChanged(Main.ds.getSelected());
    142                         }
    143                 });
    144                 buttonPanel.add(button);
    145 
    146                 button = new JButton(tr("Search"), ImageProvider.get("dialogs", "search"));
    147                 button.setToolTipText(tr("Search for objects."));
    148                 button.addActionListener(new ActionListener(){
     137            }
     138                }));
     139
     140                buttonPanel.add(createButton("Search", "dialogs/search", "Search for objects.", new ActionListener(){
    149141                        private String lastSearch = "";
    150142                        public void actionPerformed(ActionEvent e) {
     
    185177                                search(lastSearch, mode);
    186178                        }
    187                 });
    188                 buttonPanel.add(button);
     179                }));
    189180
    190181                add(buttonPanel, BorderLayout.SOUTH);
    191182                selectionChanged(Main.ds.getSelected());
     183        }
     184
     185        private JButton createButton(String name, String icon, String tooltip, ActionListener action) {
     186                JButton button = new JButton(tr(name), ImageProvider.get(icon));
     187                button.setToolTipText(tr(tooltip));
     188                button.addActionListener(action);
     189                button.putClientProperty("help", "Dialog/SelectionList/"+name);
     190                return button;
    192191        }
    193192
  • src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r119 r155  
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.actions.JosmAction;
     15import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1516
    1617/**
    1718 * This class is a toggle dialog that can be turned on and off. It is attached
    1819 * to a ButtonModel.
    19  * 
     20 *
    2021 * @author imi
    2122 */
    22 public class ToggleDialog extends JPanel {
     23public class ToggleDialog extends JPanel implements Helpful {
    2324
    2425        public final class ToggleDialogAction extends JosmAction {
     
    4950                setPreferredSize(new Dimension(330,preferredHeight));
    5051                action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, KeyEvent.ALT_MASK, iconName);
     52                String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
     53                action.putValue("help", helpId.substring(0, helpId.length()-6));
    5154                setLayout(new BorderLayout());
    5255                add(new JLabel(name), BorderLayout.NORTH);
     
    5457                setBorder(BorderFactory.createEtchedBorder());
    5558        }
     59
     60        public String helpTopic() {
     61                String help = getClass().getName();
     62                help = help.substring(help.lastIndexOf('.')+1, help.length()-6);
     63            return "Dialog/"+help;
     64    }
    5665}
  • src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java

    r153 r155  
    5656import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    5757import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    58 import org.openstreetmap.josm.gui.dialogs.LayerList;
     58import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    5959import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    6060import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;
     
    360360                });
    361361                return new Component[]{
    362                                 new JMenuItem(new LayerList.ShowHideLayerAction(this)),
    363                                 new JMenuItem(new LayerList.DeleteLayerAction(this)),
     362                                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
     363                                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
    364364                                new JSeparator(),
    365365                                sync,
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r144 r155  
    4040import org.openstreetmap.josm.gui.MapView;
    4141import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    42 import org.openstreetmap.josm.gui.dialogs.LayerList;
     42import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    4343import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    4444import org.openstreetmap.josm.tools.GBC;
     
    327327        @Override public Component[] getMenuEntries() {
    328328                return new Component[]{
    329                                 new JMenuItem(new LayerList.ShowHideLayerAction(this)),
    330                                 new JMenuItem(new LayerList.DeleteLayerAction(this)),
     329                                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
     330                                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
    331331                                new JSeparator(),
    332332                                new JMenuItem(new SaveAction()),
  • src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java

    r138 r155  
    4040import org.openstreetmap.josm.gui.MapView;
    4141import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    42 import org.openstreetmap.josm.gui.dialogs.LayerList;
     42import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    4343import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    4444import org.openstreetmap.josm.tools.ColorHelper;
     
    277277               
    278278                return new Component[]{
    279                                 new JMenuItem(new LayerList.ShowHideLayerAction(this)),
    280                                 new JMenuItem(new LayerList.DeleteLayerAction(this)),
     279                                new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)),
     280                                new JMenuItem(new LayerListDialog.DeleteLayerAction(this)),
    281281                                new JSeparator(),
    282282                                new JMenuItem(new GpxExportAction(this)),
Note: See TracChangeset for help on using the changeset viewer.