Package org.nbgit

Examples of org.nbgit.OutputLogger


        RequestProcessor rp = Git.getInstance().getRequestProcessor(repository);
        GitProgressSupport support = new GitProgressSupport() {

            public void perform() {
                boolean bNoUpdates = true;
                OutputLogger logger = getLogger();

                logger.outputInRed(
                        NbBundle.getMessage(UpdateAction.class,
                        "MSG_UPDATE_TITLE")); // NOI18N
                logger.outputInRed(
                        NbBundle.getMessage(UpdateAction.class,
                        "MSG_UPDATE_TITLE_SEP")); // NOI18N
                logger.output(
                        NbBundle.getMessage(UpdateAction.class,
                        "MSG_UPDATE_INFO_SEP", revStr, root.getAbsolutePath())); // NOI18N
                List<String> list = updateAll(root, doForcedUpdate, revStr);

                if (list != null && !list.isEmpty()) {
                    bNoUpdates = isNoUpdates(list.get(0));
                    //logger.clearOutput();
                    logger.output(list);
                    logger.output(""); // NOI18N
                }
                // refresh filesystem to take account of changes
                FileObject rootObj = FileUtil.toFileObject(root);
                try {
                    rootObj.getFileSystem().refresh(true);
                } catch (Exception ex) {
                }

                // Force Status Refresh from this dir and below
                if (!bNoUpdates) {
                    GitUtils.forceStatusRefreshProject(ctx);
                }
                logger.outputInRed(
                        NbBundle.getMessage(UpdateAction.class,
                        "MSG_UPDATE_DONE")); // NOI18N
                logger.output(""); // NOI18N
            }
        };
        support.start(rp, repository, org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Update_Progress")); // NOI18N
    }
View Full Code Here


        final Project proj = GitUtils.getProject(context);
        File projFile = GitUtils.getProjectFile(proj);

        if (projFile == null) {
            OutputLogger logger = OutputLogger.getLogger(Git.GIT_OUTPUT_TAB_TITLE);
            logger.outputInRed(NbBundle.getMessage(InitAction.class, "MSG_CREATE_TITLE")); // NOI18N
            logger.outputInRed(NbBundle.getMessage(InitAction.class, "MSG_CREATE_TITLE_SEP")); // NOI18N
            logger.outputInRed(
                    NbBundle.getMessage(InitAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
            logger.output(""); // NOI18N
            JOptionPane.showMessageDialog(null,
                    NbBundle.getMessage(InitAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW"),// NOI18N
                    NbBundle.getMessage(InitAction.class, "MSG_CREATE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
                    JOptionPane.INFORMATION_MESSAGE);
            logger.closeLog();
            return;
        }
        String projName = GitProjectUtils.getProjectName(projFile);

        File rootDir = getCommonAncestor(files);
        final File root = getCommonAncestor(rootDir, projFile);
        if (root == null) {
            return;
        }
        final String prjName = projName;
        final Repository repo = git.getRepository(root);

        RequestProcessor rp = git.getRequestProcessor(root.getAbsolutePath());

        GitProgressSupport supportCreate = new GitProgressSupport() {

            public void perform() {
                try {
                    OutputLogger logger = getLogger();
                    logger.outputInRed(
                            NbBundle.getMessage(InitAction.class,
                            "MSG_CREATE_TITLE")); // NOI18N
                    logger.outputInRed(
                            NbBundle.getMessage(InitAction.class,
                            "MSG_CREATE_TITLE_SEP")); // NOI18N
                    logger.output(
                            NbBundle.getMessage(InitAction.class,
                            "MSG_CREATE_INIT", prjName, root)); // NOI18N

                    repo.create();
                } catch (IOException ex) {
                    notifyLater(ex);
                }
            }
        };
        supportCreate.start(rp, root.getAbsolutePath(),
                org.openide.util.NbBundle.getMessage(InitAction.class, "MSG_Create_Progress")); // NOI18N

        GitProgressSupport supportAdd = new GitProgressSupport() {

            public void perform() {
                OutputLogger logger = getLogger();
                try {
                    List<File> files = getFileList(repo, root);
                    IndexBuilder.create(repo).
                            log(logger).
                            addAll(files).
                            write();

                    logger.output(
                            NbBundle.getMessage(InitAction.class,
                            "MSG_CREATE_ADD", files.size(), root.getAbsolutePath())); // NOI18N
                    logger.output(""); // NOI18N
                    logger.outputInRed(NbBundle.getMessage(InitAction.class, "MSG_CREATE_DONE_WARNING")); // NOI18N
                } catch (IOException ex) {
                    notifyLater(ex);
                } finally {
                    logger.outputInRed(NbBundle.getMessage(InitAction.class, "MSG_CREATE_DONE")); // NOI18N
                    logger.output(""); // NOI18N
                }
            }
        };

        supportAdd.start(rp, root.getAbsolutePath(),
View Full Code Here

            @Override
            protected void perform() {
                String projName = (projFile != null)
                                  ? GitProjectUtils.getProjectName(projFile)
                                  : null;
                OutputLogger logger = getLogger();
                try {

                    if (projName != null) {
                        logger.outputInRed(
                                NbBundle.getMessage(CloneAction.class,
                                "MSG_CLONE_FROM", projName, source)); // NOI18N
                        logger.outputInRed(
                                NbBundle.getMessage(CloneAction.class,
                                "MSG_CLONE_TO", projName, target)); // NOI18N
                    } else {
                        logger.outputInRed(
                                NbBundle.getMessage(CloneAction.class,
                                "MSG_EXTERNAL_CLONE_FROM", source)); // NOI18N
                        logger.outputInRed(
                                NbBundle.getMessage(CloneAction.class,
                                "MSG_EXTERNAL_CLONE_TO", target)); // NOI18N
                    }
                    logger.output(""); // NOI18N

                    doInit(repo, source, logger);
                    FetchResult r = doFetch(repo, logger);
                    Ref branch = r.getAdvertisedRef(Constants.HEAD);
                    if (branch == null) {
                        this.cancel();
                    }
                    doCheckout(repo, branch, logger);

                    if (isLocalClone) {
                        Git git = Git.getInstance();
                        ProjectManager projectManager = ProjectManager.getDefault();
                        File normalizedCloneFolder = FileUtil.normalizeFile(target);
                        File cloneProjFile;
                        if (!projIsRepos) {
                            String name = (projFile != null)
                                    ? projFile.getAbsolutePath().substring(source.getPath().length() + 1)
                                    : target.getAbsolutePath();
                            cloneProjFile = new File(normalizedCloneFolder, name);
                        } else {
                            cloneProjFile = normalizedCloneFolder;
                        }
                        openProject(cloneProjFile, projectManager, git);
                    } else if (scanForProjects) {
                        CloneCompleted cc = new CloneCompleted(target);
                        if (isCanceled()) {
                            return;
                        }
                        cc.scanForProjects(this);
                    }

                } catch (URISyntaxException usex) {
                    notifyLater(usex);
                } catch (IOException ex) {
                    notifyLater(ex);
                } finally {
                    if (!isLocalClone) {
                        logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
                        logger.output(""); // NOI18N
                    }
                }
            }

            private void openProject(final File cloneProjFile, final ProjectManager projectManager, final Git git) {
                SwingUtilities.invokeLater(new Runnable() {

                    public void run() {
                        // Open and set focus on the cloned project if possible
                        OutputLogger logger = getLogger();
                        try {
                            FileObject cloneProj = FileUtil.toFileObject(cloneProjFile);
                            Project proj = null;
                            if (cloneProjFile != null && cloneProj != null) {
                                proj = projectManager.findProject(cloneProj);
                            }
                            if (proj != null) {
                                GitProjectUtils.openProject(proj, this, false);
                                                      // TODO: GitModuleConfig.getDefault().getSetMainProject()
                                git.versionedFilesChanged();
                                git.refreshAllAnnotations();
                            } else {
                                logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN")); // NOI18N
                            }
                        } catch (IOException ioe) {
                            notifyLater(ioe);
                        } finally {
                            logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
                            logger.output("")// NOI18N
                        }
                    }
                });
            }
        };
View Full Code Here

        if (searchingUrl()) {
            RequestProcessor rp = Git.getInstance().getRequestProcessor(master.getRepositoryUrl());
            GitProgressSupport support = new GitProgressSupport() {

                public void perform() {
                    OutputLogger logger = getLogger();
                    search(master.getRepositoryUrl(), null, fromRevision, toRevision, this, logger);
                }
            };
            support.start(rp, master.getRepositoryUrl(), NbBundle.getMessage(SearchExecutor.class, "MSG_Search_Progress")); // NOI18N
        } else {
            for (final String rootUrl : workFiles.keySet()) {
                final Set<File> files = workFiles.get(rootUrl);
                RequestProcessor rp = Git.getInstance().getRequestProcessor(rootUrl);
                GitProgressSupport support = new GitProgressSupport() {

                    public void perform() {
                        OutputLogger logger = getLogger();
                        search(rootUrl, files, fromRevision, toRevision, this, logger);
                    }
                };
                support.start(rp, rootUrl, NbBundle.getMessage(SearchExecutor.class, "MSG_Search_Progress")); // NOI18N
            }
View Full Code Here

    }

    public void performAction(ActionEvent e) {
        final File root = GitUtils.getRootFile(context);
        if (root == null) {
            OutputLogger logger = OutputLogger.getLogger(Git.GIT_OUTPUT_TAB_TITLE);
            logger.outputInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_TITLE")); // NOI18N
            logger.outputInRed(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_TITLE_SEP")); // NOI18N
            logger.outputInRed(
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
            logger.output(""); // NOI18N
            logger.closeLog();
            JOptionPane.showMessageDialog(null,
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW"),// NOI18N
                    NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
                    JOptionPane.INFORMATION_MESSAGE);
            return;
View Full Code Here

            org.netbeans.modules.versioning.util.Utils.insert(GitModuleConfig.getDefault().getPreferences(), RECENT_COMMIT_MESSAGES, origMessage, 20);
            RequestProcessor rp = Git.getInstance().getRequestProcessor(repository.getAbsolutePath());
            GitProgressSupport support = new GitProgressSupport() {

                public void perform() {
                    OutputLogger logger = getLogger();
                    performCommit(message, commitFiles, ctx, this, prjName, logger);
                }
            };
            support.start(rp, repository.getAbsolutePath(), org.openide.util.NbBundle.getMessage(CommitAction.class, "LBL_Commit_Progress")); // NOI18N
        }
View Full Code Here

        File root = GitUtils.getRootFile(context);
        File[] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
        boolean bNotManaged = (root == null) || (files == null || files.length == 0);

        if (bNotManaged) {
            OutputLogger logger = OutputLogger.getLogger(Git.GIT_OUTPUT_TAB_TITLE);
            logger.outputInRed(NbBundle.getMessage(DiffAction.class, "MSG_DIFF_TITLE")); // NOI18N
            logger.outputInRed(NbBundle.getMessage(DiffAction.class, "MSG_DIFF_TITLE_SEP")); // NOI18N
            logger.outputInRed(
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
            logger.output(""); // NOI18N
            logger.closeLog();
            JOptionPane.showMessageDialog(null,
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW"),// NOI18N
                    NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
                    JOptionPane.INFORMATION_MESSAGE);
            return;
View Full Code Here

TOP

Related Classes of org.nbgit.OutputLogger

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.