Changeset 4596 in josm for trunk/src/org
- Timestamp:
- 2011-11-15T21:00:55+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r4595 r4596 91 91 92 92 MultikeyActionsHandler.getInstance().addAction(instance.new ShowHideLayerAction(false)); 93 MultikeyActionsHandler.getInstance().addAction(instance.new ActivateLayerAction()); 93 94 } 94 95 … … 238 239 // -- activate action 239 240 activateLayerAction = new ActivateLayerAction(); 241 activateLayerAction.updateEnabledState(); 240 242 adaptTo(activateLayerAction, selectionModel); 241 243 … … 618 620 */ 619 621 620 public final class ActivateLayerAction extends AbstractAction implements IEnabledStateUpdating, MapView.LayerChangeListener {622 public final class ActivateLayerAction extends AbstractAction implements IEnabledStateUpdating, MapView.LayerChangeListener, MultikeyShortcutAction{ 621 623 private Layer layer; 622 624 … … 632 634 putValue(SMALL_ICON, ImageProvider.get("dialogs", "activate")); 633 635 putValue(SHORT_DESCRIPTION, tr("Activate the selected layer")); 636 putValue(ACCELERATOR_KEY, Shortcut.registerShortcut("core_multikey:activateLayer", "", 'A', Shortcut.GROUP_DIRECT, KeyEvent.SHIFT_DOWN_MASK + KeyEvent.ALT_DOWN_MASK).getKeyStroke()); 634 637 putValue("help", HelpUtil.ht("/Dialog/LayerList#ActivateLayer")); 635 updateEnabledState();636 638 } 637 639 … … 644 646 toActivate = model.getSelectedLayers().get(0); 645 647 } 648 execute(toActivate); 649 } 650 651 private void execute(Layer layer) { 646 652 // model is going to be updated via LayerChangeListener 647 653 // and PropertyChangeEvents 648 Main.map.mapView.setActiveLayer( toActivate);649 toActivate.setVisible(true);654 Main.map.mapView.setActiveLayer(layer); 655 layer.setVisible(true); 650 656 } 651 657 … … 681 687 public void layerRemoved(Layer oldLayer) { 682 688 updateEnabledState(); 689 } 690 691 @Override 692 public void executeMultikeyAction(int index) { 693 Layer l = LayerListDialog.getLayerForIndex(index); 694 if (l != null) { 695 execute(l); 696 } 697 } 698 699 @Override 700 public void repeateLastMultikeyAction() { 701 // Do nothing, repating not supported 702 } 703 704 @Override 705 public List<MultikeyInfo> getMultikeyCombinations() { 706 return LayerListDialog.getLayerInfoByClass(Layer.class); 707 } 708 709 @Override 710 public MultikeyInfo getLastMultikeyAction() { 711 return null; // Repeating action doesn't make much sense for activating 683 712 } 684 713 }
Note:
See TracChangeset
for help on using the changeset viewer.