[572506] Use the archive path for a more specific default name when downloading Tomcat

Change-Id: Id3e2b86c1e6e424fec22b405592fd6f759788b21
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.java
index c10a7b7..c30180d 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.java
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@
 	public static String install;
 	public static String installDialogTitle;
 	public static String selectInstallDir;
+	public static String installing;
 	public static String installedJRE;
 	public static String installedJREs;
 	public static String runtimeDefaultJRE;
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.properties b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.properties
index 1ace106..8fcfc33 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/Messages.properties
@@ -21,6 +21,7 @@
 installedJRE=&JRE:
 installedJREs=&Installed JREs...
 selectInstallDir=Select parent for Tomcat installation directory.
+installing=Installing {0}
 runtimeDefaultJRE=Workbench default JRE
 contextCleanup=The context root of module {0} has been modified. Do you want to update the server configuration to match?
 
diff --git a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
index 22383a0..bafe395 100644
--- a/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
+++ b/plugins/org.eclipse.jst.server.tomcat.ui/tomcatui/org/eclipse/jst/server/tomcat/ui/internal/TomcatRuntimeComposite.java
@@ -37,6 +37,7 @@
 import org.eclipse.jface.window.Window;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -53,7 +54,6 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.PlatformUI;
-
 import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
 import org.eclipse.wst.server.core.TaskModel;
 import org.eclipse.wst.server.core.internal.IInstallableRuntime;
@@ -219,7 +219,7 @@
 				if (selectedDirectory != null) {
 //					ir.install(new Path(selectedDirectory));
 					final IPath installPath = new Path(selectedDirectory);
-					installRuntimeJob = new Job("Installing server runtime environment") {
+					installRuntimeJob = new Job(NLS.bind(Messages.installing, ir.getArchivePath())) {
 						public boolean belongsTo(Object family) {
 							return ServerPlugin.PLUGIN_ID.equals(family);
 						}
@@ -244,10 +244,15 @@
 					jobListener = new JobChangeAdapter() {
 						public void done(IJobChangeEvent event) {
 							installRuntimeJob.removeJobChangeListener(this);
+							final IStatus status = event.getResult();
 							installRuntimeJob = null;
 							Display.getDefault().asyncExec(new Runnable() {
 								public void run() {
 									if (!isDisposed()) {
+										if (status.isOK() && ir.getArchivePath() != null) {
+											name.setText(ir.getArchivePath());
+											runtimeWC.setName(name.getText());
+										}
 										validate();
 									}
 								}
@@ -255,6 +260,7 @@
 						}
 					};
 					installRuntimeJob.addJobChangeListener(jobListener);
+					installRuntimeJob.setUser(true);
 					installRuntimeJob.schedule();
 				}
 			}