mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-69518 - NPE: DebuggerUIUtil.calcPopupLocation
This commit is contained in:
+13
-10
@@ -26,6 +26,7 @@ import com.intellij.openapi.util.AsyncResult;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
@@ -62,11 +63,11 @@ public class XBreakpointUtil {
|
||||
|
||||
public static <B extends XBreakpoint<?>> XBreakpointType<B, ?> getType(@NotNull B breakpoint) {
|
||||
//noinspection unchecked
|
||||
return (XBreakpointType<B,?>)breakpoint.getType();
|
||||
return (XBreakpointType<B, ?>)breakpoint.getType();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static XBreakpointType<?,?> findType(@NotNull @NonNls String id) {
|
||||
public static XBreakpointType<?, ?> findType(@NotNull @NonNls String id) {
|
||||
for (XBreakpointType breakpointType : getBreakpointTypes()) {
|
||||
if (id.equals(breakpointType.getId())) {
|
||||
return breakpointType;
|
||||
@@ -75,7 +76,7 @@ public class XBreakpointUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static XBreakpointType<?,?>[] getBreakpointTypes() {
|
||||
public static XBreakpointType<?, ?>[] getBreakpointTypes() {
|
||||
return XBreakpointType.EXTENSION_POINT_NAME.getExtensions();
|
||||
}
|
||||
|
||||
@@ -136,10 +137,10 @@ public class XBreakpointUtil {
|
||||
*/
|
||||
@NotNull
|
||||
public static AsyncResult<XLineBreakpoint> toggleLineBreakpoint(@NotNull Project project,
|
||||
@NotNull XSourcePosition position,
|
||||
@Nullable Editor editor,
|
||||
boolean temporary,
|
||||
boolean moveCarret) {
|
||||
@NotNull XSourcePosition position,
|
||||
@Nullable Editor editor,
|
||||
boolean temporary,
|
||||
boolean moveCarret) {
|
||||
int lineStart = position.getLine();
|
||||
VirtualFile file = position.getFile();
|
||||
// for folded text check each line and find out type with the biggest priority
|
||||
@@ -162,7 +163,8 @@ public class XBreakpointUtil {
|
||||
final XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
|
||||
if (breakpoint != null && temporary && !breakpoint.isTemporary()) {
|
||||
breakpoint.setTemporary(true);
|
||||
} else if (type.canPutAt(file, line, project) || breakpoint != null) {
|
||||
}
|
||||
else if (type.canPutAt(file, line, project) || breakpoint != null) {
|
||||
if (typeWinner == null || type.getPriority() > typeWinner.getPriority()) {
|
||||
typeWinner = type;
|
||||
lineWinner = line;
|
||||
@@ -178,8 +180,9 @@ public class XBreakpointUtil {
|
||||
if (typeWinner != null) {
|
||||
XSourcePosition winPosition = (lineStart == lineWinner) ? position : XSourcePositionImpl.create(file, lineWinner);
|
||||
if (winPosition != null) {
|
||||
AsyncResult<XLineBreakpoint> res = XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(project, typeWinner, winPosition, temporary,
|
||||
DebuggerUIUtil.calcPopupLocation(editor, lineWinner));
|
||||
RelativePoint point = editor != null ? DebuggerUIUtil.calcPopupLocation(editor, lineWinner) : null;
|
||||
AsyncResult<XLineBreakpoint> res =
|
||||
XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(project, typeWinner, winPosition, temporary, point);
|
||||
|
||||
if (editor != null && lineStart != lineWinner) {
|
||||
int offset = editor.getDocument().getLineStartOffset(lineWinner);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class DebuggerUIUtil {
|
||||
ApplicationManager.getApplication().invokeLater(runnable);
|
||||
}
|
||||
|
||||
public static RelativePoint calcPopupLocation(Editor editor, final int line) {
|
||||
public static RelativePoint calcPopupLocation(@NotNull Editor editor, final int line) {
|
||||
Point p = editor.logicalPositionToXY(new LogicalPosition(line + 1, 0));
|
||||
|
||||
final Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
|
||||
|
||||
Reference in New Issue
Block a user