use of org.jetbrains.jps.model.java.JavaSourceRootProperties in project intellij-community by JetBrains.
the class JavaProjectRootsUtil method isForGeneratedSources.
public static boolean isForGeneratedSources(SourceFolder sourceFolder) {
JavaSourceRootProperties properties = sourceFolder.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
JavaResourceRootProperties resourceProperties = sourceFolder.getJpsElement().getProperties(JavaModuleSourceRootTypes.RESOURCES);
return properties != null && properties.isForGeneratedSources() || resourceProperties != null && resourceProperties.isForGeneratedSources();
}
use of org.jetbrains.jps.model.java.JavaSourceRootProperties in project intellij-community by JetBrains.
the class ProjectViewDirectoryHelper method getLocationString.
@Nullable
public String getLocationString(@NotNull PsiDirectory psiDirectory, boolean includeUrl, boolean includeRootType) {
StringBuilder result = new StringBuilder();
final VirtualFile directory = psiDirectory.getVirtualFile();
if (ProjectRootsUtil.isLibraryRoot(directory, psiDirectory.getProject())) {
result.append(ProjectBundle.message("module.paths.root.node", "library").toLowerCase(Locale.getDefault()));
} else if (includeRootType) {
SourceFolder sourceRoot = ProjectRootsUtil.getModuleSourceRoot(psiDirectory.getVirtualFile(), psiDirectory.getProject());
if (sourceRoot != null) {
ModuleSourceRootEditHandler<?> handler = ModuleSourceRootEditHandler.getEditHandler(sourceRoot.getRootType());
if (handler != null) {
JavaSourceRootProperties properties = sourceRoot.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
if (properties != null && properties.isForGeneratedSources()) {
result.append("generated ");
}
result.append(handler.getFullRootTypeName().toLowerCase(Locale.getDefault()));
}
}
}
if (includeUrl) {
if (result.length() > 0)
result.append(",").append(FontUtil.spaceAndThinSpace());
result.append(FileUtil.getLocationRelativeToUserHome(directory.getPresentableUrl()));
}
return result.length() == 0 ? null : result.toString();
}
use of org.jetbrains.jps.model.java.JavaSourceRootProperties in project android by JetBrains.
the class ContentEntriesSetup method addSourceFolder.
private static void addSourceFolder(@NotNull ContentEntry contentEntry, @NotNull File folderPath, @NotNull JpsModuleSourceRootType type, boolean generated) {
String url = pathToIdeaUrl(folderPath);
SourceFolder sourceFolder = contentEntry.addSourceFolder(url, type);
if (generated) {
JpsModuleSourceRoot sourceRoot = sourceFolder.getJpsElement();
JpsElement properties = sourceRoot.getProperties();
if (properties instanceof JavaSourceRootProperties) {
((JavaSourceRootProperties) properties).setForGeneratedSources(true);
}
}
}
use of org.jetbrains.jps.model.java.JavaSourceRootProperties in project intellij-elixir by KronicDeth.
the class ElixirTarget method computeRootDescriptors.
@NotNull
@Override
public List<ElixirSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
List<ElixirSourceRootDescriptor> result = new ArrayList<ElixirSourceRootDescriptor>();
JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> root : myModule.getSourceRoots(type)) {
result.add(new ElixirSourceRootDescriptor(root.getFile(), this));
}
return result;
}
use of org.jetbrains.jps.model.java.JavaSourceRootProperties in project intellij-community by JetBrains.
the class ContentEntryTreeCellRenderer method getPresentablePrefix.
private static String getPresentablePrefix(final ContentEntry entry, final VirtualFile file) {
for (final SourceFolder sourceFolder : entry.getSourceFolders()) {
if (file.equals(sourceFolder.getFile())) {
JpsModuleSourceRoot element = sourceFolder.getJpsElement();
JavaSourceRootProperties properties = element.getProperties(JavaModuleSourceRootTypes.SOURCES);
if (properties != null)
return properties.getPackagePrefix();
JavaResourceRootProperties resourceRootProperties = element.getProperties(JavaModuleSourceRootTypes.RESOURCES);
if (resourceRootProperties != null)
return resourceRootProperties.getRelativeOutputPath();
}
}
return "";
}
Aggregations