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

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

Introduction

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

Prototype

@Deprecated
public void setName(String name) 

Source Link

Document

The name of the remote to change the URL for.

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 {/* w  w w  . j av a  2s.  co  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);
        }
}