bug 18791
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
index 0bb4627..069c4cf 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Feature.java
@@ -237,6 +237,7 @@
IFeatureContentProvider provider = getFeatureContentProvider();
IVerifier verifier = provider.getVerifier();
IFeatureReference result = null;
+ IFeatureReference alreadyInstalledFeature = null;
IFeatureContentConsumer consumer = null;
IPluginEntry[] targetSitePluginEntries = null;
@@ -366,7 +367,9 @@
// check if we need to install feature files [16718]
// store will throw CoreException if another feature is already
// installed in the same place
- if (!featureAlreadyInstalled(targetSite)){
+ alreadyInstalledFeature =
+ featureAlreadyInstalled(targetSite); // 18867
+ if (alreadyInstalledFeature == null){
//Install feature files
references = provider.getFeatureEntryContentReferences(monitor);
@@ -407,6 +410,8 @@
if (consumer != null) {
if (success) {
result = consumer.close();
+ if (result == null)
+ result = alreadyInstalledFeature; // 18867
// close the log
recoveryLog.close(recoveryLog.END_INSTALL_LOG);
} else {
@@ -858,9 +863,10 @@
}
/*
- * returns true f the same feature is installed on the site
+ * returns reference if the same feature is installed on the site
+ * [18867]
*/
- private boolean featureAlreadyInstalled(ISite targetSite){
+ private IFeatureReference featureAlreadyInstalled(ISite targetSite){
IFeatureReference[] references = targetSite.getFeatureReferences();
IFeatureReference currentReference = null;
@@ -869,13 +875,13 @@
// do not compare URL
try {
if (this.equals(currentReference.getFeature()))
- return true;
+ return currentReference; // 18867
} catch (CoreException e){
UpdateManagerPlugin.warn(null,e);
}
}
UpdateManagerPlugin.warn("ValidateAlreadyInstalled:Feature "+this+" not found on site"+this.getURL());
- return false;
+ return null;
}
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard.java b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard.java
index 823599c..41cd992 100644
--- a/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard.java
+++ b/update/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard.java
@@ -154,8 +154,10 @@
IFeature oldFeature = job.getOldFeature();
if (oldFeature!=null) {
boolean oldSuccess = unconfigure(oldFeature);
- if (!oldSuccess)
- throwError(UpdateUIPlugin.getResourceString(KEY_OLD));
+ if (!oldSuccess) {
+ if (!isNestedChild(oldFeature)) // "eat" the error if nested child
+ throwError(UpdateUIPlugin.getResourceString(KEY_OLD));
+ }
}
} else if (job.getJobType() == PendingChange.CONFIGURE) {
configure(job.getFeature());
@@ -208,4 +210,25 @@
private IVerificationListener getVerificationListener() {
return new JarVerificationService(this.getShell());
}
+
+ private boolean isNestedChild(IFeature feature) {
+ IConfiguredSite[] csites = config.getConfiguredSites();
+ try {
+ for (int i=0; csites!=null && i<csites.length; i++) {
+ IFeatureReference[] refs = csites[i].getConfiguredFeatures();
+ for (int j=0; refs!=null && j<refs.length; j++) {
+ IFeature parent = refs[j].getFeature();
+ IFeatureReference[] children = parent.getIncludedFeatureReferences();
+ for (int k=0; children!=null && k<children.length; k++) {
+ IFeature child = children[k].getFeature();
+ if (feature.equals(child))
+ return true;
+ }
+ }
+ }
+ } catch(CoreException e) {
+ // will return false
+ }
+ return false;
+ }
}
\ No newline at end of file