eclipse/eclipse-updatehomedir.patch

148 lines
6.3 KiB
Diff
Raw Normal View History

diff -uNr src/org/eclipse/update/internal/ui/wizards/ModeSelectionPage.java src.orig/org/eclipse/update/internal/ui/wizards/ModeSelectionPage.java
--- src/org/eclipse/update/internal/ui/wizards/ModeSelectionPage.java 2005-06-10 18:27:12.000000000 -0400
+++ src.orig/org/eclipse/update/internal/ui/wizards/ModeSelectionPage.java 2005-06-16 12:08:30.000000000 -0400
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.update.internal.ui.wizards;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
@@ -70,10 +71,17 @@
GridLayout layout = new GridLayout();
composite.setLayout(layout);
updatesButton = new Button(composite, SWT.RADIO);
- updatesButton.setText(UpdateUIMessages.ModeSelectionPage_updates);
+ updatesButton.setText(UpdateUIMessages.ModeSelectionPage_updates);
updateMode = !getSettings().getBoolean(P_NEW_FEATURES_MODE);
+ // don't allow updates if the installation location is readonly
+ if (Platform.getInstallLocation().isReadOnly()) {
+ updatesButton.setEnabled(false);
+ updateMode = false;
+ }
updatesButton.setSelection(updateMode);
+
+
final Label updatesText = new Label(composite, SWT.WRAP);
updatesText.setText(UpdateUIMessages.ModeSelectionPage_updatesText);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
diff -uNr src/org/eclipse/update/internal/ui/wizards/TargetPage.java src.orig/org/eclipse/update/internal/ui/wizards/TargetPage.java
--- src/org/eclipse/update/internal/ui/wizards/TargetPage.java 2005-06-10 18:29:01.000000000 -0400
+++ src.orig/org/eclipse/update/internal/ui/wizards/TargetPage.java 2005-06-16 12:09:05.000000000 -0400
@@ -10,25 +10,48 @@
*******************************************************************************/
package org.eclipse.update.internal.ui.wizards;
-import java.io.*;
-import java.util.*;
-
+import java.io.File;
+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.resource.*;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.update.configuration.*;
-import org.eclipse.update.core.*;
-import org.eclipse.update.internal.operations.*;
-import org.eclipse.update.internal.ui.*;
-import org.eclipse.update.internal.ui.parts.*;
-import org.eclipse.update.operations.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.update.configuration.IConfiguredSite;
+import org.eclipse.update.configuration.IInstallConfiguration;
+import org.eclipse.update.configuration.IInstallConfigurationChangedListener;
+import org.eclipse.update.configuration.LocalSystemInfo;
+import org.eclipse.update.core.IFeature;
+import org.eclipse.update.internal.operations.UpdateUtils;
+import org.eclipse.update.internal.ui.UpdateLabelProvider;
+import org.eclipse.update.internal.ui.UpdateUI;
+import org.eclipse.update.internal.ui.UpdateUIImages;
+import org.eclipse.update.internal.ui.UpdateUIMessages;
+import org.eclipse.update.internal.ui.parts.DefaultContentProvider;
+import org.eclipse.update.internal.ui.parts.SWTUtil;
+import org.eclipse.update.operations.IInstallFeatureOperation;
public class TargetPage extends BannerPage implements IDynamicPage {
private TableViewer jobViewer;
@@ -150,7 +173,7 @@
label.setLayoutData(gd);
installLocation = new Label(client, SWT.NULL);
- installLocation.setText("foo"); //$NON-NLS-1$
+ installLocation.setText("");
gd = new GridData(GridData.FILL_HORIZONTAL);
installLocation.setLayoutData(gd);
@@ -359,8 +382,28 @@
jobs[i].setTargetSite(defaultSite);
continue;
}
+
+ IConfiguredSite csite = getFirstTargetSite(jobs[i]);
+ if (csite == null && Platform.getInstallLocation().isReadOnly()) {
+ // there are no updateable sites and the installation location is read only
+ // make an update site in the user's home direcotry
+ String sitePath = System.getProperty("user.home") + File.separator + ".eclipse" + File.separator +
+ Platform.getProduct().getId() + File.separator + "updates"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ try {
+ csite = config.createConfiguredSite(new File(sitePath));
+ 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;
+ }
+ }
- jobs[i].setTargetSite(getFirstTargetSite(jobs[i]));
+ jobs[i].setTargetSite(csite);
}
}
@@ -370,7 +413,7 @@
IConfiguredSite[] sites = config.getConfiguredSites();
for (int i = 0; i < sites.length; i++) {
IConfiguredSite csite = sites[i];
2005-04-20 16:48:00 +00:00
- if (getSiteVisibility(csite, job))
+ if (getSiteVisibility(csite, job) && csite.verifyUpdatableStatus().isOK() == true)
return csite;
}
return null;