/*package*/ static CsmFile findSource(CsmFile header) { String name = getName(header.getAbsolutePath().toString()); Collection<CsmFile> includers = CsmIncludeHierarchyResolver.getDefault().getFiles(header); for (CsmFile f : includers) { if (CndFileUtils.areFilenamesEqual( getName(f.getAbsolutePath().toString()), name )) { // we found source file with the same name // as header and with dependency to it. Best shot. return f; } } // look for random namesake for (CsmFile f : header.getProject().getSourceFiles()) { if (CndFileUtils.areFilenamesEqual( getName(f.getAbsolutePath().toString()), name )) { return f; } } return null; }
private static CsmFile findSource(CsmFile header) { String name = getFileName(header.getAbsolutePath()); Collection<CsmFile> includers = CsmIncludeHierarchyResolver.getDefault().getFiles(header); for (CsmFile f : includers) { if (CndFileUtils.areFilenamesEqual(getFileName(f.getAbsolutePath()), name)) { // we found source file with the same name // as header and with dependency to it. Best shot. return f; } } // look for random namesake for (CsmFile f : header.getProject().getSourceFiles()) { if (CndFileUtils.areFilenamesEqual(getFileName(f.getAbsolutePath().toString()), name)) { return f; } } return null; }
&& CndFileUtils.areFilenamesEqual( name, getName(h.getIncludeFile().getAbsolutePath().toString())) ) { return h.getIncludeFile(); CsmFile namesake = null; for (CsmFile f : source.getProject().getHeaderFiles()) { if (CndFileUtils.areFilenamesEqual( getName(f.getAbsolutePath().toString()), name)) { if (CndFileUtils.areFilenamesEqual( path, trimExtension(f.getAbsolutePath().toString()) )) { if (CndFileUtils.areFilenamesEqual( getName(f.getAbsolutePath().toString()), name)) { if (CndFileUtils.areFilenamesEqual( path, trimExtension(f.getAbsolutePath().toString()) )) { return f;
private static FileObject findBrother(DataObject dob, Collection<String> extensions) { assert (dob != null); assert (dob.getPrimaryFile() != null); if (!extensions.isEmpty()) { // get a file object associated with the data object FileObject fo = dob.getPrimaryFile(); FileObject[] childs = fo.getParent().getChildren(); // try to find a file with the same name and one of passed extensions for (String ext : extensions) { // use FileUtilities to find brother of the file object // FileObject res = FileUtil.findBrother(fo, ext[i]); // IZ117750. Netbeans don't recognize MAC FS as case-insensitive // so FileObject.getFileObject(name, extension) can create // separate FileObjects for name.h and name.H although they are names // of the same file. So FileUtil.findBrother can't be used for now. String ne = fo.getName() + '.' + ext; for (int j = 0; j < childs.length; j++) { FileObject fileObject = childs[j]; if ( CndFileUtils.areFilenamesEqual( fileObject.getNameExt(), ne )) { return fileObject; } } } } return null; }