cleanup — default implementation of processSentToBackground

This commit is contained in:
Vladimir Krivosheev
2017-05-15 14:36:45 +02:00
parent 667459f3d4
commit 16fdca9f08
6 changed files with 17 additions and 33 deletions
@@ -63,13 +63,10 @@ public class HotSwapProgressImpl extends HotSwapProgress{
public HotSwapProgressImpl(Project project) {
super(project);
myProgressWindow = new BackgroundableProcessIndicator(getProject(), myTitle, new PerformInBackgroundOption() {
@Override
public boolean shouldStartInBackground() {
return DebuggerSettings.getInstance().HOTSWAP_IN_BACKGROUND;
}
public void processSentToBackground() {
}
}, null, null, true);
myProgressWindow.addStateDelegate(new AbstractProgressIndicatorExBase(){
@Override
@@ -81,6 +78,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
myUpdateQueue = new MergingUpdateQueue("HotSwapProgress update queue", 100, true, null, myProgressWindow);
}
@Override
public void finished() {
super.finished();
@@ -160,6 +158,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
return res.toString();
}
@Override
public void addMessage(DebuggerSession session, final int type, final String text) {
List<String> messages = myMessages.get(type);
if (messages == null) {
@@ -169,6 +168,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
messages.add(session.getSessionName() + ": " + text + ";");
}
@Override
public void setText(final String text) {
myUpdateQueue.queue(new Update("Text") {
@Override
@@ -182,6 +182,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
});
}
@Override
public void setTitle(final String text) {
DebuggerInvocationUtil.invokeLater(getProject(), () -> {
if (!myProgressWindow.isCanceled() && myProgressWindow.isRunning()) {
@@ -191,6 +192,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
}
@Override
public void setFraction(final double v) {
DebuggerInvocationUtil.invokeLater(getProject(), () -> {
if (!myProgressWindow.isCanceled() && myProgressWindow.isRunning()) {
@@ -199,6 +201,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
}, myProgressWindow.getModalityState());
}
@Override
public boolean isCancelled() {
return myProgressWindow.isCanceled();
}
@@ -207,6 +210,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{
return myProgressWindow;
}
@Override
public void setDebuggerSession(DebuggerSession session) {
myTitle = DebuggerBundle.message("progress.hot.swap.title") + " : " + session.getSessionName();
myProgressWindow.setTitle(myTitle);
@@ -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.
@@ -255,11 +255,6 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
public boolean shouldStartInBackground() {
return true;
}
@Override
public void processSentToBackground() {
}
};
}
@@ -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.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.progress;
/**
@@ -23,17 +22,15 @@ public interface PerformInBackgroundOption {
PerformInBackgroundOption DEAF = new PerformInBackgroundOption() {
@Override
public boolean shouldStartInBackground() { return false; }
@Override
public void processSentToBackground() {}
};
PerformInBackgroundOption ALWAYS_BACKGROUND = new PerformInBackgroundOption() {
@Override
public boolean shouldStartInBackground() { return true; }
@Override
public void processSentToBackground() {}
};
boolean shouldStartInBackground();
void processSentToBackground();
default void processSentToBackground() {
}
}
@@ -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.
@@ -131,10 +131,6 @@ public class ExportTestResultsAction extends DumbAwareAction {
public boolean shouldStartInBackground() {
return true;
}
@Override
public void processSentToBackground() {
}
}) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
@@ -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.
@@ -218,9 +218,6 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
public boolean shouldStartInBackground() {
return PERFORM_UPDATE_IN_BACKGROUND;
}
@Override
public void processSentToBackground() {}
}
private class CommitInBackgroundOption implements PerformInBackgroundOption {
@@ -228,9 +225,6 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
public boolean shouldStartInBackground() {
return PERFORM_COMMIT_IN_BACKGROUND;
}
@Override
public void processSentToBackground() {}
}
private class EditInBackgroundOption implements PerformInBackgroundOption {
@@ -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.
@@ -28,10 +28,8 @@ public class BackgroundFromStartOption implements PerformInBackgroundOption {
return ourInstance;
}
@Override
public boolean shouldStartInBackground() {
return true;
}
public void processSentToBackground() {
}
}