From 2ed1baafaa3bfef60cdcd34de9771517d953b7fc Mon Sep 17 00:00:00 2001 From: pq Date: Thu, 8 May 2025 15:40:25 -0700 Subject: [PATCH] [CQ] rename `Flutter` -> `InspectorView` --- .../src/io/flutter/FlutterInitializer.java | 4 +- .../logging/FlutterConsoleLogManager.java | 4 +- ...spectorViewToolWindowManagerListener.java} | 8 +-- .../{FlutterView.java => InspectorView.java} | 50 ++++++++-------- ...Factory.java => InspectorViewFactory.java} | 21 +++---- ...ViewState.java => InspectorViewState.java} | 11 ++-- .../vmService/DisplayRefreshRateManager.java | 6 +- .../flutter/vmService/VMServiceManager.java | 4 +- ...erViewTest.java => InspectorViewTest.java} | 57 ++++++++++--------- resources/META-INF/plugin.xml | 4 +- resources/META-INF/plugin_template.xml | 4 +- 11 files changed, 83 insertions(+), 90 deletions(-) rename flutter-idea/src/io/flutter/toolwindow/{FlutterViewToolWindowManagerListener.java => InspectorViewToolWindowManagerListener.java} (85%) rename flutter-idea/src/io/flutter/view/{FlutterView.java => InspectorView.java} (92%) rename flutter-idea/src/io/flutter/view/{FlutterViewFactory.java => InspectorViewFactory.java} (67%) rename flutter-idea/src/io/flutter/view/{FlutterViewState.java => InspectorViewState.java} (86%) rename flutter-idea/testSrc/unit/io/flutter/view/{FlutterViewTest.java => InspectorViewTest.java} (78%) diff --git a/flutter-idea/src/io/flutter/FlutterInitializer.java b/flutter-idea/src/io/flutter/FlutterInitializer.java index 6ae608ea89..b217c1cfce 100644 --- a/flutter-idea/src/io/flutter/FlutterInitializer.java +++ b/flutter-idea/src/io/flutter/FlutterInitializer.java @@ -52,7 +52,7 @@ import io.flutter.survey.FlutterSurveyNotifications; import io.flutter.utils.FlutterModuleUtils; import io.flutter.utils.OpenApiUtils; -import io.flutter.view.FlutterViewFactory; +import io.flutter.view.InspectorViewFactory; import org.jetbrains.annotations.NotNull; import java.time.LocalDate; @@ -366,7 +366,7 @@ public void actionPerformed(@NotNull AnActionEvent event) { private void initializeToolWindows(@NotNull final Project project) { // Start watching for Flutter debug active events. - FlutterViewFactory.init(project); + InspectorViewFactory.init(project); RemainingDevToolsViewFactory.init(project); DevToolsExtensionsViewFactory.init(project); toolWindowsInitialized = true; diff --git a/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java b/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java index 5562ee45a2..cb917f64a4 100644 --- a/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java +++ b/flutter-idea/src/io/flutter/logging/FlutterConsoleLogManager.java @@ -35,7 +35,7 @@ import io.flutter.settings.FlutterSettings; import io.flutter.utils.JsonUtils; import io.flutter.view.EmbeddedBrowser; -import io.flutter.view.FlutterView; +import io.flutter.view.InspectorView; import io.flutter.vmService.VmServiceConsumers; import org.dartlang.vm.service.VmService; import org.dartlang.vm.service.consumer.GetObjectConsumer; @@ -372,7 +372,7 @@ public void actionPerformed(@NotNull AnActionEvent event) { return; } - final ToolWindow toolWindow = toolWindowManager.getToolWindow(FlutterView.TOOL_WINDOW_ID); + final ToolWindow toolWindow = toolWindowManager.getToolWindow(InspectorView.TOOL_WINDOW_ID); if (toolWindow != null && !toolWindow.isVisible()) { toolWindow.show(); } diff --git a/flutter-idea/src/io/flutter/toolwindow/FlutterViewToolWindowManagerListener.java b/flutter-idea/src/io/flutter/toolwindow/InspectorViewToolWindowManagerListener.java similarity index 85% rename from flutter-idea/src/io/flutter/toolwindow/FlutterViewToolWindowManagerListener.java rename to flutter-idea/src/io/flutter/toolwindow/InspectorViewToolWindowManagerListener.java index 6ff4f7c0fa..5e24baa874 100644 --- a/flutter-idea/src/io/flutter/toolwindow/FlutterViewToolWindowManagerListener.java +++ b/flutter-idea/src/io/flutter/toolwindow/InspectorViewToolWindowManagerListener.java @@ -9,15 +9,15 @@ import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.ex.ToolWindowManagerListener; -import io.flutter.view.FlutterView; +import io.flutter.view.InspectorView; import org.jetbrains.annotations.NotNull; -public class FlutterViewToolWindowManagerListener implements ToolWindowManagerListener { +public class InspectorViewToolWindowManagerListener implements ToolWindowManagerListener { private boolean inspectorIsOpen; private Runnable onWindowOpen; private Runnable onWindowFirstVisible; - public FlutterViewToolWindowManagerListener(Project project, ToolWindow toolWindow) { + public InspectorViewToolWindowManagerListener(Project project, ToolWindow toolWindow) { project.getMessageBus().connect().subscribe(ToolWindowManagerListener.TOPIC, this); inspectorIsOpen = toolWindow.isShowStripeButton(); @@ -33,7 +33,7 @@ public void updateOnWindowFirstVisible(Runnable onWindowFirstVisible) { @Override public void stateChanged(@NotNull ToolWindowManager toolWindowManager) { - final ToolWindow inspectorWindow = toolWindowManager.getToolWindow(FlutterView.TOOL_WINDOW_ID); + final ToolWindow inspectorWindow = toolWindowManager.getToolWindow(InspectorView.TOOL_WINDOW_ID); if (inspectorWindow == null) { return; } diff --git a/flutter-idea/src/io/flutter/view/FlutterView.java b/flutter-idea/src/io/flutter/view/InspectorView.java similarity index 92% rename from flutter-idea/src/io/flutter/view/FlutterView.java rename to flutter-idea/src/io/flutter/view/InspectorView.java index b7ac1ea22a..cc4efea754 100644 --- a/flutter-idea/src/io/flutter/view/FlutterView.java +++ b/flutter-idea/src/io/flutter/view/InspectorView.java @@ -42,10 +42,11 @@ import io.flutter.sdk.FlutterSdk; import io.flutter.sdk.FlutterSdkVersion; import io.flutter.settings.FlutterSettings; -import io.flutter.toolwindow.FlutterViewToolWindowManagerListener; +import io.flutter.toolwindow.InspectorViewToolWindowManagerListener; import io.flutter.utils.*; import org.dartlang.vm.service.VmService; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -55,17 +56,14 @@ import java.util.concurrent.atomic.AtomicReference; @com.intellij.openapi.components.State( - name = "FlutterView", + name = "InspectorView", storages = {@Storage("$WORKSPACE_FILE$")} ) -public class FlutterView implements PersistentStateComponent, Disposable { - private static final Logger LOG = Logger.getInstance(FlutterView.class); +public class InspectorView implements PersistentStateComponent, Disposable { + private static final Logger LOG = Logger.getInstance(InspectorView.class); - public static final String TOOL_WINDOW_ID = "Flutter Inspector"; + public static final @NotNull String TOOL_WINDOW_ID = "Flutter Inspector"; - public static final String WIDGET_TAB_LABEL = "Widgets"; - public static final String RENDER_TAB_LABEL = "Render Tree"; - public static final String PERFORMANCE_TAB_LABEL = "Performance"; protected static final String INSTALLATION_IN_PROGRESS_LABEL = "Installing JxBrowser and DevTools..."; protected static final String INSTALLATION_TIMED_OUT_LABEL = "Waiting for JxBrowser installation timed out. Restart your IDE to try again."; @@ -73,12 +71,12 @@ public class FlutterView implements PersistentStateComponent, protected static final String DEVTOOLS_FAILED_LABEL = "Setting up DevTools failed."; protected static final int INSTALLATION_WAIT_LIMIT_SECONDS = 2000; - protected final EventStream shouldAutoHorizontalScroll = new EventStream<>(FlutterViewState.AUTO_SCROLL_DEFAULT); - protected final EventStream highlightNodesShownInBothTrees = - new EventStream<>(FlutterViewState.HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT); + protected final @NotNull EventStream shouldAutoHorizontalScroll = new EventStream<>(InspectorViewState.AUTO_SCROLL_DEFAULT); + protected final @NotNull EventStream highlightNodesShownInBothTrees = + new EventStream<>(InspectorViewState.HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT); @NotNull - private final FlutterViewState state = new FlutterViewState(); + private final InspectorViewState state = new InspectorViewState(); @VisibleForTesting @NotNull @@ -87,23 +85,23 @@ public class FlutterView implements PersistentStateComponent, @NotNull private final Project myProject; - private Content emptyContent; + private @Nullable Content emptyContent; - private FlutterViewToolWindowManagerListener toolWindowListener; + private InspectorViewToolWindowManagerListener toolWindowListener; private int devToolsInstallCount = 0; private final JxBrowserUtils jxBrowserUtils; private final JxBrowserManager jxBrowserManager; - public FlutterView(@NotNull Project project) { + public InspectorView(@NotNull Project project) { this(project, JxBrowserManager.getInstance(), new JxBrowserUtils(), new ViewUtils()); } @VisibleForTesting @NonInjectable - protected FlutterView(@NotNull Project project, - @NotNull JxBrowserManager jxBrowserManager, - JxBrowserUtils jxBrowserUtils, - ViewUtils viewUtils) { + protected InspectorView(@NotNull Project project, + @NotNull JxBrowserManager jxBrowserManager, + JxBrowserUtils jxBrowserUtils, + ViewUtils viewUtils) { myProject = project; this.jxBrowserUtils = jxBrowserUtils; this.jxBrowserManager = jxBrowserManager; @@ -120,7 +118,7 @@ public void dispose() { @NotNull @Override - public FlutterViewState getState() { + public InspectorViewState getState() { return state; } @@ -130,14 +128,14 @@ public Project getProject() { } @Override - public void loadState(@NotNull FlutterViewState state) { + public void loadState(@NotNull InspectorViewState state) { this.state.copyFrom(state); shouldAutoHorizontalScroll.setValue(this.state.getShouldAutoScroll()); highlightNodesShownInBothTrees.setValue(this.state.getHighlightNodesShownInBothTrees()); } - void initToolWindow(ToolWindow window) { + void initToolWindow(@NotNull ToolWindow window) { if (window.isDisposed()) return; updateForEmptyContent(window); @@ -264,7 +262,7 @@ protected void verifyEventDispatchThread() { @VisibleForTesting protected void setUpToolWindowListener(FlutterApp app, ToolWindow toolWindow, boolean isEmbedded, DevToolsIdeFeature ideFeature) { if (this.toolWindowListener == null) { - this.toolWindowListener = new FlutterViewToolWindowManagerListener(myProject, toolWindow); + this.toolWindowListener = new InspectorViewToolWindowManagerListener(myProject, toolWindow); } this.toolWindowListener.updateOnWindowOpen(() -> { devToolsInstallCount += 1; @@ -432,13 +430,13 @@ private void replacePanelLabel(ToolWindow toolWindow, JComponent label) { }); } - private void debugActiveHelper(FlutterApp app) { + private void debugActiveHelper(@NotNull FlutterApp app) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); if (!(toolWindowManager instanceof ToolWindowManagerEx)) { return; } - final ToolWindow toolWindow = toolWindowManager.getToolWindow(FlutterView.TOOL_WINDOW_ID); + final ToolWindow toolWindow = toolWindowManager.getToolWindow(InspectorView.TOOL_WINDOW_ID); if (toolWindow == null) { return; } @@ -464,7 +462,7 @@ private void debugActiveHelper(FlutterApp app) { } else { if (toolWindowListener == null) { - toolWindowListener = new FlutterViewToolWindowManagerListener(myProject, toolWindow); + toolWindowListener = new InspectorViewToolWindowManagerListener(myProject, toolWindow); } // If the window isn't visible yet, only executed embedded browser steps when it becomes visible. toolWindowListener.updateOnWindowFirstVisible(() -> { diff --git a/flutter-idea/src/io/flutter/view/FlutterViewFactory.java b/flutter-idea/src/io/flutter/view/InspectorViewFactory.java similarity index 67% rename from flutter-idea/src/io/flutter/view/FlutterViewFactory.java rename to flutter-idea/src/io/flutter/view/InspectorViewFactory.java index 3d144a4728..c1f482fe9a 100644 --- a/flutter-idea/src/io/flutter/view/FlutterViewFactory.java +++ b/flutter-idea/src/io/flutter/view/InspectorViewFactory.java @@ -13,18 +13,17 @@ import com.intellij.openapi.wm.ToolWindowFactory; import com.intellij.openapi.wm.ToolWindowManager; import io.flutter.utils.OpenApiUtils; -import io.flutter.utils.ViewListener; import org.jetbrains.annotations.NotNull; -public class FlutterViewFactory implements ToolWindowFactory, DumbAware { +public class InspectorViewFactory implements ToolWindowFactory, DumbAware { private static final String TOOL_WINDOW_VISIBLE_PROPERTY = "flutter.view.tool.window.visible"; public static void init(@NotNull Project project) { project.getMessageBus().connect().subscribe( - FlutterViewMessages.FLUTTER_DEBUG_TOPIC, (FlutterViewMessages.FlutterDebugNotifier)(event) -> initFlutterView(project, event) + FlutterViewMessages.FLUTTER_DEBUG_TOPIC, (FlutterViewMessages.FlutterDebugNotifier)(event) -> initInspectorView(project, event) ); - final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(FlutterView.TOOL_WINDOW_ID); + final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(InspectorView.TOOL_WINDOW_ID); if (window != null) { window.setAvailable(true); @@ -39,10 +38,10 @@ public boolean shouldBeAvailable(@NotNull Project project) { return false; } - private static void initFlutterView(@NotNull Project project, FlutterViewMessages.FlutterDebugEvent event) { + private static void initInspectorView(@NotNull Project project, FlutterViewMessages.FlutterDebugEvent event) { OpenApiUtils.safeInvokeLater(() -> { - final FlutterView flutterView = project.getService(FlutterView.class); - flutterView.debugActive(event); + final InspectorView inspectorView = project.getService(InspectorView.class); + inspectorView.debugActive(event); }); } @@ -50,13 +49,7 @@ private static void initFlutterView(@NotNull Project project, FlutterViewMessage public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { //noinspection CodeBlock2Expr DumbService.getInstance(project).runWhenSmart(() -> { - project.getService(FlutterView.class).initToolWindow(toolWindow); + project.getService(InspectorView.class).initToolWindow(toolWindow); }); } - - public static class FlutterViewListener extends ViewListener { - public FlutterViewListener(@NotNull Project project) { - super(project, FlutterView.TOOL_WINDOW_ID, TOOL_WINDOW_VISIBLE_PROPERTY); - } - } } diff --git a/flutter-idea/src/io/flutter/view/FlutterViewState.java b/flutter-idea/src/io/flutter/view/InspectorViewState.java similarity index 86% rename from flutter-idea/src/io/flutter/view/FlutterViewState.java rename to flutter-idea/src/io/flutter/view/InspectorViewState.java index 01da954ae0..2dbb4951c3 100644 --- a/flutter-idea/src/io/flutter/view/FlutterViewState.java +++ b/flutter-idea/src/io/flutter/view/InspectorViewState.java @@ -7,18 +7,19 @@ import com.intellij.util.EventDispatcher; import com.intellij.util.xmlb.annotations.Attribute; +import org.jetbrains.annotations.NotNull; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** - * State for the Flutter view. + * State for the Inspector view. */ -public class FlutterViewState { +public class InspectorViewState { public static final boolean AUTO_SCROLL_DEFAULT = false; public static final boolean HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT = false; - private final EventDispatcher dispatcher = EventDispatcher.create(ChangeListener.class); + private final @NotNull EventDispatcher dispatcher = EventDispatcher.create(ChangeListener.class); @Attribute(value = "splitter-proportion") public float splitterProportion; @@ -29,7 +30,7 @@ public class FlutterViewState { @Attribute(value = "highlight-nodes-shown-in-both-trees") public boolean highlightNodesShownInBothTrees = HIGHLIGHT_NODES_SHOWN_IN_BOTH_TREES_DEFAULT; - public FlutterViewState() { + public InspectorViewState() { } public float getSplitterProportion() { @@ -58,7 +59,7 @@ public void removeListener(ChangeListener listener) { dispatcher.removeListener(listener); } - void copyFrom(FlutterViewState other) { + void copyFrom(InspectorViewState other) { splitterProportion = other.splitterProportion; } diff --git a/flutter-idea/src/io/flutter/vmService/DisplayRefreshRateManager.java b/flutter-idea/src/io/flutter/vmService/DisplayRefreshRateManager.java index 05d9fcfc46..079a8dd265 100644 --- a/flutter-idea/src/io/flutter/vmService/DisplayRefreshRateManager.java +++ b/flutter-idea/src/io/flutter/vmService/DisplayRefreshRateManager.java @@ -79,7 +79,7 @@ public Double getCurrentDisplayRefreshRateRaw() { private CompletableFuture getDisplayRefreshRate() { final CompletableFuture displayRefreshRate = new CompletableFuture<>(); - vmServiceManager.getFlutterViewId().whenComplete((String id, Throwable throwable) -> { + vmServiceManager.getInspectorViewId().whenComplete((String id, Throwable throwable) -> { if (throwable != null) { // We often see "java.lang.RuntimeException: Method not found" from here; perhaps a race condition? LOG.warn(throwable.getMessage()); @@ -102,11 +102,11 @@ private CompletableFuture getDisplayRefreshRate() { return displayRefreshRate; } - private CompletableFuture invokeGetDisplayRefreshRate(String flutterViewId) { + private CompletableFuture invokeGetDisplayRefreshRate(String inspectorViewId) { final CompletableFuture ret = new CompletableFuture<>(); final JsonObject params = new JsonObject(); - params.addProperty("viewId", flutterViewId); + params.addProperty("viewId", inspectorViewId); vmService.callServiceExtension( vmServiceManager.getCurrentFlutterIsolateRaw().getId(), ServiceExtensions.displayRefreshRate, params, diff --git a/flutter-idea/src/io/flutter/vmService/VMServiceManager.java b/flutter-idea/src/io/flutter/vmService/VMServiceManager.java index 4140576a0b..b9180853a2 100644 --- a/flutter-idea/src/io/flutter/vmService/VMServiceManager.java +++ b/flutter-idea/src/io/flutter/vmService/VMServiceManager.java @@ -518,14 +518,14 @@ private void unregisterService(String serviceName) { } } - public CompletableFuture getFlutterViewId() { + public CompletableFuture getInspectorViewId() { return getFlutterViewsList().exceptionally(exception -> { throw new RuntimeException(exception.getMessage()); }).thenApplyAsync((JsonElement element) -> { final JsonArray viewsList = element.getAsJsonObject().get("views").getAsJsonArray(); for (JsonElement jsonElement : viewsList) { final JsonObject view = jsonElement.getAsJsonObject(); - if (Objects.equals(view.get("type").getAsString(), "FlutterView")) { + if (Objects.equals(view.get("type").getAsString(), "InspectorView")) { return view.get("id").getAsString(); } } diff --git a/flutter-idea/testSrc/unit/io/flutter/view/FlutterViewTest.java b/flutter-idea/testSrc/unit/io/flutter/view/InspectorViewTest.java similarity index 78% rename from flutter-idea/testSrc/unit/io/flutter/view/FlutterViewTest.java rename to flutter-idea/testSrc/unit/io/flutter/view/InspectorViewTest.java index 49065290d5..6467b4cca3 100644 --- a/flutter-idea/testSrc/unit/io/flutter/view/FlutterViewTest.java +++ b/flutter-idea/testSrc/unit/io/flutter/view/InspectorViewTest.java @@ -30,12 +30,12 @@ import java.util.concurrent.TimeoutException; -import static io.flutter.view.FlutterView.*; +import static io.flutter.view.InspectorView.*; import static org.mockito.Mockito.*; //@PrepareForTest({ThreadUtil.class, FlutterInitializer.class, JxBrowserUtils.class, // InspectorGroupManagerService.class, SwingUtilities.class}) -public class FlutterViewTest { +public class InspectorViewTest { Project mockProject = mock(Project.class); @Mock FlutterApp mockApp; @Mock ToolWindow mockToolWindow; @@ -87,8 +87,8 @@ public void tearDown() { public void testHandleJxBrowserInstalled() { // If JxBrowser has been installed, we should use the DevTools instance to open the embedded browser. final JxBrowserUtils mockJxBrowserUtils = mock(JxBrowserUtils.class); - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockJxBrowserUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockJxBrowserUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(spy).verifyEventDispatchThread(); doNothing().when(spy).openInspectorWithDevTools(any(), any(), anyBoolean(), any()); @@ -108,8 +108,8 @@ public void testHandleJxBrowserInstallationFailed() { when(mockJxBrowserManager.getLatestFailureReason()).thenReturn(new InstallationFailedReason(FailureType.FILE_DOWNLOAD_FAILED)); // If JxBrowser failed to install, we should show a failure message that allows the user to manually retry. - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockJxBrowserUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockJxBrowserUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(viewUtilsSpy).presentClickableLabel( eq(mockToolWindow), anyList() @@ -128,8 +128,8 @@ public void testHandleJxBrowserInstallationInProgressWithSuccessfulInstall() { // If the JxBrowser installation is initially in progress, we should show a message about the installation. // If the installation quickly finishes (on the first re-check), then we should call the function to handle successful installation. - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(spy).presentOpenDevToolsOptionWithMessage(any(), any(), any(), any()); doNothing().when(spy).handleJxBrowserInstalled(any(), any(), any()); @@ -146,8 +146,8 @@ public void testHandleJxBrowserInstallationInProgressWaiting() { // If the JxBrowser installation is in progress and is not finished on the first re-check, we should start a thread to wait for the // installation to finish. - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(spy).presentOpenDevToolsOptionWithMessage(any(), any(), any(), any()); doNothing().when(spy).startJxBrowserInstallationWaitingThread(any(), any(), any()); @@ -164,8 +164,8 @@ public void testWaitForJxBrowserInstallationWithoutTimeout() throws TimeoutExcep when(mockJxBrowserManager.waitForInstallation(INSTALLATION_WAIT_LIMIT_SECONDS)).thenReturn(JxBrowserStatus.INSTALLATION_FAILED); // If waiting for JxBrowser installation completes without timing out, then we should return to event thread. - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(spy).handleUpdatedJxBrowserStatusOnEventThread(any(), any(), any(), any()); @@ -182,8 +182,8 @@ public void testWaitForJxBrowserInstallationWithTimeout() throws TimeoutExceptio when(mockJxBrowserManager.waitForInstallation(INSTALLATION_WAIT_LIMIT_SECONDS)).thenThrow(new TimeoutException()); // If the JxBrowser installation doesn't complete on time, we should show a timed out message. - final FlutterView flutterView = new FlutterView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); - final FlutterView spy = spy(flutterView); + final InspectorView inspectorView = new InspectorView(mockProject, mockJxBrowserManager, mockUtils, viewUtilsSpy); + final InspectorView spy = spy(inspectorView); doNothing().when(spy).presentOpenDevToolsOptionWithMessage(any(), any(), any(), any()); @@ -195,33 +195,34 @@ public void testWaitForJxBrowserInstallationWithTimeout() throws TimeoutExceptio @Test public void testHandleUpdatedJxBrowserStatusWithFailure() { // If waiting for JxBrowser installation completes with failure, then we should redirect to the function that handles failure. - final FlutterView partialMockFlutterView = mock(FlutterView.class); - doCallRealMethod().when(partialMockFlutterView) + final InspectorView partialMockInspectorView = mock(InspectorView.class); + doCallRealMethod().when(partialMockInspectorView) .handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLATION_FAILED, DevToolsIdeFeature.TOOL_WINDOW); - partialMockFlutterView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLATION_FAILED, - DevToolsIdeFeature.TOOL_WINDOW); - verify(partialMockFlutterView, times(1)).handleJxBrowserInstallationFailed(mockApp, mockToolWindow, DevToolsIdeFeature.TOOL_WINDOW); + partialMockInspectorView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLATION_FAILED, + DevToolsIdeFeature.TOOL_WINDOW); + verify(partialMockInspectorView, times(1)).handleJxBrowserInstallationFailed(mockApp, mockToolWindow, DevToolsIdeFeature.TOOL_WINDOW); } @Test public void testHandleUpdatedJxBrowserStatusWithSuccess() { // If waiting for JxBrowser installation completes with failure, then we should redirect to the function that handles failure. - final FlutterView partialMockFlutterView = mock(FlutterView.class); - doCallRealMethod().when(partialMockFlutterView) + final InspectorView partialMockInspectorView = mock(InspectorView.class); + doCallRealMethod().when(partialMockInspectorView) .handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLED, DevToolsIdeFeature.TOOL_WINDOW); - partialMockFlutterView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLED, DevToolsIdeFeature.TOOL_WINDOW); - verify(partialMockFlutterView, times(1)).handleJxBrowserInstalled(mockApp, mockToolWindow, DevToolsIdeFeature.TOOL_WINDOW); + partialMockInspectorView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.INSTALLED, + DevToolsIdeFeature.TOOL_WINDOW); + verify(partialMockInspectorView, times(1)).handleJxBrowserInstalled(mockApp, mockToolWindow, DevToolsIdeFeature.TOOL_WINDOW); } @Test public void testHandleUpdatedJxBrowserStatusWithOtherstatus() { // If waiting for JxBrowser installation completes with any other status, then we should recommend opening non-embedded DevTools. - final FlutterView partialMockFlutterView = mock(FlutterView.class); - doCallRealMethod().when(partialMockFlutterView) + final InspectorView partialMockInspectorView = mock(InspectorView.class); + doCallRealMethod().when(partialMockInspectorView) .handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.NOT_INSTALLED, DevToolsIdeFeature.TOOL_WINDOW); - partialMockFlutterView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.NOT_INSTALLED, - DevToolsIdeFeature.TOOL_WINDOW); - verify(partialMockFlutterView, times(1)) + partialMockInspectorView.handleUpdatedJxBrowserStatus(mockApp, mockToolWindow, JxBrowserStatus.NOT_INSTALLED, + DevToolsIdeFeature.TOOL_WINDOW); + verify(partialMockInspectorView, times(1)) .presentOpenDevToolsOptionWithMessage(mockApp, mockToolWindow, INSTALLATION_WAIT_FAILED, DevToolsIdeFeature.TOOL_WINDOW); } } diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index 442696fe36..9294ef7cca 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -422,7 +422,7 @@ - + @@ -431,7 +431,7 @@ - + diff --git a/resources/META-INF/plugin_template.xml b/resources/META-INF/plugin_template.xml index 305c0c2b8c..f40409e640 100644 --- a/resources/META-INF/plugin_template.xml +++ b/resources/META-INF/plugin_template.xml @@ -324,7 +324,7 @@ - + @@ -333,7 +333,7 @@ - +