Index: applications/editors/josm/plugins/download_along/.classpath
===================================================================
--- applications/editors/josm/plugins/download_along/.classpath	(revision 29744)
+++ applications/editors/josm/plugins/download_along/.classpath	(revision 29744)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
Index: applications/editors/josm/plugins/download_along/.project
===================================================================
--- applications/editors/josm/plugins/download_along/.project	(revision 29744)
+++ applications/editors/josm/plugins/download_along/.project	(revision 29744)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>JOSM-download_along</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: applications/editors/josm/plugins/download_along/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- applications/editors/josm/plugins/download_along/.settings/org.eclipse.jdt.core.prefs	(revision 29744)
+++ applications/editors/josm/plugins/download_along/.settings/org.eclipse.jdt.core.prefs	(revision 29744)
@@ -0,0 +1,95 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
Index: applications/editors/josm/plugins/download_along/build.xml
===================================================================
--- applications/editors/josm/plugins/download_along/build.xml	(revision 29743)
+++ applications/editors/josm/plugins/download_along/build.xml	(revision 29744)
@@ -1,31 +1,3 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!--
-** This is a template build file for a JOSM  plugin.
-**
-** Maintaining versions
-** ====================
-** see README.template
-**
-** Usage
-** =====
-** To build it run
-**
-**    > ant  dist
-**
-** To install the generated plugin locally (in you default plugin directory) run
-**
-**    > ant  install
-**
-** The generated plugin jar is not automatically available in JOSMs plugin configuration
-** dialog. You have to check it in first.
-**
-** Use the ant target 'publish' to check in the plugin and make it available to other
-** JOSM users:
-**    set the properties commit.message and plugin.main.version
-** and run
-**    > ant  publish
-**
-**
--->
 <project name="download_along" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
@@ -33,208 +5,19 @@
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="4980"/>
-    <!--
-      ************************************************
-      ** should not be necessary to change the following properties
-     -->
-    <property name="josm" location="../../core/dist/josm-custom.jar"/>
-    <property name="plugin.build.dir" value="build"/>
-    <property name="plugin.src.dir" value="src"/>
-    <!-- this is the directory where the plugin jar is copied to -->
-    <property name="plugin.dist.dir" value="../../dist"/>
-    <property name="ant.build.javac.target" value="1.5"/>
-    <property name="plugin.dist.dir" value="../../dist"/>
-    <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
-    <!--
-    **********************************************************
-    ** init - initializes the build
-    **********************************************************
+
+	<!-- Configure these properties (replace "..." accordingly).
+         See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
     -->
-    <target name="init">
-        <mkdir dir="${plugin.build.dir}"/>
-    </target>
-    <!--
-    **********************************************************
-    ** compile - complies the source tree
-    **********************************************************
-    -->
-    <target name="compile" depends="init">
-        <echo message="compiling sources for  ${plugin.jar} ... "/>
-        <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
-            <compilerarg value="-Xlint:deprecation"/>
-            <compilerarg value="-Xlint:unchecked"/>
-        </javac>
-    </target>
-    <!--
-    **********************************************************
-    ** dist - creates the plugin jar
-    **********************************************************
-    -->
-    <target name="dist" depends="compile,revision">
-        <echo message="creating ${plugin.jar.name} ... "/>
-        <copy todir="${plugin.build.dir}/images">
-            <fileset dir="images"/>
-        </copy>
-        <copy todir="${plugin.build.dir}/data">
-            <fileset dir="data"/>
-        </copy>
-        <copy todir="${plugin.build.dir}">
-            <fileset dir=".">
-                <include name="README"/>
-                <include name="LICENSE"/>
-            </fileset>
-        </copy>
-        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
-            <!--
-        ************************************************
-        ** configure these properties. Most of them will be copied to the plugins
-        ** manifest file. Property values will also show up in the list available
-        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
-        **
-        ************************************************
-    -->
-            <manifest>
-                <attribute name="Author" value="Nakor"/>
-                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugin.download_along.DownloadAlong"/>
-                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
-                <attribute name="Plugin-Description" value="Downloads OSM data along a way"/>
-                <attribute name="Plugin-Icon" value="images/download_along.png"/>
-                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/DownloadAlong"/>
-                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
-                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
-            </manifest>
-        </jar>
-    </target>
-    <!--
-    **********************************************************
-    ** revision - extracts the current revision number for the
-    **    file build.number and stores it in the XML property
-    **    version.*
-    **********************************************************
-    -->
-    <target name="revision">
-        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="info"/>
-            <arg value="--xml"/>
-            <arg value="."/>
-        </exec>
-        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
-        <delete file="REVISION"/>
-    </target>
-    <!--
-    **********************************************************
-    ** clean - clean up the build environment
-    **********************************************************
-    -->
-    <target name="clean">
-        <delete dir="${plugin.build.dir}"/>
-        <delete file="${plugin.jar}"/>
-    </target>
-    <!--
-    **********************************************************
-    ** install - install the plugin in your local JOSM installation
-    **********************************************************
-    -->
-    <target name="install" depends="dist">
-        <property environment="env"/>
-        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
-            <and>
-                <os family="windows"/>
-            </and>
-        </condition>
-        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
-    </target>
-    <!--
-    ************************** Publishing the plugin *********************************** 
-    -->
-    <!--
-        ** extracts the JOSM release for the JOSM version in ../core and saves it in the 
-        ** property ${coreversion.info.entry.revision}
-        **
-        -->
-    <target name="core-info">
-        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="info"/>
-            <arg value="--xml"/>
-            <arg value="../../core"/>
-        </exec>
-        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
-        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
-        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
-        <delete file="core.info.xml"/>
-    </target>
-    <!--
-        ** commits the source tree for this plugin
-        -->
-    <target name="commit-current">
-        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="commit"/>
-            <arg value="-m '${commit.message}'"/>
-            <arg value="."/>
-        </exec>
-    </target>
-    <!--
-        ** updates (svn up) the source tree for this plugin
-        -->
-    <target name="update-current">
-        <echo>Updating plugin source ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="up"/>
-            <arg value="."/>
-        </exec>
-        <echo>Updating ${plugin.jar} ...</echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="up"/>
-            <arg value="../dist/${plugin.jar}"/>
-        </exec>
-    </target>
-    <!--
-        ** commits the plugin.jar 
-        -->
-    <target name="commit-dist">
-        <echo>
-    ***** Properties of published ${plugin.jar} *****
-    Commit message    : '${commit.message}'                 
-    Plugin-Mainversion: ${plugin.main.version}
-    JOSM build version: ${coreversion.info.entry.revision}
-    Plugin-Version    : ${version.entry.commit.revision}
-    ***** / Properties of published ${plugin.jar} *****                 
-                        
-    Now commiting ${plugin.jar} ...
-    </echo>
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
-            <env key="LANG" value="C"/>
-            <arg value="-m '${commit.message}'"/>
-            <arg value="commit"/>
-            <arg value="${plugin.jar}"/>
-        </exec>
-    </target>
-    <!-- ** make sure svn is present as a command line tool ** -->
-    <target name="ensure-svn-present">
-        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
-            <env key="LANG" value="C"/>
-            <arg value="--version"/>
-        </exec>
-        <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
-            <!-- return code not set at all? Most likely svn isn't installed -->
-            <condition>
-                <not>
-                    <isset property="svn.exit.code"/>
-                </not>
-            </condition>
-        </fail>
-        <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
-            <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
-            <condition>
-                <isfailure code="${svn.exit.code}"/>
-            </condition>
-        </fail>
-    </target>
-    <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
-    </target>
+    <property name="plugin.author" value="Nakor"/>
+    <property name="plugin.class" value="org.openstreetmap.josm.plugin.download_along.DownloadAlong"/>
+    <property name="plugin.description" value="Downloads OSM data along a way"/>
+    <property name="plugin.icon" value="images/download_along.png"/>
+    <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/DownloadAlong"/>
+    <!--<property name="plugin.early" value="..."/>-->
+    <!--<property name="plugin.requires" value="..."/>-->
+    <!--<property name="plugin.stage" value="..."/>-->
+
+    <!-- ** include targets that all plugins have in common ** -->
+    <import file="../build-common.xml"/>
+
 </project>
Index: applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlong.java
===================================================================
--- applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlong.java	(revision 29743)
+++ applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlong.java	(revision 29744)
@@ -1,293 +1,16 @@
 package org.openstreetmap.josm.plugin.download_along;
 
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.geom.Area;
-import java.awt.geom.Rectangle2D;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Future;
-
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.JosmAction;
-import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTaskList;
-import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.gui.MainMenu;
-import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
-import org.openstreetmap.josm.tools.GBC;
-import org.openstreetmap.josm.tools.Shortcut;
 
 public class DownloadAlong extends Plugin {
-  private static final String PREF_DOWNLOAD_ALONG_TRACK_DISTANCE = "downloadAlong.downloadAlongTrack.distance";
-  private static final String PREF_DOWNLOAD_ALONG_TRACK_AREA = "downloadAlong.downloadAlongTrack.area";
+	static final String PREF_DOWNLOAD_ALONG_TRACK_DISTANCE = "downloadAlong.downloadAlongTrack.distance";
+	static final String PREF_DOWNLOAD_ALONG_TRACK_AREA = "downloadAlong.downloadAlongTrack.area";
 
-  JMenuItem DownloadAlong;
-
-  public DownloadAlong(PluginInformation info) {
-    super(info);
-    DownloadAlong = MainMenu.add(Main.main.menu.toolsMenu,
-        new DownloadAlongAction());
-
-  }
-
-  private static class DownloadAlongAction extends JosmAction {
-    /**
-         *
-         */
-    private static final long serialVersionUID = 1L;
-
-    public DownloadAlongAction() {
-      super(tr("Download along..."), "download_along",
-          tr("Download OSM data along the selected ways."),
-          Shortcut.registerShortcut("tools:download_along", tr("Tool: {0}",
-          tr("Download Along")), KeyEvent.VK_D, Shortcut.ALT_SHIFT), true);
-    }
-
-    public void actionPerformed(ActionEvent e) {
-      Collection<OsmPrimitive> selection = Main.main.getCurrentDataSet()
-          .getSelected();
-
-      int ways = 0;
-      for (OsmPrimitive prim : selection) {
-        if (prim instanceof Way)
-          ways++;
-      }
-
-      if (ways < 1) {
-        JOptionPane.showMessageDialog(Main.parent,
-            tr("Please select 1 or more ways to download along"));
-        return;
-      }
-
-      JPanel msg = new JPanel(new GridBagLayout());
-      Integer dist[] = { 5000, 500, 50 };
-      Integer area[] = { 20, 10, 5, 1 };
-
-      msg.add(new JLabel(tr("Download everything within:")), GBC.eol());
-      String s[] = new String[dist.length];
-      for (int i = 0; i < dist.length; ++i) {
-        s[i] = tr("{0} meters", dist[i]);
-      }
-      JList buffer = new JList(s);
-      buffer.setSelectedIndex(Main.pref.getInteger(
-          PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, 0));
-      msg.add(buffer, GBC.eol());
-
-      msg.add(new JLabel(tr("Maximum area per request:")), GBC.eol());
-      s = new String[area.length];
-      for (int i = 0; i < area.length; ++i) {
-        s[i] = tr("{0} sq km", area[i]);
-      }
-      JList maxRect = new JList(s);
-      maxRect.setSelectedIndex(Main.pref.getInteger(
-          PREF_DOWNLOAD_ALONG_TRACK_AREA, 0));
-      msg.add(maxRect, GBC.eol());
-
-      int ret = JOptionPane.showConfirmDialog(Main.parent, msg,
-          tr("Download from OSM along this track"),
-          JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
-      switch (ret) {
-      case JOptionPane.CANCEL_OPTION:
-      case JOptionPane.CLOSED_OPTION:
-        return;
-      default:
-        // continue
-      }
-
-      Main.pref.putInteger(PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, buffer
-          .getSelectedIndex());
-      Main.pref.putInteger(PREF_DOWNLOAD_ALONG_TRACK_AREA, maxRect
-          .getSelectedIndex());
-
-      /*
-       * Find the average latitude for the data we're contemplating, so we can
-       * know how many metres per degree of longitude we have.
-       */
-      double latsum = 0;
-      int latcnt = 0;
-
-      for (OsmPrimitive prim : selection) {
-          if (prim instanceof Way) {
-              Way way = (Way) prim;
-              for (Node n : way.getNodes()) {
-                  latsum += n.getCoor().lat();
-                  latcnt++;
-              }
-          }
-      }
-
-      double avglat = latsum / latcnt;
-      double scale = Math.cos(Math.toRadians(avglat));
-
-      /*
-       * Compute buffer zone extents and maximum bounding box size. Note that
-       * the maximum we ever offer is a bbox area of 0.002, while the API
-       * theoretically supports 0.25, but as soon as you touch any built-up
-       * area, that kind of bounding box will download forever and then stop
-       * because it has more than 50k nodes.
-       */
-      Integer i = buffer.getSelectedIndex();
-      int buffer_dist = dist[i < 0 ? 0 : i];
-      double buffer_y = buffer_dist / 100000.0;
-      double buffer_x = buffer_y / scale;
-      i = maxRect.getSelectedIndex();
-      double max_area = area[i < 0 ? 0 : i] / 10000.0 / scale;
-      Area a = new Area();
-      Rectangle2D r = new Rectangle2D.Double();
-
-      /*
-       * Collect the combined area of all gpx points plus buffer zones around
-       * them. We ignore points that lie closer to the previous point than the
-       * given buffer size because otherwise this operation takes ages.
-       */
-      LatLon previous = null;
-      for (OsmPrimitive prim : selection) {
-        Way way = (Way) prim;
-        for (Node p : way.getNodes()) {
-          LatLon c = p.getCoor();
-          ArrayList<LatLon> intermediateNodes = new ArrayList<LatLon>();
-          if (previous != null
-              && c.greatCircleDistance(previous) > buffer_dist) {
-            Double d = c.greatCircleDistance(previous) / buffer_dist;
-            int nbNodes = d.intValue();
-            System.out.println(tr("{0} intermediate nodes to download.", nbNodes));
-            System.out.println(tr("between {0} {1} and {2} {3}", c.lat(), c.lon(), previous.lat(), previous.lon()));
-            for (i = 1; i < nbNodes; i++) {
-              intermediateNodes.add(new LatLon(previous.lat()+(i * (c.lat() - previous.lat())
-                  / (nbNodes+1)), previous.lon()+(i * (c.lon() - previous.lon()) / (nbNodes+1))));
-              System.out.println(tr("  adding {0} {1}", previous.lat()+(i * (c.lat() - previous.lat())
-                  / (nbNodes+1)), previous.lon()+(i * (c.lon() - previous.lon()) / (nbNodes+1))));
-           }
-          }
-          intermediateNodes.add(c);
-          for (LatLon d : intermediateNodes) {
-            if (previous == null
-                || d.greatCircleDistance(previous) > buffer_dist) {
-              // we add a buffer around the point.
-              r.setRect(d.lon() - buffer_x, d.lat() - buffer_y, 2 * buffer_x,
-                  2 * buffer_y);
-              a.add(new Area(r));
-              previous = d;
-            }
-          }
-          previous = c;
-        }
-      }
-
-      /*
-       * Area "a" now contains the hull that we would like to download data for.
-       * however we can only download rectangles, so the following is an attempt
-       * at finding a number of rectangles to download.
-       *
-       * The idea is simply: Start out with the full bounding box. If it is too
-       * large, then split it in half and repeat recursively for each half until
-       * you arrive at something small enough to download. The algorithm is
-       * improved by always using the intersection between the rectangle and the
-       * actual desired area. For example, if you have a track that goes like
-       * this: +----+ | /| | / | | / | |/ | +----+ then we would first look at
-       * downloading the whole rectangle (assume it's too big), after that we
-       * split it in half (upper and lower half), but we donot request the full
-       * upper and lower rectangle, only the part of the upper/lower rectangle
-       * that actually has something in it.
-       */
-
-      List<Rectangle2D> toDownload = new ArrayList<Rectangle2D>();
-
-      addToDownload(a, a.getBounds(), toDownload, max_area);
-
-      msg = new JPanel(new GridBagLayout());
-
-      msg.add(new JLabel(tr("<html>This action will require {0} individual<br>"
-          + "download requests. Do you wish<br>to continue?</html>", toDownload
-          .size())), GBC.eol());
-
-      if (toDownload.size() > 1) {
-        ret = JOptionPane.showConfirmDialog(Main.parent, msg,
-            tr("Download from OSM along this track"),
-            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
-        switch (ret) {
-        case JOptionPane.CANCEL_OPTION:
-        case JOptionPane.CLOSED_OPTION:
-          return;
-        default:
-          // continue
-        }
-      }
-      final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(
-          tr("Download data"));
-      final Future<?> future = new DownloadOsmTaskList().download(false,
-          toDownload, monitor);
-      Main.worker.submit(new Runnable() {
-        public void run() {
-          try {
-            future.get();
-          } catch (Exception e) {
-            e.printStackTrace();
-            return;
-          }
-          monitor.close();
-        }
-      });
-    }
-
-    private static void addToDownload(Area a, Rectangle2D r,
-        Collection<Rectangle2D> results, double max_area) {
-      Area tmp = new Area(r);
-      // intersect with sought-after area
-      tmp.intersect(a);
-      if (tmp.isEmpty())
-        return;
-      Rectangle2D bounds = tmp.getBounds2D();
-      if (bounds.getWidth() * bounds.getHeight() > max_area) {
-        // the rectangle gets too large; split it and make recursive call.
-        Rectangle2D r1;
-        Rectangle2D r2;
-        if (bounds.getWidth() > bounds.getHeight()) {
-          // rectangles that are wider than high are split into a left and right
-          // half,
-          r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds
-              .getWidth() / 2, bounds.getHeight());
-          r2 = new Rectangle2D.Double(bounds.getX() + bounds.getWidth() / 2,
-              bounds.getY(), bounds.getWidth() / 2, bounds.getHeight());
-        } else {
-          // others into a top and bottom half.
-          r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds
-              .getWidth(), bounds.getHeight() / 2);
-          r2 = new Rectangle2D.Double(bounds.getX(), bounds.getY()
-              + bounds.getHeight() / 2, bounds.getWidth(),
-              bounds.getHeight() / 2);
-        }
-        addToDownload(a, r1, results, max_area);
-        addToDownload(a, r2, results, max_area);
-      } else {
-        results.add(bounds);
-      }
-    }
-
-    @Override
-    protected void updateEnabledState() {
-      setEnabled(getEditLayer() != null);
-    }
-    
-    @Override
-    protected void updateEnabledState(
-        Collection<? extends OsmPrimitive> selection) {
-      // do nothing
-    }
-  }
+	public DownloadAlong(PluginInformation info) {
+		super(info);
+		MainMenu.add(Main.main.menu.toolsMenu, new DownloadAlongAction());
+	}
 }
Index: applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlongAction.java
===================================================================
--- applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlongAction.java	(revision 29744)
+++ applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlongAction.java	(revision 29744)
@@ -0,0 +1,252 @@
+package org.openstreetmap.josm.plugin.download_along;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.awt.geom.Area;
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Future;
+
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTaskList;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.HelpAwareOptionPane;
+import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
+import org.openstreetmap.josm.gui.help.HelpUtil;
+import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
+import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Shortcut;
+import org.openstreetmap.josm.tools.Utils;
+
+class DownloadAlongAction extends JosmAction {
+
+	public DownloadAlongAction() {
+		super(tr("Download along..."), "download_along", tr("Download OSM data along the selected ways."), 
+				Shortcut.registerShortcut("tools:download_along", tr("Tool: {0}", tr("Download Along")), 
+						KeyEvent.VK_D, Shortcut.ALT_SHIFT), true);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		Collection<OsmPrimitive> selection = Main.main.getCurrentDataSet().getSelected();
+
+		int ways = 0;
+		for (OsmPrimitive prim : selection) {
+			if (prim instanceof Way)
+				ways++;
+		}
+
+		if (ways < 1) {
+			JOptionPane.showMessageDialog(Main.parent, tr("Please select 1 or more ways to download along"));
+			return;
+		}
+
+		DownloadPanel panel = new DownloadPanel();
+		
+        ButtonSpec[] options = new ButtonSpec[] {
+                new ButtonSpec(
+                        tr("Download"),
+                        ImageProvider.get("download"),
+                        tr("Click to download"),
+                        null // no specific help text
+                ),
+                new ButtonSpec(
+                        tr("Cancel"),
+                        ImageProvider.get("cancel"),
+                        tr("Click to cancel"),
+                        null // no specific help text
+                )
+        };
+
+		if (0 != HelpAwareOptionPane.showOptionDialog(Main.parent, panel, tr("Download from OSM along this track"),
+				JOptionPane.QUESTION_MESSAGE, null, options, options[0], HelpUtil.ht("/Tools/DownloadAlong"))) {
+			return;
+		}
+
+		Main.pref.putDouble(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, panel.getDistance());
+		Main.pref.putDouble(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_AREA, panel.getArea());
+
+		/*
+		 * Find the average latitude for the data we're contemplating, so we
+		 * can know how many metres per degree of longitude we have.
+		 */
+		double latsum = 0;
+		int latcnt = 0;
+
+		for (OsmPrimitive prim : selection) {
+			if (prim instanceof Way) {
+				Way way = (Way) prim;
+				for (Node n : way.getNodes()) {
+					latsum += n.getCoor().lat();
+					latcnt++;
+				}
+			}
+		}
+
+		double avglat = latsum / latcnt;
+		double scale = Math.cos(Math.toRadians(avglat));
+
+		/*
+		 * Compute buffer zone extents and maximum bounding box size. Note
+		 * that the maximum we ever offer is a bbox area of 0.002, while the
+		 * API theoretically supports 0.25, but as soon as you touch any
+		 * built-up area, that kind of bounding box will download forever
+		 * and then stop because it has more than 50k nodes.
+		 */
+		double buffer_dist = panel.getDistance();
+		double buffer_y = buffer_dist / 100000.0;
+		double buffer_x = buffer_y / scale;
+		double max_area = panel.getArea() / 10000.0 / scale;
+		Area a = new Area();
+		Rectangle2D r = new Rectangle2D.Double();
+
+		/*
+		 * Collect the combined area of all gpx points plus buffer zones
+		 * around them. We ignore points that lie closer to the previous
+		 * point than the given buffer size because otherwise this operation
+		 * takes ages.
+		 */
+		LatLon previous = null;
+		for (OsmPrimitive prim : selection) {
+			if (prim instanceof Way) {
+				Way way = (Way) prim;
+				for (Node p : way.getNodes()) {
+					LatLon c = p.getCoor();
+					ArrayList<LatLon> intermediateNodes = new ArrayList<LatLon>();
+					if (previous != null && c.greatCircleDistance(previous) > buffer_dist) {
+						Double d = c.greatCircleDistance(previous) / buffer_dist;
+						int nbNodes = d.intValue();
+						System.out.println(tr("{0} intermediate nodes to download.", nbNodes));
+						System.out.println(tr("between {0} {1} and {2} {3}", c.lat(), c.lon(), previous.lat(),
+								previous.lon()));
+						for (int i = 1; i < nbNodes; i++) {
+							intermediateNodes.add(new LatLon(previous.lat()
+									+ (i * (c.lat() - previous.lat()) / (nbNodes + 1)), previous.lon()
+									+ (i * (c.lon() - previous.lon()) / (nbNodes + 1))));
+							System.out.println(tr("  adding {0} {1}", previous.lat()
+									+ (i * (c.lat() - previous.lat()) / (nbNodes + 1)), previous.lon()
+									+ (i * (c.lon() - previous.lon()) / (nbNodes + 1))));
+						}
+					}
+					intermediateNodes.add(c);
+					for (LatLon d : intermediateNodes) {
+						if (previous == null || d.greatCircleDistance(previous) > buffer_dist) {
+							// we add a buffer around the point.
+							r.setRect(d.lon() - buffer_x, d.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y);
+							a.add(new Area(r));
+							previous = d;
+						}
+					}
+					previous = c;
+				}
+			}
+		}
+
+		/*
+		 * Area "a" now contains the hull that we would like to download
+		 * data for. however we can only download rectangles, so the
+		 * following is an attempt at finding a number of rectangles to
+		 * download.
+		 * 
+		 * The idea is simply: Start out with the full bounding box. If it
+		 * is too large, then split it in half and repeat recursively for
+		 * each half until you arrive at something small enough to download.
+		 * The algorithm is improved by always using the intersection
+		 * between the rectangle and the actual desired area. For example,
+		 * if you have a track that goes like this: +----+ | /| | / | | / |
+		 * |/ | +----+ then we would first look at downloading the whole
+		 * rectangle (assume it's too big), after that we split it in half
+		 * (upper and lower half), but we donot request the full upper and
+		 * lower rectangle, only the part of the upper/lower rectangle that
+		 * actually has something in it.
+		 */
+
+		List<Rectangle2D> toDownload = new ArrayList<Rectangle2D>();
+
+		addToDownload(a, a.getBounds(), toDownload, max_area);
+
+		JPanel msg = new JPanel(new GridBagLayout());
+
+		msg.add(new JLabel(tr("<html>This action will require {0} individual<br>"
+				+ "download requests. Do you wish<br>to continue?</html>", toDownload.size())), GBC.eol());
+
+		if (toDownload.size() > 1) {
+			if (JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main.parent, msg, tr("Download from OSM along this track"),
+					JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {
+				return;
+			}
+		}
+		final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download data"));
+		final Future<?> future = new DownloadOsmTaskList().download(false, toDownload, monitor);
+		Main.worker.submit(new Runnable() {
+			public void run() {
+				try {
+					future.get();
+				} catch (Exception e) {
+					e.printStackTrace();
+					return;
+				}
+				monitor.close();
+			}
+		});
+	}
+
+	private static void addToDownload(Area a, Rectangle2D r, Collection<Rectangle2D> results, double max_area) {
+		Area tmp = new Area(r);
+		// intersect with sought-after area
+		tmp.intersect(a);
+		if (tmp.isEmpty())
+			return;
+		Rectangle2D bounds = tmp.getBounds2D();
+		if (bounds.getWidth() * bounds.getHeight() > max_area) {
+			// the rectangle gets too large; split it and make recursive
+			// call.
+			Rectangle2D r1;
+			Rectangle2D r2;
+			if (bounds.getWidth() > bounds.getHeight()) {
+				// rectangles that are wider than high are split into a left
+				// and right
+				// half,
+				r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth() / 2, bounds.getHeight());
+				r2 = new Rectangle2D.Double(bounds.getX() + bounds.getWidth() / 2, bounds.getY(),
+						bounds.getWidth() / 2, bounds.getHeight());
+			} else {
+				// others into a top and bottom half.
+				r1 = new Rectangle2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight() / 2);
+				r2 = new Rectangle2D.Double(bounds.getX(), bounds.getY() + bounds.getHeight() / 2,
+						bounds.getWidth(), bounds.getHeight() / 2);
+			}
+			addToDownload(a, r1, results, max_area);
+			addToDownload(a, r2, results, max_area);
+		} else {
+			results.add(bounds);
+		}
+	}
+
+	@Override
+	protected void updateEnabledState() {
+        if (getCurrentDataSet() == null) {
+            setEnabled(false);
+        } else {
+            updateEnabledState(getCurrentDataSet().getSelected());
+        }
+	}
+
+	@Override
+	protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
+        setEnabled(Utils.exists(selection, OsmPrimitive.wayPredicate));
+	}
+}
Index: applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadPanel.java
===================================================================
--- applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadPanel.java	(revision 29744)
+++ applications/editors/josm/plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadPanel.java	(revision 29744)
@@ -0,0 +1,82 @@
+package org.openstreetmap.josm.plugin.download_along;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.GridBagLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.GBC;
+
+public class DownloadPanel extends JPanel {
+
+	private static final Integer dist[] = { 5000, 500, 50 };
+	private static final Integer area[] = { 20, 10, 5, 1 };
+	
+	private final JList buffer;
+	private final JList maxRect;
+	
+	private static final double getPreferenceValue(String prefKey, Integer array[]) {
+		int legacyIndex = Main.pref.getInteger(prefKey, -1);
+		return (0 <= legacyIndex && legacyIndex < array.length)
+				? array[legacyIndex] 
+				: Main.pref.getDouble(prefKey, array[0]);
+	}
+	
+	public DownloadPanel() {
+		super(new GridBagLayout());
+
+		add(new JLabel(tr("Download everything within:")), GBC.eol());
+		String s[] = new String[dist.length];
+		for (int i = 0; i < dist.length; ++i) {
+			s[i] = tr("{0} meters", dist[i]);
+		}
+		buffer = new JList(s);
+		
+		double distanceValue = getPreferenceValue(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, dist);
+		int distanceLegacyIndex = Main.pref.getInteger(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_DISTANCE, -1);
+		if (distanceLegacyIndex == -1) {
+			for (int i = 0; i < dist.length; i++) {
+				if (dist[i] == (int)distanceValue) {
+					distanceLegacyIndex = i;
+					break;
+				}
+			}
+		}
+		
+		buffer.setSelectedIndex(distanceLegacyIndex);
+		add(buffer, GBC.eol());
+
+		add(new JLabel(tr("Maximum area per request:")), GBC.eol());
+		s = new String[area.length];
+		for (int i = 0; i < area.length; ++i) {
+			s[i] = tr("{0} sq km", area[i]);
+		}
+		maxRect = new JList(s);
+
+		double areaValue = getPreferenceValue(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_AREA, area);
+		int areaLegacyIndex = Main.pref.getInteger(DownloadAlong.PREF_DOWNLOAD_ALONG_TRACK_AREA, -1);
+		if (areaLegacyIndex == -1) {
+			for (int i = 0; i < area.length; i++) {
+				if (area[i] == (int)areaValue) {
+					areaLegacyIndex = i;
+					break;
+				}
+			}
+		}
+		
+		maxRect.setSelectedIndex(areaLegacyIndex);
+		add(maxRect, GBC.eol());
+	}
+	
+	public final double getDistance() {
+		return dist[buffer.getSelectedIndex()];
+	}
+
+	public final double getArea() {
+		return area[maxRect.getSelectedIndex()];
+	}
+}
