Search in sources :

Example 41 with RepositoryTreeNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode in project egit by eclipse.

the class ConfigurePushCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    RepositoryTreeNode selectedNode = getFirstOrNull(getSelectedNodes(event));
    final String configName;
    if (selectedNode instanceof RemoteNode)
        configName = ((RemoteNode) selectedNode).getObject();
    else if (selectedNode instanceof PushNode)
        configName = ((RemoteNode) selectedNode.getParent()).getObject();
    else
        return null;
    Dialog dlg = SimpleConfigurePushDialog.getDialog(getShell(event), selectedNode.getRepository(), configName);
    dlg.open();
    return null;
}
Also used : RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) SimpleConfigurePushDialog(org.eclipse.egit.ui.internal.push.SimpleConfigurePushDialog) Dialog(org.eclipse.jface.dialogs.Dialog) RemoteNode(org.eclipse.egit.ui.internal.repository.tree.RemoteNode) PushNode(org.eclipse.egit.ui.internal.repository.tree.PushNode)

Example 42 with RepositoryTreeNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode 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)

Example 43 with RepositoryTreeNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode in project egit by eclipse.

the class ImportProjectsCommand method getMultipleSelectedProjects.

private List<String> getMultipleSelectedProjects(List<RepositoryTreeNode> pSelectedNodes) {
    if (!multipleProjectsSelected(pSelectedNodes)) {
        return Collections.emptyList();
    }
    ArrayList<String> paths = new ArrayList<>();
    for (RepositoryTreeNode node : pSelectedNodes) {
        String path = getPathFromNode(node);
        if (path == null) {
            return null;
        }
        paths.add(path);
    }
    return paths;
}
Also used : RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) ArrayList(java.util.ArrayList)

Example 44 with RepositoryTreeNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode in project egit by eclipse.

the class ImportProjectsCommand method openWizard.

private void openWizard(ExecutionEvent event, List<RepositoryTreeNode> selectedNodes) throws ExecutionException {
    IWizardDescriptor descriptor = findSmartImportWizardDescriptor();
    if (descriptor == null || multipleProjectsSelected(selectedNodes)) {
        RepositoryTreeNode node;
        if (multipleProjectsSelected(selectedNodes)) {
            node = findRepoNode(selectedNodes.get(0));
        } else {
            node = selectedNodes.get(0);
        }
        String path = getPathFromNode(node);
        if (path == null) {
            return;
        }
        openGitCreateProjectViaWizardWizard(event, node, path, getMultipleSelectedProjects(selectedNodes));
    } else {
        String path = getPathFromNode(selectedNodes.get(0));
        openSmartImportWizard(event, descriptor, path);
    }
}
Also used : IWizardDescriptor(org.eclipse.ui.wizards.IWizardDescriptor) RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)

Example 45 with RepositoryTreeNode

use of org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode 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

RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)46 Repository (org.eclipse.jgit.lib.Repository)17 Ref (org.eclipse.jgit.lib.Ref)13 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)11 ArrayList (java.util.ArrayList)10 TagNode (org.eclipse.egit.ui.internal.repository.tree.TagNode)10 IOException (java.io.IOException)9 File (java.io.File)8 IResource (org.eclipse.core.resources.IResource)7 RefNode (org.eclipse.egit.ui.internal.repository.tree.RefNode)6 IPath (org.eclipse.core.runtime.IPath)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 RevCommit (org.eclipse.jgit.revwalk.RevCommit)4 RevObject (org.eclipse.jgit.revwalk.RevObject)4 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)3 Path (org.eclipse.core.runtime.Path)3 Job (org.eclipse.core.runtime.jobs.Job)3 FileNode (org.eclipse.egit.ui.internal.repository.tree.FileNode)3 RemoteNode (org.eclipse.egit.ui.internal.repository.tree.RemoteNode)3 StashedCommitNode (org.eclipse.egit.ui.internal.repository.tree.StashedCommitNode)3