[Esbox-commits] r1924 - in trunk: org.maemo.esbox.maemosdk.core/conf org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core

eswartz at garage.maemo.org eswartz at garage.maemo.org
Mon Aug 3 18:58:30 EEST 2009


Author: eswartz
Date: 2009-08-03 18:58:28 +0300 (Mon, 03 Aug 2009)
New Revision: 1924

Modified:
   trunk/org.maemo.esbox.maemosdk.core/conf/maemo_prefs.xml
   trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java
   trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java
   trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java
   trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
Log:
Merge rev 1911:1923 from work_Ed branch.  Usability for question dialogs and VM switching.

Modified: trunk/org.maemo.esbox.maemosdk.core/conf/maemo_prefs.xml
===================================================================
--- trunk/org.maemo.esbox.maemosdk.core/conf/maemo_prefs.xml	2009-08-03 14:58:39 UTC (rev 1923)
+++ trunk/org.maemo.esbox.maemosdk.core/conf/maemo_prefs.xml	2009-08-03 15:58:28 UTC (rev 1924)
@@ -8,7 +8,7 @@
 	<!-- others commands -->	
 	<entry key="DISPLAY_X_COMMAND_UNIX">Xephyr ${DISPLAY} -host-cursor -dpi 96 -ac -screen ${RESOLUTION} ${PLATFORM_PARAMETERS}</entry>
 	<entry key="DISPLAY_X_COMMAND_OSX">Xephyr ${DISPLAY} -host-cursor -dpi 96 -ac -screen ${RESOLUTION} ${PLATFORM_PARAMETERS}</entry>
-	<entry key="DISPLAY_X_COMMAND_WIN32">c:/cygwin/usr/X11R6/bin/Xwin ${DISPLAY} -lesspointer -swcursor -dpi 96 -ac -screen 0 ${RESOLUTION} ${PLATFORM_PARAMETERS}</entry>
+	<entry key="DISPLAY_X_COMMAND_WIN32">c:/cygwin/bin/Xwin ${DISPLAY} -lesspointer -swcursor -dpi 96 -ac -screen 0 ${RESOLUTION} ${PLATFORM_PARAMETERS}</entry>
 	<!-- this is initialized dynamically <entry key="DISPLAY_X_COMMAND"></entry> -->
 	
 	<!-- others commands -->	

Modified: trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java
===================================================================
--- trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2009-08-03 14:58:39 UTC (rev 1923)
+++ trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/api/maemosdk/ui/preferences/BuildMachinePreferencePage.java	2009-08-03 15:58:28 UTC (rev 1924)
@@ -23,7 +23,6 @@
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.preference.PreferencePage;
@@ -57,6 +56,7 @@
 import org.maemo.mica.common.core.machine.IMachine;
 import org.maemo.mica.common.core.machine.MachineManager;
 import org.maemo.mica.common.core.machine.MachineRegistry;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
 import org.maemo.mica.common.ui.dialogs.StyledTextProgressDialog;
 import org.maemo.mica.internal.api.common.core.sdk.SDKManagerInternal;
 import org.maemo.mica.internal.api.common.ui.utils.PixelConverter;
@@ -420,14 +420,27 @@
 		}
 
 		if (vmRunning && selectedMachine != null) {
-			boolean doit = MessageDialog.openQuestion(getShell(), 
+			boolean doit;
+			String message;
+			if (selectedMachine.getName().equals(current.getName())) {
+				// the same machine, different message
+				message = MessageFormat.format(
+						"You have changed virtual machine settings for ''{0}''.  The virtual machine is still running, however.\n \n"+
+						"If you changed disk images or the executable, the machine should be shut down and restarted.\n \n"+
+						"Should I do this now?",
+						selectedMachine.getName());
+			} else {
+				message = MessageFormat.format(
+						"You have changed virtual machines.  The previous machine ''{0}'' is still running, however.\n \n"+
+						"That machine may share files or other resources with ''{1}'' and should probably not run at the same time.\n \n"+
+						"Should I do this now?",
+						current.getName(),
+						selectedMachine.getName());
+			}
+			doit = DialogUtils.showQuestionDialog(getShell(), 
 					"Shut down?", 
-					MessageFormat.format(
-						"The previous machine ''{0}'' seems to be active and may have files open that will conflict with the new virtual machine.\n \n"+
-						"Should I shut it down before starting ''{1}''?\n \n"+
-						"(If you only changed network settings and ran ''dhclient3'', answer ''No''.)",
-						current.getName(),
-						selectedMachine.getName()));
+					message,
+					"Shut down", "Leave running");
 			if (doit) {
 				ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
 				try {

Modified: trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java
===================================================================
--- trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java	2009-08-03 14:58:39 UTC (rev 1923)
+++ trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java	2009-08-03 15:58:28 UTC (rev 1924)
@@ -11,13 +11,14 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.maemosdk.ui.actions;
 
+import java.text.MessageFormat;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
 
 /**
  * @author reijula
@@ -42,9 +43,14 @@
 		if (target == null)
 			return;
 		if (MaemoScriptLauncher.getInstance().isMaemoStarted(target)) {
-			boolean restart = MessageDialog.openQuestion(null, 
+			boolean restart = DialogUtils.showQuestionDialog(null, 
 					"Maemo AF is running", 
-					"The Maemo Application Framework appears to be already running.\n\nIf you do not see it, you may need to restart it or wait for its startup to complete.\n\nDo you want to restart it for " + target.getName() + "?");
+					MessageFormat.format(
+						"The Maemo Application Framework appears to be running.\n \n"+
+						"If you do not see it, you may need to restart it or wait for its startup to complete.\n \n"+
+						"Do you want to restart it for {0}?",
+						target.getName()),
+					"Restart", "Cancel");
 			if (!restart)
 				return;
 			

Modified: trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java
===================================================================
--- trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java	2009-08-03 14:58:39 UTC (rev 1923)
+++ trunk/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java	2009-08-03 15:58:28 UTC (rev 1924)
@@ -15,13 +15,15 @@
  */
 package org.maemo.esbox.internal.maemosdk.ui.actions;
 
+import java.text.MessageFormat;
+
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.common.ui.dialogs.DialogUtils;
 
 /**
  * @author reijula
@@ -55,8 +57,21 @@
 			return;
 		try {
 			if (XLauncher.getInstance().isCorrectXServerRunning(target)) {
-				MessageDialog.openInformation(null, "X Running", "X is still running.  Terminate it first if necessary.");
-				return;
+				boolean restart = DialogUtils.showQuestionDialog(null, 
+						"X is Running", 
+						MessageFormat.format(
+							"The X Server appears to be running.\n \n"+
+							"Do you want to restart it for {0}?",
+							target.getName()),
+						"Restart", "Cancel");
+				if (!restart)
+					return;
+				
+				ISDKTarget killTarget = MaemoScriptLauncher.getInstance().getPreviousTarget();
+				if (killTarget == null)
+					killTarget = target;
+				
+				XLauncher.getInstance().stopX(killTarget, null);
 			}
 		} catch (MicaException e) {
 			// failed, so definitely not running

Modified: trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-08-03 14:58:39 UTC (rev 1923)
+++ trunk/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-08-03 15:58:28 UTC (rev 1924)
@@ -22,7 +22,6 @@
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.*;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
-import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
 import org.maemo.esbox.internal.api.scratchbox.core.commands.ICommand;
 import org.maemo.esbox.internal.api.scratchbox.core.commands.ICommandAbstractor;
 import org.maemo.esbox.internal.api.scratchbox.core.sdk.AbstractScratchboxSDK;
@@ -875,9 +874,10 @@
 					new IStreamMonitor[] { unmountErrorSniffer },
 					multiStatus, monitor);
 			if (unmountErrorSniffer.unmountFailed()) {
-				reporter.log(Activator.createErrorStatus("Unmounting appeared to fail.  It's not safe to continue.",
-						null));
-				monitor.setCanceled(true);
+				IStatus status = Activator.createErrorStatus("Unmounting appeared to fail.  It's not safe to continue.",
+						null);
+				reporter.log(status);
+				multiStatus.add(status);
 			}
 			if (monitor.isCanceled())
 				return Status.CANCEL_STATUS;
@@ -950,7 +950,7 @@
 		
 		IProgressReporter reporter = new StringBuilderProgressReporter(true);
 		
-		IStatus status = shutdown(getMachine(), getInstallRoot(), monitor, reporter);
+		IStatus status = shutdown(getMachine(), getInstallRoot(), new SubProgressMonitor(monitor, 1), reporter);
 	
 		if (!monitor.isCanceled() && status.matches(IStatus.ERROR))
 			throw new MicaException("Problems during shutdown of " + getDisplayName(), 
@@ -1002,7 +1002,7 @@
 							forceShutdown(monitor);
 							return Status.OK_STATUS;
 						} catch (MicaException e) {
-							return Activator.createErrorStatus("Failed to restart " + getDisplayName(), e);
+							return Activator.createErrorStatus("Failed to shutdown " + getDisplayName(), e);
 						}
 					}
 					



More information about the Esbox-commits mailing list