Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/CodeMiningStrategy.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java9
2 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/CodeMiningStrategy.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/CodeMiningStrategy.java
index 27e645801..79f16fdf1 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/CodeMiningStrategy.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/codemining/CodeMiningStrategy.java
@@ -37,12 +37,10 @@ class CodeMiningStrategy implements IReconcilingStrategy, IReconcilingStrategyEx
@Override
public void initialReconcile() {
- if (fViewer != null) {
- // FIXME: this update is done because minings is not updated on focus by AbstractTextEditor#setFocus
- // But I'm a little afraid to update minings each time editor will have focus
- // @Mickael what do you think about doing update minings on AbstractTextEditor#setFocus ?
- fViewer.updateCodeMinings();
- }
+ // Do nothing
+ // Initial reconcilation will happen when the SourceViewer
+ // has initialized the code mining provider
+ // see SourceViewer#ensureCodeMiningManagerInstalled
}
@Override
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
index c98d750c0..303b9c511 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java
@@ -1272,13 +1272,14 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
boolean enable= codeMiningProviders != null && codeMiningProviders.length > 0;
fCodeMiningProviders= codeMiningProviders;
if (enable) {
- if (hasCodeMiningProviders()) {
+ if (fCodeMiningManager != null) {
fCodeMiningManager.setCodeMiningProviders(fCodeMiningProviders);
}
ensureCodeMiningManagerInstalled();
} else {
- if (hasCodeMiningProviders())
+ if (fCodeMiningManager != null) {
fCodeMiningManager.uninstall();
+ }
fCodeMiningManager= null;
}
}
@@ -1296,12 +1297,14 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
fInlinedAnnotationSupport.install(this, fAnnotationPainter);
}
fCodeMiningManager= new CodeMiningManager(this, fInlinedAnnotationSupport, fCodeMiningProviders);
+ // now trigger an update
+ updateCodeMinings();
}
}
@Override
public boolean hasCodeMiningProviders() {
- return fCodeMiningManager != null;
+ return fCodeMiningManager != null; // manager always has at least one provider
}
@Override

Back to the top