Changeset 13265 in josm


Ignore:
Timestamp:
2017-12-31T03:09:43+01:00 (7 years ago)
Author:
Don-vip
Message:

see #15709 - fix a lot of memory leaks. Now gui.layer.geoImage.* classes are correctly garbage collected when the mapframe is destroyed

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r13040 r13265  
    348348            }
    349349        }
     350        toolBarActions.removeAll();
    350351        for (int i = 0; i < toolBarToggle.getComponentCount(); ++i) {
    351352            if (toolBarToggle.getComponent(i) instanceof Destroyable) {
     
    353354            }
    354355        }
     356        toolBarToggle.removeAll();
    355357
    356358        statusLine.destroy();
    357359        mapView.destroy();
    358360        keyDetector.unregister();
     361
     362        allDialogs.clear();
     363        allDialogButtons.clear();
     364        allMapModeButtons.clear();
    359365    }
    360366
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r11746 r13265  
    330330            }
    331331        }
     332        mSpltPane.removeAll();
     333        allDialogs.clear();
     334        panels.clear();
    332335    }
    333336
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r12881 r13265  
    5050import org.openstreetmap.josm.Main;
    5151import org.openstreetmap.josm.actions.JosmAction;
    52 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    53 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    5452import org.openstreetmap.josm.data.preferences.BooleanProperty;
    5553import org.openstreetmap.josm.data.preferences.ParametrizedEnumProperty;
     
    7068import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
    7169import org.openstreetmap.josm.spi.preferences.Config;
     70import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
     71import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    7272import org.openstreetmap.josm.tools.Destroyable;
    7373import org.openstreetmap.josm.tools.GBC;
     
    288288
    289289        private ToggleDialogAction(String name, String iconName, String tooltip, Shortcut shortcut) {
    290             super(name, iconName, tooltip, shortcut, false);
     290            super(name, iconName, tooltip, shortcut, false, false);
    291291        }
    292292
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r13264 r13265  
    6363import org.openstreetmap.josm.gui.layer.JumpToMarkerActions.JumpToPreviousMarker;
    6464import org.openstreetmap.josm.gui.layer.Layer;
    65 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
    66 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
    67 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
    68 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
     65import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    6966import org.openstreetmap.josm.gui.util.GuiHelper;
    7067import org.openstreetmap.josm.tools.ImageProvider;
     
    10299    private MouseMotionAdapter mouseMotionAdapter;
    103100    private MapModeChangeListener mapModeListener;
     101    private ActiveLayerChangeListener activeLayerChangeListener;
    104102
    105103    /** Mouse position where the last image was selected. */
     
    992990        mapModeListener.mapModeChange(null, MainApplication.getMap().mapMode);
    993991
    994         MainApplication.getLayerManager().addActiveLayerChangeListener(e -> {
     992        activeLayerChangeListener = e -> {
    995993            if (MainApplication.getLayerManager().getActiveLayer() == this) {
    996994                // only in select mode it is possible to click the images
    997995                MainApplication.getMap().selectSelectTool(false);
    998996            }
    999         });
    1000 
    1001         MainApplication.getLayerManager().addLayerChangeListener(new LayerChangeListener() {
    1002             @Override
    1003             public void layerAdded(LayerAddEvent e) {
    1004                 // Do nothing
    1005             }
    1006 
    1007             @Override
    1008             public void layerRemoving(LayerRemoveEvent e) {
    1009                 if (e.getRemovedLayer() == GeoImageLayer.this) {
    1010                     stopLoadThumbs();
    1011                     MapView mapView = MainApplication.getMap().mapView;
    1012                     mapView.removeMouseListener(mouseAdapter);
    1013                     mapView.removeMouseMotionListener(mouseMotionAdapter);
    1014                     MapFrame.removeMapModeChangeListener(mapModeListener);
    1015                     currentPhoto = -1;
    1016                     if (data != null) {
    1017                         data.clear();
    1018                     }
    1019                     data = null;
    1020                     // stop listening to layer change events
    1021                     MainApplication.getLayerManager().removeLayerChangeListener(this);
    1022                 }
    1023             }
    1024 
    1025             @Override
    1026             public void layerOrderChanged(LayerOrderChangeEvent e) {
    1027                 // Do nothing
    1028             }
    1029         });
     997        };
     998        MainApplication.getLayerManager().addActiveLayerChangeListener(activeLayerChangeListener);
    1030999
    10311000        MapFrame map = MainApplication.getMap();
     
    10361005
    10371006    @Override
     1007    public synchronized void destroy() {
     1008        super.destroy();
     1009        stopLoadThumbs();
     1010        MapView mapView = MainApplication.getMap().mapView;
     1011        mapView.removeMouseListener(mouseAdapter);
     1012        mapView.removeMouseMotionListener(mouseMotionAdapter);
     1013        MapFrame.removeMapModeChangeListener(mapModeListener);
     1014        MainApplication.getLayerManager().removeActiveLayerChangeListener(activeLayerChangeListener);
     1015        currentPhoto = -1;
     1016        if (data != null) {
     1017            data.clear();
     1018        }
     1019        data = null;
     1020    }
     1021
     1022    @Override
    10381023    public LayerPainter attachToMapView(MapViewEvent event) {
    10391024        MapView.addZoomChangeListener(this);
    1040         return super.attachToMapView(event);
     1025        return new CompatibilityModeLayerPainter() {
     1026            @Override
     1027            public void detachFromMapView(MapViewEvent event) {
     1028                MapView.removeZoomChangeListener(GeoImageLayer.this);
     1029            }
     1030        };
    10411031    }
    10421032
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r13220 r13265  
    3434import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
    3535import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
     36import org.openstreetmap.josm.tools.Destroyable;
    3637import org.openstreetmap.josm.tools.ExifReader;
    3738import org.openstreetmap.josm.tools.ImageProvider;
     
    4344 * Offers basic mouse interaction (zoom, drag) and on-screen text.
    4445 */
    45 public class ImageDisplay extends JComponent implements PreferenceChangedListener {
     46public class ImageDisplay extends JComponent implements Destroyable, PreferenceChangedListener {
    4647
    4748    /** The file that is currently displayed */
     
    6364    /** The tracker to load the images */
    6465    private final MediaTracker tracker = new MediaTracker(this);
     66
     67    private final ImgDisplayMouseListener mouseListener = new ImgDisplayMouseListener();
    6568
    6669    private String osdText;
     
    663666     */
    664667    public ImageDisplay() {
    665         ImgDisplayMouseListener mouseListener = new ImgDisplayMouseListener();
    666668        addMouseListener(mouseListener);
    667669        addMouseWheelListener(mouseListener);
     
    669671        Config.getPref().addPreferenceChangeListener(this);
    670672        preferenceChanged(null);
     673    }
     674
     675    @Override
     676    public void destroy() {
     677        removeMouseListener(mouseListener);
     678        removeMouseWheelListener(mouseListener);
     679        removeMouseMotionListener(mouseListener);
     680        Config.getPref().removePreferenceChangeListener(this);
    671681    }
    672682
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

    r13264 r13265  
    1515import java.text.SimpleDateFormat;
    1616
    17 import javax.swing.AbstractAction;
    1817import javax.swing.Box;
    1918import javax.swing.JButton;
    20 import javax.swing.JComponent;
    2119import javax.swing.JPanel;
    2220import javax.swing.JToggleButton;
    2321
     22import org.openstreetmap.josm.actions.JosmAction;
    2423import org.openstreetmap.josm.gui.MainApplication;
    2524import org.openstreetmap.josm.gui.dialogs.DialogsPanel.Action;
     
    4140public final class ImageViewerDialog extends ToggleDialog implements LayerChangeListener, ActiveLayerChangeListener {
    4241
    43     private static final String COMMAND_ZOOM = "zoom";
    44     private static final String COMMAND_CENTERVIEW = "centre";
    45     private static final String COMMAND_NEXT = "next";
    46     private static final String COMMAND_REMOVE = "remove";
    47     private static final String COMMAND_REMOVE_FROM_DISK = "removefromdisk";
    48     private static final String COMMAND_PREVIOUS = "previous";
    49     private static final String COMMAND_COLLAPSE = "collapse";
    50     private static final String COMMAND_FIRST = "first";
    51     private static final String COMMAND_LAST = "last";
    52     private static final String COMMAND_COPY_PATH = "copypath";
     42    private final ImageZoomAction imageZoomAction = new ImageZoomAction();
     43    private final ImageCenterViewAction imageCenterViewAction = new ImageCenterViewAction();
     44    private final ImageNextAction imageNextAction = new ImageNextAction();
     45    private final ImageRemoveAction imageRemoveAction = new ImageRemoveAction();
     46    private final ImageRemoveFromDiskAction imageRemoveFromDiskAction = new ImageRemoveFromDiskAction();
     47    private final ImagePreviousAction imagePreviousAction = new ImagePreviousAction();
     48    private final ImageCollapseAction imageCollapseAction = new ImageCollapseAction();
     49    private final ImageFirstAction imageFirstAction = new ImageFirstAction();
     50    private final ImageLastAction imageLastAction = new ImageLastAction();
     51    private final ImageCopyPathAction imageCopyPathAction = new ImageCopyPathAction();
    5352
    5453    private final ImageDisplay imgDisplay = new ImageDisplay();
     
    9089        Dimension buttonDim = new Dimension(26, 26);
    9190
    92         ImageAction prevAction = new ImageAction(COMMAND_PREVIOUS, new ImageProvider("dialogs", "previous"), tr("Previous"));
    93         btnPrevious = new JButton(prevAction);
     91        btnPrevious = new JButton(imagePreviousAction);
    9492        btnPrevious.setPreferredSize(buttonDim);
    95         Shortcut scPrev = Shortcut.registerShortcut(
    96                 "geoimage:previous", tr("Geoimage: {0}", tr("Show previous Image")), KeyEvent.VK_PAGE_UP, Shortcut.DIRECT);
    97         final String previousImage = "Previous Image";
    98         MainApplication.registerActionShortcut(prevAction, scPrev);
    99         btnPrevious.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scPrev.getKeyStroke(), previousImage);
    100         btnPrevious.getActionMap().put(previousImage, prevAction);
    10193        btnPrevious.setEnabled(false);
    10294
    103         final String removePhoto = tr("Remove photo from layer");
    104         ImageAction delAction = new ImageAction(COMMAND_REMOVE, new ImageProvider("dialogs", "delete"), removePhoto);
    105         JButton btnDelete = new JButton(delAction);
     95        JButton btnDelete = new JButton(imageRemoveAction);
    10696        btnDelete.setPreferredSize(buttonDim);
    107         Shortcut scDelete = Shortcut.registerShortcut(
    108                 "geoimage:deleteimagefromlayer", tr("Geoimage: {0}", tr("Remove photo from layer")), KeyEvent.VK_DELETE, Shortcut.SHIFT);
    109         MainApplication.registerActionShortcut(delAction, scDelete);
    110         btnDelete.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scDelete.getKeyStroke(), removePhoto);
    111         btnDelete.getActionMap().put(removePhoto, delAction);
    112 
    113         ImageAction delFromDiskAction = new ImageAction(COMMAND_REMOVE_FROM_DISK,
    114                 new ImageProvider("dialogs", "geoimage/deletefromdisk"), tr("Delete image file from disk"));
    115         JButton btnDeleteFromDisk = new JButton(delFromDiskAction);
     97
     98        JButton btnDeleteFromDisk = new JButton(imageRemoveFromDiskAction);
    11699        btnDeleteFromDisk.setPreferredSize(buttonDim);
    117         Shortcut scDeleteFromDisk = Shortcut.registerShortcut(
    118                 "geoimage:deletefilefromdisk", tr("Geoimage: {0}", tr("Delete File from disk")), KeyEvent.VK_DELETE, Shortcut.CTRL_SHIFT);
    119         final String deleteImage = "Delete image file from disk";
    120         MainApplication.registerActionShortcut(delFromDiskAction, scDeleteFromDisk);
    121         btnDeleteFromDisk.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scDeleteFromDisk.getKeyStroke(), deleteImage);
    122         btnDeleteFromDisk.getActionMap().put(deleteImage, delFromDiskAction);
    123 
    124         ImageAction copyPathAction = new ImageAction(COMMAND_COPY_PATH, new ImageProvider("copy"), tr("Copy image path"));
    125         JButton btnCopyPath = new JButton(copyPathAction);
     100
     101        JButton btnCopyPath = new JButton(imageCopyPathAction);
    126102        btnCopyPath.setPreferredSize(buttonDim);
    127         Shortcut scCopyPath = Shortcut.registerShortcut(
    128                 "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT);
    129         final String copyImage = "Copy image path";
    130         MainApplication.registerActionShortcut(copyPathAction, scCopyPath);
    131         btnCopyPath.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scCopyPath.getKeyStroke(), copyImage);
    132         btnCopyPath.getActionMap().put(copyImage, copyPathAction);
    133 
    134         ImageAction nextAction = new ImageAction(COMMAND_NEXT, new ImageProvider("dialogs", "next"), tr("Next"));
    135         btnNext = new JButton(nextAction);
     103
     104        btnNext = new JButton(imageNextAction);
    136105        btnNext.setPreferredSize(buttonDim);
    137         Shortcut scNext = Shortcut.registerShortcut(
    138                 "geoimage:next", tr("Geoimage: {0}", tr("Show next Image")), KeyEvent.VK_PAGE_DOWN, Shortcut.DIRECT);
    139         final String nextImage = "Next Image";
    140         MainApplication.registerActionShortcut(nextAction, scNext);
    141         btnNext.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scNext.getKeyStroke(), nextImage);
    142         btnNext.getActionMap().put(nextImage, nextAction);
    143106        btnNext.setEnabled(false);
    144107
    145         MainApplication.registerActionShortcut(
    146                 new ImageAction(COMMAND_FIRST, null, null),
    147                 Shortcut.registerShortcut(
    148                         "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT)
    149         );
    150         MainApplication.registerActionShortcut(
    151                 new ImageAction(COMMAND_LAST, null, null),
    152                 Shortcut.registerShortcut(
    153                         "geoimage:last", tr("Geoimage: {0}", tr("Show last Image")), KeyEvent.VK_END, Shortcut.DIRECT)
    154         );
    155 
    156         tbCentre = new JToggleButton(new ImageAction(COMMAND_CENTERVIEW,
    157                 new ImageProvider("dialogs", "centreview"), tr("Center view")));
     108        tbCentre = new JToggleButton(imageCenterViewAction);
    158109        tbCentre.setPreferredSize(buttonDim);
    159110
    160         JButton btnZoomBestFit = new JButton(new ImageAction(COMMAND_ZOOM,
    161                 new ImageProvider("dialogs", "zoom-best-fit"), tr("Zoom best fit and 1:1")));
     111        JButton btnZoomBestFit = new JButton(imageZoomAction);
    162112        btnZoomBestFit.setPreferredSize(buttonDim);
    163113
    164         btnCollapse = new JButton(new ImageAction(COMMAND_COLLAPSE,
    165                 new ImageProvider("dialogs", "collapse"), tr("Move dialog to the side pane")));
     114        btnCollapse = new JButton(imageCollapseAction);
    166115        btnCollapse.setPreferredSize(new Dimension(20, 20));
    167116        btnCollapse.setAlignmentY(Component.TOP_ALIGNMENT);
     
    202151        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
    203152        MainApplication.getLayerManager().removeLayerChangeListener(this);
     153        // Manually destroy actions until JButtons are replaced by standard SideButtons
     154        imageFirstAction.destroy();
     155        imageLastAction.destroy();
     156        imagePreviousAction.destroy();
     157        imageNextAction.destroy();
     158        imageCenterViewAction.destroy();
     159        imageCollapseAction.destroy();
     160        imageCopyPathAction.destroy();
     161        imageRemoveAction.destroy();
     162        imageRemoveFromDiskAction.destroy();
     163        imageZoomAction.destroy();
    204164        super.destroy();
    205     }
    206 
    207     class ImageAction extends AbstractAction {
    208         private final String action;
    209 
    210         ImageAction(String action, ImageProvider provider, String toolTipText) {
    211             this.action = action;
    212             putValue(SHORT_DESCRIPTION, toolTipText);
    213             if (provider != null) {
    214                 provider.getResource().attachImageIcon(this, true);
    215             }
    216         }
    217 
    218         @Override
    219         public void actionPerformed(ActionEvent e) {
    220             if (COMMAND_NEXT.equals(action)) {
    221                 if (currentLayer != null) {
    222                     currentLayer.showNextPhoto();
    223                 }
    224             } else if (COMMAND_PREVIOUS.equals(action)) {
    225                 if (currentLayer != null) {
    226                     currentLayer.showPreviousPhoto();
    227                 }
    228             } else if (COMMAND_FIRST.equals(action) && currentLayer != null) {
     165        dialog = null;
     166    }
     167
     168    private class ImageNextAction extends JosmAction {
     169        ImageNextAction() {
     170            super(null, new ImageProvider("dialogs", "next"), tr("Next"), Shortcut.registerShortcut(
     171                    "geoimage:next", tr("Geoimage: {0}", tr("Show next Image")), KeyEvent.VK_PAGE_DOWN, Shortcut.DIRECT),
     172                  false, null, false);
     173        }
     174
     175        @Override
     176        public void actionPerformed(ActionEvent e) {
     177            if (currentLayer != null) {
     178                currentLayer.showNextPhoto();
     179            }
     180        }
     181    }
     182
     183    private class ImagePreviousAction extends JosmAction {
     184        ImagePreviousAction() {
     185            super(null, new ImageProvider("dialogs", "previous"), tr("Previous"), Shortcut.registerShortcut(
     186                    "geoimage:previous", tr("Geoimage: {0}", tr("Show previous Image")), KeyEvent.VK_PAGE_UP, Shortcut.DIRECT),
     187                  false, null, false);
     188        }
     189
     190        @Override
     191        public void actionPerformed(ActionEvent e) {
     192            if (currentLayer != null) {
     193                currentLayer.showPreviousPhoto();
     194            }
     195        }
     196    }
     197
     198    private class ImageFirstAction extends JosmAction {
     199        ImageFirstAction() {
     200            super(null, (ImageProvider) null, null, Shortcut.registerShortcut(
     201                    "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT),
     202                  false, null, false);
     203        }
     204
     205        @Override
     206        public void actionPerformed(ActionEvent e) {
     207            if (currentLayer != null) {
    229208                currentLayer.showFirstPhoto();
    230             } else if (COMMAND_LAST.equals(action) && currentLayer != null) {
     209            }
     210        }
     211    }
     212
     213    private class ImageLastAction extends JosmAction {
     214        ImageLastAction() {
     215            super(null, (ImageProvider) null, null, Shortcut.registerShortcut(
     216                    "geoimage:last", tr("Geoimage: {0}", tr("Show last Image")), KeyEvent.VK_END, Shortcut.DIRECT),
     217                  false, null, false);
     218        }
     219
     220        @Override
     221        public void actionPerformed(ActionEvent e) {
     222            if (currentLayer != null) {
    231223                currentLayer.showLastPhoto();
    232             } else if (COMMAND_CENTERVIEW.equals(action)) {
    233                 final JToggleButton button = (JToggleButton) e.getSource();
    234                 centerView = button.isEnabled() && button.isSelected();
    235                 if (centerView && currentEntry != null && currentEntry.getPos() != null) {
    236                     MainApplication.getMap().mapView.zoomTo(currentEntry.getPos());
    237                 }
    238             } else if (COMMAND_ZOOM.equals(action)) {
    239                 imgDisplay.zoomBestFitOrOne();
    240             } else if (COMMAND_REMOVE.equals(action)) {
    241                 if (currentLayer != null) {
    242                     currentLayer.removeCurrentPhoto();
    243                 }
    244             } else if (COMMAND_REMOVE_FROM_DISK.equals(action)) {
    245                 if (currentLayer != null) {
    246                     currentLayer.removeCurrentPhotoFromDisk();
    247                 }
    248             } else if (COMMAND_COPY_PATH.equals(action)) {
    249                 if (currentLayer != null) {
    250                     currentLayer.copyCurrentPhotoPath();
    251                 }
    252             } else if (COMMAND_COLLAPSE.equals(action)) {
    253                 collapseButtonClicked = true;
    254                 detachedDialog.getToolkit().getSystemEventQueue().postEvent(new WindowEvent(detachedDialog, WindowEvent.WINDOW_CLOSING));
    255             }
     224            }
     225        }
     226    }
     227
     228    private class ImageCenterViewAction extends JosmAction {
     229        ImageCenterViewAction() {
     230            super(null, new ImageProvider("dialogs", "centreview"), tr("Center view"), null,
     231                  false, null, false);
     232        }
     233
     234        @Override
     235        public void actionPerformed(ActionEvent e) {
     236            final JToggleButton button = (JToggleButton) e.getSource();
     237            centerView = button.isEnabled() && button.isSelected();
     238            if (centerView && currentEntry != null && currentEntry.getPos() != null) {
     239                MainApplication.getMap().mapView.zoomTo(currentEntry.getPos());
     240            }
     241        }
     242    }
     243
     244    private class ImageZoomAction extends JosmAction {
     245        ImageZoomAction() {
     246            super(null, new ImageProvider("dialogs", "zoom-best-fit"), tr("Zoom best fit and 1:1"), null,
     247                  false, null, false);
     248        }
     249
     250        @Override
     251        public void actionPerformed(ActionEvent e) {
     252            imgDisplay.zoomBestFitOrOne();
     253        }
     254    }
     255
     256    private class ImageRemoveAction extends JosmAction {
     257        ImageRemoveAction() {
     258            super(null, new ImageProvider("dialogs", "delete"), tr("Remove photo from layer"), Shortcut.registerShortcut(
     259                    "geoimage:deleteimagefromlayer", tr("Geoimage: {0}", tr("Remove photo from layer")), KeyEvent.VK_DELETE, Shortcut.SHIFT),
     260                  false, null, false);
     261        }
     262
     263        @Override
     264        public void actionPerformed(ActionEvent e) {
     265            if (currentLayer != null) {
     266                currentLayer.removeCurrentPhoto();
     267            }
     268        }
     269    }
     270
     271    private class ImageRemoveFromDiskAction extends JosmAction {
     272        ImageRemoveFromDiskAction() {
     273            super(null, new ImageProvider("dialogs", "geoimage/deletefromdisk"), tr("Delete image file from disk"),
     274                  Shortcut.registerShortcut(
     275                    "geoimage:deletefilefromdisk", tr("Geoimage: {0}", tr("Delete File from disk")), KeyEvent.VK_DELETE, Shortcut.CTRL_SHIFT),
     276                  false, null, false);
     277        }
     278
     279        @Override
     280        public void actionPerformed(ActionEvent e) {
     281            if (currentLayer != null) {
     282                currentLayer.removeCurrentPhotoFromDisk();
     283            }
     284        }
     285    }
     286
     287    private class ImageCopyPathAction extends JosmAction {
     288        ImageCopyPathAction() {
     289            super(null, new ImageProvider("copy"), tr("Copy image path"), Shortcut.registerShortcut(
     290                    "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT),
     291                  false, null, false);
     292        }
     293
     294        @Override
     295        public void actionPerformed(ActionEvent e) {
     296            if (currentLayer != null) {
     297                currentLayer.copyCurrentPhotoPath();
     298            }
     299        }
     300    }
     301
     302    private class ImageCollapseAction extends JosmAction {
     303        ImageCollapseAction() {
     304            super(null, new ImageProvider("dialogs", "collapse"), tr("Move dialog to the side pane"), null,
     305                  false, null, false);
     306        }
     307
     308        @Override
     309        public void actionPerformed(ActionEvent e) {
     310            collapseButtonClicked = true;
     311            detachedDialog.getToolkit().getSystemEventQueue().postEvent(new WindowEvent(detachedDialog, WindowEvent.WINDOW_CLOSING));
    256312        }
    257313    }
     
    455511        }
    456512    }
    457 
    458513}
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r12808 r13265  
    245245        if (name != null) {
    246246            childMap.remove(name);
     247        } else {
     248            childMap.values().removeIf(child::equals);
    247249        }
    248250    }
Note: See TracChangeset for help on using the changeset viewer.