ref #6566 Add CoreExpression to admin menu items
[taxeditor.git] / eu.etaxonomy.taxeditor.application / src / main / java / eu / etaxonomy / taxeditor / update / InstallNewSoftwareHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2008, 2009 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package eu.etaxonomy.taxeditor.update;
12
13 import org.eclipse.core.runtime.jobs.Job;
14 import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
15
16 /**
17 * InstallNewSoftwareHandler invokes the install wizard
18 *
19 * @since 3.5
20 */
21 public class InstallNewSoftwareHandler extends PreloadingRepositoryHandler {
22
23 /**
24 * The constructor.
25 */
26 public InstallNewSoftwareHandler() {
27 super();
28 }
29
30 protected void doExecute(LoadMetadataRepositoryJob job) {
31 getProvisioningUI().openInstallWizard(null, null, job);
32 }
33
34 protected boolean waitForPreload() {
35 // If the user cannot see repositories, then we may as well wait
36 // for existing repos to load so that content is available.
37 // If the user can manipulate the repositories, then we don't wait,
38 // because we don't know which ones they want to work with.
39 return !getProvisioningUI().getPolicy().getRepositoriesVisible();
40 }
41
42 protected void setLoadJobProperties(Job loadJob) {
43 super.setLoadJobProperties(loadJob);
44 // If we are doing a background load, we do not wish to authenticate, as the
45 // user is unaware that loading was needed
46 if (!waitForPreload()) {
47 loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true));
48 loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_EVENTS, Boolean.toString(true));
49 }
50 }
51 }