Skip to content

Commit b8ada3b

Browse files
committed
Rebase
1 parent 5aa8644 commit b8ada3b

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
@@ -28,6 +28,7 @@
2828
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.console.event.QueryParametersRetrievalErrorEvent.PARAMS_ERROR_COMMON_MSG;
2929
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.datasource.interactions.DataSourceDialog.HEIGHT;
3030
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.datasource.interactions.DataSourceDialog.THICKNESS;
31+
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.SHORT_STRING_LENGTH;
3132
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.getCause;
3233
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.truncateString;
3334
import static com.neueda.jetbrains.plugin.graphdb.jetbrains.util.ExceptionWrapper.wrapExceptionInMeaningMessage;
@@ -164,7 +165,7 @@ private String printException(Exception exception) {
164165
}
165166
error(errorMessage);
166167
String details = exception.getMessage() + '\n' + getCause(exception);
167-
log.printHyperlink(SHOW_DETAILS, p -> showPopup("Error details", details));
168+
log.printHyperlink(" " + SHOW_DETAILS, p -> showPopup("Error details", details));
168169
newLine();
169170
return errorMessage;
170171
}
@@ -180,7 +181,7 @@ private void showPopup(String title, String details) {
180181
JTextArea exceptionDetails = new JTextArea();
181182
exceptionDetails.setLineWrap(true);
182183
exceptionDetails.append(details);
183-
JLabel jLabel = new JLabel(truncateString(details, 120), AllIcons.Process.State.RedExcl, JLabel.LEFT);
184+
JLabel jLabel = new JLabel(truncateString(details, SHORT_STRING_LENGTH), AllIcons.Process.State.RedExcl, JLabel.LEFT);
184185

185186
JBScrollPane scrollPane = new JBScrollPane(exceptionDetails);
186187
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
@@ -21,6 +21,8 @@
2121
import javax.swing.*;
2222
import java.awt.*;
2323

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

2628
public abstract class DataSourceDialog extends DialogWrapper {
@@ -36,6 +38,7 @@ protected DataSourceDialog(@Nullable Project project, DataSourcesView dataSource
3638
public abstract DataSourceApi constructDataSource();
3739

3840
protected abstract void showLoading();
41+
3942
protected abstract void hideLoading();
4043

4144
public boolean go() {
@@ -44,7 +47,6 @@ public boolean go() {
4447
}
4548

4649

47-
4850
public void validationPopup() {
4951
JPanel popupPanel = new JPanel(new BorderLayout());
5052
popupPanel.setBorder(JBUI.Borders.empty(THICKNESS));
@@ -113,16 +115,11 @@ private void connectionFailed(
113115
JComponent contentPanel) {
114116
hideLoading();
115117

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

118120
JTextArea exceptionCauses = new JTextArea();
119121
exceptionCauses.setLineWrap(true);
120-
121-
Throwable cause = exception.getCause();
122-
while (cause != null) {
123-
exceptionCauses.append(cause.getMessage() + "\n");
124-
cause = cause.getCause();
125-
}
122+
exceptionCauses.append(getCause(exception));
126123

127124
JBScrollPane scrollPane = new JBScrollPane(exceptionCauses);
128125
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)