Search in sources :

Example 1 with PushWizardDialog

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

the class PushUpstreamOrBranchActionHandler method pushOrConfigure.

/**
 * @param repository
 * @param config
 * @param shell
 */
public static void pushOrConfigure(final Repository repository, RemoteConfig config, Shell shell) {
    if (config != null) {
        PushOperationUI op = new PushOperationUI(repository, config.getName(), false);
        op.start();
    } else {
        Ref head = getHeadIfSymbolic(repository);
        if (head != null) {
            PushBranchWizard pushBranchWizard = new PushBranchWizard(repository, head);
            PushWizardDialog dlg = new PushWizardDialog(shell, pushBranchWizard);
            dlg.open();
        }
    }
}
Also used : Ref(org.eclipse.jgit.lib.Ref) PushWizardDialog(org.eclipse.egit.ui.internal.push.PushWizardDialog) PushOperationUI(org.eclipse.egit.ui.internal.push.PushOperationUI) PushBranchWizard(org.eclipse.egit.ui.internal.push.PushBranchWizard)

Example 2 with PushWizardDialog

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

the class PushBranchActionHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Repository repository = getRepository(true, event);
    try {
        PushBranchWizard wizard = null;
        Ref ref = getBranchRef(repository);
        if (ref != null) {
            wizard = new PushBranchWizard(repository, ref);
        } else {
            ObjectId id = repository.resolve(repository.getFullBranch());
            wizard = new PushBranchWizard(repository, id);
        }
        PushWizardDialog dlg = new PushWizardDialog(getShell(event), wizard);
        dlg.open();
    } catch (IOException ex) {
        Activator.handleError(ex.getLocalizedMessage(), ex, false);
    }
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) Ref(org.eclipse.jgit.lib.Ref) ObjectId(org.eclipse.jgit.lib.ObjectId) PushWizardDialog(org.eclipse.egit.ui.internal.push.PushWizardDialog) IOException(java.io.IOException) PushBranchWizard(org.eclipse.egit.ui.internal.push.PushBranchWizard)

Example 3 with PushWizardDialog

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

the class PushCommitHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PlotCommit commit = (PlotCommit) getSelection(event).getFirstElement();
    final Repository repo = getRepository(event);
    try {
        PushBranchWizard wizard = null;
        Ref localBranch = null;
        for (int i = 0; i < commit.getRefCount(); i++) {
            Ref currentRef = commit.getRef(i);
            if (localBranch == null && currentRef.getName().startsWith(Constants.R_HEADS))
                localBranch = currentRef;
        }
        if (localBranch == null)
            wizard = new PushBranchWizard(repo, commit.getId());
        else
            wizard = new PushBranchWizard(repo, localBranch);
        PushWizardDialog dlg = new PushWizardDialog(HandlerUtil.getActiveShellChecked(event), wizard);
        dlg.setHelpAvailable(true);
        dlg.open();
    } catch (Exception e) {
        Activator.handleError(e.getMessage(), e, true);
    }
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) Ref(org.eclipse.jgit.lib.Ref) PlotCommit(org.eclipse.jgit.revplot.PlotCommit) PushWizardDialog(org.eclipse.egit.ui.internal.push.PushWizardDialog) PushBranchWizard(org.eclipse.egit.ui.internal.push.PushBranchWizard) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 4 with PushWizardDialog

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

the class PushCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<RepositoryTreeNode> nodes = getSelectedNodes(event);
    RepositoryTreeNode node = nodes.get(0);
    IWizard pushWiz = null;
    try {
        switch(node.getType()) {
            case REF:
                Ref ref = (Ref) node.getObject();
                pushWiz = new PushBranchWizard(node.getRepository(), ref);
                break;
            case TAG:
                pushWiz = createPushTagsWizard(nodes);
                break;
            case REPO:
                pushWiz = new PushWizard(node.getRepository());
                break;
            default:
                // $NON-NLS-1$
                throw new UnsupportedOperationException("type not supported!");
        }
    } catch (URISyntaxException e1) {
        Activator.handleError(e1.getMessage(), e1, true);
        return null;
    }
    WizardDialog dlg = new PushWizardDialog(getShell(event), pushWiz);
    dlg.setHelpAvailable(pushWiz.isHelpAvailable());
    dlg.open();
    return null;
}
Also used : Ref(org.eclipse.jgit.lib.Ref) RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) IWizard(org.eclipse.jface.wizard.IWizard) PushWizard(org.eclipse.egit.ui.internal.push.PushWizard) PushWizardDialog(org.eclipse.egit.ui.internal.push.PushWizardDialog) URISyntaxException(java.net.URISyntaxException) PushBranchWizard(org.eclipse.egit.ui.internal.push.PushBranchWizard) PushWizardDialog(org.eclipse.egit.ui.internal.push.PushWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

PushBranchWizard (org.eclipse.egit.ui.internal.push.PushBranchWizard)4 PushWizardDialog (org.eclipse.egit.ui.internal.push.PushWizardDialog)4 Ref (org.eclipse.jgit.lib.Ref)4 Repository (org.eclipse.jgit.lib.Repository)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 PushOperationUI (org.eclipse.egit.ui.internal.push.PushOperationUI)1 PushWizard (org.eclipse.egit.ui.internal.push.PushWizard)1 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)1 IWizard (org.eclipse.jface.wizard.IWizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1 PlotCommit (org.eclipse.jgit.revplot.PlotCommit)1