com.jetbrains.python.debugger.AbstractLineBreakpointHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of python-community Show documentation
Show all versions of python-community Show documentation
A packaging of the IntelliJ Community Edition python-community library.
This is release number 1 of trunk branch 142.
The newest version!
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.debugger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
import com.intellij.xdebugger.breakpoints.XBreakpointType;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author traff
*/
public class AbstractLineBreakpointHandler extends XBreakpointHandler> {
protected final PyDebugProcess myDebugProcess;
private final Map, XSourcePosition> myBreakPointPositions = Maps.newHashMap();
public AbstractLineBreakpointHandler(
Class extends XBreakpointType, ?>> breakpointTypeClass,
@NotNull final PyDebugProcess debugProcess) {
super(breakpointTypeClass);
myDebugProcess = debugProcess;
}
public void reregisterBreakpoints() {
List> breakpoints = Lists.newArrayList(myBreakPointPositions.keySet());
for (XLineBreakpoint breakpoint : breakpoints) {
unregisterBreakpoint(breakpoint, false);
registerBreakpoint(breakpoint);
}
}
public void registerBreakpoint(@NotNull final XLineBreakpoint breakpoint) {
final XSourcePosition position = breakpoint.getSourcePosition();
if (position != null) {
myDebugProcess.addBreakpoint(myDebugProcess.getPositionConverter().convertToPython(position), breakpoint);
myBreakPointPositions.put(breakpoint, position);
}
}
public void unregisterBreakpoint(@NotNull final XLineBreakpoint breakpoint, final boolean temporary) {
final XSourcePosition position = myBreakPointPositions.get(breakpoint);
if (position != null) {
myDebugProcess.removeBreakpoint(myDebugProcess.getPositionConverter().convertToPython(position));
myBreakPointPositions.remove(breakpoint);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy