Package org.netbeans.api.project

Examples of org.netbeans.api.project.Sources


                else if (this.relatedEditMediator != null && this.relatedEditMediator.ownedFolders.contains(normalizedFile)) {
                    rootsFromRelatedSourceRoots.add (normalizedFile);
                    continue;
                }
                if ((p=FileOwnerQuery.getOwner(normalizedFile.toURI()))!=null && !p.getProjectDirectory().equals(project.getProjectDirectory())) {
                    final Sources sources = (Sources) p.getLookup().lookup (Sources.class);
                    if (sources == null) {
                        rootsFromOtherProjects.add (normalizedFile);
                        continue;
                    }
                    final SourceGroup[] sourceGroups = sources.getSourceGroups(Sources.TYPE_GENERIC);
                    final SourceGroup[] javaGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
                    final SourceGroup[] groups = new SourceGroup [sourceGroups.length + javaGroups.length];
                    System.arraycopy(sourceGroups,0,groups,0,sourceGroups.length);
                    System.arraycopy(javaGroups,0,groups,sourceGroups.length,javaGroups.length);
                    final FileObject projectDirectory = p.getProjectDirectory();
                    final FileObject fileObject = FileUtil.toFileObject(normalizedFile);
View Full Code Here


        Project[] open = OpenProjects.getDefault().getOpenProjects();
        return ArrayUtils.isEmpty(open) ? CollectionUtils.EMPTY_COLLECTION : Arrays.asList(open);
    }

    public static ClassPath getSourceClassPath(final Project project) {
        Sources sources = org.netbeans.api.project.ProjectUtils.getSources(project);
        SourceGroup srcGroup = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)[0];
        return ClassPath.getClassPath(srcGroup.getRootFolder(), ClassPath.SOURCE);
    }
View Full Code Here

        SourceGroup srcGroup = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)[0];
        return ClassPath.getClassPath(srcGroup.getRootFolder(), ClassPath.SOURCE);
    }

    public static ClasspathInfo getSourceClassPathInfo(final Project project) {
        Sources sources = org.netbeans.api.project.ProjectUtils.getSources(project);
        SourceGroup srcGroup = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)[0];
        return ClasspathInfo.create(srcGroup.getRootFolder());
    }
View Full Code Here

        return PackageUtils.getPackages(getSourceClassPath(project), includeRootPackage);
    }

    public static Collection<FileObject> getProjectFiles(final Project project, final FileType... types) {
        Collection<FileObject> fileObjects = new ArrayList<FileObject>();
        Sources srcs = org.netbeans.api.project.ProjectUtils.getSources(project);
        SourceGroup[] srcGrps = srcs.getSourceGroups(Sources.TYPE_GENERIC);
        for (SourceGroup srcGrp : srcGrps) {
            fileObjects.addAll(FileObjectUtils.getFiles(srcGrp.getRootFolder(), true, types));
        }
        return fileObjects;
    }
View Full Code Here

            /* It's a relative file path*/
            file = new File(projectOwner.getProjectDirectory().getPath(), path);
        }else{
            /* It's an element name. Assume is a java file */
            String filePath=path.replace(".", "/")+DEFAULT_EXTENSION;
            Sources sources = ProjectUtils.getSources(projectOwner);
            SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
            file = new File(sourceGroups[0].getRootFolder().getPath(), filePath);
        }
        return file;
    }
View Full Code Here

    /**
     * @param project
     * @return True if the project contains sources.
     */
    private boolean configureSourcesAndBinariesProperties(String module, Project project) {
        Sources sources = ProjectUtils.getSources(project);
        SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        if (sourceGroups != null && sourceGroups.length != 0) {
            String sourceProperty = "sonar.sources";
            if (module != null) {
                sourceProperty = module + "." + sourceProperty;
            }
View Full Code Here

        Set retVal = new HashSet();
        final FileObject documentBase = wm.getDocumentBase();
        Project project = FileOwnerQuery.getOwner(documentBase);

        Library sipLibrary = LibraryManager.getDefault().getLibrary(libname);
        Sources s = project.getLookup().lookup(Sources.class);
        SourceGroup[] sources = null;
        if (null != s) {
            sources = s.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        }
        if (sipLibrary != null) {
            Library[] sipLibs = new Library[1];
            sipLibs[0] = sipLibrary;
            boolean extended = false;
View Full Code Here

     * Initialize panels representing individual wizard's steps and sets
     * various properties for them influencing wizard appearance.
     */
    private WizardDescriptor.Panel[] getPanels() {
        Project project = Templates.getProject(wizard);
        Sources sources = ProjectUtils.getSources(project);
        SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        if (panels == null) {
            embedded = new SipListenerWizardPanel1();
            panels = new WizardDescriptor.Panel[]{
                JavaTemplates.createPackageChooser(project,sourceGroups,embedded)
            };
View Full Code Here

     */
    private WizardDescriptor.Panel[] getPanels() {
        if (panels == null) {
       
            Project project = Templates.getProject(wizard);
            Sources s = ProjectUtils.getSources(project);
            SourceGroup[] groups = s.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
            WizardDescriptor.Panel targetChooser =
                    0 == groups.length ?
                    Templates.createSimpleTargetChooser(
                        project,
                        groups,
View Full Code Here

//            "cs:utf-8,en:utf-8"
            return sb.toString();
        }
       
        private FileObject getProjectJavaSourcesRoot(Project project) {
            Sources srcs = ProjectUtils.getSources(project);
            SourceGroup[] javaSrcs =
                    srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
            if(javaSrcs.length > 0){
                return javaSrcs[0].getRootFolder();
            }else {
                throw new RuntimeException("No java sources in given project.");
            }
View Full Code Here

TOP

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

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.