mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enabled quick evaluate and smart step into while debugging decompiled code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.debugger.actions;
|
||||
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -67,7 +68,7 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
|
||||
final int startOffset = doc.getLineStartOffset(line);
|
||||
final TextRange lineRange = new TextRange(startOffset, doc.getLineEndOffset(line));
|
||||
final int offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), startOffset, " \t");
|
||||
PsiElement element = file.findElementAt(offset);
|
||||
PsiElement element = DebuggerUtilsEx.findElementAt(file, offset);
|
||||
if (element != null && !(element instanceof PsiCompiledElement)) {
|
||||
do {
|
||||
final PsiElement parent = element.getParent();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.EditorTextProvider;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
|
||||
@@ -103,11 +104,7 @@ public class JavaDebuggerEvaluator extends XDebuggerEvaluator {
|
||||
PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
|
||||
if (psiFile == null) {
|
||||
return;
|
||||
}
|
||||
PsiElement elementAtCursor = psiFile.findElementAt(offset);
|
||||
PsiElement elementAtCursor = DebuggerUtilsEx.findElementAt(PsiDocumentManager.getInstance(project).getPsiFile(document), offset);
|
||||
if (elementAtCursor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -668,4 +668,16 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
return XSourcePositionImpl.createOpenFileDescriptor(project, this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompiler aware version
|
||||
*/
|
||||
@Nullable
|
||||
public static PsiElement findElementAt(@Nullable PsiFile file, int offset) {
|
||||
if (file instanceof PsiCompiledFile) {
|
||||
file = ((PsiCompiledFile)file).getDecompiledPsiFile();
|
||||
}
|
||||
if (file == null) return null;
|
||||
return file.findElementAt(offset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user