[Title]
authorshihyun <shihyun@shihyun-Samsung-Desktop-System.(none)>
Fri, 14 Jun 2013 05:45:37 +0000 (14:45 +0900)
committershihyun <shihyun@shihyun-Samsung-Desktop-System.(none)>
Fri, 14 Jun 2013 05:45:37 +0000 (14:45 +0900)
* change the type of update dialog.
* move update dialog to next button in welcome page

Change-Id: Ica6bdd4f53fc6771e9161d3b79b78056941c6dd7

InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java
InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java

index 6046bae..954834e 100644 (file)
@@ -94,6 +94,7 @@ import org.tizen.installmanager.ui.page.WelcomePage;
 import org.tizen.installmanager.ui.page.InstallingPage.InstallProgressMonitor;
 import org.tizen.installmanager.ui.page.WelcomePage.RADIO_ACTION;
 import org.tizen.installmanager.util.PathUtil;
+import org.tizen.installmanager.util.ShellUtil;
 
 
 /**
@@ -179,18 +180,6 @@ public class InstallManagerWindow extends ApplicationWindow {
                                        
                                });
                                
-                               //checking installmanager update.
-                               if (Options.doUpdateInstallManager) {
-                                       progressbar.updateName("Checking InstallManager update.\nIt may take a minute...");
-                                       
-                                       shell.getDisplay().asyncExec(new Runnable() {
-                                               public void run() {
-                                                       updateInstallManager(shell);
-                                               }
-                                       });
-                                       
-                               }
-                               
                                //init end
                                progressbar.finish();
                        }
@@ -199,25 +188,26 @@ public class InstallManagerWindow extends ApplicationWindow {
                if (!shell.isDisposed()) {
                        progressbar.open();
                }
-               
-               if (ErrorController.isInstallManagerUpdatable) {
-                       throw new IMExitException(Config.EXITCODE_HAS_SELF_UPDATE);
-               }
 
                Log.log("Window init end");
        }
        
        private void updateInstallManager(Shell shell) {
                if (controller.canInstallManagerUpdate()) {
-                       String msg = "Do you want to update the install-manager?";
-                       int ret = MessageBoxDlg.showDlg(shell, "InstallManager", msg, DialogType.WARNING, false);
-                       if (ret == SWT.YES) { 
-                               if (controller.updateInstallManager()) {
-                                       Log.log("InstallManager is updatable.");
-                                       System.out.println("## Success to update the InstallManager, and restart now.");
-                                       ErrorController.isInstallManagerUpdatable = true;
-                                       return;
-                               } else {
+                       String msg = "Install-manager will be updated.\nIt may take a minute...";
+                       MessageBoxDlg.showDlg(shell, "InstallManager", msg, DialogType.NOTIFY, false);
+                       
+                       if (controller.updateInstallManager()) {
+                               Log.log("## Success to update the InstallManager, and restart now.");
+                               System.out.println("## Success to update the InstallManager, and restart now.");
+                               
+                               String binary = PathUtil.get(Registry.getInstalledPath(), Config.INSTALL_MANAGER_DIRECTORY, Config.EXECUTE_FILE_NAME_OF_INSTALL_MANAGER);
+                               String command = ShellUtil.addInterpreter(binary);
+                               try {
+                                       Runtime.getRuntime().exec(command);
+                                       System.exit(0);
+                               } catch (IOException e) {
+                                       Log.ExceptionLog(e);
                                        return;
                                }
                        } else {
@@ -342,6 +332,7 @@ public class InstallManagerWindow extends ApplicationWindow {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                if (sl_composite.topControl == compositeWelcomePage) {
+                                       updateInstallManager(e.display.getActiveShell());
                                        addExtraButton.setVisible(false);
                                        btnSettings.setVisible(false);
                                        if (compositeWelcomePage.getSelectedRadioButton() == RADIO_ACTION.INSTALL) {
@@ -718,18 +709,6 @@ public class InstallManagerWindow extends ApplicationWindow {
                                        }
                                });
                                
-                               //checking installmanager update.
-                               if (Options.doUpdateInstallManager) {
-                                       progressbar.updateName("Checking InstallManager update.\nIt may take a minute...");
-                                       
-                                       shell.getDisplay().asyncExec(new Runnable() {
-                                               public void run() {
-                                                       updateInstallManager(shell);
-                                               }
-                                       });
-                                       
-                               }
-                               
                                //init end
                                progressbar.finish();
                        }
@@ -738,16 +717,6 @@ public class InstallManagerWindow extends ApplicationWindow {
                if (!shell.isDisposed()) {
                        progressbar.open();
                }
-               
-               if (ErrorController.isInstallManagerUpdatable) {
-                       String binary = PathUtil.get(Registry.getInstalledPath(), Config.INSTALL_MANAGER_DIRECTORY, Config.EXECUTE_FILE_NAME_OF_INSTALL_MANAGER);
-                       try {
-                               Runtime.getRuntime().exec(binary);
-                       } catch (IOException e) {
-                               Log.ExceptionLog(e);
-                       }
-                       System.exit(0);
-               }
 
                Log.log("Window refresh end");
        }
index a45760c..ac58c56 100644 (file)
@@ -342,22 +342,13 @@ public class ViewController {
                //get installable packages
                PackageSet selectedMetas = packageManager.getPackagesByNames(installList);
                
-               //add mandatory packages
+               //add mandatory packages, madatory packages always reinstall.
                selectedMetas.addAll(
-                               packageManager.getUpdatableMandatoryPackages());
+                               packageManager.getMandatoryPackages());
                
                //get set of packages by purpose.
                selectedMetas = getMetaPackagesByPurpose(selectedMetas);
                
-               //add install-manager package
-               if (!isInstalledInstallManager()) {
-                       Package installmanagerPkg = packageManager.getPackageByName(InstallManagerConstants.INSTALLMANAGER_PACKAGE_NAME);
-                       
-                       if (installmanagerPkg != null) {
-                               selectedMetas.add(installmanagerPkg);
-                       }
-               }
-               
                return packageManager.getInstallablePackages(selectedMetas);
        }
        
@@ -741,6 +732,10 @@ public class ViewController {
                } else {
                        String version = Config.getInstance().getCurrentConfigFile().getInstallManagerVersion();
                        
+                       if (version == null || version.isEmpty()) {
+                               return true;
+                       }
+                       
                        if (Version.compareTo(new Version(version), pkg.getVersion()) < 0) {
                                return true;
                        } else {