Skip to content

Commit

Permalink
Migrate from deprecated method: ProjectTopics.X to ModuleListener.X (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jwren authored Dec 17, 2024
1 parent 1bc5151 commit c436bda
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions flutter-idea/src/io/flutter/FlutterInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.intellij.ProjectTopics;
import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.ide.ui.UISettingsListener;
import com.intellij.notification.*;
Expand Down Expand Up @@ -122,7 +121,7 @@ public void runActivity(@NotNull Project project) {
initializeToolWindows(project);
}
else {
project.getMessageBus().connect().subscribe(ProjectTopics.MODULES, new ModuleListener() {
project.getMessageBus().connect().subscribe(ModuleListener.TOPIC, new ModuleListener() {
@Override
public void moduleAdded(@NotNull Project project, @NotNull Module module) {
if (!toolWindowsInitialized && FlutterModuleUtils.isFlutterModule(module)) {
Expand Down
3 changes: 1 addition & 2 deletions flutter-idea/src/io/flutter/project/ProjectWatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package io.flutter.project;

import com.intellij.ProjectTopics;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
Expand Down Expand Up @@ -44,7 +43,7 @@ public void projectClosed(@NotNull Project project) {
manager.addProjectManagerListener(project, listener);

final MessageBusConnection bus = project.getMessageBus().connect();
bus.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
bus.subscribe(ModuleRootListener.TOPIC, new ModuleRootListener() {
@Override
public void rootsChanged(@NotNull ModuleRootEvent event) {
fireEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package io.flutter.sdk;

import com.intellij.ProjectTopics;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.DumbService;
Expand Down Expand Up @@ -51,7 +50,7 @@ protected void onBeforeFileChange(@NotNull VirtualFile file) {
}
}, getProject());

getProject().getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
getProject().getMessageBus().connect().subscribe(ModuleRootListener.TOPIC, new ModuleRootListener() {
@Override
public void rootsChanged(@NotNull ModuleRootEvent event) {
scheduleUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.android.tools.idea.gradle.project.sync.GradleSyncInvoker;
import com.android.tools.idea.gradle.project.sync.GradleSyncListener;
import com.intellij.ProjectTopics;
import com.intellij.facet.FacetManager;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
Expand All @@ -27,7 +26,6 @@
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
//import com.intellij.openapi.project.impl.ProjectExImpl;
import com.intellij.openapi.project.impl.ProjectImpl;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import com.intellij.openapi.projectRoots.Sdk;
Expand Down Expand Up @@ -280,7 +278,7 @@ protected void onBeforeFileChange(@NotNull VirtualFile file) {
}
}, project);

project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
project.getMessageBus().connect().subscribe(ModuleRootListener.TOPIC, new ModuleRootListener() {
@Override
public void rootsChanged(@NotNull ModuleRootEvent event) {
manager.scheduleUpdate();
Expand Down
3 changes: 1 addition & 2 deletions flutter-studio/src/io/flutter/utils/AddToAppUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import com.android.tools.idea.gradle.project.sync.GradleSyncListener;
import com.android.tools.idea.gradle.project.sync.GradleSyncState;
import com.intellij.ProjectTopics;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessListener;
import com.intellij.debugger.impl.DebuggerManagerListener;
Expand Down Expand Up @@ -57,7 +56,7 @@ public static boolean initializeAndDetectFlutter(@NotNull Project project) {
}

if (!FlutterModuleUtils.hasFlutterModule(project)) {
connection.subscribe(ProjectTopics.MODULES, new ModuleListener() {
connection.subscribe(ModuleListener.TOPIC, new ModuleListener() {
@Override
public void moduleAdded(@NotNull Project proj, @NotNull Module mod) {
if (AndroidUtils.FLUTTER_MODULE_NAME.equals(mod.getName()) ||
Expand Down

0 comments on commit c436bda

Please sign in to comment.