Example usage for org.eclipse.jgit.lib StoredConfig fromText

List of usage examples for org.eclipse.jgit.lib StoredConfig fromText

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib StoredConfig fromText.

Prototype

public void fromText(String text) throws ConfigInvalidException 

Source Link

Document

Clear this configuration and reset to the contents of the parsed string.

Usage

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

License:Open Source License

private void gitConfig() {
    try {//from  w w w . j a v  a  2  s.com
        StoredConfig config = ((Git) getValue()).getRepository().getConfig();
        Dialog dialog = new Dialog();
        dialog.setTitle(
                java.util.ResourceBundle.getBundle("com/chungkwong/jgitgui/text").getString("CONFIGURE"));
        TextArea area = new TextArea(config.toText());
        dialog.getDialogPane().setContent(area);
        dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.APPLY);
        dialog.showAndWait();
        if (dialog.getResult().equals(ButtonType.APPLY)) {
            config.fromText(area.getText());
            config.save();
        }
    } catch (Exception ex) {
        Logger.getLogger(GitTreeItem.class.getName()).log(Level.SEVERE, null, ex);
        Util.informUser(ex);
    }
}