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

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

Introduction

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

Prototype

public String toText() 

Source Link

Document

Get this configuration, formatted as a Git style text file.

Usage

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

License:Open Source License

private void gitConfig() {
    try {/* w  w w.j  a  v  a  2  s .  c  om*/
        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);
    }
}

From source file:org.wandora.application.tools.git.Status.java

License:Open Source License

@Override
public void execute(Wandora wandora, Context context) {

    try {/*w  w  w .ja  va  2  s .c  o m*/
        Git git = getGit();
        if (git != null) {
            setDefaultLogger();
            setLogTitle("Git status");

            Repository repository = git.getRepository();
            StoredConfig config = repository.getConfig();

            log("Git conf:");
            log(config.toText());

            log("Git status:");
            org.eclipse.jgit.api.Status status = git.status().call();
            log("Added: " + status.getAdded());
            log("Changed: " + status.getChanged());
            log("Conflicting: " + status.getConflicting());
            log("ConflictingStageState: " + status.getConflictingStageState());
            log("IgnoredNotInIndex: " + status.getIgnoredNotInIndex());
            log("Missing: " + status.getMissing());
            log("Modified: " + status.getModified());
            log("Removed: " + status.getRemoved());
            log("Untracked: " + status.getUntracked());
            log("UntrackedFolders: " + status.getUntrackedFolders());
            log("Ready.");
        } else {
            logAboutMissingGitRepository();
        }
    } catch (Exception e) {
        log(e);
    }
    setState(WAIT);
}