support hiding PsiDirectoryNode sources roots
authorTom Lundell <tomlu@google.com>
Wed, 2 Sep 2015 14:00:33 +0000 (17:00 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Wed, 2 Sep 2015 14:01:44 +0000 (17:01 +0300)
platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiDirectoryNode.java

index 902ba8473d3cb02cfa048b764517f0fa70905650..6b10cb6446de7ef9cc9746bdf70e2f617541032b 100644 (file)
@@ -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());