From 65806b16f9b6ea6aa1486822391b2b6b0e35e3b3 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Fri, 25 Jan 2013 23:14:21 +0000 Subject: [PATCH] SDK NBI Installer: - remove all products with current version when uninstalling - remove app link for OSX when uninstalling git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10167 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/org/mycompany/ConfigurationLogic.java | 10 ++++++ .../components/sequences/MainSequence.java | 31 +++++++++++++------ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/sdk/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java b/sdk/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java index bfa6fa199..8ed320ea7 100644 --- a/sdk/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java +++ b/sdk/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java @@ -7,6 +7,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.Locale; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import org.mycompany.wizard.panels.HelloWorldPanel; import org.mycompany.installer.utils.applications.NetBeansRCPUtils; import org.netbeans.installer.product.components.ProductConfigurationLogic; @@ -301,6 +303,14 @@ public class ConfigurationLogic extends ProductConfigurationLogic { //ignore } } + } else{ + String appName=ResourceUtils.getString(ConfigurationLogic.class, "CL.app.name"); + File exeLink = new File(installLocation.getParentFile().getParent()+"/MacOS/"+appName); + try { + FileUtils.deleteWithEmptyParents(exeLink); + } catch (IOException ex) { + LogManager.log("Error removing app Link: " + ex); + } } ///////////////////////////////////////////////////////////////////////////// //remove cluster/update files diff --git a/sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/sequences/MainSequence.java b/sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/sequences/MainSequence.java index 64e52bbc5..d4e6721ca 100644 --- a/sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/sequences/MainSequence.java +++ b/sdk/nbi/stub/ext/engine/src/org/mycompany/installer/wizard/components/sequences/MainSequence.java @@ -49,6 +49,8 @@ import org.netbeans.installer.product.components.Product; import org.netbeans.installer.product.Registry; import org.netbeans.installer.utils.ResourceUtils; import org.netbeans.installer.utils.helper.ExecutionMode; +import org.netbeans.installer.utils.helper.Status; +import org.netbeans.installer.utils.helper.Version; import org.netbeans.installer.wizard.components.WizardSequence; import org.netbeans.installer.wizard.components.actions.DownloadConfigurationLogicAction; import org.netbeans.installer.wizard.components.actions.DownloadInstallationDataAction; @@ -88,13 +90,23 @@ public class MainSequence extends WizardSequence { installAction.setProperty(InstallAction.DESCRIPTION_PROPERTY, DEFAULT_IA_DESCRIPTION); } - + @Override public void executeForward() { final Registry registry = Registry.getInstance(); final List toInstall = registry.getProductsToInstall(); final List toUninstall = registry.getProductsToUninstall(); - + //normen - uninstall all other items with same version number + if (toUninstall.size() > 0) { + Version ver; + ver = toUninstall.get(0).getVersion(); + List products = registry.getProducts(); + for (Product product : products) { + if (product.getVersion().equals(ver)) { + product.setStatus(Status.TO_BE_UNINSTALLED); + } + } + } // remove all current children (if there are any), as the components // selection has probably changed and we need to rebuild from scratch getChildren().clear(); @@ -116,9 +128,9 @@ public class MainSequence extends WizardSequence { } //normen - use first product path for all projects -> no separate path // wizards needed - if(initProduct == null){ + if (initProduct == null) { initProduct = product; - }else{ + } else { addChild(new CopyInstallLocationAction(initProduct, product)); } addChild(productSequences.get(product)); @@ -133,19 +145,19 @@ public class MainSequence extends WizardSequence { if (toInstall.size() > 0) { addChild(downloadInstallationDataAction); - addChild(installAction); + addChild(installAction); } addChild(postInstallSummaryPanel); - + super.executeForward(); } @Override public boolean canExecuteForward() { - return ExecutionMode.NORMAL == ExecutionMode.getCurrentExecutionMode() && - (Registry.getInstance().getProductsToInstall().size() > 0 || - Registry.getInstance().getProductsToUninstall().size() > 0); + return ExecutionMode.NORMAL == ExecutionMode.getCurrentExecutionMode() + && (Registry.getInstance().getProductsToInstall().size() > 0 + || Registry.getInstance().getProductsToUninstall().size() > 0); } ///////////////////////////////////////////////////////////////////////////////// // Constants @@ -157,5 +169,4 @@ public class MainSequence extends WizardSequence { ResourceUtils.getString( MainSequence.class, "MS.IA.description"); // NOI18N - }