mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reduce usage of JSDebuggerSupportUtils
This commit is contained in:
+10
-4
@@ -1,15 +1,21 @@
|
||||
package org.jetbrains.debugger;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class DebuggerSupportUtils {
|
||||
@Nullable
|
||||
public static PsiElement getContextElement(@NotNull VirtualFile virtualFile, int offset, @NotNull Project project) {
|
||||
return XDebuggerUtil.getInstance().findContextElement(virtualFile, offset, project, true);
|
||||
public static XSourcePosition calcSourcePosition(@Nullable PsiElement element) {
|
||||
if (element != null) {
|
||||
PsiElement navigationElement = element.getNavigationElement();
|
||||
VirtualFile file = navigationElement.getContainingFile().getVirtualFile();
|
||||
if (file != null) {
|
||||
return XDebuggerUtil.getInstance().createPositionByOffset(file, navigationElement.getTextOffset());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user