Ignore:
Timestamp:
2012-08-24T13:41:33+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] See #josm7980 - Fix memory leaks in alignways, fixAdresses, measurement, routing, turnlanes and waypoint_search plugins

Location:
applications/editors/josm/plugins/alignways/src/com/tilusnet/josm/plugins/alignways
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/alignways/src/com/tilusnet/josm/plugins/alignways/AlignWaysAction.java

    r27852 r28624  
    5858
    5959                    AlignWaysCmdKeepLength cmdAW;
    60                     if (AlignWaysPlugin.awDialog.getAwOpt() == AligningModeOption.ALGN_OPT_KEEP_ANGLE) {
     60                    if (AlignWaysPlugin.getAwDialog().getAwOpt() == AligningModeOption.ALGN_OPT_KEEP_ANGLE) {
    6161                        cmdAW = new AlignWaysCmdKeepAngles();
    6262                    } else {
  • applications/editors/josm/plugins/alignways/src/com/tilusnet/josm/plugins/alignways/AlignWaysDialog.java

    r27466 r28624  
    163163
    164164    }
    165 
    166     public JCheckBoxMenuItem getWindowMenuItem() {
    167         return windowMenuItem;
    168     }
    169 
    170 
    171165}
  • applications/editors/josm/plugins/alignways/src/com/tilusnet/josm/plugins/alignways/AlignWaysPlugin.java

    r27508 r28624  
    22
    33import static org.openstreetmap.josm.tools.I18n.tr;
    4 
    5 import javax.swing.JMenuItem;
    64
    75import org.openstreetmap.josm.Main;
     
    2018public class AlignWaysPlugin extends Plugin {
    2119
    22     static AlignWaysMode awMode;
    23     private final IconToggleButton btn;
    24     static JMenuItem alignWaysMenuItem;
    25     static JosmAction awAction;
    26     static AlignWaysDialog awDialog;
    27     static IconToggleButton optBtn;
     20    private static AlignWaysMode awMode;
     21    private static IconToggleButton btn;
     22    private static JosmAction awAction;
     23    private static AlignWaysDialog awDialog;
     24    private static IconToggleButton optBtn;
    2825
    2926    // The major version is e.g. used to decide when to trigger What's New windows
     
    3330        super(info);
    3431       
    35         // Construct the AlignWays mode toggle button
    36         awMode = new AlignWaysMode(Main.map, "alignways", tr("Align Ways mode"));
    37         btn = new IconToggleButton(awMode);
    38         btn.setVisible(true);
    39        
    4032        // Add the action entries to the Tools Menu
    4133        Main.main.menu.toolsMenu.addSeparator();
    4234        awAction = new AlignWaysAction();
    43         alignWaysMenuItem = MainMenu.add(Main.main.menu.toolsMenu, awAction);
    44        
    45         awDialog = new AlignWaysDialog(awMode);
    46         // Prevent user clicking on the Windows menu entry while panel is meaningless
    47         awDialog.getWindowMenuItem().setEnabled(false);
     35        MainMenu.add(Main.main.menu.toolsMenu, awAction);
    4836    }
    4937
    5038    @Override
    5139    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    52         if(newFrame != null) {
    53             optBtn = newFrame.addToggleDialog(AlignWaysPlugin.getAwDialog());
     40        if (newFrame != null) {
     41            // Construct the AlignWays mode toggle button
     42            awMode = new AlignWaysMode(Main.map, "alignways", tr("Align Ways mode"));
     43            btn = new IconToggleButton(awMode);
     44            btn.setVisible(true);
     45            newFrame.addMapMode(btn);
     46            optBtn = newFrame.addToggleDialog(awDialog = new AlignWaysDialog(awMode));
    5447        } else {
    55             // Disable menu item in Windows menu
    56             awDialog.getWindowMenuItem().setEnabled(false);
    57         }
    58 
    59         if (Main.map != null) {
    60             Main.map.addMapMode(btn);
    61             // Re-enable menu item in Windows menu
    62             awDialog.getWindowMenuItem().setEnabled(true);
     48            awDialog = null;
     49            optBtn = null;
     50            btn = null;
     51            awMode = null;
    6352        }
    6453    }
     
    9180        return optBtn;
    9281    }
    93 
    9482}
  • applications/editors/josm/plugins/alignways/src/com/tilusnet/josm/plugins/alignways/AlignWaysTipsPanel.java

    r27348 r28624  
    101101        step04.setText(tr("<html>\n<div style=\"font-family:sans-serif\">\n<ul>\n  <li><b>Align the segments.</b> Press <b><i><span style=\"color:green\">{0}"
    102102                + "</span></i></b>. Alternatively you''ll find the command in the <b>Tools</b>\n menu or may want to place the action on the <b>toolbar</b>.\n  </li>\n</ul>\n</div>\n</html>\n\n",
    103                 AlignWaysPlugin.awAction.getShortcut().getKeyText()));
     103                AlignWaysPlugin.getAwAction().getShortcut().getKeyText()));
    104104        step04.setVerticalAlignment(SwingConstants.TOP);
    105105
Note: See TracChangeset for help on using the changeset viewer.