3
3
import com .intellij .execution .filters .TextConsoleBuilderFactory ;
4
4
import com .intellij .execution .ui .ConsoleView ;
5
5
import com .intellij .execution .ui .ConsoleViewContentType ;
6
+ import com .intellij .icons .AllIcons ;
6
7
import com .intellij .openapi .Disposable ;
7
8
import com .intellij .openapi .project .Project ;
9
+ import com .intellij .openapi .ui .popup .JBPopupFactory ;
8
10
import com .intellij .openapi .util .Disposer ;
9
11
import com .intellij .util .messages .MessageBus ;
10
12
import com .neueda .jetbrains .plugin .graphdb .database .api .query .GraphQueryResult ;
16
18
import com .neueda .jetbrains .plugin .graphdb .jetbrains .ui .console .event .QueryParametersRetrievalErrorEvent ;
17
19
import com .neueda .jetbrains .plugin .graphdb .jetbrains .ui .datasource .metadata .MetadataRetrieveEvent ;
18
20
21
+ import javax .swing .*;
19
22
import java .awt .*;
20
23
import java .util .HashMap ;
21
24
import java .util .Map ;
22
25
23
26
import static com .neueda .jetbrains .plugin .graphdb .jetbrains .ui .console .event .QueryParametersRetrievalErrorEvent .PARAMS_ERROR_COMMON_MSG ;
24
- import static com .neueda .jetbrains .plugin .graphdb .jetbrains .ui . console . log . ShowExceptionDetailsFilter . SHOW_DETAILS ;
27
+ import static com .neueda .jetbrains .plugin .graphdb .jetbrains .util . ExceptionWrapper . getCause ;
25
28
import static com .neueda .jetbrains .plugin .graphdb .jetbrains .util .ExceptionWrapper .wrapExceptionInMeaningMessage ;
26
29
27
30
public class LogPanel implements Disposable {
31
+ private static final String SHOW_DETAILS = "Show details" ;
32
+
28
33
private ConsoleView log ;
29
34
private Map <String , String > exceptions = new HashMap <>();
30
35
private Map <String , String > causes = new HashMap <>();
@@ -36,7 +41,6 @@ public void initialize(GraphConsoleView graphConsoleView, Project project) {
36
41
.createBuilder (project )
37
42
.getConsole ();
38
43
log .addMessageFilter (new GoToTabFilter (log ));
39
- log .addMessageFilter (new ShowExceptionDetailsFilter (log , exceptions ));
40
44
41
45
Disposer .register (graphConsoleView , log );
42
46
graphConsoleView .getLogTab ().add (log .getComponent (), BorderLayout .CENTER );
@@ -149,11 +153,13 @@ public void error(String message) {
149
153
private String printException (Exception exception ) {
150
154
String errorMessage ;
151
155
if (exception .getMessage () != null ) {
152
- errorMessage = wrapExceptionInMeaningMessage (exception ) + " " + SHOW_DETAILS ;
156
+ errorMessage = wrapExceptionInMeaningMessage (exception );
153
157
} else {
154
- errorMessage = exception .toString () + " " + SHOW_DETAILS ;
158
+ errorMessage = exception .toString ();
155
159
}
156
160
error (errorMessage );
161
+ String details = exception .getMessage () + '\n' + getCause (exception );
162
+ log .printHyperlink (SHOW_DETAILS , p -> showPopup ("Error" , details ));
157
163
newLine ();
158
164
return errorMessage ;
159
165
}
@@ -162,6 +168,18 @@ private void newLine() {
162
168
log .print ("\n " , ConsoleViewContentType .NORMAL_OUTPUT );
163
169
}
164
170
171
+ private void showPopup (String title , String text ) {
172
+ JBPopupFactory .getInstance ()
173
+ .createComponentPopupBuilder (
174
+ new JLabel (text ,
175
+ AllIcons .General .Error ,
176
+ JLabel .LEFT ),
177
+ log .getComponent ())
178
+ .setTitle (title )
179
+ .createPopup ()
180
+ .showInFocusCenter ();
181
+ }
182
+
165
183
@ Override
166
184
public void dispose () {
167
185
log .dispose ();
0 commit comments