Search in sources :

Example 6 with RemoteNode

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

the class PushConfiguredRemoteCommand method getRemoteConfig.

private RemoteConfig getRemoteConfig(RepositoryTreeNode node) {
    if (node instanceof RepositoryNode)
        return SimpleConfigurePushDialog.getConfiguredRemote(node.getRepository());
    if (node instanceof RemoteNode || node instanceof PushNode) {
        RemoteNode remoteNode;
        if (node instanceof PushNode)
            remoteNode = (RemoteNode) node.getParent();
        else
            remoteNode = (RemoteNode) node;
        try {
            RemoteConfig config = new RemoteConfig(remoteNode.getRepository().getConfig(), remoteNode.getObject());
            boolean fetchConfigured = !config.getFetchRefSpecs().isEmpty();
            boolean pushConfigured = !config.getPushRefSpecs().isEmpty();
            if (fetchConfigured || pushConfigured)
                return config;
            else
                return null;
        } catch (URISyntaxException e) {
            return null;
        }
    }
    return null;
}
Also used : RemoteNode(org.eclipse.egit.ui.internal.repository.tree.RemoteNode) URISyntaxException(java.net.URISyntaxException) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) RemoteConfig(org.eclipse.jgit.transport.RemoteConfig) PushNode(org.eclipse.egit.ui.internal.repository.tree.PushNode)

Example 7 with RemoteNode

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

the class ConfigureFetchCommand 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 FetchNode)
        configName = ((RemoteNode) selectedNode.getParent()).getObject();
    else
        return null;
    Dialog dlg = SimpleConfigureFetchDialog.getDialog(getShell(event), selectedNode.getRepository(), configName);
    dlg.open();
    return null;
}
Also used : FetchNode(org.eclipse.egit.ui.internal.repository.tree.FetchNode) RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) SimpleConfigureFetchDialog(org.eclipse.egit.ui.internal.fetch.SimpleConfigureFetchDialog) Dialog(org.eclipse.jface.dialogs.Dialog) RemoteNode(org.eclipse.egit.ui.internal.repository.tree.RemoteNode)

Example 8 with RemoteNode

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

the class ConfigureGerritRemoteCommand method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final RemoteNode node = getSelectedNodes(event).get(0);
    Repository repository = node.getRepository();
    final String remoteName = node.getObject();
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    ConfigureGerritWizard configureGerritWizard = new ConfigureGerritWizard(repository, remoteName);
    WizardDialog dlg = new WizardDialog(shell, configureGerritWizard);
    dlg.setHelpAvailable(false);
    dlg.open();
    return null;
}
Also used : Repository(org.eclipse.jgit.lib.Repository) Shell(org.eclipse.swt.widgets.Shell) RemoteNode(org.eclipse.egit.ui.internal.repository.tree.RemoteNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ConfigureGerritWizard(org.eclipse.egit.ui.internal.gerrit.ConfigureGerritWizard)

Example 9 with RemoteNode

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

Aggregations

RemoteNode (org.eclipse.egit.ui.internal.repository.tree.RemoteNode)9 PushNode (org.eclipse.egit.ui.internal.repository.tree.PushNode)5 IOException (java.io.IOException)4 FetchNode (org.eclipse.egit.ui.internal.repository.tree.FetchNode)4 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)4 RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)3 StoredConfig (org.eclipse.jgit.lib.StoredConfig)3 URISyntaxException (java.net.URISyntaxException)2 ArrayList (java.util.ArrayList)2 IPath (org.eclipse.core.runtime.IPath)2 FileNode (org.eclipse.egit.ui.internal.repository.tree.FileNode)2 FolderNode (org.eclipse.egit.ui.internal.repository.tree.FolderNode)2 RefNode (org.eclipse.egit.ui.internal.repository.tree.RefNode)2 WorkingDirNode (org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode)2 Dialog (org.eclipse.jface.dialogs.Dialog)2 Repository (org.eclipse.jgit.lib.Repository)2 RemoteConfig (org.eclipse.jgit.transport.RemoteConfig)2 File (java.io.File)1 Comparator (java.util.Comparator)1 List (java.util.List)1