1 /*******************************************************************************
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org
.eclipse
.egit
.ui
.internal
.actions
;
11 import java
.net
.URISyntaxException
;
13 import org
.eclipse
.core
.runtime
.IStatus
;
14 import org
.eclipse
.core
.runtime
.Status
;
15 import org
.eclipse
.egit
.ui
.Activator
;
16 import org
.eclipse
.egit
.ui
.UIText
;
17 import org
.eclipse
.egit
.ui
.internal
.fetch
.FetchWizard
;
18 import org
.eclipse
.jface
.action
.IAction
;
19 import org
.eclipse
.jface
.dialogs
.ErrorDialog
;
20 import org
.eclipse
.jface
.wizard
.WizardDialog
;
21 import org
.eclipse
.jgit
.lib
.Repository
;
24 * Action for displaying fetch wizard - allowing selection of specifications for
25 * fetch, and fetching objects/refs from another repository.
27 public class FetchAction
extends RepositoryAction
{
29 public void execute(IAction action
) {
30 final Repository repository
= getRepository(true);
31 if (repository
== null)
34 final FetchWizard fetchWizard
;
36 fetchWizard
= new FetchWizard(repository
);
37 } catch (URISyntaxException x
) {
38 ErrorDialog
.openError(getShell(), UIText
.FetchAction_wrongURITitle
,
39 UIText
.FetchAction_wrongURIMessage
, new Status(
40 IStatus
.ERROR
, Activator
.getPluginId(), x
44 final WizardDialog dialog
= new WizardDialog(getShell(), fetchWizard
);
49 public boolean isEnabled() {
50 return getRepository(false) != null;