Example usage for org.eclipse.jgit.api RemoteSetUrlCommand setUri

List of usage examples for org.eclipse.jgit.api RemoteSetUrlCommand setUri

Introduction

In this page you can find the example usage for org.eclipse.jgit.api RemoteSetUrlCommand setUri.

Prototype

@Deprecated
public void setUri(URIish uri) 

Source Link

Document

The new URL for the remote.

Usage

From source file:com.chungkwong.jgitgui.RemoteTreeItem.java

License:Open Source License

private void gitRemoteResetURL() {
    TextInputDialog branchDialog = new TextInputDialog();
    branchDialog.setTitle(java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text")
            .getString("CHOOSE A NEW URL FOR THE REMOTE CONFIGURE"));
    branchDialog.setHeaderText(java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text")
            .getString("ENTER THE NEW URL OF THE REMOTE CONFIGURE:"));
    Optional<String> name = branchDialog.showAndWait();
    if (name.isPresent())
        try {/*ww  w.ja v  a2s. c o  m*/
            RemoteSetUrlCommand command = ((Git) getParent().getValue()).remoteSetUrl();
            command.setName(((RemoteConfig) getValue()).getName());
            command.setUri(new URIish(name.get()));
            command.setPush(true);
            command.call();
            command = ((Git) getParent().getValue()).remoteSetUrl();
            command.setName(((RemoteConfig) getValue()).getName());
            command.setUri(new URIish(name.get()));
            command.setPush(false);
            command.call();
        } catch (Exception ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            Util.informUser(ex);
        }
}