mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
jps build: hide/show information messages (IDEA-53161)
GitOrigin-RevId: 9376fad781c0bd35fa7be08503a1716bba2e29ad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ec6937be0b
commit
3c4b5284a8
@@ -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;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1ZM7 12L7 7L9 7V12H7ZM7 4L7 6L9 6L9 4L7 4Z" fill="#6E6E6E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 314 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1ZM7 12L7 7L9 7V12H7ZM7 4L7 6L9 6L9 4L7 4Z" fill="#AFB1B3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 314 B |
@@ -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<ErrorTreeElement> elems = mySimpleMessages.get(kind);
|
||||
if (elems != null) {
|
||||
@@ -127,14 +123,12 @@ public class ErrorViewStructure extends AbstractTreeStructure {
|
||||
synchronized (myLock) {
|
||||
final List<NavigatableMessageElement> children = myGroupNameToMessagesMap.get(((GroupingElement)element).getName());
|
||||
if (children != null && !children.isEmpty()) {
|
||||
if (myCanHideWarnings && ErrorTreeViewConfiguration.getInstance(myProject).isHideWarnings()) {
|
||||
if (isFilteringNeeded()) {
|
||||
final List<ErrorTreeElement> 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<NavigatableMessageElement> 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<ErrorTreeElement> simpleMessages = mySimpleMessages.get(kind);
|
||||
|
||||
+28
-2
@@ -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() {
|
||||
|
||||
+9
@@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class ErrorTreeViewConfiguration implements PersistentStateComponent<ErrorTreeViewConfiguration> {
|
||||
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<Erro
|
||||
HIDE_WARNINGS = value;
|
||||
}
|
||||
|
||||
public boolean isHideInfoMessages() {
|
||||
return HIDE_INFO_MESSAGES;
|
||||
}
|
||||
|
||||
public void setHideInfoMessages(boolean value) {
|
||||
HIDE_INFO_MESSAGES = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorTreeViewConfiguration getState() {
|
||||
return this;
|
||||
|
||||
@@ -97,6 +97,7 @@ errortree.error=Error:
|
||||
errortree.warning=Warning:
|
||||
errortree.note=Note:
|
||||
action.show.warnings=Show warnings
|
||||
action.show.infos=Show information messages
|
||||
action.next.message=Next Message
|
||||
action.previous.message=Previous Message
|
||||
action.next.problem=Next Problem
|
||||
|
||||
@@ -990,6 +990,7 @@ public class AllIcons {
|
||||
/** 16x16 */ public static final Icon SeparatorH = load("/general/separatorH.svg");
|
||||
/** 16x16 */ public static final Icon Settings = load("/general/settings.svg");
|
||||
/** 16x16 */ public static final Icon Show_to_implement = load("/general/show_to_implement.svg");
|
||||
/** 16x16 */ public static final Icon ShowInfos = load("/general/showInfos.svg");
|
||||
/** 16x16 */ public static final Icon ShowWarning = load("/general/showWarning.svg");
|
||||
/** 16x16 */ public static final Icon TbHidden = load("/general/tbHidden.svg");
|
||||
/** 16x16 */ public static final Icon TbShown = load("/general/tbShown.svg");
|
||||
|
||||
Reference in New Issue
Block a user