Search in sources :

Example 1 with RepositorySelection

use of org.eclipse.egit.ui.internal.components.RepositorySelection in project egit by eclipse.

the class FetchWizard method performFinish.

@Override
public boolean performFinish() {
    boolean calledFromRepoPage = false;
    if (getContainer().getCurrentPage() == repoPage)
        calledFromRepoPage = true;
    if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested())
        saveConfig();
    if (repoPage.getStoreInSecureStore()) {
        if (!SecureStoreUtils.storeCredentials(repoPage.getCredentials(), repoPage.getSelection().getURI()))
            return false;
    }
    final FetchOperationUI op;
    int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
    final RepositorySelection repoSelection = repoPage.getSelection();
    if (calledFromRepoPage)
        op = new FetchOperationUI(localDb, repoSelection.getConfig(), timeout, false);
    else if (repoSelection.isConfigSelected())
        op = new FetchOperationUI(localDb, repoSelection.getConfig().getURIs().get(0), refSpecPage.getRefSpecs(), timeout, false);
    else
        op = new FetchOperationUI(localDb, repoSelection.getURI(false), refSpecPage.getRefSpecs(), timeout, false);
    UserPasswordCredentials credentials = repoPage.getCredentials();
    if (credentials != null)
        op.setCredentialsProvider(new EGitCredentialsProvider(credentials.getUser(), credentials.getPassword()));
    // add the RefSpecs from the RefSpec page into the FetchOperation
    if (!calledFromRepoPage)
        op.setTagOpt(refSpecPage.getTagOpt());
    op.start();
    repoPage.saveUriInPrefs();
    return true;
}
Also used : RepositorySelection(org.eclipse.egit.ui.internal.components.RepositorySelection) EGitCredentialsProvider(org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider) UserPasswordCredentials(org.eclipse.egit.core.securestorage.UserPasswordCredentials)

Aggregations

UserPasswordCredentials (org.eclipse.egit.core.securestorage.UserPasswordCredentials)1 RepositorySelection (org.eclipse.egit.ui.internal.components.RepositorySelection)1 EGitCredentialsProvider (org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider)1