当前位置: 首页>>代码示例>>Java>>正文


Java JavaProjectConstants.SOURCES_TYPE_RESOURCES属性代码示例

本文整理汇总了Java中org.netbeans.api.java.project.JavaProjectConstants.SOURCES_TYPE_RESOURCES属性的典型用法代码示例。如果您正苦于以下问题:Java JavaProjectConstants.SOURCES_TYPE_RESOURCES属性的具体用法?Java JavaProjectConstants.SOURCES_TYPE_RESOURCES怎么用?Java JavaProjectConstants.SOURCES_TYPE_RESOURCES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.netbeans.api.java.project.JavaProjectConstants的用法示例。


在下文中一共展示了JavaProjectConstants.SOURCES_TYPE_RESOURCES属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isOnSourceClasspath

/**
 * Is given file on any source classpath?
 *
 * @param fo
 * @return
 * @deprecated 
 */
@Deprecated
public static boolean isOnSourceClasspath(FileObject fo) {
    Project pr = FileOwnerQuery.getOwner(fo);
    if (pr == null) {
        return false;
    }

    //workaround for 143542
    for (String type : new String[]{JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_TYPE_RESOURCES}) {
        for (SourceGroup sg : ProjectUtils.getSources(pr).getSourceGroups(type)) {
            if (fo == sg.getRootFolder() || (FileUtil.isParentOf(sg.getRootFolder(), fo) && sg.contains(fo))) {
                return ClassPath.getClassPath(fo, ClassPath.SOURCE) != null;
            }
        }
    }
    return false;
    //end of workaround
    //return ClassPath.getClassPath(fo, ClassPath.SOURCE)!=null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:RefactoringUtils.java

示例2: findResourceCP

/**
 * Find a resource path for a project.
 * @param project a module project
 * @return a classpath where resources can be found
 */
public static ClassPath findResourceCP(Project project) {
    Sources s = ProjectUtils.getSources(project);
    List<FileObject> roots = new ArrayList<FileObject>();
    for (String type : new String[] {JavaProjectConstants.SOURCES_TYPE_JAVA, JavaProjectConstants.SOURCES_TYPE_RESOURCES}) {
        for (SourceGroup group : s.getSourceGroups(type)) {
            roots.add(group.getRootFolder());
        }
    }
    if (roots.isEmpty()) {
        LOG.log(Level.WARNING, "no resource path for {0}", project);
    }
    return ClassPathSupport.createClassPath(roots.toArray(new FileObject[roots.size()]));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:LayerUtils.java

示例3: initialize

@Override
public void initialize(WizardDescriptor wizard) {
    this.wizard = wizard;

    Project project = Templates.getProject(wizard);
    if (project == null) {
        throw new IllegalStateException(
                NbBundle.getMessage(FXMLTemplateWizardIterator.class,
                "MSG_ConfigureFXMLPanel_Project_Null_Error")); // NOI18N
    }
    isMavenOrGradle = JFXProjectUtils.isMavenProject(project) || JFXProjectUtils.isGradleProject(project);

    Sources sources = ProjectUtils.getSources(project);
    SourceGroup[] sourceGroupsJava = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    SourceGroup[] sourceGroupsResources = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
    if (sourceGroupsJava == null || sourceGroupsJava.length == 0) {
        throw new IllegalStateException(
                NbBundle.getMessage(FXMLTemplateWizardIterator.class,
                "MSG_ConfigureFXMLPanel_SGs_Error")); // NOI18N
    }
    if(isMavenOrGradle) {
        supportFXML = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
        supportCSS = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_RESOURCES);
        if(sourceGroupsResources != null && sourceGroupsResources.length > 0) {
            supportFXML.addSourceGroups(sourceGroupsResources);
            supportCSS.addSourceGroups(sourceGroupsResources);
        } else {
            supportFXML.addSourceGroupProxy(project, NbBundle.getMessage(FXMLTemplateWizardIterator.class,"LAB_ProjectResources"), // NOI18N
                    new String[]{defaultMavenFXMLPackage, defaultMavenImagesPackage, defaultMavenCSSPackage});
            supportCSS.addSourceGroupProxy(project, NbBundle.getMessage(FXMLTemplateWizardIterator.class,"LAB_ProjectResources"), // NOI18N
                    new String[]{defaultMavenFXMLPackage, defaultMavenImagesPackage, defaultMavenCSSPackage});
            FileObject dirFXML = supportFXML.getCurrentPackageFolder(true);
            if (dirFXML == null) {
                // default Maven resources are overriden in the project's pom.xml (#250097)
                supportFXML = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
                supportFXML.addSourceGroups(sourceGroupsJava); //must exist
                supportCSS = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
                supportCSS.addSourceGroups(sourceGroupsJava); //must exist
            }
        }
    } else {
        supportFXML = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
        supportFXML.addSourceGroups(sourceGroupsJava); //must exist
        supportCSS = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
        supportCSS.addSourceGroups(sourceGroupsJava); //must exist
    }
    supportController = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
    supportController.addSourceGroups(sourceGroupsJava); //must exist
    supportController.setParent(supportFXML);
    supportCSS.setParent(supportFXML);
    
    index = 0;
    panels = createPanels(project, supportFXML, supportController, supportCSS);
    String[] steps = createSteps();
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent)c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:71,代码来源:FXMLTemplateWizardIterator.java


注:本文中的org.netbeans.api.java.project.JavaProjectConstants.SOURCES_TYPE_RESOURCES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。