本文整理汇总了Java中org.netbeans.api.java.project.JavaProjectConstants.SOURCES_TYPE_JAVA属性的典型用法代码示例。如果您正苦于以下问题:Java JavaProjectConstants.SOURCES_TYPE_JAVA属性的具体用法?Java JavaProjectConstants.SOURCES_TYPE_JAVA怎么用?Java JavaProjectConstants.SOURCES_TYPE_JAVA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.netbeans.api.java.project.JavaProjectConstants
的用法示例。
在下文中一共展示了JavaProjectConstants.SOURCES_TYPE_JAVA属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCombos
private void initCombos() {
Sources sources = ProjectUtils.getSources(project);
SourceGroup[] sourceGroupsJava = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
if (sourceGroupsJava == null) {
throw new IllegalStateException(
NbBundle.getMessage(FXMLTemplateWizardIterator.class,
"MSG_ConfigureFXMLPanel_SGs_Error")); // NOI18N
}
support = new SourceGroupSupport(JavaProjectConstants.SOURCES_TYPE_JAVA);
support.addSourceGroups(sourceGroupsJava); //must exist
comboBoxSourceRoot.setModel(new DefaultComboBoxModel(support.getSourceGroups().toArray()));
// SourceGroupSupport.SourceGroupProxy preselectedGroup = support.getParent().getCurrentSourceGroup();
// ignoreRootCombo = true;
// comboBoxSourceRoot.setSelectedItem(preselectedGroup);
// ignoreRootCombo = false;
// comboBoxPackage.getEditor().setItem(support.getParent().getCurrentPackageName());
updatePackages();
updateText();
updateResult();
}
示例2: 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;
}
示例3: 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()]));
}
示例4: create
public static SourceRoots create(UpdateHelper helper, PropertyEvaluator evaluator, ReferenceHelper refHelper,
String projectConfigurationNamespace, String elementName, boolean isTest, String newRootNameTemplate) {
Parameters.notNull("helper", helper); // NOI18N
Parameters.notNull("evaluator", evaluator); // NOI18N
Parameters.notNull("refHelper", refHelper); // NOI18N
Parameters.notNull("projectConfigurationNamespace", projectConfigurationNamespace); // NOI18N
Parameters.notNull("elementName", elementName); // NOI18N
Parameters.notNull("newRootNameTemplate", newRootNameTemplate); // NOI18N
return new SourceRoots(helper, evaluator, refHelper, projectConfigurationNamespace, elementName,
JavaProjectConstants.SOURCES_TYPE_JAVA, isTest, newRootNameTemplate);
}
示例5: 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);
}
}
}
示例6: getSourceRootType
@Override
public String getSourceRootType() {
return JavaProjectConstants.SOURCES_TYPE_JAVA;
}