本文整理汇总了Java中com.intellij.debugger.impl.DebuggerUtilsEx.getContainingMethod方法的典型用法代码示例。如果您正苦于以下问题:Java DebuggerUtilsEx.getContainingMethod方法的具体用法?Java DebuggerUtilsEx.getContainingMethod怎么用?Java DebuggerUtilsEx.getContainingMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.debugger.impl.DebuggerUtilsEx
的用法示例。
在下文中一共展示了DebuggerUtilsEx.getContainingMethod方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remapElement
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
private PsiElement remapElement(PsiElement element) {
String name = JVMNameUtil.getClassVMName(getEnclosingClass(element));
if (name != null && !name.equals(myExpectedClassName)) {
return null;
}
PsiElement method = DebuggerUtilsEx.getContainingMethod(element);
if (!StringUtil.isEmpty(myExpectedMethodName)) {
if (method == null) {
return null;
}
else if ((method instanceof PsiMethod && myExpectedMethodName.equals(((PsiMethod)method).getName()))) {
if (insideBody(element, ((PsiMethod)method).getBody())) return element;
}
else if (method instanceof PsiLambdaExpression && LambdaMethodFilter.isLambdaName(myExpectedMethodName)) {
if (insideBody(element, ((PsiLambdaExpression)method).getBody())) return element;
}
}
return null;
}
示例2: getContainingMethod
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@Nullable
public PsiElement getContainingMethod(@NotNull LineBreakpoint<?> breakpoint) {
SourcePosition position = breakpoint.getSourcePosition();
if (position == null) return null;
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties instanceof JavaLineBreakpointProperties && !(breakpoint instanceof RunToCursorBreakpoint)) {
Integer ordinal = ((JavaLineBreakpointProperties)properties).getLambdaOrdinal();
if (ordinal > -1) {
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
if (ordinal < lambdas.size()) {
return lambdas.get(ordinal);
}
}
}
return DebuggerUtilsEx.getContainingMethod(position);
}
示例3: remapElement
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
private PsiElement remapElement(PsiElement element)
{
String name = JVMNameUtil.getClassVMName(getEnclosingClass(element));
if(name != null && !name.equals(myExpectedClassName))
{
return null;
}
PsiElement method = DebuggerUtilsEx.getContainingMethod(element);
if(!StringUtil.isEmpty(myExpectedMethodName))
{
if(method == null)
{
return null;
}
else if(((method instanceof PsiMethod && myExpectedMethodName.equals(((PsiMethod) method).getName())) || (method instanceof PsiLambdaExpression && DebuggerUtilsEx.isLambdaName
(myExpectedMethodName))) && insideBody(element, DebuggerUtilsEx.getBody(method)))
{
return element;
}
}
return null;
}
示例4: getContainingMethod
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@Nullable
public PsiElement getContainingMethod(@NotNull LineBreakpoint<?> breakpoint)
{
SourcePosition position = breakpoint.getSourcePosition();
if(position == null)
{
return null;
}
JavaBreakpointProperties properties = breakpoint.getProperties();
if(properties instanceof JavaLineBreakpointProperties && !(breakpoint instanceof RunToCursorBreakpoint))
{
Integer ordinal = ((JavaLineBreakpointProperties) properties).getLambdaOrdinal();
if(ordinal > -1)
{
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
if(ordinal < lambdas.size())
{
return lambdas.get(ordinal);
}
}
}
return DebuggerUtilsEx.getContainingMethod(position);
}
示例5: getHighlightRange
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@Override
public TextRange getHighlightRange(SourcePosition sourcePosition) {
PsiElement method = DebuggerUtilsEx.getContainingMethod(sourcePosition);
if (method instanceof PsiLambdaExpression) {
return method.getTextRange();
}
return null;
}
示例6: computeVariants
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
@Override
public List<JavaBreakpointVariant> computeVariants(@NotNull Project project, @NotNull XSourcePosition position) {
PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
if (file == null) {
return Collections.emptyList();
}
SourcePosition pos = SourcePosition.createFromLine(file, position.getLine());
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(pos, true);
if (lambdas.isEmpty()) {
return Collections.emptyList();
}
PsiElement startMethod = DebuggerUtilsEx.getContainingMethod(pos);
//noinspection SuspiciousMethodCalls
if (lambdas.contains(startMethod) && lambdas.size() == 1) {
return Collections.emptyList();
}
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
if (document == null) {
return Collections.emptyList();
}
List<JavaBreakpointVariant> res = new SmartList<JavaBreakpointVariant>();
res.add(new JavaBreakpointVariant(position)); //all
if (startMethod instanceof PsiMethod) {
res.add(new ExactJavaBreakpointVariant(position, startMethod, -1)); // base method
}
int ordinal = 0;
for (PsiLambdaExpression lambda : lambdas) { //lambdas
PsiElement firstElem = DebuggerUtilsEx.getFirstElementOnTheLine(lambda, document, position.getLine());
res.add(new ExactJavaBreakpointVariant(XSourcePositionImpl.createByElement(firstElem), lambda, ordinal++));
}
return res;
}
示例7: getHighlightRange
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@Override
public TextRange getHighlightRange(SourcePosition sourcePosition)
{
PsiElement method = DebuggerUtilsEx.getContainingMethod(sourcePosition);
if(method instanceof PsiLambdaExpression)
{
return method.getTextRange();
}
return null;
}
示例8: computeVariants
import com.intellij.debugger.impl.DebuggerUtilsEx; //导入方法依赖的package包/类
@NotNull
@Override
public List<JavaBreakpointVariant> computeVariants(@NotNull Project project, @NotNull XSourcePosition position)
{
SourcePosition pos = DebuggerUtilsEx.toSourcePosition(position, project);
if(pos == null)
{
return Collections.emptyList();
}
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(pos, true);
if(lambdas.isEmpty())
{
return Collections.emptyList();
}
PsiElement startMethod = DebuggerUtilsEx.getContainingMethod(pos);
//noinspection SuspiciousMethodCalls
if(lambdas.contains(startMethod) && lambdas.size() == 1)
{
return Collections.emptyList();
}
Document document = PsiDocumentManager.getInstance(project).getDocument(pos.getFile());
if(document == null)
{
return Collections.emptyList();
}
List<JavaBreakpointVariant> res = new SmartList<>();
if(!(startMethod instanceof PsiLambdaExpression))
{
res.add(new LineJavaBreakpointVariant(position, startMethod, -1)); // base method
}
int ordinal = 0;
for(PsiLambdaExpression lambda : lambdas) //lambdas
{
PsiElement firstElem = DebuggerUtilsEx.getFirstElementOnTheLine(lambda, document, position.getLine());
XSourcePositionImpl elementPosition = XSourcePositionImpl.createByElement(firstElem);
if(elementPosition != null)
{
if(lambda == startMethod)
{
res.add(0, new LineJavaBreakpointVariant(elementPosition, lambda, ordinal++));
}
else
{
res.add(new LambdaJavaBreakpointVariant(elementPosition, lambda, ordinal++));
}
}
}
res.add(new JavaBreakpointVariant(position)); //all
return res;
}