Ignore:
Timestamp:
2012-02-23T10:17:25+01:00 (13 years ago)
Author:
akks
Message:

reltoolbox, turnlanes: fix shortcut and toolbar warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java

    r27901 r27927  
    5858
    5959    public final static String PREF_PREFIX = "reltoolbox";
    60 
     60   
    6161    private final DefaultTableModel relationsData;
    6262    private ChosenRelation chosenRelation;
     
    6666    private RoleComboBoxModel roleBoxModel;
    6767    private SortAndFixAction sortAndFixAction;
     68    // actions saved for unregistering on dialog destroying
     69    private final EnterRoleAction enterRoleAction;
     70    private final FindRelationAction findRelationAction;
     71    private final CreateMultipolygonAction createMultipolygonAction;
     72    private final CreateRelationAction createRelationAction;
     73    private final AddRemoveMemberAction addRemoveMemberAction;
    6874
    6975    public RelContextDialog() {
     
    101107        });
    102108        roleBox.setVisible(false);
    103         final Action enterRoleAction = new EnterRoleAction(); // just for the shortcut
     109        enterRoleAction = new EnterRoleAction(); // just for the shortcut
    104110
    105111        // [±][X] relation U [AZ][Down][Edit]
    106112        chosenRelationPanel = new JPanel(new GridBagLayout());
    107         chosenRelationPanel.add(new JButton(new AddRemoveMemberAction(chosenRelation)), GBC.std());
     113        addRemoveMemberAction = new AddRemoveMemberAction(chosenRelation);
     114        chosenRelationPanel.add(new JButton(addRemoveMemberAction), GBC.std());
    108115        chosenRelationPanel.add(sizeButton(new JButton(new ClearChosenRelationAction(chosenRelation)), 32, 0), GBC.std());
    109116        final ChosenRelationComponent chosenRelationComponent = new ChosenRelationComponent(chosenRelation);
     
    147154        // [+][Multi] [X]Adm [X]Tags [X]1
    148155        JPanel bottomLine = new JPanel(new GridBagLayout());
    149         bottomLine.add(new JButton(new CreateRelationAction(chosenRelation)), GBC.std());
    150         final JButton multipolygonButton = new JButton(new CreateMultipolygonAction(chosenRelation));
     156        createRelationAction = new CreateRelationAction(chosenRelation);
     157        bottomLine.add(new JButton(createRelationAction), GBC.std());
     158        createMultipolygonAction = new CreateMultipolygonAction(chosenRelation);
     159        final JButton multipolygonButton = new JButton(createMultipolygonAction);
    151160        bottomLine.add(multipolygonButton, GBC.std());
    152161//        bottomLine.add(sizeButton(new JButton(new MultipolygonSettingsAction()), 16, 0), GBC.std().fill(GBC.VERTICAL));
    153162        bottomLine.add(Box.createHorizontalGlue(), GBC.std().fill());
    154         bottomLine.add(new JButton(new FindRelationAction(chosenRelation)), GBC.eol());
     163        findRelationAction = new FindRelationAction(chosenRelation);
     164        bottomLine.add(new JButton(findRelationAction), GBC.eol());
    155165        rcPanel.add(sizeButton(bottomLine, 0, 24), BorderLayout.SOUTH);
    156166
     
    351361    }
    352362
     363    @Override
     364    public void destroy() {
     365        enterRoleAction.destroy();
     366        findRelationAction.destroy();
     367        createMultipolygonAction.destroy();
     368        createRelationAction.destroy();
     369        addRemoveMemberAction.destroy();
     370        super.destroy();
     371    }
     372   
    353373    private static final String POSSIBLE_ROLES_FILE = "relcontext/possible_roles.txt";
    354374    private static final Map<String, List<String>> possibleRoles = loadRoles();
     
    545565            super(tr("Change role"), null, tr("Enter role for selected members"),
    546566                    Shortcut.registerShortcut("reltoolbox:changerole", tr("Relation Toolbox: {0}", tr("Enter role for selected members")),
    547                     KeyEvent.VK_R, Shortcut.ALT_CTRL), true, "relcontext/enterrole", true);
     567                    KeyEvent.VK_R, Shortcut.ALT_CTRL), false, "relcontext/enterrole", true);
    548568            chosenRelation.addChosenRelationListener(this);
    549569            updateEnabledState();
     
    561581            setEnabled(newRelation != null);
    562582        }
    563     }
    564 
     583        }
     584       
    565585    private class RoleComboBoxModel extends AbstractListModel implements ComboBoxModel {
    566586        private List<String> roles = new ArrayList<String>();
Note: See TracChangeset for help on using the changeset viewer.