Skip to content

Commit

Permalink
Use the progress monitoring API appropriately.
Browse files Browse the repository at this point in the history
- A method should call Submonitor.convert(..) upon receiving its monitor
  in order to correctly allocate its share of the work to be done
- Fixes eclipse-jdtls#1722

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
  • Loading branch information
rgrunber committed Jun 18, 2021
1 parent 5793709 commit 8997d4a
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICodeAssist;
import org.eclipse.jdt.core.ICompilationUnit;
Expand Down Expand Up @@ -166,7 +167,8 @@ private IMember getCallHierarchyElement(String uri, int line, int character, IPr
}

private List<CallHierarchyIncomingCall> getIncomingCallItemsAt(String uri, int line, int character, IProgressMonitor monitor) throws JavaModelException {
IMember candidate = getCallHierarchyElement(uri, line, character, monitor);
SubMonitor sub = SubMonitor.convert(monitor, 2);
IMember candidate = getCallHierarchyElement(uri, line, character, sub.split(1));
if (candidate == null) {
return null;
}
Expand All @@ -179,7 +181,7 @@ private List<CallHierarchyIncomingCall> getIncomingCallItemsAt(String uri, int l
return null;
}

MethodWrapper[] calls = wrapper.getCalls(monitor);
MethodWrapper[] calls = wrapper.getCalls(sub.split(1));
if (calls == null) {
return null;
}
Expand All @@ -199,7 +201,8 @@ private List<CallHierarchyIncomingCall> getIncomingCallItemsAt(String uri, int l
}

private List<CallHierarchyOutgoingCall> getOutgoingCallItemsAt(String uri, int line, int character, IProgressMonitor monitor) throws JavaModelException {
IMember candidate = getCallHierarchyElement(uri, line, character, monitor);
SubMonitor sub = SubMonitor.convert(monitor, 2);
IMember candidate = getCallHierarchyElement(uri, line, character, sub.split(1));
if (candidate == null) {
return null;
}
Expand All @@ -211,7 +214,7 @@ private List<CallHierarchyOutgoingCall> getOutgoingCallItemsAt(String uri, int l
return null;
}

MethodWrapper[] calls = wrapper.getCalls(monitor);
MethodWrapper[] calls = wrapper.getCalls(sub.split(1));
if (calls == null) {
return null;
}
Expand Down

0 comments on commit 8997d4a

Please sign in to comment.