Changeset 7949 in josm


Ignore:
Timestamp:
2015-01-10T00:38:05+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #10933 - keep the same selection in selection dialog after cliking the "select" button + code refactoring/cleanup

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
3 edited

Legend:

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

    r7304 r7949  
    3232
    3333import org.openstreetmap.josm.Main;
     34import org.openstreetmap.josm.actions.AbstractSelectAction;
    3435import org.openstreetmap.josm.data.SelectionChangedListener;
    3536import org.openstreetmap.josm.data.conflict.Conflict;
     
    441442    }
    442443
    443     class SelectAction extends AbstractAction implements ListSelectionListener {
    444         public SelectAction() {
    445             putValue(NAME, tr("Select"));
    446             putValue(SHORT_DESCRIPTION,  tr("Set the selected elements on the map to the selected items in the list above."));
    447             putValue(SMALL_ICON, ImageProvider.get("dialogs", "select"));
     444    class SelectAction extends AbstractSelectAction implements ListSelectionListener {
     445        private SelectAction() {
    448446            putValue("help", ht("/Dialog/ConflictList#SelectAction"));
    449447        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r7909 r7949  
    3434
    3535import org.openstreetmap.josm.Main;
     36import org.openstreetmap.josm.actions.AbstractSelectAction;
    3637import org.openstreetmap.josm.actions.AutoScaleAction;
    3738import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction;
     
    318319     * of this dialog
    319320     */
    320     class SelectAction extends AbstractAction implements ListSelectionListener {
     321    class SelectAction extends AbstractSelectAction implements ListSelectionListener {
    321322        /**
    322323         * Constructs a new {@code SelectAction}.
    323324         */
    324325        public SelectAction() {
    325             putValue(NAME, tr("Select"));
    326             putValue(SHORT_DESCRIPTION,  tr("Set the selected elements on the map to the selected items in the list above."));
    327             putValue(SMALL_ICON, ImageProvider.get("dialogs","select"));
    328326            updateEnabledState();
    329327        }
     
    336334            if (editLayer == null) return;
    337335            editLayer.data.setSelected(sel);
     336            model.selectionModel.setSelectionInterval(0, sel.size()-1);
    338337        }
    339338
     
    722721
    723722        @Override
    724         public void primitivesAdded(PrimitivesAddedEvent event) {/* ignored - handled by SelectionChangeListener */}
    725         @Override
    726         public void primitivesRemoved(PrimitivesRemovedEvent event) {/* ignored - handled by SelectionChangeListener*/}
     723        public void primitivesAdded(PrimitivesAddedEvent event) {
     724            /* ignored - handled by SelectionChangeListener */
     725        }
     726
     727        @Override
     728        public void primitivesRemoved(PrimitivesRemovedEvent event) {
     729            /* ignored - handled by SelectionChangeListener*/
     730        }
    727731    }
    728732
     
    736740
    737741        public SearchMenuItem(SearchSetting s) {
    738             super(Utils.shortenString(s.toString(), org.openstreetmap.josm.actions.search.SearchAction.MAX_LENGTH_SEARCH_EXPRESSION_DISPLAY));
     742            super(Utils.shortenString(s.toString(),
     743                    org.openstreetmap.josm.actions.search.SearchAction.MAX_LENGTH_SEARCH_EXPRESSION_DISPLAY));
    739744            this.s = s;
    740745            addActionListener(this);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r7576 r7949  
    2828
    2929import org.openstreetmap.josm.Main;
     30import org.openstreetmap.josm.actions.AbstractSelectAction;
    3031import org.openstreetmap.josm.actions.AutoScaleAction;
    3132import org.openstreetmap.josm.actions.relation.EditRelationAction;
     
    102103        List<SideButton> buttons = new LinkedList<>();
    103104
    104         selectButton = new SideButton(new AbstractAction() {
    105             {
    106                 putValue(NAME, tr("Select"));
    107                 putValue(SHORT_DESCRIPTION,  tr("Set the selected elements on the map to the selected items in the list above."));
    108                 putValue(SMALL_ICON, ImageProvider.get("dialogs","select"));
    109             }
     105        selectButton = new SideButton(new AbstractSelectAction() {
    110106            @Override
    111107            public void actionPerformed(ActionEvent e) {
Note: See TracChangeset for help on using the changeset viewer.