mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
deprecate addCompilationStatusListener — message bus should be used instead
This commit is contained in:
@@ -55,8 +55,7 @@ import org.jetbrains.jps.javac.ExternalJavacManager;
|
||||
import org.jetbrains.jps.javac.OutputFileConsumer;
|
||||
import org.jetbrains.jps.javac.OutputFileObject;
|
||||
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
+7
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -27,10 +27,7 @@ import com.intellij.compiler.server.BuildManagerListener;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.compiler.CompilationStatusListener;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompileScope;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.diagnostic.ControlFlowException;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -58,6 +55,7 @@ import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.intellij.util.indexing.StorageException;
|
||||
import com.intellij.util.io.PersistentEnumeratorBase;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import gnu.trove.THashSet;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -103,7 +101,8 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
if (isEnabled()) {
|
||||
myProject.getMessageBus().connect(myProject).subscribe(BuildManagerListener.TOPIC, new BuildManagerListener() {
|
||||
MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
|
||||
connection.subscribe(BuildManagerListener.TOPIC, new BuildManagerListener() {
|
||||
@Override
|
||||
public void buildStarted(Project project, UUID sessionId, boolean isAutomake) {
|
||||
if (project == myProject) {
|
||||
@@ -112,8 +111,7 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
|
||||
}
|
||||
});
|
||||
|
||||
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
|
||||
compilerManager.addCompilationStatusListener(new CompilationStatusListener() {
|
||||
connection.subscribe(CompilerTopics.COMPILATION_STATUS, new CompilationStatusListener() {
|
||||
@Override
|
||||
public void compilationFinished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
|
||||
compilationFinished(compileContext);
|
||||
@@ -142,6 +140,7 @@ public class CompilerReferenceServiceImpl extends CompilerReferenceServiceEx imp
|
||||
myDirtyScopeHolder.installVFSListener();
|
||||
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
CompilerManager compilerManager = CompilerManager.getInstance(myProject);
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
boolean isUpToDate;
|
||||
boolean indexExist = CompilerReferenceReader.exists(myProject);
|
||||
|
||||
@@ -244,12 +244,12 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
semaphore.down();
|
||||
final List<String> generatedFilePaths = new ArrayList<>();
|
||||
getCompilerManager().addCompilationStatusListener(new CompilationStatusAdapter() {
|
||||
myProject.getMessageBus().connect(getTestRootDisposable()).subscribe(CompilerTopics.COMPILATION_STATUS, new CompilationStatusAdapter() {
|
||||
@Override
|
||||
public void fileGenerated(String outputRoot, String relativePath) {
|
||||
generatedFilePaths.add(relativePath);
|
||||
}
|
||||
}, getTestRootDisposable());
|
||||
});
|
||||
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
|
||||
final CompileStatusNotification callback = new CompileStatusNotification() {
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -20,7 +20,7 @@ import java.util.EventListener;
|
||||
/**
|
||||
* A listener for compiler events.
|
||||
*
|
||||
* @see CompilerManager#addCompilationStatusListener(CompilationStatusListener)
|
||||
* @see CompilerTopics.COMPILATION_STATUS
|
||||
*/
|
||||
public interface CompilationStatusListener extends EventListener {
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -256,18 +256,21 @@ public abstract class CompilerManager {
|
||||
@Nullable Runnable onTaskFinished);
|
||||
|
||||
/**
|
||||
* Register a listener to track compilation events.
|
||||
*
|
||||
* @param listener the listener to be registered.
|
||||
* @deprecated Use CompilerTopics.COMPILATION_STATUS
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void addCompilationStatusListener(@NotNull CompilationStatusListener listener);
|
||||
|
||||
/**
|
||||
* @deprecated Use CompilerTopics.COMPILATION_STATUS
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void addCompilationStatusListener(@NotNull CompilationStatusListener listener, @NotNull Disposable parentDisposable);
|
||||
|
||||
/**
|
||||
* Unregister a compilation listener.
|
||||
*
|
||||
* @param listener the listener to be unregistered.
|
||||
* @deprecated Use CompilerTopics.COMPILATION_STATUS
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void removeCompilationStatusListener(@NotNull CompilationStatusListener listener);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user