eclipse/eclipse-updatehomedir.patch

121 lines
4.7 KiB
Diff
Raw Normal View History

2005-04-20 16:48:00 +00:00
? @dot
? build.xml
? org.eclipse.update.ui_3.1.0.jar
Index: src/org/eclipse/update/internal/ui/wizards/TargetPage.java
===================================================================
RCS file: /home/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/TargetPage.java,v
retrieving revision 1.67
diff -u -r1.67 TargetPage.java
--- src/org/eclipse/update/internal/ui/wizards/TargetPage.java 1 Mar 2005 20:29:25 -0000 1.67
2005-04-20 16:48:00 +00:00
+++ src/org/eclipse/update/internal/ui/wizards/TargetPage.java 19 Apr 2005 23:05:52 -0000
@@ -10,24 +10,45 @@
*******************************************************************************/
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;
2005-04-20 16:48:00 +00:00
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.viewers.*;
-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.help.*;
-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.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.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.help.WorkbenchHelp;
+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.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;
2005-04-20 16:48:00 +00:00
@@ -149,7 +170,7 @@
label.setLayoutData(gd);
installLocation = new Label(client, SWT.NULL);
- installLocation.setText("foo");
+ installLocation.setText("");
gd = new GridData(GridData.FILL_HORIZONTAL);
installLocation.setLayoutData(gd);
2005-04-20 16:48:00 +00:00
@@ -362,9 +383,27 @@
jobs[i].setTargetSite(defaultSite);
continue;
}
2005-04-20 16:48:00 +00:00
+
+ IConfiguredSite csite = getFirstTargetSite(jobs[i]);
- jobs[i].setTargetSite(getFirstTargetSite(jobs[i]));
2005-04-20 16:48:00 +00:00
-
+ if (csite == null) {
+ // there are no updateable sites, make one in the user's home direcotry
+ String sitePath = System.getProperty("user.home") + File.separator + ".eclipse/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(csite);
}
}
2005-04-20 16:48:00 +00:00
@@ -373,7 +412,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.verifyUpdatableStatus().isOK() == true)
return csite;
}
return null;