use of com.intellij.openapi.roots.ui.configuration.ContentEntryEditor in project intellij-community by JetBrains.
the class ToggleExcludedStateAction method setSelected.
@Override
public void setSelected(final AnActionEvent e, final boolean isSelected) {
final VirtualFile[] selectedFiles = getSelectedFiles();
assert selectedFiles.length != 0;
ContentEntryEditor contentEntryEditor = myEntryTreeEditor.getContentEntryEditor();
for (VirtualFile selectedFile : selectedFiles) {
if (isSelected) {
if (!contentEntryEditor.isExcludedOrUnderExcludedDirectory(selectedFile)) {
// not excluded yet
contentEntryEditor.addExcludeFolder(selectedFile);
}
} else {
contentEntryEditor.removeExcludeFolder(selectedFile.getUrl());
}
}
}
use of com.intellij.openapi.roots.ui.configuration.ContentEntryEditor in project intellij-community by JetBrains.
the class ToggleSourcesStateAction method isSelected.
@Override
public boolean isSelected(final AnActionEvent e) {
final VirtualFile[] selectedFiles = getSelectedFiles();
if (selectedFiles.length == 0)
return false;
final ContentEntryEditor editor = myEntryTreeEditor.getContentEntryEditor();
return myEditHandler.getRootType().equals(editor.getRootType(selectedFiles[0]));
}
use of com.intellij.openapi.roots.ui.configuration.ContentEntryEditor in project intellij-community by JetBrains.
the class ToggleSourcesStateAction method setSelected.
@Override
public void setSelected(final AnActionEvent e, final boolean isSelected) {
final VirtualFile[] selectedFiles = getSelectedFiles();
assert selectedFiles.length != 0;
final ContentEntryEditor contentEntryEditor = myEntryTreeEditor.getContentEntryEditor();
for (VirtualFile selectedFile : selectedFiles) {
final SourceFolder sourceFolder = contentEntryEditor.getSourceFolder(selectedFile);
if (isSelected) {
if (sourceFolder == null) {
// not marked yet
P properties = myEditHandler.getRootType().createDefaultProperties();
contentEntryEditor.addSourceFolder(selectedFile, myEditHandler.getRootType(), properties);
} else if (!myEditHandler.getRootType().equals(sourceFolder.getRootType())) {
P properties;
if (myEditHandler.getRootType().getClass().equals(sourceFolder.getRootType().getClass())) {
properties = (P) sourceFolder.getJpsElement().getProperties().getBulkModificationSupport().createCopy();
} else {
properties = myEditHandler.getRootType().createDefaultProperties();
}
contentEntryEditor.removeSourceFolder(sourceFolder);
contentEntryEditor.addSourceFolder(selectedFile, myEditHandler.getRootType(), properties);
}
} else if (sourceFolder != null) {
// already marked
contentEntryEditor.removeSourceFolder(sourceFolder);
}
}
}
Aggregations