support hiding PsiDirectoryNode sources roots

This commit is contained in:
Tom Lundell
2015-09-02 17:01:44 +03:00
committed by nik
parent 2c7df2ae1e
commit 7612cfe350
@@ -69,6 +69,10 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
return !PlatformUtils.isCidr();
}
protected boolean shouldShowSourcesRoot() {
return true;
}
@Override
protected void updateImpl(PresentationData data) {
Project project = getProject();
@@ -104,7 +108,7 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
final String location = FileUtil.getLocationRelativeToUserHome(directoryFile.getPresentableUrl());
data.addText(" (" + location + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
else {
else if (shouldShowSourcesRoot()) {
SourceFolder sourceRoot = ProjectRootsUtil.getModuleSourceRoot(directoryFile, project);
if (sourceRoot != null) {
ModuleSourceRootEditHandler<?> handler = ModuleSourceRootEditHandler.getEditHandler(sourceRoot.getRootType());