deprecate ProjectLifecycleListener.Adapter

This commit is contained in:
Vladimir Krivosheev
2016-08-01 12:02:51 +02:00
parent 640aec156b
commit 5e5322cf2a
5 changed files with 17 additions and 21 deletions
@@ -27,7 +27,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.UnknownModuleType;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.project.impl.ProjectLifecycleListener;
@@ -45,13 +44,11 @@ import java.util.List;
@State(name = ModuleManagerImpl.COMPONENT_NAME, storages = @Storage("modules.xml"))
public class ModuleManagerComponent extends ModuleManagerImpl {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.module.impl.ModuleManagerComponent");
private final ProgressManager myProgressManager;
private final MessageBusConnection myConnection;
public ModuleManagerComponent(Project project, ProgressManager progressManager, MessageBus bus) {
public ModuleManagerComponent(Project project, MessageBus bus) {
super(project, bus);
myConnection = bus.connect(project);
myProgressManager = progressManager;
myConnection.setDefaultHandler(new MessageHandler() {
@Override
public void handle(Method event, Object... params) {
@@ -60,7 +57,7 @@ public class ModuleManagerComponent extends ModuleManagerImpl {
});
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS);
myConnection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
myConnection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void projectComponentsInitialized(@NotNull final Project project) {
if (project != myProject) return;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public class IconDeferrerImpl extends IconDeferrer {
clear();
}
});
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void afterProjectClosed(@NotNull Project project) {
clear();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,20 +29,19 @@ import org.jetbrains.annotations.NotNull;
public interface ProjectLifecycleListener {
Topic<ProjectLifecycleListener> TOPIC = Topic.create("Various stages of project lifecycle notifications", ProjectLifecycleListener.class);
void projectComponentsInitialized(@NotNull Project project);
default void projectComponentsInitialized(@NotNull Project project) {
}
void beforeProjectLoaded(@NotNull Project project);
default void beforeProjectLoaded(@NotNull Project project) {
}
void afterProjectClosed(@NotNull Project project);
default void afterProjectClosed(@NotNull Project project) {
}
/**
* @deprecated Use {@link ProjectLifecycleListener}
*/
@Deprecated
abstract class Adapter implements ProjectLifecycleListener {
@Override
public void projectComponentsInitialized(@NotNull Project project) { }
@Override
public void beforeProjectLoaded(@NotNull Project project) { }
@Override
public void afterProjectClosed(@NotNull Project project) { }
}
}
@@ -210,7 +210,7 @@ public class StartupManagerImpl extends StartupManagerEx {
if (!app.isHeadlessEnvironment()) {
final long sessionId = VirtualFileManager.getInstance().asyncRefresh(null);
final MessageBusConnection connection = app.getMessageBus().connect();
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
@Override
public void afterProjectClosed(@NotNull Project project) {
if (project != myProject) return;
@@ -165,7 +165,7 @@ class IcsManager(dir: Path) {
autoSyncManager.registerListeners(application)
application.messageBus.connect().subscribe(ProjectLifecycleListener.TOPIC, object : ProjectLifecycleListener.Adapter() {
application.messageBus.connect().subscribe(ProjectLifecycleListener.TOPIC, object : ProjectLifecycleListener {
override fun beforeProjectLoaded(project: Project) {
if (project.isDefault) {
return