static ClasspathInfo createClasspathInfo(FileObject fileObject) { return ClasspathInfo.create( ClassPath.getClassPath(fileObject, ClassPath.BOOT), ClassPath.getClassPath(fileObject, ClassPath.COMPILE), ClassPath.getClassPath(fileObject, ClassPath.SOURCE) ); }
public static String getPackageName(FileObject folder) { return ClassPath.getClassPath( folder, ClassPath.SOURCE) .getResourceName(folder, '.', false); }
private static String fileToClassName (FileObject fo) { // remove ".class" from and use dots for for separator ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE); if (cp == null) { logger.log(Level.WARNING, "Did not find EXECUTE class path for {0}", fo); return null; } // FileObject root = cp.findOwnerRoot (fo); return cp.getResourceName (fo, '.', false); } }
/** * @return corresponding class name for given source file */ static String getClassNameForFile(FileObject fo) { ClassPath cp = ClassPath.getClassPath(fo, ClassPath.SOURCE); return cp != null ? cp.getResourceName(fo, '.', false) : null; }
private static String getClassName(FileObject fileObj) { //PENDING: is it ensured that the classpath is non-null? return ClassPath.getClassPath(fileObj, ClassPath.SOURCE) .getResourceName(fileObj, '.', false); }
public static String getPackageName(FileObject folder) { ClassPath cp = ClassPath.getClassPath(folder, ClassPath.SOURCE); if (cp != null) { return cp.getResourceName(folder, '.', false); } return null; }
/** * Checks whether the project of given file uses Swing Application Framework, * i.e. whether the framework is on project classpath. Does not check if * there is an Application subclass (the project can be just a library). * @param fileInProject some source file contained in the project * @return true if the project of given file uses app framework */ static boolean isFrameworkLibAvailable(FileObject fileInProject) { ClassPath cp = ClassPath.getClassPath(fileInProject, ClassPath.EXECUTE); return cp != null && cp.findResource(APPLICATION_RESOURCE_NAME) != null && projectCanUseFramework(fileInProject); }
public static String getPackageName(FileObject folder) { assert folder.isFolder() : "argument must be folder"; //NOI18N return ClassPath.getClassPath( folder, ClassPath.SOURCE) .getResourceName(folder, '.', false); }
private static String getPackageName(FileObject folder) { assert folder.isFolder() : "argument must be folder"; return ClassPath.getClassPath( folder, ClassPath.SOURCE) .getResourceName(folder, '.', false); }
private @CheckForNull FileObject findBundle(FileObject javaFile) { ClassPath cp = ClassPath.getClassPath(javaFile, ClassPath.SOURCE); if (cp == null) { return null; } String name = cp.getResourceName(javaFile); if (name != null) { int index = name.lastIndexOf('/'); name = name.substring(0, index) + "/Bundle.properties"; //NOI18N return cp.findResource(name); } return null; }
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; }
ResourcePackageUpdate(RenameRefactoring refactoring, RefactoringElementImplementation refElement, FileObject resFolder) { this.refactoring = refactoring; this.refElement = refElement; this.resFolder = DataFolder.findFolder(resFolder); oldPkgName = ClassPath.getClassPath(resFolder, ClassPath.SOURCE) .getResourceName(resFolder.getParent(), '.', false); }
static PropertiesDataObject getPropertiesDataObject(FileObject srcFile) { ClassPath cp = ClassPath.getClassPath(srcFile, ClassPath.SOURCE); if (cp == null) { return null; } String srcClassName = cp.getResourceName(srcFile, '.', false); String bundleName = getBundleName(srcClassName); return getPropertiesDataObject(srcFile, bundleName, false); }
private static String getPreffiledName(CompilationInfo info, String selectedFramework) { FileObject fileObj = info.getFileObject(); ClassPath cp = ClassPath.getClassPath(fileObj, ClassPath.SOURCE); String className = cp.getResourceName(fileObj, '.', false); return className + getTestingFrameworkSuffix(selectedFramework) + TEST_CLASS_SUFFIX; }
private static String findApplicationClass(FileObject fileInProject) { if (isFrameworkLibAvailable(fileInProject)) { ClassPath cp = ClassPath.getClassPath(fileInProject, ClassPath.SOURCE); return scanFolderForApplication(cp.findOwnerRoot(fileInProject)); } else { return null; } }
private void componentClassRename(FileObject originalFile) { String oldName = refInfo.getOldName(originalFile); String newName = refInfo.getNewName(); String pkg = ClassPath.getClassPath(originalFile, ClassPath.SOURCE) .getResourceName(originalFile.getParent(), '.', false); String oldClassName = (pkg != null && pkg.length() > 0) ? pkg + "." + oldName : oldName; // NOI18N String newClassName = (pkg != null && pkg.length() > 0) ? pkg + "." + newName : newName; // NOI18N componentChange(oldClassName, newClassName); }
private static ResourceMap getAppDefaultResourceMap(FileObject srcFile, String appClassName) { FileObject appFO = AppFrameworkSupport.getFileForClass(srcFile, appClassName); // TBD this is provisional code - we should go through all subclasses of // the current user's application appClassName = org.jdesktop.application.Application.class.getName(); String[] bundleNames = new String[] { getBundleName(appClassName) }; return new ResourceMap(null, ClassPath.getClassPath(srcFile, ClassPath.EXECUTE).getClassLoader(true), bundleNames); }
private static boolean isAptBuildGeneratedFolder(@NonNull final FileObject root) { final ClassPath scp = ClassPath.getClassPath(root, ClassPath.SOURCE); if (scp != null) { for (FileObject srcRoot : scp.getRoots()) { if (root.toURL().equals( AnnotationProcessingQuery.getAnnotationProcessingOptions(srcRoot).sourceOutputDirectory())) { return true; } } } return false; }
private static boolean hasSpringOnClassPath(Project project) { SourceGroup[] javaSources = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); for (SourceGroup javaSource : javaSources) { ClassPath compileCp = ClassPath.getClassPath(javaSource.getRootFolder(), ClassPath.COMPILE); if (compileCp != null) { if (SpringUtilities.containsSpring(compileCp)) { return true; } } } return false; }
public void readSettings(WizardDescriptor settings) { Project project = Templates.getProject(settings); FileObject targetFolder = Templates.getTargetFolder(settings); FileObject artifact = NewSpringXMLConfigWizardIterator.getSourceGroupArtifact(project, targetFolder); getComponent().setClassPath(ClassPath.getClassPath(artifact, ClassPath.COMPILE)); }