Changeset 9365 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-09T21:55:09+01:00 (9 years ago)
Author:
simon04
Message:

see #8749 - Make "Add selection to relation" an expert action

File:
1 edited

Legend:

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

    r9264 r9365  
    2525import javax.swing.JComponent;
    2626import javax.swing.JList;
     27import javax.swing.JMenuItem;
    2728import javax.swing.JPanel;
    2829import javax.swing.JPopupMenu;
     
    3435
    3536import org.openstreetmap.josm.Main;
     37import org.openstreetmap.josm.actions.ExpertToggleAction;
    3638import org.openstreetmap.josm.actions.relation.AddSelectionToRelations;
    3739import org.openstreetmap.josm.actions.relation.DeleteRelationsAction;
     
    8688 * objects are visible on the map and can be selected there. Relations are not.
    8789 */
    88 public class RelationListDialog extends ToggleDialog implements DataSetListener, NavigatableComponent.ZoomChangeListener {
     90public class RelationListDialog extends ToggleDialog
     91        implements DataSetListener, NavigatableComponent.ZoomChangeListener, ExpertToggleAction.ExpertModeChangeListener {
    8992    /** The display list. */
    9093    private final JList<Relation> displaylist;
     
    116119    /** add all selected primitives to the given relations */
    117120    private final AddSelectionToRelations addSelectionToRelations = new AddSelectionToRelations();
     121    private transient JMenuItem addSelectionToRelationMenuItem;
    118122
    119123    private final transient HighlightHelper highlightHelper = new HighlightHelper();
     
    212216        DataSet.addSelectionListener(addSelectionToRelations);
    213217        dataChanged(null);
     218        ExpertToggleAction.addExpertModeChangeListener(this);
     219        expertChanged(ExpertToggleAction.isExpert());
    214220    }
    215221
     
    220226        DatasetEventManager.getInstance().removeDatasetListener(this);
    221227        DataSet.removeSelectionListener(addSelectionToRelations);
     228        ExpertToggleAction.removeExpertModeChangeListener(this);
    222229    }
    223230
     
    595602        popupMenuHandler.addAction(deleteRelationsAction).setVisible(false);
    596603
    597         popupMenuHandler.addAction(addSelectionToRelations);
     604        addSelectionToRelationMenuItem = popupMenuHandler.addAction(addSelectionToRelations);
    598605    }
    599606
     
    682689        }
    683690    }
     691
     692    @Override
     693    public void expertChanged(boolean isExpert) {
     694        addSelectionToRelationMenuItem.setVisible(isExpert);
     695    }
    684696}
Note: See TracChangeset for help on using the changeset viewer.