org.netbeans.api.java.classpath.ClassPath.getClassPath()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.netbeans.api.java.classpath.ClassPath.getClassPath()方法的一些代码示例,展示了ClassPath.getClassPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassPath.getClassPath()方法的具体详情如下:
包路径:org.netbeans.api.java.classpath.ClassPath
类名称:ClassPath
方法名:getClassPath

ClassPath.getClassPath介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

static ClasspathInfo createClasspathInfo(FileObject fileObject) {
  return ClasspathInfo.create(
      ClassPath.getClassPath(fileObject, ClassPath.BOOT),
      ClassPath.getClassPath(fileObject, ClassPath.COMPILE),
      ClassPath.getClassPath(fileObject, ClassPath.SOURCE)
      );
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-insync

public static String getPackageName(FileObject folder) {
  return ClassPath.getClassPath(
      folder, ClassPath.SOURCE)
      .getResourceName(folder, '.', false);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

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);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

/**
 * @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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

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);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

public static String getPackageName(FileObject folder) {
  ClassPath cp = ClassPath.getClassPath(folder, ClassPath.SOURCE);
  if (cp != null) {
    return cp.getResourceName(folder, '.', false);
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

/**
 * 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);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

public static String getPackageName(FileObject folder) {
  assert folder.isFolder() : "argument must be folder";  //NOI18N
  return ClassPath.getClassPath(
      folder, ClassPath.SOURCE)
      .getResourceName(folder, '.', false);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-refactoring

private static String getPackageName(FileObject folder) {
  assert folder.isFolder() : "argument must be folder";
  return ClassPath.getClassPath(
      folder, ClassPath.SOURCE)
      .getResourceName(folder, '.', false);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

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;
}

代码示例来源:origin: AlexFalappa/nb-springboot

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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

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);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

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);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-testrunner-ui

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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

private static String findApplicationClass(FileObject fileInProject) {
  if (isFrameworkLibAvailable(fileInProject)) {
    ClassPath cp = ClassPath.getClassPath(fileInProject, ClassPath.SOURCE);
    return scanFolderForApplication(cp.findOwnerRoot(fileInProject));
  } else {
    return null;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-form-refactoring

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);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp

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);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

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));
}

相关文章