42
42
import io .flutter .sdk .FlutterSdk ;
43
43
import io .flutter .sdk .FlutterSdkVersion ;
44
44
import io .flutter .settings .FlutterSettings ;
45
- import io .flutter .toolwindow .FlutterViewToolWindowManagerListener ;
45
+ import io .flutter .toolwindow .InspectorViewToolWindowManagerListener ;
46
46
import io .flutter .utils .*;
47
47
import org .dartlang .vm .service .VmService ;
48
48
import org .jetbrains .annotations .NotNull ;
49
+ import org .jetbrains .annotations .Nullable ;
49
50
50
51
import javax .swing .*;
51
52
import java .awt .*;
55
56
import java .util .concurrent .atomic .AtomicReference ;
56
57
57
58
@ com .intellij .openapi .components .State (
58
- name = "FlutterView " ,
59
+ name = "InspectorView " ,
59
60
storages = {@ Storage ("$WORKSPACE_FILE$" )}
60
61
)
61
- public class FlutterView implements PersistentStateComponent <FlutterViewState >, Disposable {
62
- private static final Logger LOG = Logger .getInstance (FlutterView .class );
62
+ public class InspectorView implements PersistentStateComponent <InspectorViewState >, Disposable {
63
+ private static final Logger LOG = Logger .getInstance (InspectorView .class );
63
64
64
- public static final String TOOL_WINDOW_ID = "Flutter Inspector" ;
65
+ public static final @ NotNull String TOOL_WINDOW_ID = "Flutter Inspector" ;
65
66
66
- public static final String WIDGET_TAB_LABEL = "Widgets" ;
67
- public static final String RENDER_TAB_LABEL = "Render Tree" ;
68
- public static final String PERFORMANCE_TAB_LABEL = "Performance" ;
69
67
protected static final String INSTALLATION_IN_PROGRESS_LABEL = "Installing JxBrowser and DevTools..." ;
70
68
protected static final String INSTALLATION_TIMED_OUT_LABEL =
71
69
"Waiting for JxBrowser installation timed out. Restart your IDE to try again." ;
72
70
protected static final String INSTALLATION_WAIT_FAILED = "The JxBrowser installation failed unexpectedly. Restart your IDE to try again." ;
73
71
protected static final String DEVTOOLS_FAILED_LABEL = "Setting up DevTools failed." ;
74
72
protected static final int INSTALLATION_WAIT_LIMIT_SECONDS = 2000 ;
75
73
76
- protected final EventStream <Boolean > shouldAutoHorizontalScroll = new EventStream <>(FlutterViewState .AUTO_SCROLL_DEFAULT );
77
- protected final EventStream <Boolean > highlightNodesShownInBothTrees =
78
- new EventStream <>(FlutterViewState .HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT );
74
+ protected final @ NotNull EventStream <Boolean > shouldAutoHorizontalScroll = new EventStream <>(InspectorViewState .AUTO_SCROLL_DEFAULT );
75
+ protected final @ NotNull EventStream <Boolean > highlightNodesShownInBothTrees =
76
+ new EventStream <>(InspectorViewState .HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT );
79
77
80
78
@ NotNull
81
- private final FlutterViewState state = new FlutterViewState ();
79
+ private final InspectorViewState state = new InspectorViewState ();
82
80
83
81
@ VisibleForTesting
84
82
@ NotNull
@@ -87,23 +85,23 @@ public class FlutterView implements PersistentStateComponent<FlutterViewState>,
87
85
@ NotNull
88
86
private final Project myProject ;
89
87
90
- private Content emptyContent ;
88
+ private @ Nullable Content emptyContent ;
91
89
92
- private FlutterViewToolWindowManagerListener toolWindowListener ;
90
+ private InspectorViewToolWindowManagerListener toolWindowListener ;
93
91
private int devToolsInstallCount = 0 ;
94
92
private final JxBrowserUtils jxBrowserUtils ;
95
93
private final JxBrowserManager jxBrowserManager ;
96
94
97
- public FlutterView (@ NotNull Project project ) {
95
+ public InspectorView (@ NotNull Project project ) {
98
96
this (project , JxBrowserManager .getInstance (), new JxBrowserUtils (), new ViewUtils ());
99
97
}
100
98
101
99
@ VisibleForTesting
102
100
@ NonInjectable
103
- protected FlutterView (@ NotNull Project project ,
104
- @ NotNull JxBrowserManager jxBrowserManager ,
105
- JxBrowserUtils jxBrowserUtils ,
106
- ViewUtils viewUtils ) {
101
+ protected InspectorView (@ NotNull Project project ,
102
+ @ NotNull JxBrowserManager jxBrowserManager ,
103
+ JxBrowserUtils jxBrowserUtils ,
104
+ ViewUtils viewUtils ) {
107
105
myProject = project ;
108
106
this .jxBrowserUtils = jxBrowserUtils ;
109
107
this .jxBrowserManager = jxBrowserManager ;
@@ -120,7 +118,7 @@ public void dispose() {
120
118
121
119
@ NotNull
122
120
@ Override
123
- public FlutterViewState getState () {
121
+ public InspectorViewState getState () {
124
122
return state ;
125
123
}
126
124
@@ -130,14 +128,14 @@ public Project getProject() {
130
128
}
131
129
132
130
@ Override
133
- public void loadState (@ NotNull FlutterViewState state ) {
131
+ public void loadState (@ NotNull InspectorViewState state ) {
134
132
this .state .copyFrom (state );
135
133
136
134
shouldAutoHorizontalScroll .setValue (this .state .getShouldAutoScroll ());
137
135
highlightNodesShownInBothTrees .setValue (this .state .getHighlightNodesShownInBothTrees ());
138
136
}
139
137
140
- void initToolWindow (ToolWindow window ) {
138
+ void initToolWindow (@ NotNull ToolWindow window ) {
141
139
if (window .isDisposed ()) return ;
142
140
143
141
updateForEmptyContent (window );
@@ -264,7 +262,7 @@ protected void verifyEventDispatchThread() {
264
262
@ VisibleForTesting
265
263
protected void setUpToolWindowListener (FlutterApp app , ToolWindow toolWindow , boolean isEmbedded , DevToolsIdeFeature ideFeature ) {
266
264
if (this .toolWindowListener == null ) {
267
- this .toolWindowListener = new FlutterViewToolWindowManagerListener (myProject , toolWindow );
265
+ this .toolWindowListener = new InspectorViewToolWindowManagerListener (myProject , toolWindow );
268
266
}
269
267
this .toolWindowListener .updateOnWindowOpen (() -> {
270
268
devToolsInstallCount += 1 ;
@@ -432,13 +430,13 @@ private void replacePanelLabel(ToolWindow toolWindow, JComponent label) {
432
430
});
433
431
}
434
432
435
- private void debugActiveHelper (FlutterApp app ) {
433
+ private void debugActiveHelper (@ NotNull FlutterApp app ) {
436
434
final ToolWindowManager toolWindowManager = ToolWindowManager .getInstance (myProject );
437
435
if (!(toolWindowManager instanceof ToolWindowManagerEx )) {
438
436
return ;
439
437
}
440
438
441
- final ToolWindow toolWindow = toolWindowManager .getToolWindow (FlutterView .TOOL_WINDOW_ID );
439
+ final ToolWindow toolWindow = toolWindowManager .getToolWindow (InspectorView .TOOL_WINDOW_ID );
442
440
if (toolWindow == null ) {
443
441
return ;
444
442
}
@@ -464,7 +462,7 @@ private void debugActiveHelper(FlutterApp app) {
464
462
}
465
463
else {
466
464
if (toolWindowListener == null ) {
467
- toolWindowListener = new FlutterViewToolWindowManagerListener (myProject , toolWindow );
465
+ toolWindowListener = new InspectorViewToolWindowManagerListener (myProject , toolWindow );
468
466
}
469
467
// If the window isn't visible yet, only executed embedded browser steps when it becomes visible.
470
468
toolWindowListener .updateOnWindowFirstVisible (() -> {
0 commit comments