Search in sources :

Example 1 with JavaResourceRootProperties

use of org.jetbrains.jps.model.java.JavaResourceRootProperties 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();
}
Also used : JavaResourceRootProperties(org.jetbrains.jps.model.java.JavaResourceRootProperties) JavaSourceRootProperties(org.jetbrains.jps.model.java.JavaSourceRootProperties)

Example 2 with JavaResourceRootProperties

use of org.jetbrains.jps.model.java.JavaResourceRootProperties in project intellij-community by JetBrains.

the class JavaResourceRootEditHandlerBase method createPropertiesEditor.

@Nullable
@Override
public JComponent createPropertiesEditor(@NotNull final SourceFolder folder, @NotNull final JComponent parentComponent, @NotNull final ContentRootPanel.ActionCallback callback) {
    final IconActionComponent iconComponent = new IconActionComponent(AllIcons.Modules.SetPackagePrefix, AllIcons.Modules.SetPackagePrefixRollover, ProjectBundle.message("module.paths.edit.properties.tooltip"), () -> {
        JavaResourceRootProperties properties = folder.getJpsElement().getProperties(JavaModuleSourceRootTypes.RESOURCES);
        assert properties != null;
        ResourceRootPropertiesDialog dialog = new ResourceRootPropertiesDialog(parentComponent, properties);
        if (dialog.showAndGet()) {
            callback.onSourceRootPropertiesChanged(folder);
        }
    });
    final JPanel panel = new JPanel(new BorderLayout());
    panel.setOpaque(false);
    panel.add(iconComponent, BorderLayout.CENTER);
    panel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    return panel;
}
Also used : JavaResourceRootProperties(org.jetbrains.jps.model.java.JavaResourceRootProperties) IconActionComponent(com.intellij.ui.roots.IconActionComponent) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with JavaResourceRootProperties

use of org.jetbrains.jps.model.java.JavaResourceRootProperties 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 "";
}
Also used : SourceFolder(com.intellij.openapi.roots.SourceFolder) JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) JavaResourceRootProperties(org.jetbrains.jps.model.java.JavaResourceRootProperties) JavaSourceRootProperties(org.jetbrains.jps.model.java.JavaSourceRootProperties)

Aggregations

JavaResourceRootProperties (org.jetbrains.jps.model.java.JavaResourceRootProperties)3 JavaSourceRootProperties (org.jetbrains.jps.model.java.JavaSourceRootProperties)2 SourceFolder (com.intellij.openapi.roots.SourceFolder)1 IconActionComponent (com.intellij.ui.roots.IconActionComponent)1 Nullable (org.jetbrains.annotations.Nullable)1 JpsModuleSourceRoot (org.jetbrains.jps.model.module.JpsModuleSourceRoot)1