1 /*******************************************************************************
2 * Copyright (c) 2007, 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package eu
.etaxonomy
.taxeditor
.update
;
13 import java
.net
.URISyntaxException
;
15 import org
.eclipse
.equinox
.internal
.p2
.ui
.dialogs
.UpdateSingleIUWizard
;
16 import org
.eclipse
.equinox
.p2
.operations
.RepositoryTracker
;
17 import org
.eclipse
.equinox
.p2
.operations
.UpdateOperation
;
18 import org
.eclipse
.equinox
.p2
.ui
.LoadMetadataRepositoryJob
;
19 import org
.eclipse
.jface
.wizard
.WizardDialog
;
21 import eu
.etaxonomy
.taxeditor
.TaxonomicEditorPlugin
;
22 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
25 * UpdateHandler invokes the check for updates UI
29 public class UpdateHandler
extends PreloadingRepositoryHandler
{
31 boolean hasNoRepos
= false;
34 protected void doExecute(LoadMetadataRepositoryJob job
) {
38 UpdateOperation operation
= getProvisioningUI().getUpdateOperation(null, null);
40 P2Util
.setUpdateRepositories(operation
);
41 } catch (URISyntaxException e
) {
42 MessagingUtils
.errorDialog("Invalid update site URI",
44 "The update site URI has an invalid syntax",
45 TaxonomicEditorPlugin
.PLUGIN_ID
,
52 operation
.resolveModal(null);
53 if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation
, getShell())) {
54 if (UpdateSingleIUWizard
.validFor(operation
)) {
55 // Special case for only updating a single root
56 UpdateSingleIUWizard wizard
= new UpdateSingleIUWizard(getProvisioningUI(), operation
);
57 WizardDialog dialog
= new WizardDialog(getShell(), wizard
);
61 // Open the normal version of the update wizard
62 getProvisioningUI().openUpdateWizard(false, operation
, job
);
68 protected boolean preloadRepositories() {
70 RepositoryTracker repoMan
= getProvisioningUI().getRepositoryTracker();
71 if (repoMan
.getKnownRepositories(getProvisioningUI().getSession()).length
== 0) {
75 return super.preloadRepositories();