diff options
author | John Arthorne | 2009-03-11 21:35:59 +0000 |
---|---|---|
committer | John Arthorne | 2009-03-11 21:35:59 +0000 |
commit | 0b39d71b172f147d296189240e859b9f6d2a671a (patch) | |
tree | 3305945365303993a745cc51107f4796b0cdc8f7 /bundles | |
parent | f42ae99021abb4076749aa9f9a9b28f308eeb1c0 (diff) | |
download | rt.equinox.p2-0b39d71b172f147d296189240e859b9f6d2a671a.tar.gz rt.equinox.p2-0b39d71b172f147d296189240e859b9f6d2a671a.tar.xz rt.equinox.p2-0b39d71b172f147d296189240e859b9f6d2a671a.zip |
Bug 268198 InstallNewSoftwareHandler causes repositories to be retained indefinitelyv20090311-1800
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java index 6c6a1950f..32c595be2 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/PreloadingRepositoryHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,7 +31,7 @@ import org.eclipse.ui.PlatformUI; */ abstract class PreloadingRepositoryHandler extends AbstractHandler { - Job loadJob = null; + Object LOAD_FAMILY = new Object(); /** * The constructor. @@ -59,23 +59,25 @@ abstract class PreloadingRepositoryHandler extends AbstractHandler { } void doExecuteAndLoad(final String profileId, boolean preloadRepositories) { - if (loadJob != null) - loadJob.cancel(); - loadJob = null; + //cancel any load that is already running + Job.getJobManager().cancel(LOAD_FAMILY); final QueryableMetadataRepositoryManager queryableManager = new QueryableMetadataRepositoryManager(Policy.getDefault().getQueryContext(), false); if (preloadRepositories) { - loadJob = new Job(ProvSDKMessages.InstallNewSoftwareHandler_LoadRepositoryJobLabel) { + Job loadJob = new Job(ProvSDKMessages.InstallNewSoftwareHandler_LoadRepositoryJobLabel) { protected IStatus run(IProgressMonitor monitor) { queryableManager.loadAll(monitor); return Status.OK_STATUS; } + public boolean belongsTo(Object family) { + return family == LOAD_FAMILY; + } + }; if (waitForPreload()) { loadJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { - loadJob = null; if (PlatformUI.isWorkbenchRunning()) if (event.getResult().isOK()) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { |