mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
delete deprecated addListener() APIs from ProjectRootManager
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.intellij.openapi.roots.impl;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -146,24 +145,6 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
|
||||
|
||||
private final Map<ModuleRootListener, MessageBusConnection> myListenerAdapters = new HashMap<ModuleRootListener, MessageBusConnection>();
|
||||
|
||||
public void addModuleRootListener(final ModuleRootListener listener) {
|
||||
final MessageBusConnection connection = myProject.getMessageBus().connect();
|
||||
myListenerAdapters.put(listener, connection);
|
||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, listener);
|
||||
}
|
||||
|
||||
public void addModuleRootListener(ModuleRootListener listener, Disposable parentDisposable) {
|
||||
final MessageBusConnection connection = myProject.getMessageBus().connect(parentDisposable);
|
||||
connection.subscribe(ProjectTopics.PROJECT_ROOTS, listener);
|
||||
}
|
||||
|
||||
public void removeModuleRootListener(ModuleRootListener listener) {
|
||||
final MessageBusConnection connection = myListenerAdapters.remove(listener);
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<String> getContentRootUrls() {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.roots;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
@@ -49,31 +48,6 @@ public abstract class ProjectRootManager implements ModificationTracker {
|
||||
@NotNull
|
||||
public abstract ProjectFileIndex getFileIndex();
|
||||
|
||||
/**
|
||||
* Adds a listener for receiving notifications about changes in project roots.
|
||||
* @deprecated Subscribe to {@link com.intellij.ProjectTopics#PROJECT_ROOTS} messages instead
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
*/
|
||||
public abstract void addModuleRootListener(ModuleRootListener listener);
|
||||
|
||||
/**
|
||||
* Adds a listener for receiving notifications about changes in project roots.
|
||||
* @deprecated Subscribe to {@link com.intellij.ProjectTopics#PROJECT_ROOTS} messages instead
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
* @param parentDisposable object, after whose disposing the listener should be removed
|
||||
*/
|
||||
public abstract void addModuleRootListener(ModuleRootListener listener, Disposable parentDisposable);
|
||||
|
||||
/**
|
||||
* Removes a listener for receiving notifications about changes in project roots.
|
||||
* @deprecated Subscribe to {@link com.intellij.ProjectTopics#PROJECT_ROOTS} messages instead
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
*/
|
||||
public abstract void removeModuleRootListener(ModuleRootListener listener);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #orderEntries()}
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package git4idea.test
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
@@ -43,20 +42,8 @@ class GitMockProjectRootManager extends ProjectRootManager {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void addModuleRootListener(ModuleRootListener listener) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void addModuleRootListener(ModuleRootListener listener, Disposable parentDisposable) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
void removeModuleRootListener(ModuleRootListener listener) {
|
||||
throw new UnsupportedOperationException()
|
||||
}
|
||||
|
||||
@Override
|
||||
VirtualFile[] getFilesFromAllModules(OrderRootType type) {
|
||||
|
||||
+16
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.utils;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityStateListener;
|
||||
@@ -28,7 +29,6 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
@@ -91,24 +91,25 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
|
||||
}
|
||||
}, MavenMergingUpdateQueue.this);
|
||||
|
||||
ProjectRootManager.getInstance(project).addModuleRootListener(new ModuleRootListener() {
|
||||
int beforeCalled;
|
||||
project.getMessageBus().connect(MavenMergingUpdateQueue.this).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
|
||||
int beforeCalled;
|
||||
|
||||
public void beforeRootsChange(ModuleRootEvent event) {
|
||||
if (beforeCalled++ == 0) {
|
||||
suspend();
|
||||
}
|
||||
public void beforeRootsChange(ModuleRootEvent event) {
|
||||
if (beforeCalled++ == 0) {
|
||||
suspend();
|
||||
}
|
||||
}
|
||||
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
if (beforeCalled == 0) return; // This may occur if listener has been added between beforeRootsChange() and rootsChanged() calls.
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
if (beforeCalled == 0)
|
||||
return; // This may occur if listener has been added between beforeRootsChange() and rootsChanged() calls.
|
||||
|
||||
if (--beforeCalled == 0) {
|
||||
resume();
|
||||
MavenMergingUpdateQueue.this.restartTimer();
|
||||
}
|
||||
if (--beforeCalled == 0) {
|
||||
resume();
|
||||
MavenMergingUpdateQueue.this.restartTimer();
|
||||
}
|
||||
}, MavenMergingUpdateQueue.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user