[ui] new error reporting dialog (IDEA-188535)

This commit is contained in:
Roman Shevchenko
2018-04-18 21:16:05 +02:00
parent c5cc88d810
commit 92599f5420
7 changed files with 700 additions and 958 deletions
@@ -1,22 +1,7 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.diagnostic;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
/**
@@ -25,10 +10,16 @@ import org.jetbrains.annotations.Nullable;
public class IdeaLoggingEvent {
private final String myMessage;
private final Throwable myThrowable;
private final Object myData;
public IdeaLoggingEvent(String message, Throwable throwable) {
this(message, throwable, null);
}
public IdeaLoggingEvent(String message, Throwable throwable, Object data) {
myMessage = message;
myThrowable = throwable;
myData = data;
}
public String getMessage() {
@@ -40,18 +31,16 @@ public class IdeaLoggingEvent {
}
public String getThrowableText() {
if (myThrowable == null) return "";
return StringUtil.getThrowableText(myThrowable);
return myThrowable != null ? StringUtil.getThrowableText(myThrowable) : "";
}
@Nullable
public Object getData() {
return null;
return myData;
}
@NonNls
@Override
public String toString() {
return "IdeaLoggingEvent[message=" + myMessage + ", throwable=" + getThrowableText() + "]";
}
}
}
@@ -1,16 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ui;
import com.intellij.ui.components.JBList;
@@ -76,8 +64,10 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
for (int index : getSelectedIndices()) {
if (index >= 0) {
JCheckBox checkbox = getCheckBoxAt(index);
value = value != null ? value : !checkbox.isSelected();
setSelected(checkbox, index, value);
if (checkbox.isEnabled()) {
value = value != null ? value : !checkbox.isSelected();
setSelected(checkbox, index, value);
}
}
}
}
@@ -98,7 +88,9 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
if (p != null) {
Dimension dim = getCheckBoxDimension(checkBox);
if (p.x >= 0 && p.x < dim.width && p.y >= 0 && p.y < dim.height) {
setSelected(checkBox, index, !checkBox.isSelected());
if (checkBox.isEnabled()) {
setSelected(checkBox, index, !checkBox.isSelected());
}
return true;
}
}
@@ -353,7 +345,7 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
Font font = getFont();
checkbox.setBackground(backgroundColor);
checkbox.setForeground(textColor);
checkbox.setEnabled(isEnabled());
checkbox.setEnabled(isEnabled() && isEnabled(index));
checkbox.setFont(font);
checkbox.setFocusPainted(false);
checkbox.setBorderPainted(false);
@@ -367,7 +359,7 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
panel.add(checkbox, BorderLayout.LINE_START);
JLabel infoLabel = new JLabel(auxText, SwingConstants.RIGHT);
infoLabel.setBorder(new EmptyBorder(0, 0, 0, checkbox.getInsets().left));
infoLabel.setBorder(JBUI.Borders.emptyRight(checkbox.getInsets().left));
infoLabel.setFont(UIUtil.getFont(UIUtil.FontSize.SMALL, font));
panel.add(infoLabel, BorderLayout.CENTER);
@@ -401,6 +393,10 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
return null;
}
protected boolean isEnabled(int index) {
return true;
}
protected Color getBackground(final boolean isSelected) {
return isSelected ? getSelectionBackground() : getBackground();
}
@@ -408,4 +404,4 @@ public class CheckBoxList<T> extends JBList<JCheckBox> {
protected Color getForeground(final boolean isSelected) {
return isSelected ? getSelectionForeground() : getForeground();
}
}
}
File diff suppressed because it is too large Load Diff
@@ -111,17 +111,17 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
}
private void doOpenErrorsDialog(@Nullable LogMessage message) {
myDialog = new IdeErrorsDialog(myMessagePool, message) {
@Override
public void doOKAction() {
super.doOKAction();
disposeDialog(this);
}
if (isOtherModalWindowActive()) {
return;
}
Project project = myFrame != null ? myFrame.getProject() : null;
myDialog = new IdeErrorsDialog(myMessagePool, project, message) {
@Override
public void doCancelAction() {
super.doCancelAction();
disposeDialog(this);
protected void dispose() {
super.dispose();
myDialog = null;
updateFatalErrorsIcon();
}
@Override
@@ -131,17 +131,11 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
}
};
myMessagePool.addListener(myDialog);
if (!isOtherModalWindowActive()) {
if (myBalloon != null) {
myBalloon.hide();
}
myDialog.show();
}
else {
myDialog.close(0);
disposeDialog(myDialog);
if (myBalloon != null) {
myBalloon.hide();
}
myDialog.show();
}
private void updateState(IdeErrorsIcon.State state) {
@@ -149,12 +143,6 @@ public class IdeMessagePanel extends JPanel implements MessagePoolListener, Icon
UIUtil.invokeLaterIfNeeded(() -> setVisible(state != IdeErrorsIcon.State.NoErrors));
}
private void disposeDialog(IdeErrorsDialog dialog) {
myMessagePool.removeListener(dialog);
updateFatalErrorsIcon();
myDialog = null;
}
@Override
public void newEntryAdded() {
updateFatalErrorsIcon();
@@ -3,7 +3,6 @@ package com.intellij.diagnostic.errordialog;
import com.intellij.diagnostic.Developer;
import com.intellij.diagnostic.DiagnosticBundle;
import com.intellij.diagnostic.IdeErrorsDialog;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.IdeBorderFactory;
@@ -35,7 +34,7 @@ public class DetailsTabForm {
public DetailsTabForm(@Nullable Action analyzeAction) {
myCommentsArea.setTitle(DiagnosticBundle.message("error.dialog.comment.prompt"));
myDetailsPane.setBackground(UIUtil.getTextFieldBackground());
myDetailsHolder.setPreferredSize(JBUI.size(IdeErrorsDialog.COMPONENTS_WIDTH, 150));
myDetailsHolder.setPreferredSize(JBUI.size(670, 150));
myDetailsHolder.setBorder(IdeBorderFactory.createBorder());
if (analyzeAction != null) {
myAnalyzeStacktraceButton.setAction(analyzeAction);
@@ -1,143 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.diagnostic.IdeErrorsDialog">
<grid id="27dc6" binding="myContentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="607" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="bea39" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="9847" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="North"/>
<properties/>
<border type="none"/>
<children>
<grid id="f2b31" layout-manager="BorderLayout" hgap="0" vgap="3">
<constraints border-constraint="Center"/>
<properties/>
<border type="empty">
<size top="1" left="0" bottom="0" right="0"/>
</border>
<children>
<grid id="b2cb3" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children>
<component id="44ee8" class="com.intellij.ui.HyperlinkLabel$Croppable" binding="myInfoLabel">
<constraints border-constraint="West"/>
<properties/>
</component>
<component id="3f648" class="com.intellij.ui.HyperlinkLabel$Croppable" binding="myDisableLink">
<constraints border-constraint="Center"/>
<properties/>
</component>
</children>
</grid>
<grid id="a2fe0" binding="myForeignPluginWarningPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="South"/>
<properties/>
<border type="none"/>
<children>
<component id="596c6" class="com.intellij.ui.HyperlinkLabel$Croppable" binding="myForeignPluginWarningLabel">
<constraints border-constraint="Center"/>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
<grid id="7403d" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="1">
<constraints border-constraint="West"/>
<properties/>
<border type="none"/>
<children>
<grid id="6e90" binding="myBackButtonPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints/>
<properties/>
<border type="none"/>
<children/>
</grid>
<component id="52018" class="javax.swing.JLabel" binding="myCountLabel">
<constraints/>
<properties>
<horizontalAlignment value="0"/>
<horizontalTextPosition value="0"/>
<text value="1 of 3"/>
</properties>
</component>
<grid id="c01f9" binding="myNextButtonPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
<grid id="16a45" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="South"/>
<properties/>
<border type="none"/>
<children>
<grid id="3eb3d" binding="myCredentialsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="North"/>
<properties/>
<border type="empty">
<size top="5" left="0" bottom="0" right="0"/>
</border>
<children>
<component id="64a8b" class="com.intellij.ui.HyperlinkLabel" binding="myCredentialsLabel">
<constraints border-constraint="East"/>
<properties/>
</component>
</children>
</grid>
<grid id="4f91d" binding="myAttachmentWarningPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="South"/>
<properties/>
<border type="empty">
<size top="5" left="0" bottom="0" right="0"/>
</border>
<children>
<component id="23d84" class="com.intellij.ui.HyperlinkLabel" binding="myAttachmentWarningLabel">
<constraints border-constraint="East"/>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
<grid id="9a9a6" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children>
<grid id="3e6fb" binding="myTabsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="7a082" binding="myAttachments" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="South"/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
</children>
</grid>
</form>
@@ -12,9 +12,11 @@ diagnostic.error.report.send=&Send
diagnostic.error.report.description=If you would like to get notified when the exceptions you submit are fixed,\nplease fill in your JetBrains Account login and password.
diagnostic.error.report.login.name=&Username:
diagnostic.error.report.login.password=&Password:
diagnostic.error.report.submit.error.anonymously=<html>Submit report anonymously or use <a>JetBrains Account...</a></html>
diagnostic.error.report.submit.report.as=<html>Submit report as <a>{0}</a></html>
diagnostic.error.report.additional.info.label=&Additional information (steps to reproduce, what were you doing when the exception occurred):
diagnostic.error.report.submit.error.anonymously=<html>Submit anonymously or use <a>JetBrains Account</a></html>
diagnostic.error.report.submit.report.as=<html>Submit as <b>{0}</b> or <a>change account</a></html>
diagnostic.error.report.additional.info.label=&Additional information (steps to reproduce, what were you doing when the exception occurred, etc.):
diagnostic.error.report.attachments.label=<html>To investigate and fix the problem, we need the following files to be attached to the bug report.<br>\
<b>Note:</b> all the data you send will be kept private.</html>
error.report.to.jetbrains.action=&Report to JetBrains
error.report.gratitude=Thank you for your feedback!
error.report.authentication.failed=JetBrains Account authentication failed. Do you want to try again?
@@ -25,6 +27,7 @@ error.report.new.eap.build.message=New build {0} is available.
error.report.sending.failure=Sending failed. Do you want to try again?
error.list.message.info={0}. Occurred {1,choice,1#once|2#{1} times} since the last clear.
error.list.message.unread=Unread.
error.list.message.submitting=Submitting...
error.list.message.submission.failed=Submission failed
error.list.message.submitted.as.link=Submitted as <a href="{0}">{1}</a>
error.list.message.duplicate=[Duplicate]
@@ -76,10 +79,16 @@ error.dialog.disable.plugin.prompt=<html>Are you sure to disable plugin <b>{0}</
error.dialog.disable.plugin.restart=Changes in plugin configuration will take effect after {0} restart.
error.dialog.disable.plugin.norestart=After disabling the plugin please restart {0} to apply changes in plugin configuration.
error.dialog.disable.plugin.title=Disable Plugin
error.dialog.disable.prompt=Are you sure you want to disable plugin <b>{0}</b>?
error.dialog.disable.prompt.lone=Functionality provided by the plugin will no longer be available.
error.dialog.disable.prompt.deps=Functionality provided by this and dependent plugins will no longer be available.
error.dialog.disable.plugin.can.restart=Changes in plugin configuration will take an effect after restart.
error.dialog.disable.plugin.no.restart=Please restart the IDE to apply changes in plugin configuration.
error.dialog.disable.plugin.action.disable=&Disable
error.dialog.disable.plugin.action.disableAndRestart=Disable and &Restart
error.dialog.foreign.plugin.warning.text=This plugin is not a production of JetBrains. Please report the problem to plugin vendor.
error.dialog.foreign.plugin.warning.text.vendor=This plugin is not a production of JetBrains. Please report the problem to plugin vendor:
error.dialog.foreign.plugin.warning=This plugin is not a production of JetBrains. Please report the problem to plugin vendor.
error.dialog.foreign.plugin.warning.unknown=<html>This plugin is not a production of JetBrains. Please report the problem to <a>plugin vendor</a>.</html>
error.dialog.foreign.plugin.warning.vendor=<html>This plugin is not a production of JetBrains. Please report the problem to <a>{0}</a>.</html>
error.dialog.clear.action=&Clear
error.dialog.clear.all.action=&Clear all
error.list.empty=(no errors)