Skip to content

Commit 1622691

Browse files
committed
Rebase
1 parent ac417a4 commit 1622691

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/ui/console/log/LogPanel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.console.event.QueryParametersRetrievalErrorEvent.PARAMS_ERROR_COMMON_MSG;
3030
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.datasource.interactions.DataSourceDialog.HEIGHT;
3131
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.datasource.interactions.DataSourceDialog.THICKNESS;
32+
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.SHORT_STRING_LENGTH;
3233
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.getCause;
3334
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.truncateString;
3435
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.wrapExceptionInMeaningMessage;
@@ -167,7 +168,7 @@ private String printException(Exception exception) {
167168
}
168169
error(errorMessage);
169170
String details = exception.getMessage() + '\n' + getCause(exception);
170-
log.printHyperlink(SHOW_DETAILS, p -> showPopup("Error details", details));
171+
log.printHyperlink(" " + SHOW_DETAILS, p -> showPopup("Error details", details));
171172
newLine();
172173
return errorMessage;
173174
}
@@ -183,7 +184,7 @@ private void showPopup(String title, String details) {
183184
JTextArea exceptionDetails = new JTextArea();
184185
exceptionDetails.setLineWrap(true);
185186
exceptionDetails.append(details);
186-
JLabel jLabel = new JLabel(truncateString(details, 120), AllIcons.Process.State.RedExcl, JLabel.LEFT);
187+
JLabel jLabel = new JLabel(truncateString(details, SHORT_STRING_LENGTH), AllIcons.Process.State.RedExcl, JLabel.LEFT);
187188

188189
JBScrollPane scrollPane = new JBScrollPane(exceptionDetails);
189190
scrollPane.setPreferredSize(new Dimension(-1, HEIGHT));

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/ui/datasource/interactions/DataSourceDialog.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import javax.swing.*;
2323
import java.awt.*;
2424

25+
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.SHORT_STRING_LENGTH;
26+
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.getCause;
2527
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.truncateString;
2628

2729
public abstract class DataSourceDialog extends DialogWrapper {
@@ -37,6 +39,7 @@ protected DataSourceDialog(@Nullable Project project, DataSourcesView dataSource
3739
public abstract DataSourceApi constructDataSource();
3840

3941
protected abstract void showLoading();
42+
4043
protected abstract void hideLoading();
4144

4245
public boolean go() {
@@ -45,7 +48,6 @@ public boolean go() {
4548
}
4649

4750

48-
4951
public void validationPopup() {
5052
JPanel popupPanel = new JPanel(new BorderLayout());
5153
popupPanel.setBorder(JBUI.Borders.empty(THICKNESS));
@@ -115,16 +117,11 @@ private void connectionFailed(
115117
JComponent contentPanel) {
116118
hideLoading();
117119

118-
JLabel connectionFailed = new JLabel("Connection failed: " + truncateString(exception.getMessage()), AllIcons.Process.State.RedExcl, JLabel.LEFT);
120+
JLabel connectionFailed = new JLabel("Connection failed: " + truncateString(exception.getMessage(), SHORT_STRING_LENGTH), AllIcons.Process.State.RedExcl, JLabel.LEFT);
119121

120122
JTextArea exceptionCauses = new JTextArea();
121123
exceptionCauses.setLineWrap(true);
122-
123-
Throwable cause = exception.getCause();
124-
while (cause != null) {
125-
exceptionCauses.append(cause.getMessage() + "\n");
126-
cause = cause.getCause();
127-
}
124+
exceptionCauses.append(getCause(exception));
128125

129126
JBScrollPane scrollPane = new JBScrollPane(exceptionCauses);
130127
scrollPane.setPreferredSize(new Dimension(-1, HEIGHT));

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/util/ExceptionWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class ExceptionWrapper {
66
private final static String NON_THIN_CHARS = "[^iIl1\\.,']";
7-
private final static int SHORT_STRING_LENGTH = 140;
7+
public final static int SHORT_STRING_LENGTH = 140;
88

99
private static int textWidth(String str) {
1010
return str.length() - str.replaceAll(NON_THIN_CHARS, "").length() / 2;

0 commit comments

Comments
 (0)