Examples of GitProgressSupport


Examples of org.nbgit.GitProgressSupport

            final File projFile,
            final boolean isLocalClone,
            final boolean scanForProjects) {

        RequestProcessor rp = Git.getInstance().getRequestProcessor(source.toString());
        final GitProgressSupport support = new GitProgressSupport() {

            Repository repo = Git.getInstance().getRepository(target);

            @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
                        }
                    }
                });
            }
        };

        //support.setRepositoryRoot(source);

        return support.start(rp, source.toString(), org.openide.util.NbBundle.getMessage(CloneAction.class, "LBL_Clone_Progress", source)); // NO
    }
View Full Code Here

Examples of org.nbgit.GitProgressSupport

            execDir = context.getRootFiles().iterator().next();
        } else {
            execDir = root;
        }

        GitProgressSupport support = new GitProgressSupport() {

            public void perform() {
                execute(command, execDir, showOutput ? getLogger() : null);
            }

        };

        /* TODO: Use MessageFormat */
        support.start(rp, root.getAbsolutePath(),
            NbBundle.getMessage(CustomAction.class, "CustomActionProgress") + " " + path.getName()); // NOI18N
    }
View Full Code Here

Examples of org.nbgit.GitProgressSupport

    public static void conflictResolved(File repository, final File[] files) {
        if (repository == null || files == null || files.length == 0) {
            return;
        }
        RequestProcessor rp = Git.getInstance().getRequestProcessor(repository);
        GitProgressSupport support = new GitProgressSupport() {

            public void perform() {
                for (int i = 0; i < files.length; i++) {
                    if (isCanceled()) {
                        return;
                    }
                    File file = files[i];
                    ConflictResolvedAction.perform(file);
                }
            }
        };
        support.start(rp, repository.getAbsolutePath(), NbBundle.getMessage(ConflictResolvedAction.class, "MSG_ConflictResolved_Progress")); // NOI18N
    }
View Full Code Here

Examples of org.nbgit.GitProgressSupport

        final String toRevision = criteria.getTo();

        completedSearches = 0;
        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

Examples of org.nbgit.GitProgressSupport

                origMessage = stripSpace(origMessage);
            }
            final String message = origMessage;
            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
TOP
Copyright © 2018 www.massapi.com. 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.