Ticket #5781: 5781-unregister.patch

File 5781-unregister.patch, 3.1 KB (added by simon04, 13 years ago)
  • src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
    index c962255..b95a6b3 100644
    a b public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    187187    private SearchAction searchActionSame = new SearchAction(true);
    188188    private SearchAction searchActionAny = new SearchAction(false);
    189189    private AddAction addAction = new AddAction();
     190    private EditAction editAction = new EditAction();
     191    private DeleteAction deleteAction = new DeleteAction();
    190192
    191193    @Override
    192194    public void showNotify() {
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    201203        DatasetEventManager.getInstance().removeDatasetListener(dataChangedAdapter);
    202204        SelectionEventManager.getInstance().removeSelectionListener(this);
    203205        MapView.removeEditLayerChangeListener(this);
     206        Main.unregisterActionShortcut(addAction);
     207        Main.unregisterActionShortcut(editAction);
     208        Main.unregisterActionShortcut(deleteAction);
    204209    }
    205210
    206211    /**
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    794799
    795800        // -- edit action
    796801        //
    797         EditAction editAction = new EditAction();
    798802        propertyTable.getSelectionModel().addListSelectionListener(editAction);
    799803        membershipTable.getSelectionModel().addListSelectionListener(editAction);
    800804        this.btnEdit = new SideButton(editAction);
    801805
    802806        // -- delete action
    803807        //
    804         DeleteAction deleteAction = new DeleteAction();
    805808        this.btnDel = new SideButton(deleteAction);
    806809        membershipTable.getSelectionModel().addListSelectionListener(deleteAction);
    807810        propertyTable.getSelectionModel().addListSelectionListener(deleteAction);
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    10901093        @Override
    10911094        protected void updateEnabledState() {
    10921095            setEnabled(
    1093                     PropertiesDialog.this.propertyTable.getSelectedRowCount() >0
    1094                     || PropertiesDialog.this.membershipTable.getSelectedRowCount() > 0
     1096                    (propertyTable != null && propertyTable.getSelectedRowCount() == 1)
     1097                    ^ (membershipTable != null && membershipTable.getSelectedRowCount() == 1)
    10951098            );
    10961099        }
    10971100
    public class PropertiesDialog extends ToggleDialog implements SelectionChangedLi  
    11381141        @Override
    11391142        protected void updateEnabledState() {
    11401143            setEnabled(
    1141                     propertyTable.getSelectedRowCount() == 1
    1142                     ^ membershipTable.getSelectedRowCount() == 1
     1144                    (propertyTable != null && propertyTable.getSelectedRowCount() == 1)
     1145                    ^ (membershipTable != null && membershipTable.getSelectedRowCount() == 1)
    11431146            );
    11441147        }
    11451148