Ignore:
Timestamp:
2012-02-28T11:29:30+01:00 (12 years ago)
Author:
jttt
Message:

Add possibility to hide side buttons in toggle dialogs permanently, show actions from buttons in popup menu

File:
1 edited

Legend:

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

    r4982 r5028  
    2020import java.util.Set;
    2121
     22import javax.swing.AbstractAction;
    2223import javax.swing.JMenuItem;
    2324import javax.swing.JOptionPane;
     
    5152import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    5253import org.openstreetmap.josm.io.OsmTransferException;
     54import org.openstreetmap.josm.tools.ImageProvider;
    5355import org.openstreetmap.josm.tools.Shortcut;
    5456import org.xml.sax.SAXException;
     
    6163 * @author frsantos
    6264 */
    63 public class ValidatorDialog extends ToggleDialog implements ActionListener, SelectionChangedListener, LayerChangeListener {
     65public class ValidatorDialog extends ToggleDialog implements SelectionChangedListener, LayerChangeListener {
    6466    /** Serializable ID */
    6567    private static final long serialVersionUID = 2952292777351992696L;
     
    105107
    106108        List<SideButton> buttons = new LinkedList<SideButton>();
    107         selectButton = new SideButton(marktr("Select"), "select", "Validator",
    108                 tr("Set the selected elements on the map to the selected items in the list above."), this);
     109
     110        selectButton = new SideButton(new AbstractAction() {
     111            {
     112                putValue(NAME, marktr("Select"));
     113                putValue(SHORT_DESCRIPTION,  tr("Set the selected elements on the map to the selected items in the list above."));
     114                putValue(SMALL_ICON, ImageProvider.get("dialogs","select"));
     115            }
     116            @Override
     117            public void actionPerformed(ActionEvent e) {
     118                setSelectedItems();
     119            }
     120        });
    109121        selectButton.setEnabled(false);
    110122        buttons.add(selectButton);
     
    112124        buttons.add(new SideButton(Main.main.validator.validateAction));
    113125
    114         fixButton = new SideButton(marktr("Fix"), "fix", "Validator", tr("Fix the selected issue."), this);
     126        fixButton = new SideButton(new AbstractAction() {
     127            {
     128                putValue(NAME, marktr("Fix"));
     129                putValue(SHORT_DESCRIPTION,  tr("Fix the selected issue."));
     130                putValue(SMALL_ICON, ImageProvider.get("dialogs","fix"));
     131            }
     132            @Override
     133            public void actionPerformed(ActionEvent e) {
     134                fixErrors(e);
     135            }
     136        });
    115137        fixButton.setEnabled(false);
    116138        buttons.add(fixButton);
    117139
    118140        if (Main.pref.getBoolean(ValidatorPreference.PREF_USE_IGNORE, true)) {
    119             ignoreButton = new SideButton(marktr("Ignore"), "delete", "Validator",
    120                     tr("Ignore the selected issue next time."), this);
     141            ignoreButton = new SideButton(new AbstractAction() {
     142                {
     143                    putValue(NAME, marktr("Ignore"));
     144                    putValue(SHORT_DESCRIPTION,  tr("Ignore the selected issue next time."));
     145                    putValue(SMALL_ICON, ImageProvider.get("dialogs","fix"));
     146                }
     147                @Override
     148                public void actionPerformed(ActionEvent e) {
     149                    ignoreErrors(e);
     150                }
     151            });
    121152            ignoreButton.setEnabled(false);
    122153            buttons.add(ignoreButton);
     
    332363        }
    333364        Main.main.getCurrentDataSet().setSelected(sel);
    334     }
    335 
    336     @Override
    337     public void actionPerformed(ActionEvent e) {
    338         String actionCommand = e.getActionCommand();
    339         if (actionCommand.equals("Select")) {
    340             setSelectedItems();
    341         } else if (actionCommand.equals("Fix")) {
    342             fixErrors(e);
    343         } else if (actionCommand.equals("Ignore")) {
    344             ignoreErrors(e);
    345         }
    346365    }
    347366
Note: See TracChangeset for help on using the changeset viewer.