@Override public void unregisterBreakpoint(@NotNull XLineBreakpoint<DlvBreakpointProperties> breakpoint, boolean temporary) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) return; Integer id = breakpoint.getUserData(ID); if (id == null) return; // obsolete breakpoint.putUserData(ID, null); breakpoints.remove(id); send(new DlvRequest.ClearBreakpoint(id)); } }
@Override public void registerBreakpoint(@NotNull XLineBreakpoint<DlvBreakpointProperties> breakpoint) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) return; VirtualFile file = breakpointPosition.getFile(); int line = breakpointPosition.getLine(); send(new DlvRequest.CreateBreakpoint(file.getPath(), line + 1)) .done(b -> { breakpoint.putUserData(ID, b.id); breakpoints.put(b.id, breakpoint); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null); }) .rejected(t -> { String message = t == null ? null : t.getMessage(); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, message); }); }
public void registerBreakpoint( @NotNull final XLineBreakpoint<CloudLineBreakpointProperties> ideBreakpoint) { if (ideBreakpoint.getSourcePosition() == null || !ideBreakpoint.isEnabled() || !(ideBreakpoint.getType() instanceof CloudLineBreakpointType)) { return; if (ideBreakpoint.getProperties().isCreatedByServer()) { if (ideBreakpoint.getProperties().isAddedOnServer() && !ideBreakpoint.getProperties().isDisabledByServer()) { PsiFile psiFile = psiManager.findFile(ideBreakpoint.getSourcePosition().getFile()); location.setLine(ideBreakpoint.getSourcePosition().getLine() + 1); if (ideBreakpoint.getConditionExpression() != null) { serverNewBreakpoint.setCondition(ideBreakpoint.getConditionExpression().getExpression());
when(virtualFile.getUrl()).thenReturn(MOCK_FILE_URL); when(xLineBreakpoint.getUserData(com.intellij.debugger.ui.breakpoints.Breakpoint.DATA_KEY)) .thenReturn(cloudLineBreakpoint); when(xLineBreakpoint.getProperties()).thenReturn(cloudLineBreakpointProperties); .addLineBreakpoint(any(), eq(MOCK_FILE_URL), eq(line), eq(cloudLineBreakpointProperties)); verify(xLineBreakpoint).putUserData(keyArgumentCaptor.capture(), eq("mock-breakpoint-id")); assertThat(keyArgumentCaptor.getValue().toString()) .isEqualTo("CloudId"); // CloudBreakpointHandler.CLOUD_ID verify(xLineBreakpoint).setCondition(eq(MOCK_BREAKPOINT_CONDITION));
@Override public void unregisterBreakpoint(@NotNull XLineBreakpoint<BallerinaBreakpointProperties> breakpoint, boolean temporary) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) { return; } breakpoints.remove(breakpoint); sendBreakpoints(); }
@Nullable public static PerlLineBreakPointDescriptor createFromBreakpoint(XLineBreakpoint<PerlLineBreakpointProperties> breakpoint, PerlDebugThread debugThread) { String fileUrl = breakpoint.getFileUrl(); descriptor.line = breakpoint.getLine(); descriptor.enabled = breakpoint.isEnabled(); descriptor.remove = false; XExpression logExpressionObject = breakpoint.getLogExpressionObject(); if (logExpressionObject != null) { descriptor.action = logExpressionObject.getExpression(); SuspendPolicy suspendPolicy = breakpoint.getSuspendPolicy(); descriptor.suspend = suspendPolicy != SuspendPolicy.NONE; XExpression conditionExpression = breakpoint.getConditionExpression(); descriptor.condition = conditionExpression != null ? conditionExpression.getExpression() : ""; return descriptor;
CloudLineBreakpointType.getInstance(), file.getUrl(), line, properties); newXIdeBreakpoint.putUserData(CloudBreakpointHandler.CLOUD_ID, serverBreakpoint.getId()); ideBreakpoints.put(serverBreakpoint.getId(), newXIdeBreakpoint); newXIdeBreakpoint.setCondition(serverBreakpoint.getCondition()); .getProperties() .setWatchExpressions( serverBreakpoint newXIdeBreakpoint.getProperties().setCreatedByServer(false); com.intellij.debugger.ui.breakpoints.Breakpoint cloudIdeBreakpoint = BreakpointManager.getJavaBreakpoint(newXIdeBreakpoint);
debuggerEditorsProvider, this, breakpoint.getSourcePosition(), "GoogleCloudTools.BreakpointWatchContextMenu", null); List<XExpression> watches = new ArrayList<XExpression>(); for (String watchExpression : breakpoint.getProperties().getWatchExpressions()) { watches.add( debuggerEditorsProvider.createExpression(
@Override public void unregisterBreakpoint( @NotNull XLineBreakpoint<CloudLineBreakpointProperties> ideBreakpoint, boolean temporary) { // If the state was set to disabled as a result of a server update, // then we do not need to update the server side. if (!ideBreakpoint.getProperties().isDisabledByServer()) { String breakpointId = ideBreakpoint.getUserData(CLOUD_ID); if (!Strings.isNullOrEmpty(breakpointId)) { process.getStateController().deleteBreakpointAsync(breakpointId); } else { LOG.warn("could not delete breakpoint because it was not added through the cloud handler."); } } // reset this flag: either it has been disabled by the server or the client has deleted it, in // both cases we need to add it again, if it is re-enabled ideBreakpoint.getProperties().setAddedOnServer(false); } }
@SuppressWarnings("ConstantConditions") @Override public void saveTo(@NotNull final XLineBreakpoint<CloudLineBreakpointProperties> ideBreakpoint) { CloudLineBreakpointProperties properties = ideBreakpoint.getProperties(); if (properties == null) { LOG.error( "Could not save changes to the breakpoint because for some reason it does not have cloud " + "properties."); return; } XBreakpointBase lineBreakpointImpl = ideBreakpoint instanceof XBreakpointBase ? (XBreakpointBase) ideBreakpoint : null; if (rootNode != null && lineBreakpointImpl != null) { List<String> expressionsToSave = new ArrayList<String>(); List<? extends WatchNode> children = rootNode.getAllChildren(); if (children != null) { for (WatchNode node : rootNode.getAllChildren()) { expressionsToSave.add(node.getExpression().getExpression()); } if (properties.setWatchExpressions( expressionsToSave.toArray(new String[expressionsToSave.size()]))) { lineBreakpointImpl.fireBreakpointChanged(); } } } }
@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()); } } });
if (existingXIdeBreakpoint != null && existingXIdeBreakpoint.isEnabled()) { continue;
@Override public void registerBreakpoint(@NotNull XLineBreakpoint<BallerinaBreakpointProperties> breakpoint) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) { return; } breakpoints.add(breakpoint); sendBreakpoints(); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null); }
isA(CloudLineBreakpointProperties.class))) .thenReturn(mockLineBreakpoint); when(mockLineBreakpoint.getProperties()).thenReturn(new CloudLineBreakpointProperties()); VirtualFile projectDir = mock(VirtualFile.class); when(projectDir.getPath()).thenReturn("/project/dir");
@Nullable private static Language getFileTypeLanguage( XLineBreakpoint<CloudLineBreakpointProperties> breakpoint) { if (breakpoint.getSourcePosition() != null) { FileType fileType = breakpoint.getSourcePosition().getFile().getFileType(); if (fileType instanceof LanguageFileType) { return ((LanguageFileType) fileType).getLanguage(); } } return null; }
} else { XSourcePosition sourcePosition = breakpoint.getSourcePosition(); if (sourcePosition == null) { return;