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

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

Introduction

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

Prototype

@Deprecated
public void setPush(boolean push) 

Source Link

Document

Whether to change the push URL of the remote instead of the fetch URL.

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 {/*from   w w w .  jav a  2s.  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);
        }
}