[Esbox-commits] r1209 - branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters

baranov at garage.maemo.org baranov at garage.maemo.org
Mon Feb 9 11:40:19 EET 2009


Author: baranov
Date: 2009-02-09 11:40:18 +0200 (Mon, 09 Feb 2009)
New Revision: 1209

Modified:
   branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
Log:
Fixing esbox bug #3431.
Shows message dialog to the user proposing to click 'Refresh' button.


Modified: branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java
===================================================================
--- branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java	2009-02-09 07:00:24 UTC (rev 1208)
+++ branches/work_Petr/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/ui/adapters/MaemoScratchbox2SDKManageTargetAdapter.java	2009-02-09 09:40:18 UTC (rev 1209)
@@ -14,7 +14,11 @@
 
 import org.eclipse.core.runtime.*;
 import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.esbox.internal.api.scratchbox.ui.adapters.MaemoScratchboxSDKManageTargetAdapterBase;
 import org.maemo.esbox.internal.scratchbox.sb2.Activator;
@@ -70,7 +74,6 @@
 			ISDKTarget target, boolean deleteRootstrap) {
 		return new MaemoTargetRemover(shell, target, deleteRootstrap) {
 
-			
 			protected void doDeleteTargetRootstrap(IProgressMonitor monitor,
 					ISDK sdk) throws MicaException {
 				((IScratchbox2SDK) sdk).removeRootstrap(
@@ -82,9 +85,24 @@
 			 * @see org.maemo.mica.internal.api.maemosdk.ui.adapters.ESboxTargetRemover#doRemoveTarget(org.maemo.mica.common.core.sdk.ISDK, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
 			 */
 			@Override
-			protected void doRemoveTarget(ISDK sdk, String targetName,
+			protected void doRemoveTarget(ISDK sdk, final String targetName,
 					IProgressMonitor monitor) throws MicaException {
-				((IScratchbox2SDK) sdk).removeTarget(targetName);
+				try{
+					((IScratchbox2SDK) sdk).removeTarget(targetName);
+				}catch(MicaException e){
+					final Display display = Display.getDefault();
+					display.syncExec(new Runnable(){
+						public void run() {
+							Shell shell = display.getActiveShell();
+							final MessageBox message = new MessageBox(shell,SWT.OK|SWT.ICON_WARNING);
+							message.setText("Can not remove rootstrap");
+							message.setMessage("Rootstrap "+targetName+" has probably been removed by some other application.\n" +
+											   "Please, click \"Refresh\" button to update the cache.");
+							message.open();
+						}
+					});
+					
+				}
 				monitor.worked(1);
 				
 			}



More information about the Esbox-commits mailing list