Search in sources :

Example 11 with PushOperationResult

use of org.eclipse.egit.core.op.PushOperationResult in project egit by eclipse.

the class PushWizard method performFinish.

@Override
public boolean performFinish() {
    boolean calledFromRepoPage = false;
    if (getContainer().getCurrentPage() == repoPage)
        calledFromRepoPage = true;
    if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested()) {
        saveRefSpecs();
    }
    if (repoPage.getStoreInSecureStore()) {
        if (!SecureStoreUtils.storeCredentials(repoPage.getCredentials(), repoPage.getSelection().getURI()))
            return false;
    }
    final PushOperation operation = createPushOperation(calledFromRepoPage);
    if (operation == null)
        return false;
    UserPasswordCredentials credentials = repoPage.getCredentials();
    if (credentials != null)
        operation.setCredentialsProvider(new EGitCredentialsProvider(credentials.getUser(), credentials.getPassword()));
    final PushOperationResult resultToCompare;
    if (confirmPage.isShowOnlyIfChangedSelected()) {
        resultToCompare = confirmPage.getConfirmedResult();
    } else {
        resultToCompare = null;
    }
    final Job job = new PushJob(NLS.bind(UIText.PushWizard_jobName, getURIsString(operation.getSpecification().getURIs())), localDb, operation, resultToCompare, getDestinationString(repoPage.getSelection()), true, PushMode.UPSTREAM);
    job.setUser(true);
    job.schedule();
    repoPage.saveUriInPrefs();
    return true;
}
Also used : PushOperationResult(org.eclipse.egit.core.op.PushOperationResult) PushOperation(org.eclipse.egit.core.op.PushOperation) Job(org.eclipse.core.runtime.jobs.Job) EGitCredentialsProvider(org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider) UserPasswordCredentials(org.eclipse.egit.core.securestorage.UserPasswordCredentials)

Aggregations

PushOperationResult (org.eclipse.egit.core.op.PushOperationResult)11 PushOperation (org.eclipse.egit.core.op.PushOperation)6 PushOperationSpecification (org.eclipse.egit.core.op.PushOperationSpecification)5 URIish (org.eclipse.jgit.transport.URIish)5 EGitCredentialsProvider (org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider)4 IOException (java.io.IOException)3 RemoteRefUpdate (org.eclipse.jgit.transport.RemoteRefUpdate)3 Test (org.junit.Test)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 CoreException (org.eclipse.core.runtime.CoreException)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 RevCommit (org.eclipse.jgit.revwalk.RevCommit)2 PushResult (org.eclipse.jgit.transport.PushResult)2 RefSpec (org.eclipse.jgit.transport.RefSpec)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1