@Override protected void processBreakPoint(@NotNull XLineBreakpoint breakpoint, XDebugSession session) { XDebuggerManager.getInstance(session.getProject()).getBreakpointManager().updateBreakpointPresentation( breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, "You can't set a breakpoint here" ); } }
@Override public void run() { manager.removeBreakpoint(existing); } });
@Override public void stop() { myDebugThread.setStop(); ApplicationManager.getApplication().runReadAction( () -> { XBreakpointManager breakpointManager = XDebuggerManager.getInstance(getSession().getProject()).getBreakpointManager(); Collection<? extends XLineBreakpoint<PerlLineBreakpointProperties>> breakpoints = breakpointManager.getBreakpoints(PerlLineBreakpointType.class); for (XLineBreakpoint<PerlLineBreakpointProperties> breakpoint : breakpoints) { breakpointManager.updateBreakpointPresentation(breakpoint, null, null); } } ); }
.setId("unexpected_path_2") .setLocation(new SourceLocation().setLine(3).setPath("b/f/pkg/Class.java"))); when(breakpointManager.findBreakpointAtLine( isA(XLineBreakpointType.class), isA(VirtualFile.class), anyInt())) .thenReturn(null); XLineBreakpoint mockLineBreakpoint = mock(XLineBreakpoint.class); when(breakpointManager.addLineBreakpoint( isA(XLineBreakpointType.class), anyString(), .addLineBreakpoint( isA(XLineBreakpointType.class), anyString(),
@Override public void run() { if (finalserverBreakpoint.getExpressions() != null && finalserverBreakpoint.getExpressions().size() > 0) { properties.setWatchExpressions( finalserverBreakpoint .getExpressions() .toArray(new String[finalserverBreakpoint.getExpressions().size()])); } XLineBreakpoint<CloudLineBreakpointProperties> newxIdeBreakpoint = manager.addLineBreakpoint( CloudLineBreakpointType.getInstance(), file.getUrl(), line, properties); // Condition, watches. if (!Strings.isNullOrEmpty(finalserverBreakpoint.getCondition())) { newxIdeBreakpoint.setCondition(finalserverBreakpoint.getCondition()); } } });
manager.findBreakpointAtLine(CloudLineBreakpointType.getInstance(), file, line); if (existingXIdeBreakpoint != null && existingXIdeBreakpoint.isEnabled()) { continue;
@Nullable public static XLineBreakpoint findBreakpoint(final Project project, final PerlDebuggingEventBreakpoint breakpointBase) { final XLineBreakpoint[] result = new XLineBreakpoint[]{null}; ApplicationManager.getApplication().runReadAction(() -> { String path = breakpointBase.getPath(); VirtualFile virtualFile; String virtualFileUrl; virtualFile = VfsUtil.findFileByIoFile(new File(breakpointBase.getDebugThread().getDebugProfileState().mapPathToLocal(path)), true); if (virtualFile == null) { virtualFileUrl = PerlRemoteFileSystem.PROTOCOL_PREFIX + path; } else { virtualFileUrl = virtualFile.getUrl(); } Collection<? extends XLineBreakpoint<PerlLineBreakpointProperties>> breakpoints = XDebuggerManager.getInstance(project).getBreakpointManager().getBreakpoints(PerlLineBreakpointType.class); for (XLineBreakpoint<PerlLineBreakpointProperties> breakpoint : breakpoints) { if (StringUtil.equals(breakpoint.getFileUrl(), virtualFileUrl) && breakpoint.getLine() == breakpointBase.getLine()) { result[0] = breakpoint; return; } } }); return result[0]; }
@Override public void stop() { getStateController().stopBackgroundListening(); RunProfile profile = getXDebugSession().getRunProfile(); if (profile instanceof CloudDebugRunConfiguration) { ((CloudDebugRunConfiguration) profile).setProcessState(processState); } getRepositoryValidator().restoreToOriginalState(getXDebugSession().getProject()); XBreakpointManager breakpointManager = XDebuggerManager.getInstance(getXDebugSession().getProject()).getBreakpointManager(); for (XBreakpoint bp : breakpointManager.getAllBreakpoints()) { com.intellij.debugger.ui.breakpoints.Breakpoint cloudBreakpoint = BreakpointManager.getJavaBreakpoint(bp); if (!(cloudBreakpoint instanceof CloudLineBreakpointType.CloudLineBreakpoint)) { continue; } CloudLineBreakpointType.CloudLineBreakpoint cloudLineBreakpoint = (CloudLineBreakpointType.CloudLineBreakpoint) cloudBreakpoint; cloudLineBreakpoint.setVerified(false); cloudLineBreakpoint.setErrorMessage(null); updateBreakpointPresentation(cloudLineBreakpoint); } }
when(xLineBreakpoint.getProperties()).thenReturn(cloudLineBreakpointProperties); when(breakpointManager.addLineBreakpoint( any(CloudLineBreakpointType.class), anyString(), .addLineBreakpoint(any(), eq(MOCK_FILE_URL), eq(line), eq(cloudLineBreakpointProperties));
manager.findBreakpointAtLine(CloudLineBreakpointType.getInstance(), file, line); if (existing != null) { ApplicationManager.getApplication()
@Override protected void processBreakPoint(@NotNull XLineBreakpoint breakpoint, XDebugSession session) { XDebuggerManager.getInstance(session.getProject()).getBreakpointManager().updateBreakpointPresentation( breakpoint, AllIcons.Debugger.Db_verified_breakpoint, "Breakpoint set" ); } }
@Override public void run() { XLineBreakpoint<CloudLineBreakpointProperties> newXIdeBreakpoint = manager.addLineBreakpoint( CloudLineBreakpointType.getInstance(), file.getUrl(), line, properties);
@Override public void run() { manager.removeBreakpoint(existingXIdeBreakpoint); } });
@Test public void testUpdateBreakpointRepresentationUsesBreakpointErrorMsgAndIcon() { XBreakpointManager breakpointManager = mock(XBreakpointManager.class); CloudDebugProcess cloudDebugProcess = mockCloudDebugProcess(breakpointManager, mock(XDebugSession.class)); XLineBreakpointImpl xBreakpoint = mock(XLineBreakpointImpl.class); CloudLineBreakpoint breakpoint = mockCloudLineBreakpoint(cloudDebugProcess, "mock error message", xBreakpoint); Icon icon = mock(Icon.class); when(breakpoint.getSetIcon(anyBoolean())).thenReturn(icon); cloudDebugProcess.updateBreakpointPresentation(breakpoint); verify(cloudDebugProcess, times(1)).getXBreakpoint(breakpoint); verify(breakpoint).getSetIcon(anyBoolean()); verify(breakpoint).getErrorMessage(); verify(breakpointManager).updateBreakpointPresentation(xBreakpoint, icon, "mock error message"); }
void updateBreakpointPresentation(CloudLineBreakpoint cloudLineBreakpoint) { final XBreakpointManager manager = getXBreakpointManager(getXDebugSession().getProject()); manager.updateBreakpointPresentation( getXBreakpoint(cloudLineBreakpoint), cloudLineBreakpoint.getSetIcon(areBreakpointsMuted()), cloudLineBreakpoint.getErrorMessage()); }
verify(cloudLineBreakpoint).getErrorMessage(); verify(breakpointManager) .updateBreakpointPresentation( eq(xLineBreakpointImpl), any(Icon.class), eq(breakPointErrorMessage));