@Override public String getName() { if(sourceGroup != null) { return sourceGroup.getName(); } return name; }
@Override public String getName() { return group.getName(); }
public String getName() { return g.getName(); }
@Override public String getName() { return g.getName(); }
public @Override String getName() { return g.getName(); }
private SourceGroup[] getTestRoots(Sources srcs) { SourceGroup[] groups = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); assert groups != null : "Cannot return null from Sources.getSourceGroups: " + srcs; //XXX - have to filter out regular source roots, there should //be better way to do this... (Hint: use UnitTestForSourceQuery) //${test - Ant based projects //2TestSourceRoot - Maven projects List<SourceGroup> result = new ArrayList<SourceGroup>(2); for (SourceGroup sg : groups) { if (sg.getName().startsWith("${test") || "2TestSourceRoot".equals(sg.getName())) { //NOI18N result.add(sg); } } return result.toArray(new SourceGroup[result.size()]); } }
private SourceGroup[] getTestRoots(Sources srcs) { SourceGroup[] groups = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); assert groups != null : "Cannot return null from Sources.getSourceGroups: " + srcs; //XXX - have to filter out regular source roots, there should //be better way to do this... (Hint: use UnitTestForSourceQuery) //${test - Ant based projects //2TestSourceRoot - Maven projects List<SourceGroup> result = new ArrayList<SourceGroup>(2); for (SourceGroup sg : groups) { if (sg.getName().startsWith("${test") || "2TestSourceRoot".equals(sg.getName())) { //NOI18N result.add(sg); } } return result.toArray(new SourceGroup[result.size()]); } }
public String getName() { if ( isProjectDir ) { return pi.getName(); } else { String n = group.getName(); if (n == null) { n = "???"; // NOI18N ErrorManager.getDefault().log(ErrorManager.WARNING, "SourceGroup impl of type " + group.getClass().getName() + " specified a null getName(); this is illegal"); } return n; } }
@Override public String getName() { if (isProjectDir) { return pi.getName(); } else { String n = group.getName(); if (n == null) { n = "???"; // NOI18N ErrorManager.getDefault().log(ErrorManager.WARNING, "SourceGroup impl of type " + group.getClass().getName() + " specified a null getName(); this is illegal"); // NOI18N } return n; } }
private ClassPath getProjectClasspath(Project prj) { Sources srcs = ProjectUtils.getSources(prj); SourceGroup[] srcGroups = srcs.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (SourceGroup group : srcGroups) { if (group.getName().toLowerCase().contains("source")) { return ClassPath.getClassPath(group.getRootFolder(), ClassPath.EXECUTE); } } return null; }
@Override public Node node(SourceGroupKey key) { String groupPath = key.group.getName(); String groupName = groupPath.substring(groupPath.lastIndexOf("/") + 1); // NOI18N if (treeViewBag.contains(groupName)) { try { DataFolder folder = DataFolder.findFolder(key.fileObject); if ("lib".equals(groupName)) { return new TreeRootNode(folder, key.group, project, TreeRootNode.Type.LIBRARY); } else { return new TreeRootNode(folder, key.group, project, TreeRootNode.Type.FOLDER); } } catch (IllegalArgumentException ex) { return null; // It might happened sometimes - see issue 208426 } } // The rest should have package view Look & Feel return PackageView.createPackageView(key.group); }
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()])); }
/** * Convenience method to obtain the source root folder. * @param project the Project object * @return the FileObject of the source root folder */ static FileObject getSourceRoot(Project project) { if (project == null) { return null; } // Search the ${src.dir} Source Package Folder first, use the first source group if failed. Sources src = ProjectUtils.getSources(project); SourceGroup[] grp = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (int i = 0; i < grp.length; i++) { if ("${src.dir}".equals(grp[i].getName())) { // NOI18N return grp[i].getRootFolder(); } } // if (grp.length != 0) { // return grp[0].getRootFolder(); // } return null; }
/** * Convenience method to obtain the source root folder. * @param project the Project object * @return the FileObject of the source root folder */ public static FileObject getSourceRoot(Project project) { if (project == null) { return null; } // Search the ${src.dir} Source Package Folder first, use the first source group if failed. Sources src = ProjectUtils.getSources(project); SourceGroup[] grp = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (int i = 0; i < grp.length; i++) { if ("${src.dir}".equals(grp[i].getName())) { // NOI18N return grp[i].getRootFolder(); } } if (grp.length != 0) { return grp[0].getRootFolder(); } return null; }
/** * Convenience method to obtain the source root folder. * @param project the Project object * @return the FileObject of the source root folder */ private static FileObject getSourceRoot(Project project) { if (project == null) { return null; } // Search the ${src.dir} Source Package Folder first, use the first source group if failed. Sources src = ProjectUtils.getSources(project); SourceGroup[] grp = src.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (int i = 0; i < grp.length; i++) { if ("${src.dir}".equals(grp[i].getName())) { // NOI18N return grp[i].getRootFolder(); } } if (grp.length != 0) { return grp[0].getRootFolder(); } return null; }
private String getPackageName(FileObject file){ FileObject parent = file.getParent(); Sources sources = ProjectUtils.getSources(project); SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); String packageName = null; for (int i = 0; i < groups.length && packageName == null; i++) { packageName = FileUtil.getRelativePath(groups[i].getRootFolder(), parent); if (packageName != null) { packageName = groups[i].getName() + "/" + packageName; // NOI18N } } return packageName + ""; // NOI18N }
private String getPackageName(FileObject file){ FileObject parent = file.getParent(); Sources sources = ProjectUtils.getSources(project); SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); String packageName = null; for (int i = 0; i < groups.length && packageName == null; i++) { packageName = FileUtil.getRelativePath(groups[i].getRootFolder(), parent); if (packageName != null) { packageName = groups[i].getName() + "/" + packageName; } } return packageName + ""; }
private String getPackageName(FileObject file){ FileObject parent = file.getParent(); Sources sources = ProjectUtils.getSources(project); SourceGroup[] groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); String packageName = null; for (int i = 0; i < groups.length && packageName == null; i++) { packageName = FileUtil.getRelativePath(groups[i].getRootFolder(), parent); if (packageName != null) { packageName = groups[i].getName() + "/" + packageName; } } return packageName + ""; }
private PackageRootNode( SourceGroup group, Children ch) { super(ch, new ProxyLookup(createLookup(group), Lookups.singleton( SearchInfoDefinitionFactory.createSearchInfoBySubnodes(ch)))); this.group = group; file = group.getRootFolder(); files = Collections.singleton(file); try { FileSystem fs = file.getFileSystem(); fileSystemListener = FileUtil.weakFileStatusListener(this, fs); fs.addFileStatusListener(fileSystemListener); } catch (FileStateInvalidException e) { Exceptions.printStackTrace(Exceptions.attachMessage(e,"Can not get " + file + " filesystem, ignoring...")); //NOI18N } setName( group.getName() ); setDisplayName( group.getDisplayName() ); // setIconBase("org/netbeans/modules/java/j2seproject/ui/resources/packageRoot"); }
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)); }