Search in sources :

Example 6 with PushOperationUI

use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.

the class PushAction method runPushOperation.

private void runPushOperation() {
    GitSynchronizeDataSet gsds = (GitSynchronizeDataSet) getConfiguration().getProperty(SYNCHRONIZATION_DATA);
    for (GitSynchronizeData gsd : gsds) {
        String remoteName = gsd.getDstRemoteName();
        if (remoteName == null)
            continue;
        RemoteConfig rc;
        Repository repo = gsd.getRepository();
        StoredConfig config = repo.getConfig();
        try {
            rc = new RemoteConfig(config, remoteName);
        } catch (URISyntaxException e) {
            Activator.logError("Unable to create RemoteConfiguration for remote: " + remoteName, // $NON-NLS-1$
            e);
            continue;
        }
        if (rc.getPushRefSpecs().isEmpty())
            // $NON-NLS-1$
            rc.addPushRefSpec(new RefSpec(HEAD + ":" + gsd.getDstMerge()));
        PushOperationUI push = new PushOperationUI(repo, rc, false);
        push.setCredentialsProvider(new EGitCredentialsProvider());
        push.start();
    }
}
Also used : StoredConfig(org.eclipse.jgit.lib.StoredConfig) GitSynchronizeData(org.eclipse.egit.core.synchronize.dto.GitSynchronizeData) Repository(org.eclipse.jgit.lib.Repository) RefSpec(org.eclipse.jgit.transport.RefSpec) GitSynchronizeDataSet(org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet) URISyntaxException(java.net.URISyntaxException) PushOperationUI(org.eclipse.egit.ui.internal.push.PushOperationUI) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) EGitCredentialsProvider(org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider)

Example 7 with PushOperationUI

use of org.eclipse.egit.ui.internal.push.PushOperationUI in project egit by eclipse.

the class CommitJob method pushUpstream.

private void pushUpstream(final RevCommit commit, final PushMode pushTo) {
    final RemoteConfig config = SimpleConfigurePushDialog.getConfiguredRemote(repository);
    if (pushTo == PushMode.GERRIT || config == null) {
        final Display display = PlatformUI.getWorkbench().getDisplay();
        display.asyncExec(new Runnable() {

            @Override
            public void run() {
                Wizard pushWizard = getPushWizard(commit, pushTo);
                if (pushWizard != null) {
                    WizardDialog wizardDialog = new WizardDialog(display.getActiveShell(), pushWizard);
                    wizardDialog.setHelpAvailable(true);
                    wizardDialog.open();
                }
            }
        });
    } else {
        PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
        op.start();
    }
}
Also used : PushOperationUI(org.eclipse.egit.ui.internal.push.PushOperationUI) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) PushToGerritWizard(org.eclipse.egit.ui.internal.push.PushToGerritWizard) PushBranchWizard(org.eclipse.egit.ui.internal.push.PushBranchWizard) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) Display(org.eclipse.swt.widgets.Display)

Aggregations

PushOperationUI (org.eclipse.egit.ui.internal.push.PushOperationUI)7 Repository (org.eclipse.jgit.lib.Repository)4 RemoteConfig (org.eclipse.jgit.transport.RemoteConfig)4 PushBranchWizard (org.eclipse.egit.ui.internal.push.PushBranchWizard)2 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1 IFile (org.eclipse.core.resources.IFile)1 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)1 GitSynchronizeDataSet (org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet)1 EGitCredentialsProvider (org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider)1 PushToGerritWizard (org.eclipse.egit.ui.internal.push.PushToGerritWizard)1 PushWizardDialog (org.eclipse.egit.ui.internal.push.PushWizardDialog)1 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)1 JobJoiner (org.eclipse.egit.ui.test.JobJoiner)1 Wizard (org.eclipse.jface.wizard.Wizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Ref (org.eclipse.jgit.lib.Ref)1 RefUpdate (org.eclipse.jgit.lib.RefUpdate)1