Ticket #18556: 18556.patch
| File 18556.patch, 5.9 KB (added by , 6 years ago) |
|---|
-
.settings/org.eclipse.jdt.core.prefs
7 7 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled 8 8 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 9 9 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 10 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1. 710 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 11 11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 12 org.eclipse.jdt.core.compiler.compliance=1. 712 org.eclipse.jdt.core.compiler.compliance=1.8 13 13 org.eclipse.jdt.core.compiler.debug.lineNumber=generate 14 14 org.eclipse.jdt.core.compiler.debug.localVariable=generate 15 15 org.eclipse.jdt.core.compiler.debug.sourceFile=generate … … 112 112 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore 113 113 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning 114 114 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning 115 org.eclipse.jdt.core.compiler.source=1. 7115 org.eclipse.jdt.core.compiler.source=1.8 -
build.xml
14 14 <property name="plugin.description" value="Downloads new data when you pan/zoom"/> 15 15 <property name="plugin.icon" value="images/continuous-download.png"/> 16 16 <property name="plugin.link" value="https://github.com/JOSM/JOSM-continuos-download"/> 17 17 <property name="plugin.canloadatruntime" value="true"/> 18 18 19 <property name="josm" location="../../core/dist/josm-custom.jar"/> 19 20 <property name="plugin.dist.dir" value="../../dist"/> 20 21 21 22 <target name="additional-manifest"> 22 23 <manifest file="MANIFEST" mode="update"> 23 24 <attribute name="7588_Plugin-Url" value="v1.1.01;https://github.com/Gnonthgol/JOSM-continuos-download/releases/download/v1.1.01/continuosDownload.jar" /> … … 33 34 34 35 <!-- ** include targets that all plugins have in common ** --> 35 36 <import file="../build-common.xml"/> 36 37 37 38 </project> -
src/org/openstreetmap/josm/plugins/continuosDownload/DownloadPlugin.java
30 30 import org.openstreetmap.josm.plugins.Plugin; 31 31 import org.openstreetmap.josm.plugins.PluginInformation; 32 32 import org.openstreetmap.josm.spi.preferences.Config; 33 import org.openstreetmap.josm.tools.Destroyable; 33 34 import org.openstreetmap.josm.tools.Logging; 34 35 import org.openstreetmap.josm.tools.Shortcut; 35 36 36 public class DownloadPlugin extends Plugin implements ZoomChangeListener {37 public class DownloadPlugin extends Plugin implements ZoomChangeListener, Destroyable { 37 38 38 39 /** 39 40 * The worker that runs all our downloads, it have more threads than … … 52 53 private Bounds lastBbox; 53 54 private boolean active; 54 55 56 DownloadPreference preference; 57 55 58 /** 56 59 * Constructs a new {@code DownloadPlugin}. 57 60 * @param info plugin info … … 72 75 73 76 @Override 74 77 public PreferenceSetting getPreferenceSetting() { 75 return new DownloadPreference(); 78 if (preference == null) 79 preference = new DownloadPreference(); 80 return preference; 76 81 } 77 82 78 83 @Override … … 172 177 public static List<String> getStrategies() { 173 178 return new ArrayList<>(strats.keySet()); 174 179 } 180 181 @Override 182 public void destroy() { 183 NavigatableComponent.removeZoomChangeListener(this); 184 worker.shutdown(); 185 if (preference != null) 186 preference.destroy(); 187 } 175 188 } -
src/org/openstreetmap/josm/plugins/continuosDownload/DownloadPreference.java
5 5 6 6 import java.awt.GridBagConstraints; 7 7 import java.awt.GridBagLayout; 8 import java.util.HashMap; 9 import java.util.Map; 8 10 9 11 import javax.swing.Box; 10 12 import javax.swing.JCheckBox; … … 16 18 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 17 19 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 18 20 import org.openstreetmap.josm.spi.preferences.Config; 21 import org.openstreetmap.josm.tools.Destroyable; 19 22 import org.openstreetmap.josm.tools.GBC; 20 23 21 24 /** 22 25 * Plugin preferences. 23 26 */ 24 public class DownloadPreference extends DefaultTabPreferenceSetting {27 public class DownloadPreference extends DefaultTabPreferenceSetting implements Destroyable { 25 28 26 29 private final JCheckBox activeDefault = new JCheckBox(tr("Activate continuous downloads at startup.")); 27 30 private final JTextField maxThreads = new JTextField(4); … … 32 35 private final JComboBox<String> strategy = new JComboBox<>(); 33 36 private final JCheckBox quietDownload = new JCheckBox(tr("Supress the default modal progress monitor when downloading.")); 34 37 38 private final Map<PreferenceTabbedPane, JPanel> guiPanes = new HashMap<>(); 35 39 /** 36 40 * Constructs a new {@code DownloadPreference}. 37 41 */ … … 101 105 102 106 panel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.VERTICAL)); 103 107 createPreferenceTabWithScrollPane(gui, panel); 108 guiPanes.put(gui, panel); 104 109 } 105 110 106 111 @Override … … 117 122 Config.getPref().putBoolean("plugin.continuos_download.quiet_download", quietDownload.isSelected()); 118 123 return r; 119 124 } 125 126 @Override 127 public void destroy() { 128 guiPanes.forEach((gui, panel) -> gui.remove(panel)); 129 } 120 130 }
