Ticket #18556: 18556.2.patch
File 18556.2.patch, 6.8 KB (added by , 4 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
1 1 <?xml version="1.0" encoding="utf-8"?> 2 <project name="continuosDownload " default="dist" basedir=".">2 <project name="continuosDownload-test" default="dist" basedir="."> 3 3 4 4 <!-- enter the SVN commit message --> 5 5 <property name="commit.message" value="Commit message"/> … … 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 private DownloadPreference preference; 57 private JCheckBoxMenuItem menuItem; 58 55 59 /** 56 60 * Constructs a new {@code DownloadPlugin}. 57 61 * @param info plugin info … … 64 68 NavigatableComponent.addZoomChangeListener(this); 65 69 66 70 ToggleAction toggle = new ToggleAction(); 67 JCheckBoxMenuItemmenuItem = MainMenu.addWithCheckbox(MainApplication.getMenu().fileMenu, toggle,71 menuItem = MainMenu.addWithCheckbox(MainApplication.getMenu().fileMenu, toggle, 68 72 MainMenu.WINDOW_MENU_GROUP.ALWAYS); 69 73 menuItem.setState(active); 70 74 toggle.addButtonModel(menuItem.getModel()); … … 72 76 73 77 @Override 74 78 public PreferenceSetting getPreferenceSetting() { 75 return new DownloadPreference(); 79 if (preference == null) 80 preference = new DownloadPreference(); 81 return preference; 76 82 } 77 83 78 84 @Override … … 172 178 public static List<String> getStrategies() { 173 179 return new ArrayList<>(strats.keySet()); 174 180 } 181 182 @Override 183 public void destroy() { 184 NavigatableComponent.removeZoomChangeListener(this); 185 worker.shutdown(); 186 MainApplication.getMenu().fileMenu.remove(menuItem); 187 if (preference != null) 188 preference.destroy(); 189 } 175 190 } -
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 }