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