Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RepositoryConfig


        return repo == null ? null : repo.getConfig();
    }

    public boolean addRepositoryActions(JMenu menu, CustomActionBuilder builder) {
        RepositoryConfig config = getRepositoryConfig(builder.getContext());
        int actions = 0;

        for (String action : config.getSubsections("nbgit")) {
            if (action.startsWith("action") && load(builder, config, action)) {
                menu.add(builder.build());
                actions++;
            }
        }
View Full Code Here


                return null;
            }

            int i = 0;
            if (isRepoSpecific()) {
                RepositoryConfig config = getRepositoryConfig(getContext());
                Collection<String> subsections = config.getSubsections("nbgit");

                while (subsections.contains("action" + i)) {
                    i++;
                }

                for (Option option : Option.values()) {
                    String value = this.getValue(option);
                    config.setString("nbgit", "action" + i, option.name(), value);
                }

                try {
                    config.save();
                } catch (IOException ex) {
                }
            } else {
                Preferences prefs = GitModuleConfig.getDefault().getPreferences();
View Full Code Here

    }

    public Properties getProperties(File file) {
        Properties props = new Properties();
        Repository repo = Git.getInstance().getRepository(file);
        RepositoryConfig config = repo.getConfig();

        props.setProperty("user.email", config.getAuthorEmail()); // NOI18N
        props.setProperty("user.name", config.getAuthorName()); // NOI18N

        boolean signOff = config.getBoolean("nbgit", "signoff", getSignOffCommits());
        props.setProperty("nbgit.signoff", signOff ? "yes" : "no"); // NOI18N

        boolean stripSpace = config.getBoolean("nbgit", "stripspace", getStripSpace());
        props.setProperty("nbgit.stripspace", stripSpace ? "yes" : "no"); // NOI18N

        return props;
    }
View Full Code Here

                protected void perform() {
                    Repository repo = Git.getInstance().getRepository(root);
                    if (repo == null) {
                        return;
                    }
                    RepositoryConfig config = repo.getConfig();
                    boolean save = false;
                    GitPropertiesNode[] gitPropertiesNodes = propTable.getNodes();
                    for (int i = 0; i < gitPropertiesNodes.length; i++) {
                        String name = gitPropertiesNodes[i].getName();
                        String value = gitPropertiesNodes[i].getValue().trim();
                        if (value.length() == 0) {
                            continue;
                        }

                        if (name.equals("user.name")) {
                            config.setString("user", null, "name", value);
                            save = true;
                        }

                        if (name.equals("user.email")) {
                            if (!GitModuleConfig.getDefault().isEmailValid(value)) {
                                GitUtils.warningDialog(GitProperties.class,
                                                       "MSG_WARN_EMAIL_TEXT", // NOI18N
                                                       "MSG_WARN_EMAIL_TITLE"); // NOI18N
                                return;
                            }
                            config.setString("user", null, "email", value);
                            save = true;
                        }

                        if (name.equals("nbgit.signoff")) {
                            config.setString("nbgit", null, "signoff", value);
                            save = true;
                        }

                        if (name.equals("nbgit.stripspace")) {
                            config.setString("nbgit", null, "stripspace", value);
                            save = true;
                        }
                    }

                    try {
                        if (save)
                            config.save();
                    } catch (IOException ex) {
                        Exceptions.printStackTrace(ex);
                    }
                }
            };
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.RepositoryConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.