From 35c519741fc9b8399aae83385a6d8d6e4ad34dd7 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 7 Oct 2011 14:23:21 +0200 Subject: [PATCH] allow marking as excluded directories under source roots (PY-4498) --- .../projectView/actions/MarkExcludeRootAction.java | 2 +- .../ide/projectView/actions/MarkRootAction.java | 11 ++++++++--- .../ide/projectView/actions/UnmarkRootAction.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java index 9238074e63eb..1096a067fc88 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkExcludeRootAction.java @@ -43,6 +43,6 @@ public class MarkExcludeRootAction extends MarkRootAction { protected String getPromptText(String message) { return "Are you sure you would like to exclude " + message + - " from the project?\nYou can restore excluded folders later using the Project Structure dialog."; + " from the project?\nYou can restore excluded directories later using the Project Structure dialog."; } } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootAction.java index c03d3921e670..218937ed2dd4 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootAction.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootAction.java @@ -101,12 +101,17 @@ public class MarkRootAction extends AnAction { @Override public void update(AnActionEvent e) { - boolean enabled = canMark(e, myMarkAsTestSources || myMarkAsExcluded || myUnmark, !myMarkAsTestSources || myMarkAsExcluded || myUnmark, null); + boolean enabled = canMark(e, myMarkAsTestSources || myMarkAsExcluded || myUnmark, !myMarkAsTestSources || myMarkAsExcluded || myUnmark, + myMarkAsExcluded, null); e.getPresentation().setVisible(enabled); e.getPresentation().setEnabled(enabled); } - public static boolean canMark(AnActionEvent e, boolean acceptSourceRoot, boolean acceptTestSourceRoot, Ref rootType) { + public static boolean canMark(AnActionEvent e, + boolean acceptSourceRoot, + boolean acceptTestSourceRoot, + boolean acceptInSourceContent, + @Nullable Ref rootType) { Module module = e.getData(LangDataKeys.MODULE); VirtualFile[] vFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY); if (module == null || vFiles == null) { @@ -131,7 +136,7 @@ public class MarkRootAction extends AnAction { return true; } } - if (fileIndex.isInSourceContent(vFile)) { + if (fileIndex.isInSourceContent(vFile) && !acceptInSourceContent) { return false; } } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java index 3e1ec83d1459..ca122bc84cc1 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/UnmarkRootAction.java @@ -29,7 +29,7 @@ public class UnmarkRootAction extends MarkRootAction { @Override public void update(AnActionEvent e) { Ref rootType = new Ref(); - boolean enabled = canMark(e, true, true, rootType); + boolean enabled = canMark(e, true, true, false, rootType); if (rootType.get() == null) { enabled = false; } -- 2.32.0