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

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

Introduction

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

Prototype

@Override
public RemoteConfig call() throws GitAPIException 

Source Link

Document

Executes the remote command with all the options and parameters collected by the setter methods of this class.

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  .  j a  v a 2  s .  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);
        }
}