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

reltoolbox, turnlanes: fix shortcut and toolbar warnings

Location:
applications/editors/josm/plugins/reltoolbox/src/relcontext
Files:
6 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>();
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextPlugin.java

    r26802 r27927  
    11package relcontext;
    22
     3import org.openstreetmap.josm.Main;
    34import org.openstreetmap.josm.gui.DefaultNameFormatter;
    45import org.openstreetmap.josm.gui.MapFrame;
     
    1718    public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame ) {
    1819        if( oldFrame == null && newFrame != null ) {
     20//            if (dialog!=null) dialog.destroy();
    1921            dialog = new RelContextDialog();
    2022            newFrame.addToggleDialog(dialog);
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java

    r27852 r27927  
    3434        super(null, "relcontext/addremove", tr("Add/remove members from the chosen relation"),
    3535                Shortcut.registerShortcut("reltoolbox:addremove", tr("Relation Toolbox: {0}", tr("Add/remove members from the chosen relation")),
    36                 KeyEvent.VK_EQUALS, Shortcut.DIRECT), true);
     36                KeyEvent.VK_EQUALS, Shortcut.DIRECT), false);
    3737        this.rel = rel;
    3838        rel.addChosenRelationListener(this);
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java

    r27852 r27927  
    3131        super("Multi", "data/multipolygon", tr("Create a multipolygon from selected objects"),
    3232                Shortcut.registerShortcut("reltoolbox:multipolygon", tr("Relation Toolbox: {0}", tr("Create multipolygon")),
    33                 KeyEvent.VK_B, Shortcut.CTRL), true);
     33                KeyEvent.VK_B, Shortcut.CTRL), false);
    3434        this.chRel = chRel;
    3535        updateEnabledState();
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java

    r27852 r27927  
    3939        super(tr("New"), "data/relation", tr("Create a relation from selected objects"),
    4040                Shortcut.registerShortcut("reltoolbox:create", tr("Relation Toolbox: {0}", tr("Create a new relation")),
    41                 KeyEvent.VK_N, Shortcut.ALT_CTRL), true);
     41                KeyEvent.VK_N, Shortcut.ALT_CTRL), false);
    4242        this.chRel = chRel;
    4343        updateEnabledState();
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java

    r27852 r27927  
    2929        super("Find", "relcontext/find", tr("Find a relation"),
    3030                Shortcut.registerShortcut("reltoolbox:find", tr("Relation Toolbox: {0}", tr("Find a relation")),
    31                 KeyEvent.VK_F, Shortcut.ALT_CTRL), true);
     31                KeyEvent.VK_F, Shortcut.ALT_CTRL), false);
    3232        this.chRel = chRel;
    3333    }
Note: See TracChangeset for help on using the changeset viewer.