Skip to content

Commit 7fc9ca8

Browse files
remove isReconciled
1 parent c35c65a commit 7fc9ca8

File tree

4 files changed

+4
-20
lines changed

4 files changed

+4
-20
lines changed

org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/codemining/ParameterNamesCodeMiningTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private void waitReconciled(JavaEditor editor, JavaSourceViewer viewer) {
106106
assertTrue(new DisplayHelper() {
107107
@Override
108108
protected boolean condition() {
109-
return JavaCodeMiningReconciler.isReconciled(editor);
109+
return JavaCodeMiningReconciler.getFuture(editor).isDone();
110110
}
111111
}.waitForCondition(viewer.getTextWidget().getDisplay(), 2000), "Editor not reconciled");
112112
}

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaCodeMiningReconciler.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public void reconciled(CompilationUnit ast, boolean forced, IProgressMonitor pro
5858
final ISourceViewerExtension5 sourceViewer= fSourceViewer;
5959
if (editor != null && sourceViewer != null) {
6060
sourceViewer.updateCodeMinings();
61-
// Use remove() to ensure atomicity
62-
CompletableFuture<ITypeRoot> future= typeRootFutureByEditor.remove(editor);
61+
CompletableFuture<ITypeRoot> future= typeRootFutureByEditor.get(editor);
6362
if (future != null && !future.isDone() && ast.getTypeRoot() != null) {
6463
future.complete(ast.getTypeRoot());
6564
}
@@ -125,9 +124,4 @@ public void uninstall() {
125124
fEditor= null;
126125
fSourceViewer= null;
127126
}
128-
129-
public static boolean isReconciled(ITextEditor editor) {
130-
CompletableFuture<ITypeRoot> future= getFuture(editor);
131-
return future.isDone() && !future.isCompletedExceptionally();
132-
}
133127
}

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaElementCodeMiningProvider.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ private List<? extends ICodeMining> computeCodeMinings(ITextViewer viewer, IText
104104
IJavaElement[] elements= unit.getChildren();
105105
List<ICodeMining> minings= new ArrayList<>(elements.length);
106106
collectMinings(unit, textEditor, unit.getChildren(), minings, viewer, monitor);
107-
// interrupt if editor was marked to be reconciled in the meantime
108-
if (!JavaCodeMiningReconciler.isReconciled(textEditor)) {
109-
monitor.setCanceled(true);
110-
}
111-
monitor.isCanceled();
112107
return minings;
113108
} catch (JavaModelException e) {
114109
// Should never occur

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/codemining/JavaMethodParameterCodeMiningProvider.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextVi
5151
ITextEditor textEditor= super.getAdapter(ITextEditor.class);
5252
CompletableFuture<ITypeRoot> future= JavaCodeMiningReconciler.getFuture(textEditor);
5353
return future.thenApplyAsync(typeRoot -> {
54-
return computeCodeMinings(textEditor, monitor, typeRoot);
54+
return computeCodeMinings(typeRoot);
5555
}).handle((result, ex) -> {
5656
if (ex instanceof CompletionException ce &&
5757
ce.getCause() instanceof CancellationException) {
@@ -61,19 +61,14 @@ public CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextVi
6161
});
6262
}
6363

64-
private List<? extends ICodeMining> computeCodeMinings(ITextEditor textEditor, IProgressMonitor monitor, ITypeRoot unit) {
64+
private List<? extends ICodeMining> computeCodeMinings(ITypeRoot unit) {
6565
if (unit == null) {
6666
return Collections.emptyList();
6767
}
6868
try {
6969
IJavaElement[] elements= unit.getChildren();
7070
List<ICodeMining> minings= new ArrayList<>(elements.length);
7171
collectLineContentCodeMinings(unit, minings);
72-
if (!JavaCodeMiningReconciler.isReconciled(textEditor)) {
73-
// the provider isn't able to return code minings for non-reconciled viewers
74-
monitor.setCanceled(true);
75-
}
76-
monitor.isCanceled();
7772
return minings;
7873
} catch (JavaModelException e) {
7974
// TODO: what should we done when there are some errors?

0 commit comments

Comments
 (0)