use of com.intellij.openapi.roots.ExcludeFolder 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);
}
}
use of com.intellij.openapi.roots.ExcludeFolder in project intellij-community by JetBrains.
the class ContentEntryImpl method clearExcludeFolders.
@Override
public void clearExcludeFolders() {
assert !isDisposed();
getRootModel().assertWritable();
for (ExcludeFolder excludeFolder : myExcludeFolders) {
Disposer.dispose((Disposable) excludeFolder);
}
myExcludeFolders.clear();
}
use of com.intellij.openapi.roots.ExcludeFolder in project intellij-community by JetBrains.
the class ContentEntryImpl method writeExternal.
public void writeExternal(@NotNull Element element) throws WriteExternalException {
assert !isDisposed();
LOG.assertTrue(ELEMENT_NAME.equals(element.getName()));
element.setAttribute(URL_ATTRIBUTE, myRoot.getUrl());
for (final SourceFolder sourceFolder : mySourceFolders) {
if (sourceFolder instanceof SourceFolderImpl) {
JpsModuleRootModelSerializer.saveSourceRoot(element, sourceFolder.getUrl(), sourceFolder.getJpsElement().asTyped());
}
}
for (final ExcludeFolder excludeFolder : myExcludeFolders) {
if (excludeFolder instanceof ExcludeFolderImpl) {
final Element subElement = new Element(ExcludeFolderImpl.ELEMENT_NAME);
((ExcludeFolderImpl) excludeFolder).writeExternal(subElement);
element.addContent(subElement);
}
}
}
use of com.intellij.openapi.roots.ExcludeFolder in project intellij-community by JetBrains.
the class ContentEntryImpl method cloneEntry.
@Override
@NotNull
public ContentEntry cloneEntry(@NotNull RootModelImpl rootModel) {
assert !isDisposed();
ContentEntryImpl cloned = new ContentEntryImpl(myRoot.getUrl(), rootModel);
for (final SourceFolder sourceFolder : mySourceFolders) {
if (sourceFolder instanceof ClonableContentFolder) {
ContentFolder folder = ((ClonableContentFolder) sourceFolder).cloneFolder(cloned);
cloned.addSourceFolder((SourceFolderImpl) folder);
}
}
for (final ExcludeFolder excludeFolder : myExcludeFolders) {
if (excludeFolder instanceof ClonableContentFolder) {
ContentFolder folder = ((ClonableContentFolder) excludeFolder).cloneFolder(cloned);
cloned.addExcludeFolder((ExcludeFolder) folder);
}
}
return cloned;
}
use of com.intellij.openapi.roots.ExcludeFolder in project intellij-community by JetBrains.
the class ContentEntryImpl method removeExcludeFolder.
@Override
public boolean removeExcludeFolder(@NotNull String url) {
for (ExcludeFolder folder : myExcludeFolders) {
if (folder.getUrl().equals(url)) {
myExcludeFolders.remove(folder);
Disposer.dispose((Disposable) folder);
return true;
}
}
return false;
}
Aggregations