Example usage for org.eclipse.jgit.transport URIish setPort

List of usage examples for org.eclipse.jgit.transport URIish setPort

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport URIish setPort.

Prototype

public URIish setPort(int n) 

Source Link

Document

Return a new URI matching this one, but with a different port.

Usage

From source file:org.eclipse.egit.ui.internal.clone.GerritConfigurationPage.java

License:Open Source License

private void setDefaults(RepositorySelection selection) {
    URIish uri = selection.getURI();/*www. ja v a2s  .co m*/
    URIish newPushURI = uri;
    if (Protocol.SSH.handles(uri)) {
        newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    } else if (Protocol.GIT.handles(uri)) {
        newPushURI = newPushURI.setScheme(Protocol.SSH.getDefaultScheme());
        newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    } else if (isHttpProtocol(uri)) {
        newPushURI = prependGerritHttpPathPrefix(newPushURI);
    }
    uriText.setText(newPushURI.toString());
    final String uriScheme = newPushURI.getScheme();
    if (uriScheme != null)
        scheme.select(scheme.indexOf(uriScheme));
    branch.setText(Constants.MASTER);
}

From source file:org.eclipse.egit.ui.internal.gerrit.GerritConfigurationPage.java

License:Open Source License

private void setDefaults(URIish uri, String targetBranch) {
    URIish newPushURI = uri;
    if (Protocol.SSH.handles(uri)) {
        newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    } else if (Protocol.GIT.handles(uri)) {
        newPushURI = newPushURI.setScheme(Protocol.SSH.getDefaultScheme());
        newPushURI = newPushURI.setPort(GERRIT_DEFAULT_SSH_PORT);
    } else if (isHttpProtocol(uri)) {
        newPushURI = prependGerritHttpPathPrefix(newPushURI);
    }/*from  ww w .  java2s .  c o m*/
    uriText.setText(newPushURI.toString());
    final String uriScheme = newPushURI.getScheme();
    if (uriScheme != null)
        scheme.select(scheme.indexOf(uriScheme));
    branch.setText(targetBranch != null ? targetBranch : Constants.MASTER);
}