Search in sources :

Example 1 with ContentFolder

use of com.intellij.openapi.roots.ContentFolder in project intellij-community by JetBrains.

the class ContentRootPanel method addFolderGroupComponents.

protected void addFolderGroupComponents() {
    final SourceFolder[] sourceFolders = getContentEntry().getSourceFolders();
    MultiMap<JpsModuleSourceRootType<?>, SourceFolder> folderByType = new MultiMap<>();
    for (SourceFolder folder : sourceFolders) {
        if (!folder.isSynthetic()) {
            folderByType.putValue(folder.getRootType(), folder);
        }
    }
    Insets insets = JBUI.insetsBottom(10);
    GridBagConstraints constraints = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, insets, 0, 0);
    for (ModuleSourceRootEditHandler<?> editor : myModuleSourceRootEditHandlers) {
        Collection<SourceFolder> folders = folderByType.get(editor.getRootType());
        if (folders.isEmpty())
            continue;
        ContentFolder[] foldersArray = folders.toArray(new ContentFolder[folders.size()]);
        final JComponent sourcesComponent = createFolderGroupComponent(editor.getRootsGroupTitle(), foldersArray, editor.getRootsGroupColor(), editor);
        add(sourcesComponent, constraints);
    }
    ExcludeFolder[] excluded = getContentEntry().getExcludeFolders();
    if (excluded.length > 0) {
        final JComponent excludedComponent = createFolderGroupComponent(ProjectBundle.message("module.paths.excluded.group"), excluded, EXCLUDED_COLOR, null);
        this.add(excludedComponent, constraints);
    }
}
Also used : SourceFolder(com.intellij.openapi.roots.SourceFolder) MultiMap(com.intellij.util.containers.MultiMap) JpsModuleSourceRootType(org.jetbrains.jps.model.module.JpsModuleSourceRootType) ContentFolder(com.intellij.openapi.roots.ContentFolder) ExcludeFolder(com.intellij.openapi.roots.ExcludeFolder)

Example 2 with ContentFolder

use of com.intellij.openapi.roots.ContentFolder in project intellij-community by JetBrains.

the class ManagingContentRootFoldersTest method testCreationOfExcludedFolderWithUrlWhenFileExists.

public void testCreationOfExcludedFolderWithUrlWhenFileExists() throws IOException {
    VirtualFile dir = createSrc();
    String url = dir.getUrl();
    ContentFolder f = entry.addExcludeFolder(url);
    assertEquals(dir, f.getFile());
    assertEquals(url, f.getUrl());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentFolder(com.intellij.openapi.roots.ContentFolder)

Example 3 with ContentFolder

use of com.intellij.openapi.roots.ContentFolder in project intellij-community by JetBrains.

the class ManagingContentRootFoldersTest method testCreationOfSourceFolderWithUrl.

public void testCreationOfSourceFolderWithUrl() throws IOException {
    VirtualFile dir = createSrc();
    String url = dir.getUrl();
    delete(dir);
    ContentFolder f = entry.addSourceFolder(url, false);
    assertNull(f.getFile());
    assertEquals(url, f.getUrl());
    dir = createSrc();
    assertEquals(dir, f.getFile());
    assertEquals(url, f.getUrl());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentFolder(com.intellij.openapi.roots.ContentFolder)

Example 4 with ContentFolder

use of com.intellij.openapi.roots.ContentFolder in project intellij-community by JetBrains.

the class ManagingContentRootFoldersTest method testCreationOfSourceFolderWithUrlWhenFileExists.

public void testCreationOfSourceFolderWithUrlWhenFileExists() throws IOException {
    VirtualFile dir = createSrc();
    String url = dir.getUrl();
    ContentFolder f = entry.addSourceFolder(url, false);
    assertEquals(dir, f.getFile());
    assertEquals(url, f.getUrl());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentFolder(com.intellij.openapi.roots.ContentFolder)

Example 5 with ContentFolder

use of com.intellij.openapi.roots.ContentFolder in project intellij-community by JetBrains.

the class ManagingContentRootFoldersTest method testCreationOfExcludedFolderWithUrl.

public void testCreationOfExcludedFolderWithUrl() throws IOException {
    VirtualFile dir = createSrc();
    String url = dir.getUrl();
    delete(dir);
    ContentFolder f = entry.addExcludeFolder(url);
    assertNull(f.getFile());
    assertEquals(url, f.getUrl());
    dir = createSrc();
    assertEquals(dir, f.getFile());
    assertEquals(url, f.getUrl());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentFolder(com.intellij.openapi.roots.ContentFolder)

Aggregations

ContentFolder (com.intellij.openapi.roots.ContentFolder)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 ExcludeFolder (com.intellij.openapi.roots.ExcludeFolder)2 SourceFolder (com.intellij.openapi.roots.SourceFolder)2 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)1 MultiMap (com.intellij.util.containers.MultiMap)1 NotNull (org.jetbrains.annotations.NotNull)1 JpsModuleSourceRootType (org.jetbrains.jps.model.module.JpsModuleSourceRootType)1