diff options
Diffstat (limited to 'examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java')
-rw-r--r-- | examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java index 9e08c2e2b..a7e9b7921 100644 --- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java +++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/InstallNewSoftwareHandler.java @@ -1,22 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.examples.rcp.cloud.p2; -import org.eclipse.equinox.internal.provisional.p2.ui.IProvHelpContextIds; -import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager; -import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.InstallWizard; -import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.ProvisioningWizardDialog; -import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.ui.PlatformUI; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; /** * InstallNewSoftwareHandler invokes the install wizard @@ -32,21 +27,25 @@ public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler { super(); } - protected void doExecute(String profileId, QueryableMetadataRepositoryManager manager) { - InstallWizard wizard = new InstallWizard(Policy.getDefault(), profileId, null, null, manager); - WizardDialog dialog = new ProvisioningWizardDialog(getShell(), wizard); - dialog.create(); - PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD); - - dialog.open(); + protected void doExecute(LoadMetadataRepositoryJob job) { + getProvisioningUI().openInstallWizard(getShell(), null, null, job); } protected boolean waitForPreload() { - // If there is no way for the user to manipulate repositories, - // then we may as well wait for existing repos to load so that - // content is available. If the user can manipulate the - // repositories, then we don't wait, because we don't know which - // ones they want to work with. - return Policy.getDefault().getRepositoryManipulator() == null; + // If the user cannot see repositories, then we may as well wait + // for existing repos to load so that content is available. + // If the user can manipulate the repositories, then we don't wait, + // because we don't know which ones they want to work with. + return !getProvisioningUI().getPolicy().getRepositoriesVisible(); + } + + protected void setLoadJobProperties(Job loadJob) { + super.setLoadJobProperties(loadJob); + // If we are doing a background load, we do not wish to authenticate, as the + // user is unaware that loading was needed + if (!waitForPreload()) { + loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true)); + loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_EVENTS, Boolean.toString(true)); + } } } |