Search in sources :

Example 1 with FetchOperationUI

use of org.eclipse.egit.ui.internal.fetch.FetchOperationUI in project egit by eclipse.

the class SynchronizeFetchJob method runInWorkspace.

@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
    SubMonitor progress = SubMonitor.convert(monitor, gsdSet.size());
    progress.setTaskName(UIText.SynchronizeFetchJob_TaskName);
    for (GitSynchronizeData gsd : gsdSet) {
        Repository repo = gsd.getRepository();
        StoredConfig repoConfig = repo.getConfig();
        String remoteName = gsd.getDstRemoteName();
        if (remoteName == null) {
            progress.worked(1);
            continue;
        }
        progress.subTask(NLS.bind(UIText.SynchronizeFetchJob_SubTaskName, remoteName));
        RemoteConfig config;
        try {
            config = new RemoteConfig(repoConfig, remoteName);
        } catch (URISyntaxException e) {
            Activator.logError(e.getMessage(), e);
            progress.worked(1);
            continue;
        }
        FetchOperationUI fetchOperationUI = new FetchOperationUI(repo, config, timeout, false);
        fetchOperationUI.setCredentialsProvider(new EGitCredentialsProvider());
        try {
            fetchOperationUI.execute(progress.newChild(1));
            gsd.updateRevs();
        } catch (Exception e) {
            showInformationDialog(remoteName);
            Activator.logError(e.getMessage(), e);
        }
    }
    return Status.OK_STATUS;
}
Also used : StoredConfig(org.eclipse.jgit.lib.StoredConfig) GitSynchronizeData(org.eclipse.egit.core.synchronize.dto.GitSynchronizeData) Repository(org.eclipse.jgit.lib.Repository) SubMonitor(org.eclipse.core.runtime.SubMonitor) URISyntaxException(java.net.URISyntaxException) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) EGitCredentialsProvider(org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider) URISyntaxException(java.net.URISyntaxException) FetchOperationUI(org.eclipse.egit.ui.internal.fetch.FetchOperationUI)

Example 2 with FetchOperationUI

use of org.eclipse.egit.ui.internal.fetch.FetchOperationUI in project egit by eclipse.

the class SimpleFetchActionHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repository = getRepository(true, event);
    if (repository == null)
        return null;
    RemoteConfig config = SimpleConfigureFetchDialog.getConfiguredRemote(repository);
    if (config == null) {
        MessageDialog.openInformation(getShell(event), UIText.SimpleFetchActionHandler_NothingToFetchDialogTitle, UIText.SimpleFetchActionHandler_NothingToFetchDialogMessage);
        return null;
    }
    new FetchOperationUI(repository, config, Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT), false).start();
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) FetchOperationUI(org.eclipse.egit.ui.internal.fetch.FetchOperationUI)

Example 3 with FetchOperationUI

use of org.eclipse.egit.ui.internal.fetch.FetchOperationUI in project egit by eclipse.

the class FetchConfiguredRemoteCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode node = getSelectedNodes(event).get(0);
    RemoteConfig config = getRemoteConfig(node);
    if (config == null) {
        MessageDialog.openInformation(getShell(event), UIText.SimpleFetchActionHandler_NothingToFetchDialogTitle, UIText.SimpleFetchActionHandler_NothingToFetchDialogMessage);
        return null;
    }
    int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
    new FetchOperationUI(node.getRepository(), config, timeout, false).start();
    return null;
}
Also used : RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) FetchOperationUI(org.eclipse.egit.ui.internal.fetch.FetchOperationUI)

Aggregations

FetchOperationUI (org.eclipse.egit.ui.internal.fetch.FetchOperationUI)3 RemoteConfig (org.eclipse.jgit.transport.RemoteConfig)3 Repository (org.eclipse.jgit.lib.Repository)2 URISyntaxException (java.net.URISyntaxException)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)1 EGitCredentialsProvider (org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider)1 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)1 StoredConfig (org.eclipse.jgit.lib.StoredConfig)1