View | Details | Raw Unified
Collapse All | Expand All

(-) plugins/org.eclipse.update.core/src/org/eclipse/update/search/IUpdateSearchQuery.java (+9 lines)
 Lines 7-12    Link Here 
 *
 *
 * Contributors:
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     IBM Corporation - initial API and implementation
 *     Red Hat Incorporated - getFeature() API addition
 *******************************************************************************/
 *******************************************************************************/
package org.eclipse.update.search;
package org.eclipse.update.search;
 Lines 50-53    Link Here 
 * @param monitor a progress monitor to report search progress within the provided site
 * @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);
	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(); 
}
}
(-) plugins/org.eclipse.update.core/src/org/eclipse/update/internal/core/ConfiguredSite.java (-1 / +4 lines)
 Lines 35-40    Link Here 
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
import org.eclipse.osgi.util.NLS;
import org.eclipse.update.configuration.IActivity;
import org.eclipse.update.configuration.IActivity;
import org.eclipse.update.configuration.IConfiguredSite;
import org.eclipse.update.configuration.IConfiguredSite;
 Lines 803-809    Link Here 
			}
			}
		} else {
		} else {
			File container = getSiteContaining(file);
			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);
				verifyStatus = createStatus(IStatus.ERROR, NLS.bind(Messages.ConfiguredSite_ContainedInAnotherSite, (new String[] { container.getAbsolutePath() })), null);
				return verifyStatus;
				return verifyStatus;
			}
			}
(-) plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/InstallWizard2.java (-1 / +1 lines)
 Lines 153-159    Link Here 
		addPage(licensePage);
		addPage(licensePage);
		optionalFeaturesPage = new OptionalFeaturesPage(config);
		optionalFeaturesPage = new OptionalFeaturesPage(config);
		addPage(optionalFeaturesPage);
		addPage(optionalFeaturesPage);
		targetPage = new TargetPage(config);
		targetPage = new TargetPage(config, isUpdate);
		addPage(targetPage);
		addPage(targetPage);
	}
	}
(-) plugins/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/wizards/TargetPage.java (-4 / +44 lines)
 Lines 18-23    Link Here 
import java.util.HashSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Iterator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
 Lines 92-97    Link Here 
    private Label installLocation;
    private Label installLocation;
    private Button changeLocation;
    private Button changeLocation;
    static HashSet added;
    static HashSet added;
    private boolean isUpdate; // whether the wizard is updating a feature or installing a new one
	class JobsContentProvider
	class JobsContentProvider
		extends DefaultContentProvider
		extends DefaultContentProvider
 Lines 236-248    Link Here 
	/**
	/**
	 * Constructor for ReviewPage2
	 * Constructor for ReviewPage2
	 */
	 */
	public TargetPage(IInstallConfiguration config) {
	public TargetPage(IInstallConfiguration config, boolean isUpdate) {
		super("Target"); //$NON-NLS-1$
		super("Target"); //$NON-NLS-1$
		setTitle(UpdateUIMessages.InstallWizard_TargetPage_title); 
		setTitle(UpdateUIMessages.InstallWizard_TargetPage_title); 
		setDescription(UpdateUIMessages.InstallWizard_TargetPage_desc); 
		setDescription(UpdateUIMessages.InstallWizard_TargetPage_desc); 
		this.config = config;
		this.config = config;
		UpdateUI.getDefault().getLabelProvider().connect(this);
		UpdateUI.getDefault().getLabelProvider().connect(this);
		configListener = new ConfigListener();
		configListener = new ConfigListener();
		this.isUpdate = isUpdate;
	}
	}
	public void setJobs(IInstallFeatureOperation[] jobs) {
	public void setJobs(IInstallFeatureOperation[] jobs) {
 Lines 273-279    Link Here 
        label.setLayoutData(gd);
        label.setLayoutData(gd);
		installLocation = new Label(client, SWT.NULL);
		installLocation = new Label(client, SWT.NULL);
        installLocation.setText("foo"); //$NON-NLS-1$
        installLocation.setText(""); //$NON-NLS-1$
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd = new GridData(GridData.FILL_HORIZONTAL);
        installLocation.setLayoutData(gd);
        installLocation.setLayoutData(gd);
        
        
 Lines 656-666    Link Here 
				continue;
				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$
					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() {
	private IConfiguredSite getMostReceantlyUsedSite() {
		IDialogSettings master = UpdateUI.getDefault().getDialogSettings();
		IDialogSettings master = UpdateUI.getDefault().getDialogSettings();
 Lines 696-702    Link Here 
		IConfiguredSite[] sites = config.getConfiguredSites();
		IConfiguredSite[] sites = config.getConfiguredSites();
		for (int i = 0; i < sites.length; i++) {
		for (int i = 0; i < sites.length; i++) {
			IConfiguredSite csite = sites[i];
			IConfiguredSite csite = sites[i];
			if (getSiteVisibility(csite, job)) 
			if (getSiteVisibility(csite, job) && 
				csite.getSite().getCurrentConfiguredSite().verifyUpdatableStatus().isOK())
				return csite;
				return csite;
		}
		}
		return null;
		return null;
(-) plugins/org.eclipse.update.core/src/org/eclipse/update/search/UpdateSearchRequest.java (-1 / +6 lines)
 Lines 10-15    Link Here 
 *******************************************************************************/
 *******************************************************************************/
package org.eclipse.update.search;
package org.eclipse.update.search;
import java.io.File;
import java.net.URL;
import java.net.URL;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.HashSet;
 Lines 164-174    Link Here 
		this.category = category;
		this.category = category;
		this.scope = scope;
		this.scope = scope;
	}
	}
	/**
	/**
	 * Returns the search catagory used in this request.
	 * Returns the search catagory used in this request.
	 * @return the search category
	 * @return the search category
	 */
	 */
	
	public IUpdateSearchCategory getCategory() {
	public IUpdateSearchCategory getCategory() {
		return category;
		return category;
	}
	}
 Lines 282-287    Link Here 
					// currently, the next conditional is only executed (qsite!=null) when
					// currently, the next conditional is only executed (qsite!=null) when
					// running an update search. 
					// running an update search. 
					if (qsite != null && searchFeatureProvidedSites) {
					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
						// check for mapping
						IUpdateSiteAdapter mappedSite = getMappedSite(updatePolicy, qsite);
						IUpdateSiteAdapter mappedSite = getMappedSite(updatePolicy, qsite);
						// when there is no mapped site the feature is not updatable
						// when there is no mapped site the feature is not updatable
(-) plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/OptionalFeatureSearchCategory.java (+7 lines)
 Lines 76-81    Link Here 
		public IQueryUpdateSiteAdapter getQuerySearchSite() {
		public IQueryUpdateSiteAdapter getQuerySearchSite() {
			return null;
			return null;
		}
		}
		/* (non-Javadoc)
		 * @see org.eclipse.update.internal.ui.search.ISearchQuery#getFeature()
		 */
		public IFeature getFeature() {
			return null;
		}
	}
	}
	public void addVersionedIdentifier(VersionedIdentifier vid) {
	public void addVersionedIdentifier(VersionedIdentifier vid) {
(-) plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/SiteSearchCategory.java (+7 lines)
 Lines 133-138    Link Here 
		public IQueryUpdateSiteAdapter getQuerySearchSite() {
		public IQueryUpdateSiteAdapter getQuerySearchSite() {
			return null;
			return null;
		}
		}
		/* (non-Javadoc)
		 * @see org.eclipse.update.internal.ui.search.ISearchQuery#getFeature()
		 */
		public IFeature getFeature() {
			return null;
		}
	}
	}
	public SiteSearchCategory() {
	public SiteSearchCategory() {
(-) plugins/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatesSearchCategory.java (+4 lines)
 Lines 285-290    Link Here 
			monitor.worked(1);
			monitor.worked(1);
			monitor.done();
			monitor.done();
		}
		}
		public IFeature getFeature() {
			return candidate;
		}
	}
	}
	private ArrayList candidates;
	private ArrayList candidates;