private boolean areBreakpointsMuted() { return getXDebugSession() != null && getXDebugSession().areBreakpointsMuted(); }
@Override public void run() { if (!getXDebugSession().isStopped()) { // Since there is no equivalent metaphor in traditional debug sessions, this simulates // the desired behavior of clearing the current context by setting the current // position // to an empty context getXDebugSession().positionReached(new XSuspendContext() {}); } } });
/** Initializes the handler. */ public CloudBreakpointHandler( @NotNull CloudDebugProcess process, ServerToIdeFileResolver fileResolver) { super(CloudLineBreakpointType.class); this.process = process; setPsiManager(PsiManager.getInstance(this.process.getXDebugSession().getProject())); this.fileResolver = fileResolver; }
/** * Called when the user clicks a pending breakpoint. We find the local IDE representation and * navigate to its line of code. */ public void navigateTo(@NotNull Breakpoint serverBreakpoint) { final XBreakpoint xIdeBreakpoint = ideBreakpoints.get(serverBreakpoint.getId()); if (xIdeBreakpoint != null && xIdeBreakpoint.getSourcePosition() != null && process.getXDebugSession() != null) { xIdeBreakpoint .getSourcePosition() .createNavigatable(process.getXDebugSession().getProject()) .navigate(true); } }
@Override public void update(AnActionEvent event) { event.getPresentation().setEnabled(!CloudDebugProcess.this.getXDebugSession().isStopped()); } }
/** Initialize the panel. */ public CloudDebugHistoricalSnapshots(@NotNull CloudDebugProcessHandler processHandler) { super(new BorderLayout()); table = new CloudDebuggerTable(); configureToolbar(); process = processHandler.getProcess(); process.getXDebugSession().addSessionListener(this); process.addListener(this); }
@Override public void mousePressed(MouseEvent event) { JTable table = (JTable) event.getSource(); Point point = event.getPoint(); Breakpoint breakpoint = getBreakPoint(point); int column = table.columnAtPoint(point); // todo: 4 and 1 here are magic numbers; use named constants for columns; maybe define // in CloudDebuggerTable class if (breakpoint != null && column == 4 && supportsMoreConfig(breakpoint)) { BreakpointsDialogFactory.getInstance(process.getXDebugSession().getProject()) .showDialog(process.getBreakpointHandler().getXBreakpoint(breakpoint)); } else if (event.getClickCount() == 1 && breakpoint != null && table.getSelectedRows().length == 1) { selectSnapshot(breakpoint, false); } } }
private void navigateToBreakpoint(@NotNull Breakpoint target) { Date snapshotTime; try { if (target.getFinalTime() == null) { LOG.warn("Could not resolve final time from breakpoint."); snapshotTime = new Date(); } else { snapshotTime = ISODateTimeFormat.dateTime().parseDateTime(target.getFinalTime()).toDate(); } } catch (IllegalArgumentException iae) { LOG.warn("Could not parse breakpoint timestamp using ISO8601."); snapshotTime = new Date(); } DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); currentSnapshot = target; if (!getXDebugSession().isStopped()) { getXDebugSession() .positionReached( new MySuspendContext( new CloudExecutionStack( getXDebugSession().getProject(), StackdriverDebuggerBundle.getString( "clouddebug.stackat", df.format(snapshotTime)), target.getStackFrames(), target.getVariableTable(), target.getEvaluatedExpressions()))); } }
/** * Initializes the current state, synchronously checks for the latest set of changes and kicks off * the background job to poll for changes. */ public void initialize(@NotNull CloudDebugProcessState processState) { this.processState = processState; currentSnapshot = null; new Task.Modal( getXDebugSession().getProject(), StackdriverDebuggerBundle.getString("clouddebug.attachingtext"), false) { @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); getStateController().initialize(CloudDebugProcess.this.processState); getRepositoryValidator().hardRefresh(); } }.queue(); // Start breakpoints refresh job on first use. getStateController().addListener(this); getStateController().startBackgroundListening(); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { getBreakpointHandler().createIdeRepresentationsIfNecessary(getCurrentBreakpointList()); } }); }
@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); } }
@Before public void setUp() { MockApplication application = new MyMockApplicationEx(parent); ActionManagerEx manager = Mockito.mock(ActionManagerEx.class); ActionToolbar actionToolbar = Mockito.mock(ActionToolbar.class); Mockito.when(actionToolbar.getComponent()).thenReturn(new JComponent() {}); Mockito.when( manager.createActionToolbar( Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean())) .thenReturn(actionToolbar); Mockito.when( manager.createActionToolbar( Mockito.anyString(), Mockito.any(ActionGroup.class), Mockito.anyBoolean(), Mockito.anyBoolean())) .thenReturn(actionToolbar); application.addComponent(ActionManager.class, manager); application.registerService(UISettings.class); ApplicationManager.setApplication(application, parent); XDebugSession session = Mockito.mock(XDebugSession.class); Mockito.when(handler.getProcess()).thenReturn(mockProcess); Mockito.when(mockProcess.getXDebugSession()).thenReturn(session); }
void updateBreakpointPresentation(CloudLineBreakpoint cloudLineBreakpoint) { final XBreakpointManager manager = getXBreakpointManager(getXDebugSession().getProject()); manager.updateBreakpointPresentation( getXBreakpoint(cloudLineBreakpoint), cloudLineBreakpoint.getSetIcon(areBreakpointsMuted()), cloudLineBreakpoint.getErrorMessage()); }
when(process.getXDebugSession()).thenReturn(session); CloudDebugProcessState processState = mock(CloudDebugProcessState.class); existingBreakpoints = new ArrayList<Breakpoint>();
&& (breakpoint.getStatus() == null || !Boolean.TRUE.equals(breakpoint.getStatus().getIsError()))) { if (!getXDebugSession().isStopped()) { getBreakpointHandler().setStateToDisabled(breakpoint);
null) .setFadeoutTime(3000) .setDisposable(process.getXDebugSession().getProject()); balloon = builder.createBalloon(); balloon.show(
Project currentProject = process.getXDebugSession().getProject(); final XBreakpointManager manager = XDebuggerManager.getInstance(process.getXDebugSession().getProject()) .getBreakpointManager(); if (serverBreakpoint.getLocation() == null) {
Project currentProject = process.getXDebugSession().getProject(); final XBreakpointManager manager = XDebuggerManager.getInstance(process.getXDebugSession().getProject()) .getBreakpointManager(); if (serverBreakpoint.getLocation() == null) {