Package org.netbeans.api.project

Examples of org.netbeans.api.project.Sources


                throw new RuntimeException("No java sources in given project.");
            }
        }

        private FileObject getProjectResourcesRoot(Project project) {
            Sources srcs = ProjectUtils.getSources(project);
            SourceGroup[] resources =
                    srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
            if(resources.length > 0){
                return resources[0].getRootFolder();
            }else {
                // no resources in given project => place together with java sources
                return getProjectJavaSourcesRoot(project);
View Full Code Here


     * various properties for them influencing wizard appearance.
     */
    private WizardDescriptor.Panel[] getPanels() {
        if (panels == null) {
            Project p = Templates.getProject(wizard);
            Sources s = ProjectUtils.getSources(p);
            SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);
            WizardDescriptor.Panel customizedTargetChooser =
                    Templates.createSimpleTargetChooser(p, groups,
                        new LayoutDefinitionWizardPanel(wizard));

            panels = new WizardDescriptor.Panel[]{
View Full Code Here

     */
    public static SourceGroup[] getSourceGroups(Project project, String sourceType) {
   
        SourceGroup[] sg = new SourceGroup[] {};
        if(null != project){
            Sources sources = ProjectUtils.getSources(project);
            sg = sources.getSourceGroups(sourceType);
        }
       
        return sg;
    }
View Full Code Here

   
    static boolean isValidRoot (File file, File[] relatedRoots, File projectFolder) {
        Project p;
        if ((p = FileOwnerQuery.getOwner(file.toURI()))!=null
            && !file.getAbsolutePath().startsWith(projectFolder.getAbsolutePath()+File.separatorChar)) {
            final Sources sources = (Sources) p.getLookup().lookup(Sources.class);
            if (sources == null) {
                return false;
            }
            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(file);
View Full Code Here

            }
        }
    }

    private Iterable<? extends FileObject> getRoots() {
        Sources _src = null;
        synchronized (this) {
            if (this.roots != null) {
                return this.roots;
            }
            if (this.src == null) {
                this.src = this.project.getLookup().lookup(Sources.class);
                this.src.addChangeListener(sourcesChangeListener);
            }
            _src = this.src;
        }
        assert _src != null;
        final SourceGroup[] sgs = _src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        final List<FileObject> _roots = new ArrayList<FileObject>(sgs.length);
        for (SourceGroup sg : sgs) {
            final FileObject root = sg.getRootFolder();
            if (UnitTestForSourceQuery.findSources(root).length == 0) {
                _roots.add(root);
View Full Code Here

     * {@link J2SESources#fireChange} method.
     */
    public SourceGroup[] getSourceGroups(final String type) {
        return ProjectManager.mutex().readAccess(new Mutex.Action<SourceGroup[]>() {
            public SourceGroup[] run() {
                Sources _delegate;
                synchronized (J2SESources.this) {
                    if (delegate == null) {                   
                        delegate = initSources();
                        delegate.addChangeListener(J2SESources.this);
                    }
                    _delegate = delegate;
                }
                SourceGroup[] groups = _delegate.getSourceGroups(type);
                if (type.equals(Sources.TYPE_GENERIC)) {
                    FileObject libLoc = getSharedLibraryFolderLocation();
                    if (libLoc != null) {
                        SourceGroup[] grps = new SourceGroup[groups.length + 1];
                        System.arraycopy(groups, 0, grps, 0, groups.length);
View Full Code Here

       
        public List<SourceGroupKey> keys() {
            if (this.project.getProjectDirectory() == null || !this.project.getProjectDirectory().isValid()) {
                return Collections.EMPTY_LIST;
            }
            Sources sources = getSources();
            SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
           
            List result =  new ArrayList(groups.length);
            for( int i = 0; i < groups.length; i++ ) {
                result.add(new SourceGroupKey(groups[i]));
            }
View Full Code Here

            for (SourceGroup sg : javasg) {
                javaroots.add(sg.getRootFolder());
            }

            List<SourceGroup> list = new ArrayList<SourceGroup>();
            Sources srcs = ProjectUtils.getSources(project);
            SourceGroup[] groovygroup = srcs.getSourceGroups(ScalaSourcesImpl.TYPE_SCALA);
            for (int i = 0; i < groovygroup.length; i++) {
                if (!javaroots.contains(groovygroup[i].getRootFolder())) {
                    list.add(groovygroup[i]);
                }
            }
View Full Code Here

            return PackageView.createPackageView(group);
        }
       
        @Override
        public void addNotify() {
            Sources srcs = ProjectUtils.getSources(project);
            srcs.addChangeListener(this);
        }
View Full Code Here

            srcs.addChangeListener(this);
        }
       
        @Override
        public void removeNotify() {
            Sources srcs = ProjectUtils.getSources(project);
            srcs.removeChangeListener(this);
        }
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.