[jbosstools-commits] JBoss Tools SVN: r44077 - in trunk: runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 27 01:37:06 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-27 01:37:06 -0400 (Thu, 27 Sep 2012)
New Revision: 44077

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java
   trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java
Log:
JBIDE-12730 to trunk runtime download workflow

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java	2012-09-27 05:04:31 UTC (rev 44076)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java	2012-09-27 05:37:06 UTC (rev 44077)
@@ -38,6 +38,7 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.BusyIndicator;
@@ -378,6 +379,11 @@
 				IRuntimeType type = getRuntimeType();
 				data.put(IDownloadRuntimes.RUNTIME_FILTER, new JBossASDownloadRuntimeFilter(type));
 				downloader.execute(data);
+				Boolean launched = (Boolean)data.get(IDownloadRuntimes.DOWNLOAD_LAUNCHED);
+				if( launched != null && launched.booleanValue()) {
+					((IWizardPage)handle).getWizard().performCancel();
+					((IWizardPage)handle).getWizard().getContainer().getShell().close();
+				}
 			}
 		}
 	}

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java	2012-09-27 05:04:31 UTC (rev 44076)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java	2012-09-27 05:37:06 UTC (rev 44077)
@@ -14,5 +14,11 @@
 	 */
 	public static final String RUNTIME_FILTER = "download.runtimes.filter";
 
-	void execute(HashMap<String, Object> data);
+	/**
+	 * Is the download initialized (true) or canceled (false)?
+	 */
+	public static final String DOWNLOAD_LAUNCHED = "is.download.launched";
+	
+	
+	public void execute(HashMap<String, Object> data);
 }

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java	2012-09-27 05:04:31 UTC (rev 44076)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeDialog.java	2012-09-27 05:37:06 UTC (rev 44077)
@@ -493,7 +493,7 @@
 		downloadJob.setUser(false);
 		downloadJob.schedule();
 		IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
-		progressService.showInDialog(getActiveShell(), downloadJob);
+		progressService.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), downloadJob);
 	}
 	
 	private IStatus downloadAndInstall(String selectedDirectory, String destinationDirectory, boolean deleteOnExit, IProgressMonitor monitor) {

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java	2012-09-27 05:04:31 UTC (rev 44076)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java	2012-09-27 05:37:06 UTC (rev 44077)
@@ -59,7 +59,8 @@
 	
 	private TableViewer viewer;
 	private Map<String, DownloadRuntime> downloadRuntimes;
-
+	private DownloadRuntimeDialog saveLocationDialog;
+	
 	public DownloadRuntimeViewerDialog(Shell parentShell) {
 		this(parentShell, null);
 	}
@@ -231,8 +232,8 @@
 			if (object instanceof DownloadRuntime) {
 				DownloadRuntime downloadRuntime = (DownloadRuntime) object;
 				if( licenseApproved(downloadRuntime)) {
-					DownloadRuntimeDialog dialog = new DownloadRuntimeDialog(getShell(), downloadRuntime);
-					dialog.open();
+					saveLocationDialog = new DownloadRuntimeDialog(getShell(), downloadRuntime);
+					saveLocationDialog.open();
 				}
 			}
 		}
@@ -275,4 +276,7 @@
 		getButton(IDialogConstants.OK_ID).setEnabled(viewer.getSelection() != null);
 	}
 	
+	public boolean isDownloading() {
+		return saveLocationDialog != null && saveLocationDialog.getReturnCode() == saveLocationDialog.OK; 
+	}
 }

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java	2012-09-27 05:04:31 UTC (rev 44076)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java	2012-09-27 05:37:06 UTC (rev 44077)
@@ -9,6 +9,7 @@
 
 public class DownloadRuntimes implements IDownloadRuntimes {
 	public static final String SHELL = IDownloadRuntimes.SHELL;
+	public static final String DOWNLOAD_LAUNCHED = IDownloadRuntimes.DOWNLOAD_LAUNCHED;
 	
 	public DownloadRuntimes() {
 		
@@ -24,6 +25,7 @@
 		// THis should also be done via a display.asynchexec
 		DownloadRuntimeViewerDialog dialog = new DownloadRuntimeViewerDialog(shell2, (IDownloadRuntimeFilter)filter);
 		dialog.open();
+		map.put(DOWNLOAD_LAUNCHED, dialog.isDownloading());
 	}
 
 }



More information about the jbosstools-commits mailing list