Package org.netbeans.api.project

Examples of org.netbeans.api.project.SourceGroup


        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


        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

        }

        protected Node[] createNodes(Object key) {

            FileObject fObj = null;
            SourceGroup grp = null;
            boolean isFile = false;

            if (key instanceof SourceGroup) {
                fObj = ((SourceGroup) key).getRootFolder();
                grp = (SourceGroup) key;
            } else if (key instanceof Key) {
                fObj = ((Key) key).folder;
                grp = ((Key) key).group;
                if (!fObj.isFolder()) {
                    isFile = true;
                }
            }

            try {
                DataObject dobj = DataObject.find(fObj);
                FilterNode fn = (isFile ?
                        new FilterNode(dobj.getNodeDelegate(), Children.LEAF) :
                        new FilterNode(dobj.getNodeDelegate(), new SourceGroupsChildren(fObj, grp)));

                if (key instanceof SourceGroup) {
                    fn.setDisplayName(grp.getDisplayName());
                }

                return new Node[]{fn};
            } catch (DataObjectNotFoundException e) {
                return null;
View Full Code Here

        public ParsedModel<Object> parseModel(ModelLoadResult retrievedModels) {
            return new ParsedModel<>(new Object());
        }

        private static SourceGroup getTestSourceGroup() {
            return new SourceGroup() {

                @Override
                public FileObject getRootFolder() {
                    return FileUtil.getConfigRoot();
                }
View Full Code Here

        Lookup lookup = rootProject.getLookup();
        Sources sources = lookup.lookup(Sources.class);
        assertNotNull("sources", sources);

        SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
        SourceGroup foundGroup = findGroupByName(CustomSourcesMergerExtDef.TEST_SRC_GROUP_NAME, groups);
        assertNotNull("Must have the source groups merged.", foundGroup);
    }
View Full Code Here

    private Set<SourceRootID> addSourceRoots(List<SingleNodeFactory> toPopulate) {
        List<NamedSourceRoot> namedRoots = javaExt.getCurrentModel().getMainModule().getNamedSourceRoots();
        Set<SourceRootID> result = CollectionUtils.newHashSet(namedRoots.size());

        for (final NamedSourceRoot root: namedRoots) {
            final SourceGroup group = GradleProjectSources.tryCreateSourceGroup(root);
            if (group == null) {
                continue;
            }

            JavaSourceGroupID groupID = root.getGroupID();
View Full Code Here

//   - org.netbeans.modules.maven.debug.DebuggerChecker
//   - org.netbeans.modules.maven.execute.DefaultReplaceTokenProvider
public final class DebugUtils {
    public static String getActiveClassName(Project project, Lookup lookup) {
        FileObject[] filesOnLookup = extractFileObjectsfromLookup(lookup);
        SourceGroup group = findGroup(ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA), filesOnLookup);

        FileObject file = null;
        for (FileObject currentFile : filesOnLookup) {
            if (!currentFile.isFolder()) {
                file = currentFile;
                break;
            }
        }

        StringBuilder className = new StringBuilder();
        if (group != null && file != null) {
            if (filesOnLookup.length < 1) {
                return "";
            }

            String relP = FileUtil.getRelativePath(group.getRootFolder(), file.getParent());
            if (relP == null) {
                return "";
            }

            if (!relP.isEmpty()) {
View Full Code Here

    /**
     * Finds the one source group, if any, which contains all of the listed
     * files.
     */
    private static SourceGroup findGroup(SourceGroup[] groups, FileObject[] files) {
        SourceGroup selected = null;
        for (FileObject file : files) {
            for (SourceGroup group : groups) {
                FileObject root = group.getRootFolder();
                if (file == root || FileUtil.isParentOf(root, file)) { // or group.contains(file)?
                    if (selected == null) {
View Full Code Here

    private static Map<String, List<SourceGroup>> findSourceGroupsOfModule(
            NbJavaModule module) {
        Map<String, List<SourceGroup>> result = new HashMap<>(8);

        for (NamedSourceRoot root: module.getNamedSourceRoots()) {
            SourceGroup newGroup = tryCreateSourceGroup(root);
            if (newGroup == null) {
                continue;
            }

            JavaSourceGroupID groupID = root.getGroupID();

            if (groupID.getGroupName() == JavaSourceGroupName.RESOURCES) {
                addToMultiMap(JavaProjectConstants.SOURCES_TYPE_RESOURCES, newGroup, result);
            }
            else {
                addToMultiMap(JavaProjectConstants.SOURCES_TYPE_JAVA, newGroup, result);
                if (groupID.isTest()) {
                    addToMultiMap(JavaProjectConstants.SOURCES_HINT_TEST, newGroup, result);
                }

                // TODO: Consider "SOURCES_TYPE_GROOVY" and "SOURCES_TYPE_SCALA", "SOURCES_TYPE_ANTLR"
            }
        }

        for (NbListedDir listedDir: module.getListedDirs()) {
            SourceGroup newGroup = tryCreateSourceGroup(listedDir);
            if (newGroup != null) {
                addToMultiMap(JavaProjectConstants.SOURCES_TYPE_RESOURCES, newGroup, result);
            }
        }
View Full Code Here

            //just in case, hold on to this
            //speakString = classReflection(o,"sun.awt.shell.Win32ShellFolder2","getDisplayName");
        }
        else if(o instanceof SourceGroup) {
            SourceGroup group = (SourceGroup)o;
            sayString = group.getDisplayName();
        }
        else if(o instanceof Project) {
            Project proj = (Project) o;
            ProjectInformation info = proj.getLookup().lookup(ProjectInformation.class);
            sayString = info.getDisplayName();
View Full Code Here

TOP

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

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.