eclipse/eclipse-updatehomedir.patch
Ben Konrath 5b612479b1 - M20060921-0945 (3.2.1 pre-release).
- Upadate patches to 3.2.1.
- Add icu4j 3.4.5 sources.
- Add Fedora version to platform about.mappings as well as sdk.
2006-09-26 04:45:35 +00:00

257 lines
11 KiB
Diff

Index: src/org/eclipse/update/internal/ui/wizards/InstallWizard2.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard2.java,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 InstallWizard2.java
--- plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard2.java 23 Aug 2006 03:55:35 -0000 1.12.2.1
+++ plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard2.java 25 Sep 2006 22:38:03 -0000
@@ -153,7 +153,7 @@
addPage(licensePage);
optionalFeaturesPage = new OptionalFeaturesPage(config);
addPage(optionalFeaturesPage);
- targetPage = new TargetPage(config);
+ targetPage = new TargetPage(config, isUpdate);
addPage(targetPage);
}
Index: src/org/eclipse/update/internal/ui/wizards/TargetPage.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/TargetPage.java,v
retrieving revision 1.81.2.1
diff -u -r1.81.2.1 TargetPage.java
--- plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/TargetPage.java 23 Aug 2006 03:55:35 -0000 1.81.2.1
+++ plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/TargetPage.java 25 Sep 2006 22:38:03 -0000
@@ -18,6 +18,9 @@
import java.util.HashSet;
import java.util.Iterator;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -92,6 +95,7 @@
private Label installLocation;
private Button changeLocation;
static HashSet added;
+ private boolean isUpdate; // whether the wizard is updating a feature or installing a new one
class JobsContentProvider
extends DefaultContentProvider
@@ -236,13 +240,14 @@
/**
* Constructor for ReviewPage2
*/
- public TargetPage(IInstallConfiguration config) {
+ public TargetPage(IInstallConfiguration config, boolean isUpdate) {
super("Target"); //$NON-NLS-1$
setTitle(UpdateUIMessages.InstallWizard_TargetPage_title);
setDescription(UpdateUIMessages.InstallWizard_TargetPage_desc);
this.config = config;
UpdateUI.getDefault().getLabelProvider().connect(this);
configListener = new ConfigListener();
+ this.isUpdate = isUpdate;
}
public void setJobs(IInstallFeatureOperation[] jobs) {
@@ -273,7 +278,7 @@
label.setLayoutData(gd);
installLocation = new Label(client, SWT.NULL);
- installLocation.setText("foo"); //$NON-NLS-1$
+ installLocation.setText(""); //$NON-NLS-1$
gd = new GridData(GridData.FILL_HORIZONTAL);
installLocation.setLayoutData(gd);
@@ -656,12 +661,45 @@
continue;
}
- jobs[i].setTargetSite(getFirstTargetSite(jobs[i]));
+ IConfiguredSite csite = getFirstTargetSite(jobs[i]);
+ if (csite == null && Platform.getInstallLocation().isReadOnly() && isUpdate == false) {
+ // there are no updateable sites, the installation location is read-only and we are installing a new feature
+ // make an update site in the user's home direcotry
+ File site = new File(System.getProperty("user.home") + File.separator + ".eclipse" + File.separator + //$NON-NLS-1$ //$NON-NLS-2$
+ Platform.getProduct().getId() + File.separator + "updates"); //$NON-NLS-1$
+
+ try {
+ csite = config.createConfiguredSite(site);
+ config.addConfiguredSite(csite);
+ IStatus status = csite.verifyUpdatableStatus();
+ if (!status.isOK())
+ throw new CoreException(status);
+
+ } catch (CoreException e) {
+ // there was a problem, the user must choose an installation site
+ csite = null;
+ // no need to check if the directory exists because File.delete() returns false if it's not there
+ deleteDir(site);
+ }
+ }
+ jobs[i].setTargetSite(csite);
}
}
-
+
+ private boolean deleteDir(File dir) {
+ if (dir.isDirectory()) {
+ String[] files = dir.list();
+ for (int i=0; i < files.length; i++) {
+ if (!deleteDir(new File(dir, files[i]))) {
+ return false;
+ }
+ }
+ }
+ return dir.delete();
+ }
+
private IConfiguredSite getMostReceantlyUsedSite() {
IDialogSettings master = UpdateUI.getDefault().getDialogSettings();
IDialogSettings section = master.getSection(TargetSiteDialog.MOST_RECEANTLY_USED_SITE_URL);
@@ -696,7 +734,7 @@
IConfiguredSite[] sites = config.getConfiguredSites();
for (int i = 0; i < sites.length; i++) {
IConfiguredSite csite = sites[i];
- if (getSiteVisibility(csite, job))
+ if (getSiteVisibility(csite, job) && csite.getSite().getCurrentConfiguredSite().verifyUpdatableStatus().isOK())
return csite;
}
return null;
Index: src/org/eclipse/update/search/UpdateSearchRequest.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/search/UpdateSearchRequest.java,v
retrieving revision 1.31
diff -u -r1.31 UpdateSearchRequest.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/search/UpdateSearchRequest.java 8 Aug 2006 20:21:42 -0000 1.31
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/search/UpdateSearchRequest.java 25 Sep 2006 22:38:05 -0000
@@ -282,6 +282,10 @@
// currently, the next conditional is only executed (qsite!=null) when
// running an update search.
if (qsite != null && searchFeatureProvidedSites) {
+ // do not update features that are installed in read-only locations
+ IFeature feature = query.getFeature();
+ if (feature != null && !feature.getSite().getCurrentConfiguredSite().verifyUpdatableStatus().isOK())
+ continue;
// check for mapping
IUpdateSiteAdapter mappedSite = getMappedSite(updatePolicy, qsite);
// when there is no mapped site the feature is not updatable
Index: src/org/eclipse/update/search/IUpdateSearchQuery.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/search/IUpdateSearchQuery.java,v
retrieving revision 1.8
diff -u -r1.8 IUpdateSearchQuery.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/search/IUpdateSearchQuery.java 1 Mar 2005 20:29:16 -0000 1.8
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/search/IUpdateSearchQuery.java 25 Sep 2006 22:38:05 -0000
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Incorporated - getFeature() API addition
*******************************************************************************/
package org.eclipse.update.search;
@@ -50,4 +51,12 @@
* @param monitor a progress monitor to report search progress within the provided site
*/
public void run(ISite site, String [] categoriesToSkip, IUpdateSearchFilter filter, IUpdateSearchResultCollector collector, IProgressMonitor monitor);
+
+/**
+ * Returns IFeature associated with the IUpdateSearchQuery
+ *
+ * @return the IFeature that is associated with the IUpdateSearchQuery
+ * @since 3.2
+ */
+ public IFeature getFeature();
}
Index: src/org/eclipse/update/internal/search/OptionalFeatureSearchCategory.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/search/OptionalFeatureSearchCategory.java,v
retrieving revision 1.9
diff -u -r1.9 OptionalFeatureSearchCategory.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/OptionalFeatureSearchCategory.java 11 Apr 2006 15:47:09 -0000 1.9
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/OptionalFeatureSearchCategory.java 25 Sep 2006 22:38:05 -0000
@@ -76,6 +76,13 @@
public IQueryUpdateSiteAdapter getQuerySearchSite() {
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.update.internal.ui.search.ISearchQuery#getFeature()
+ */
+ public IFeature getFeature() {
+ return null;
+ }
}
public void addVersionedIdentifier(VersionedIdentifier vid) {
Index: src/org/eclipse/update/internal/search/UpdatesSearchCategory.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatesSearchCategory.java,v
retrieving revision 1.27
diff -u -r1.27 UpdatesSearchCategory.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatesSearchCategory.java 11 Apr 2006 15:47:09 -0000 1.27
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatesSearchCategory.java 25 Sep 2006 22:38:05 -0000
@@ -285,6 +285,10 @@
monitor.worked(1);
monitor.done();
}
+
+ public IFeature getFeature() {
+ return candidate;
+ }
}
private ArrayList candidates;
Index: src/org/eclipse/update/internal/search/SiteSearchCategory.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java,v
retrieving revision 1.14.2.1
diff -u -r1.14.2.1 SiteSearchCategory.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java 18 Aug 2006 23:31:21 -0000 1.14.2.1
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java 25 Sep 2006 22:38:05 -0000
@@ -133,6 +133,14 @@
public IQueryUpdateSiteAdapter getQuerySearchSite() {
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.update.internal.ui.search.ISearchQuery#getFeature()
+ */
+ public IFeature getFeature() {
+ return null;
+ }
+
}
public SiteSearchCategory() {
Index: src/org/eclipse/update/internal/core/ConfiguredSite.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java,v
retrieving revision 1.96
diff -u -r1.96 ConfiguredSite.java
--- plugins/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java 30 Mar 2006 02:34:37 -0000 1.96
+++ plugins/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java 25 Sep 2006 22:38:05 -0000
@@ -35,6 +35,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
import org.eclipse.update.configuration.IActivity;
import org.eclipse.update.configuration.IConfiguredSite;
@@ -803,7 +804,9 @@
}
} else {
File container = getSiteContaining(file);
- if (container != null) {
+ // allow the install location to pass even though it looks like this
+ // site is contained in another site
+ if (container != null && !siteLocation.equals(Platform.getInstallLocation().getURL().getFile())) {
verifyStatus = createStatus(IStatus.ERROR, NLS.bind(Messages.ConfiguredSite_ContainedInAnotherSite, (new String[] { container.getAbsolutePath() })), null);
return verifyStatus;
}