Java Code Examples for org.netbeans.spi.project.support.GenericSources#group()
The following examples show how to use
org.netbeans.spi.project.support.GenericSources#group() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaEESourcesImpl.java From netbeans with Apache License 2.0 | 6 votes |
private List<SourceGroup> getWebSourceGroups() { List<SourceGroup> sourceGroups = new ArrayList<>(); ProjectWebRootProvider webRootProvider = project.getLookup().lookup(ProjectWebRootProvider.class); GradleWebProject wp = GradleWebProject.get(project); if (webRootProvider != null && wp != null) { Collection<FileObject> webRoots = webRootProvider.getWebRoots(); String projectDirPath = wp.getWebAppDir().getAbsolutePath(); for (FileObject webRoot : webRoots) { boolean isDefault = webRoot.getPath().equals(projectDirPath); SourceGroup g = GenericSources.group(project, webRoot, TYPE_DOC_ROOT, getDisplayName(webRoot, isDefault), null, null); if (isDefault) { sourceGroups.add(0, g); } else { sourceGroups.add(g); } } } return sourceGroups; }
Example 2
Source File: PackageRenameHandlerTest.java From netbeans with Apache License 2.0 | 5 votes |
public @Override void setUp() throws Exception { final FileObject root = TestUtil.makeScratchDir(this); root.createFolder("testproject"); MockLookup.setInstances(TestUtil.testProjectFactory()); SourceGroup group = GenericSources.group(ProjectManager.getDefault().findProject(root), root.createFolder("src"), "testGroup", "Test Group", null, null); Children ch = PackageView.createPackageView(group).getChildren(); // Create folder FileUtil.createFolder(root, "src/foo"); n = ch.findChild("foo"); assertNotNull(n); }
Example 3
Source File: MavenSourcesImpl.java From netbeans with Apache License 2.0 | 5 votes |
/** * consult the SourceGroup cache, return true if anything changed.. */ private boolean checkSourceGroupCache(@NullAllowed File rootF, String name, String displayName, Map<String, SourceGroup> groups, NbMavenProject watcher) { FileObject root; if (rootF != null) { watcher.addWatchedPath(Utilities.toURI(rootF)); root = FileUtil.toFileObject(rootF); } else { root = null; } SourceGroup group = groups.get(name); if ((root == null || root.isData()) && group != null) { groups.remove(name); return true; } if (root == null || root.isData()) { return false; } boolean changed = false; if (group == null) { group = GenericSources.group(proj, root, name, displayName, null, null); groups.put(name, group); changed = true; } else { if (!group.getRootFolder().equals(root)) { group = GenericSources.group(proj, root, name, displayName, null, null); groups.put(name, group); changed = true; } } return changed; }
Example 4
Source File: SourcesNodeFactory.java From netbeans with Apache License 2.0 | 5 votes |
private SourceGroup makeJavadocDocfilesSourceGroup() { String propname = "javadoc.docfiles"; // NOI18N FileObject root = resolveFileObjectFromProperty(propname); if(root == null) { return null; } return GenericSources.group(project, root, propname, NbBundle.getMessage(ModuleLogicalView.class, "LBL_extra_javadoc_files"), null, null); }
Example 5
Source File: Selenium2PhpSupportImpl.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages("sources_display_name=Selenium Sources") private SourceGroup getSeleniumSourceGroup(Project project) { FileObject dir = getSeleniumDir(project, true); if (dir == null) { return ProjectUtils.getSources(project).getSourceGroups(Sources.TYPE_GENERIC)[0]; } String sourcesDisplayName = Bundle.sources_display_name(); return GenericSources.group(project, dir, "SeleniumDir", sourcesDisplayName, null, null); }
Example 6
Source File: MMKnowledgeSources.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
private static SourceGroup[] getSourceGroups(final Project project) { final String klazz = project.getClass().getName(); LOGGER.info("Request sources for project type " + klazz); SourceGroup knowledgeSrc = null; try { FileObject knowledgeFolder = project.getProjectDirectory().getFileObject(KNOWLEDGE_FOLDER_NAME); if (knowledgeFolder == null && isKnowledgeFolderAllowedForCreation()) { knowledgeFolder = project.getProjectDirectory().createFolder(KNOWLEDGE_FOLDER_NAME); } if (knowledgeFolder != null) { final String rootKnowledgeFolderName = BUNDLE.getString("KnowledgeSourceGroup.displayName"); knowledgeSrc = GenericSources.group(project, knowledgeFolder, KNOWLEDGE_FOLDER_NAME, rootKnowledgeFolderName, new ImageIcon(BadgeIcons.BADGED_FOLDER), new ImageIcon(BadgeIcons.BADGED_FOLDER_OPEN)); } else { LOGGER.info("Knowledge folder is not presented in " + project); } } catch (IOException ex) { LOGGER.error("Can't make source group for knowledge folder", ex); } final SourceGroup[] result; if (knowledgeSrc == null) { result = new SourceGroup[0]; } else { result = new SourceGroup[]{knowledgeSrc}; } return result; }
Example 7
Source File: J2eeMavenSourcesImpl.java From netbeans with Apache License 2.0 | 4 votes |
private WebResourceGroup(Project project, FileObject webRoot, String name, String displayName) { this.project = project; this.group = GenericSources.group(project, webRoot, name, displayName, null, null); }