Package org.netbeans.api.project

Examples of org.netbeans.api.project.ProjectManager


                    projectDir);
            return;
        }

        try {
            ProjectManager projectManager = ProjectManager.getDefault();
            try (Closeable safeToOpenKey = NbGradleProjectFactory.safeToOpen(projectDirObj)) {
                assert safeToOpenKey != null; // Avoid warning

                // We have to clear this list because if the project
                // does not have build.gradle, NetBeans might have
                // already determined that the directory does not
                // contain a project.
                projectManager.clearNonProjectCache();

                Project subProject = projectManager.findProject(projectDirObj);
                if (subProject == null) {
                    LOGGER.log(Level.WARNING,
                            "Project cannot be found: {0}",
                            projectDir);
                    return;
View Full Code Here


                    }
                    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();
View Full Code Here

    public static String getProjectName(final File root) {
        if (root == null || !root.isDirectory()) {
            return null;
        }
        final ProjectManager projectManager = ProjectManager.getDefault();
        FileObject rootFileObj = FileUtil.toFileObject(FileUtil.normalizeFile(root));
        // This can happen if the root is "ssh://<something>"
        if (rootFileObj == null || projectManager == null) {
            return null;
        }
        String res = null;
        if (projectManager.isProject(rootFileObj)) {
            try {
                Project prj = projectManager.findProject(rootFileObj);

                res = getProjectName(prj);
            } catch (Exception ex) {
                Git.LOG.log(Level.FINE, "getProjectName() file: {0} {1}", new Object[]{rootFileObj.getPath(), ex.toString()}); // NOI18N
            }
View Full Code Here

        // We assume that the toplevel directory should not be ignored.
        if (topFile == null || topFile.equals(file)) {
            return false;        // We assume that the Project should not be ignored.
        }
        if (file.isDirectory()) {
            ProjectManager projectManager = ProjectManager.getDefault();
            if (projectManager.isProject(FileUtil.toFileObject(file))) {
                return false;
            }
        }

        Repository repo = Git.getInstance().getRepository(topFile);
View Full Code Here

TOP

Related Classes of org.netbeans.api.project.ProjectManager

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.