Ticket #17184: 17184.patch
File 17184.patch, 5.8 KB (added by , 6 years ago) |
---|
-
src/org/openstreetmap/josm/actions/JosmAction.java
252 252 public void destroy() { 253 253 if (sc != null && !sc.isAutomatic()) { 254 254 MainApplication.unregisterActionShortcut(this); 255 sc = null; 255 256 } 256 257 if (layerChangeAdapter != null) { 257 258 getLayerManager().removeLayerChangeListener(layerChangeAdapter); 258 259 getLayerManager().removeActiveLayerChangeListener(activeLayerChangeAdapter); 260 layerChangeAdapter = null; 259 261 } 260 262 if (selectionChangeAdapter != null) { 261 263 SelectionEventManager.getInstance().removeSelectionListener(selectionChangeAdapter); 264 selectionChangeAdapter = null; 262 265 } 263 266 } 264 267 -
src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
308 308 case 2: BugReportSender.reportBug(reportHeader); break; 309 309 default: // do nothing 310 310 } 311 GuiHelper.destroyComponents(ed, false);312 311 } 313 312 } -
src/org/openstreetmap/josm/gui/ExtendedDialog.java
459 459 super.setVisible(visible); 460 460 461 461 if (!visible && disposeOnClose) { 462 GuiHelper.destroyComponents(this, false); 462 463 dispose(); 464 buttons.clear(); 463 465 } 464 466 } 465 467 -
src/org/openstreetmap/josm/gui/util/GuiHelper.java
33 33 import java.util.concurrent.ExecutionException; 34 34 import java.util.concurrent.FutureTask; 35 35 36 import javax.swing.Action; 36 37 import javax.swing.GrayFilter; 37 38 import javax.swing.ImageIcon; 39 import javax.swing.JButton; 38 40 import javax.swing.JColorChooser; 39 41 import javax.swing.JComponent; 40 42 import javax.swing.JFileChooser; … … 648 650 } 649 651 650 652 /** 651 * Destroys recursively all {@link Destroyable} components of a given container, and option nally the container itself.653 * Destroys recursively all {@link Destroyable} components of a given container, and optionally the container itself. 652 654 * @param component the component to destroy 653 655 * @param destroyItself whether to destroy the component itself 654 656 * @since 14463 655 657 */ 656 658 public static void destroyComponents(Component component, boolean destroyItself) { 659 657 660 if (component instanceof Container) { 658 for (Component c : ((Container) component).getComponents()) {661 for (Component c : ((Container) component).getComponents()) { 659 662 destroyComponents(c, true); 660 663 } 661 664 } 665 if (component instanceof JButton) { 666 if (!(component instanceof Destroyable)) { 667 Action a = ((JButton) component).getAction(); 668 if (a instanceof Destroyable) { 669 ((Destroyable) a).destroy(); 670 } 671 ((JButton) component).setAction(null); 672 } 673 } 662 674 if (destroyItself && component instanceof Destroyable) { 663 675 ((Destroyable) component).destroy(); 664 676 } -
src/org/openstreetmap/josm/gui/widgets/JosmTextArea.java
18 18 */ 19 19 public class JosmTextArea extends JTextArea implements Destroyable, FocusListener { 20 20 21 private finalPopupMenuLauncher launcher;21 private PopupMenuLauncher launcher; 22 22 23 23 /** 24 24 * Constructs a new {@code JosmTextArea}. A default model is set, the initial string … … 125 125 @Override 126 126 public void destroy() { 127 127 removeFocusListener(this); 128 TextContextualPopupMenu.disableMenuFor(this, launcher); 128 if (launcher != null) { 129 TextContextualPopupMenu.disableMenuFor(this, launcher); 130 launcher = null; 131 } 129 132 } 130 133 } -
src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
131 131 protected TextContextualPopupMenu detach() { 132 132 if (isAttached()) { 133 133 component.removePropertyChangeListener(EDITABLE, propertyChangeListener); 134 removeAll();135 134 if (undoRedo) { 136 135 component.getDocument().removeUndoableEditListener(undoEditListener); 136 if (!GraphicsEnvironment.isHeadless()) { 137 component.getInputMap().put( 138 KeyStroke.getKeyStroke(KeyEvent.VK_Z, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), null); 139 component.getInputMap().put( 140 KeyStroke.getKeyStroke(KeyEvent.VK_Y, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), null); 141 } 137 142 } 143 144 removeAll(); 138 145 component = null; 139 146 } 140 147 return this;