mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show notification if breakpoint is reached in another thread
This commit is contained in:
@@ -38,6 +38,9 @@ import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.ProcessOutputTypes;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -60,6 +63,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.AbstractDebuggerSession;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
|
||||
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
@@ -70,6 +74,7 @@ import com.sun.jdi.request.StepRequest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -451,6 +456,37 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
getContextManager().fireStateChanged(getContextManager().getContext(), EVENT_THREADS_REFRESH);
|
||||
}
|
||||
});
|
||||
final ThreadReferenceProxyImpl thread = suspendContext.getThread();
|
||||
if (thread != null) {
|
||||
List<Pair<Breakpoint, Event>> descriptors = DebuggerUtilsEx.getEventDescriptors(suspendContext);
|
||||
if (!descriptors.isEmpty()) {
|
||||
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(
|
||||
DebuggerBundle.message("status.breakpoint.reached.in.thread", thread.name()),
|
||||
DebuggerBundle.message("status.breakpoint.reached.in.thread.switch"),
|
||||
NotificationType.INFORMATION, new NotificationListener() {
|
||||
@Override
|
||||
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
|
||||
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
||||
notification.expire();
|
||||
getProcess().getManagerThread().schedule(new SuspendContextCommandImpl(suspendContext) {
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
final DebuggerContextImpl debuggerContext =
|
||||
DebuggerContextImpl.createDebuggerContext(DebuggerSession.this, suspendContext, thread, null);
|
||||
|
||||
DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getContextManager().setState(debuggerContext, STATE_PAUSED, EVENT_PAUSE, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).notify(getProject());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ status.line.breakpoint.reached=Breakpoint reached at {0}({1}:{2,number,#})
|
||||
status.line.breakpoint.reached.full.trace=Breakpoint reached at {0}
|
||||
export.threads.stackframe.format=at {0}({1}:{2,number,#})
|
||||
status.generic.breakpoint.reached=Breakpoint reached
|
||||
status.breakpoint.reached.in.thread=Breakpoint reached in thread {0}
|
||||
status.breakpoint.reached.in.thread.switch=<a href="#">Switch thread</a>
|
||||
status.method.entry.breakpoint.reached=Method ''{0}'' entered at {1}({2}:{3,number,#})
|
||||
status.method.exit.breakpoint.reached=Method breakpoint reached. Method ''{0}'' is about to exit at {1}({2}:{3,number,#})
|
||||
status.exception.breakpoint.reached=Exception breakpoint reached
|
||||
|
||||
Reference in New Issue
Block a user