This repository was archived by the owner on Mar 16, 2026. It is now read-only.
forked from microsoft/java-debug
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBreakpointLocationLocator.java
More file actions
73 lines (65 loc) · 2.69 KB
/
Copy pathBreakpointLocationLocator.java
File metadata and controls
73 lines (65 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*******************************************************************************
* Copyright (c) 2022 Microsoft Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gayan Perera (gayanper@gmail.com) - initial API and implementation
*******************************************************************************/
package com.microsoft.java.debug;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.MethodDeclaration;
@SuppressWarnings("restriction")
public class BreakpointLocationLocator
extends org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator {
private IMethodBinding methodBinding;
public BreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber,
boolean bindingsResolved,
boolean bestMatch, int offset, int end) {
super(compilationUnit, lineNumber, bindingsResolved, bestMatch, offset, end);
}
@Override
public boolean visit(MethodDeclaration node) {
boolean result = super.visit(node);
if (methodBinding == null && getLocationType() == LOCATION_METHOD) {
this.methodBinding = node.resolveBinding();
}
return result;
}
/**
* Returns the signature of method found if the
* {@link org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator#getLocationType()}
* is
* {@link org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator#LOCATION_METHOD}.
* Otherwise return null.
*/
public String getMethodSignature() {
if (this.methodBinding == null) {
return null;
}
return BindingUtils.toSignature(this.methodBinding);
}
/**
* Returns the name of method found if the
* {@link org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator#getLocationType()}
* is
* {@link org.eclipse.jdt.internal.debug.core.breakpoints.ValidBreakpointLocationLocator#LOCATION_METHOD}.
* Otherwise return null.
*/
public String getMethodName() {
if (this.methodBinding == null) {
return null;
}
return this.methodBinding.getName();
}
@Override
public String getFullyQualifiedTypeName() {
if (this.methodBinding != null) {
return this.methodBinding.getDeclaringClass().getQualifiedName();
}
return super.getFullyQualifiedTypeName();
}
}