mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reverted view update delay, BEFORE_RESUME can not be delayed
This commit is contained in:
@@ -20,7 +20,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.SingleAlarm;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -34,26 +34,29 @@ import java.util.EventObject;
|
||||
public abstract class XDebugView implements Disposable {
|
||||
public enum SessionEvent {PAUSED, BEFORE_RESUME, RESUMED, STOPPED, FRAME_CHANGED, SETTINGS_CHANGED}
|
||||
|
||||
private final Alarm myUpdateAlarm;
|
||||
private static final int VIEW_UPDATE_DELAY = 100; //ms
|
||||
private final SingleAlarm myClearAlarm;
|
||||
private static final int VIEW_CLEAR_DELAY = 100; //ms
|
||||
|
||||
public XDebugView() {
|
||||
myUpdateAlarm = new Alarm(this);
|
||||
myClearAlarm = new SingleAlarm(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clear();
|
||||
}
|
||||
}, VIEW_CLEAR_DELAY, this);
|
||||
}
|
||||
|
||||
protected final void requestClear() {
|
||||
myClearAlarm.cancelAndRequest();
|
||||
}
|
||||
|
||||
protected final void cancelClear() {
|
||||
myClearAlarm.cancel();
|
||||
}
|
||||
|
||||
protected abstract void clear();
|
||||
|
||||
public void onSessionEvent(@NotNull final SessionEvent event) {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
myUpdateAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processSessionEvent(event);
|
||||
}
|
||||
}, VIEW_UPDATE_DELAY);
|
||||
}
|
||||
|
||||
protected abstract void processSessionEvent(@NotNull SessionEvent event);
|
||||
public abstract void processSessionEvent(@NotNull SessionEvent event);
|
||||
|
||||
@Nullable
|
||||
protected static XDebugSession getSession(@NotNull EventObject e) {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class XDebugViewSessionListener extends XDebugSessionAdapter {
|
||||
AppUIUtil.invokeLaterIfProjectAlive(session.getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myDebugView.onSessionEvent(event);
|
||||
myDebugView.processSessionEvent(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -221,11 +221,13 @@ public class XFramesView extends XDebugView {
|
||||
mySelectedStack = null;
|
||||
XSuspendContext suspendContext = session == null ? null : session.getSuspendContext();
|
||||
if (suspendContext == null) {
|
||||
clear();
|
||||
requestClear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event == SessionEvent.PAUSED) {
|
||||
// clear immediately
|
||||
cancelClear();
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,10 +57,11 @@ public class XVariablesView extends XVariablesViewBase {
|
||||
|
||||
tree.markNodesObsolete();
|
||||
if (stackFrame != null) {
|
||||
cancelClear();
|
||||
buildTreeAndRestoreState(stackFrame);
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
requestClear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -275,6 +275,7 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
|
||||
XDebugSession session = getSession(getMainPanel());
|
||||
XStackFrame stackFrame = session == null ? null : session.getCurrentStackFrame();
|
||||
if (stackFrame != null) {
|
||||
cancelClear();
|
||||
tree.setSourcePosition(stackFrame.getSourcePosition());
|
||||
myRootNode.updateWatches(stackFrame.getEvaluator());
|
||||
if (myTreeState != null) {
|
||||
@@ -282,7 +283,7 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
|
||||
}
|
||||
}
|
||||
else {
|
||||
clear();
|
||||
requestClear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
@Override
|
||||
public void run() {
|
||||
for (XDebugView view : myViews) {
|
||||
view.onSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
|
||||
view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user