diff --git a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java index 5ddd818afc84..70b348e5e388 100644 --- a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java +++ b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java @@ -368,7 +368,8 @@ public class CompilerTask extends Task.Backgroundable { !myMessagesAutoActivated && ( CompilerMessageCategory.ERROR.equals(category) || - (CompilerMessageCategory.WARNING.equals(category) && !ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) + (CompilerMessageCategory.WARNING.equals(category) && !ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) || + (CompilerMessageCategory.INFORMATION.equals(category) && !ErrorTreeViewConfiguration.getInstance(myProject).isHideInfoMessages()) ); if (shouldAutoActivate) { myMessagesAutoActivated = true; diff --git a/platform/icons/src/general/showInfos.svg b/platform/icons/src/general/showInfos.svg new file mode 100644 index 000000000000..5a8b5148209c --- /dev/null +++ b/platform/icons/src/general/showInfos.svg @@ -0,0 +1,3 @@ + + + diff --git a/platform/icons/src/general/showInfos_dark.svg b/platform/icons/src/general/showInfos_dark.svg new file mode 100644 index 000000000000..240af4f3aa88 --- /dev/null +++ b/platform/icons/src/general/showInfos_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java index d8f6ff45bb61..5fade97f43c0 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/ErrorViewStructure.java @@ -100,12 +100,8 @@ public class ErrorViewStructure extends AbstractTreeStructure { // simple messages synchronized (myLock) { for (final ErrorTreeElementKind kind : ourMessagesOrder) { - if (myCanHideWarnings) { - if (ErrorTreeElementKind.WARNING.equals(kind) || ErrorTreeElementKind.NOTE.equals(kind)) { - if (ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) { - continue; - } - } + if (shouldHide(kind)) { + continue; } final List elems = mySimpleMessages.get(kind); if (elems != null) { @@ -127,14 +123,12 @@ public class ErrorViewStructure extends AbstractTreeStructure { synchronized (myLock) { final List children = myGroupNameToMessagesMap.get(((GroupingElement)element).getName()); if (children != null && !children.isEmpty()) { - if (myCanHideWarnings && ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) { + if (isFilteringNeeded()) { final List filtered = new ArrayList<>(children.size()); for (final NavigatableMessageElement navigatableMessageElement : children) { - ErrorTreeElementKind kind = navigatableMessageElement.getKind(); - if (ErrorTreeElementKind.WARNING.equals(kind) || ErrorTreeElementKind.NOTE.equals(kind)) { - continue; + if (!shouldHide(navigatableMessageElement.getKind())) { + filtered.add(navigatableMessageElement); } - filtered.add(navigatableMessageElement); } return filtered.toArray(ErrorTreeElement.EMPTY_ARRAY); } @@ -146,16 +140,38 @@ public class ErrorViewStructure extends AbstractTreeStructure { return ErrorTreeElement.EMPTY_ARRAY; } + private boolean isFilteringNeeded() { + if (!myCanHideWarnings) { + return false; + } + final ErrorTreeViewConfiguration config = ErrorTreeViewConfiguration.getInstance(myProject); + return config.isHideWarnings() || config.isHideInfoMessages(); + } + + private boolean shouldHide(ErrorTreeElementKind kind) { + if (!myCanHideWarnings) { + return false; + } + switch (kind) { + case WARNING: + case NOTE: + return ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings(); + case INFO: + return ErrorTreeViewConfiguration.getInstance(myProject).isHideInfoMessages(); + default: + return false; + } + } + private boolean shouldShowFileElement(GroupingElement groupingElement) { - if (!myCanHideWarnings || !ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) { + if (!isFilteringNeeded()) { return getChildCount(groupingElement) > 0; } synchronized (myLock) { final List children = myGroupNameToMessagesMap.get(groupingElement.getName()); if (children != null) { for (final NavigatableMessageElement child : children) { - ErrorTreeElementKind kind = child.getKind(); - if (!ErrorTreeElementKind.WARNING.equals(kind) && !ErrorTreeElementKind.NOTE.equals(kind)) { + if (!shouldHide(child.getKind())) { return true; } } @@ -372,10 +388,8 @@ public class ErrorViewStructure extends AbstractTreeStructure { @Nullable public ErrorTreeElement getFirstMessage(@NotNull ErrorTreeElementKind kind) { - if (myCanHideWarnings && - (ErrorTreeElementKind.WARNING.equals(kind) || ErrorTreeElementKind.NOTE.equals(kind)) && - ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) { - return null; // no warnings are available + if (shouldHide(kind)) { + return null; // elements of this kind are hidden } synchronized (myLock) { final List simpleMessages = mySimpleMessages.get(kind); diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java index 556a409099be..3f516b3e52be 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java @@ -543,6 +543,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur group.add(new StopAction()); if (canHideWarnings()) { group.addSeparator(); + group.add(new ShowInfosAction()); group.add(new ShowWarningsAction()); } @@ -656,8 +657,29 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur @Override public void setSelected(@NotNull AnActionEvent event, boolean showWarnings) { - if (showWarnings == isHideWarnings()) { - myConfiguration.setHideWarnings(!showWarnings); + final boolean hideWarnings = !showWarnings; + if (myConfiguration.isHideWarnings() != hideWarnings) { + myConfiguration.setHideWarnings(hideWarnings); + myStructureModel.invalidate(); + } + } + } + + private class ShowInfosAction extends ToggleAction implements DumbAware { + ShowInfosAction() { + super(IdeBundle.message("action.show.infos"), null, AllIcons.General.ShowInfos); + } + + @Override + public boolean isSelected(@NotNull AnActionEvent event) { + return !isHideInfos(); + } + + @Override + public void setSelected(@NotNull AnActionEvent event, boolean showInfos) { + final boolean hideInfos = !showInfos; + if (myConfiguration.isHideInfoMessages() != hideInfos) { + myConfiguration.setHideInfoMessages(hideInfos); myStructureModel.invalidate(); } } @@ -667,6 +689,10 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur return myConfiguration.isHideWarnings(); } + public boolean isHideInfos() { + return myConfiguration.isHideInfoMessages(); + } + private class MyTreeExpander implements TreeExpander { @Override public void expandAll() { diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/impl/ErrorTreeViewConfiguration.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/impl/ErrorTreeViewConfiguration.java index b18444e5f1e9..f668521ea079 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/impl/ErrorTreeViewConfiguration.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/impl/ErrorTreeViewConfiguration.java @@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull; public class ErrorTreeViewConfiguration implements PersistentStateComponent { public boolean IS_AUTOSCROLL_TO_SOURCE = false; public boolean HIDE_WARNINGS = false; + public boolean HIDE_INFO_MESSAGES = false; public static ErrorTreeViewConfiguration getInstance(Project project) { return ServiceManager.getService(project, ErrorTreeViewConfiguration.class); @@ -32,6 +33,14 @@ public class ErrorTreeViewConfiguration implements PersistentStateComponent