Java Code Examples for org.netbeans.api.project.SourceGroup#getName()
The following examples show how to use
org.netbeans.api.project.SourceGroup#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDataDirsNodeFactory.java From netbeans with Apache License 2.0 | 6 votes |
public Node node(final SourceGroup key) { try { Node nodeDelegate = DataObject.find(key.getRootFolder()).getNodeDelegate(); return new FilterNode(nodeDelegate, null, new ProxyLookup(nodeDelegate.getLookup(), Lookups.singleton(new PathFinder(key)))) { @Override public String getName() { return key.getName(); } @Override public String getDisplayName() { return key.getDisplayName(); } }; } catch (DataObjectNotFoundException ex) { throw new AssertionError(ex); } }
Example 2
Source File: MiscPrivateUtilities.java From netbeans with Apache License 2.0 | 6 votes |
public static ClassPath getClassPath(Project project, String type) { ClassPathProvider provider = project.getLookup().lookup(ClassPathProvider.class); if (provider == null) { return null; } Sources sources = project.getLookup().lookup(Sources.class); if (sources == null) { return null; } SourceGroup[] sourceGroups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); List<ClassPath> classPaths = new ArrayList<ClassPath>(sourceGroups.length); for (SourceGroup sourceGroup : sourceGroups) { String sourceGroupId = sourceGroup.getName(); if (sourceGroupId != null && sourceGroupId.contains("test")) { // NOI18N continue; } FileObject rootFolder = sourceGroup.getRootFolder(); ClassPath path = provider.findClassPath(rootFolder, type); classPaths.add(path); } return ClassPathSupport.createProxyClassPath(classPaths.toArray(new ClassPath[classPaths.size()])); }
Example 3
Source File: TreeRootNode.java From netbeans with Apache License 2.0 | 6 votes |
private TreeRootNode(Node originalNode, SourceGroup group, GrailsProject project, Type type) { super(originalNode, new PackageFilterChildren(originalNode), new ProxyLookup( originalNode.getLookup(), Lookups.fixed( new PathFinder(group), // no need for explicit search info // Adding TemplatesImpl to Node's lookup to narrow-down // number of displayed templates with the NewFile action. // see # 122942 new TemplatesImpl(project, group) ) )); String pathName = group.getName(); setShortDescription(pathName.substring(project.getProjectDirectory().getPath().length() + 1)); this.group = group; this.visualType = type; group.addPropertyChangeListener(WeakListeners.propertyChange(this, group)); }
Example 4
Source File: CPExtender.java From netbeans with Apache License 2.0 | 5 votes |
private static String findScope(SourceGroup grp, String type) { String scope = ClassPath.EXECUTE.equals(type) || JavaClassPathConstants.MODULE_EXECUTE_PATH.equals(type)? Artifact.SCOPE_RUNTIME : null; //NOI18N //figure if we deal with test or regular sources. String name = grp.getName(); if (MavenSourcesImpl.NAME_TESTSOURCE.equals(name)) { scope = "test"; //NOI18N } if (scope == null && (JavaClassPathConstants.COMPILE_ONLY.equals(type) || JavaClassPathConstants.PROCESSOR_PATH.equals(type))) { scope = Artifact.SCOPE_PROVIDED; } return scope; }
Example 5
Source File: SourcesNodeFactory.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({"# {0} - label of source group", "# {1} - project name", "ERR_WrongSG={0} is owned by project {1}, cannot be used here, see issue #138310 for details."}) @Override public Node node(SourceGroup group) { Project owner = FileOwnerQuery.getOwner(group.getRootFolder()); if (owner != project) { if (owner == null) { //#152418 if project for folder is not found, just look the other way.. Logger.getLogger(SourcesNodeFactory.class.getName()).log(Level.INFO, "Cannot find a project owner for folder {0}", group.getRootFolder()); //NOI18N return null; } AbstractNode erroNode = new AbstractNode(Children.LEAF); String prjText = ProjectUtils.getInformation(owner).getDisplayName(); //TODO: Could this happen? Use Bundle. erroNode.setDisplayName("Error Node: " + group.getDisplayName() + " " + prjText); return erroNode; } String name = group.getName(); Node ret; switch(name) { case "42gatling.data": case "43gatling.bodies": case "49gatling.resources": ret = ResourcesFolderNode.createResourcesFolderNode(group); break; default: ret = PackageView.createPackageView(group); } ret.setShortDescription(FileUtil.getRelativePath(project.getProjectDirectory(), group.getRootFolder())); return ret; }