Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2018-03-21 08:38:16 -0400
committerMickael Istria2018-04-24 10:31:27 -0400
commit6e3500bbb912961be9724d506486bb4c65180477 (patch)
tree705e8696f12651396d52432e4ab100d31dde7551
parent658a3ab665fa5ee7fbba7ddc6b235372fc46ff2f (diff)
downloadeclipse.platform.text-6e3500bbb912961be9724d506486bb4c65180477.tar.gz
eclipse.platform.text-6e3500bbb912961be9724d506486bb4c65180477.tar.xz
eclipse.platform.text-6e3500bbb912961be9724d506486bb4c65180477.zip
After fCodeMiningManager is initialized in ensureCodeMiningManagerInstalled, it is not assured that updateCodeMinings() is called afterwards. The initial reconciling has already called before an annotation painter is set. But only when this has happened the code mining is properly installed and an initial mining has to be shown. Thus ensureCodeMiningManagerInstalled calls updateCodeMinings after initialization of the manager. Also changed guard conditions since it is intended to check that the code mining manager is set, but method hasCodeMiningProviders is from its name not so clear that this is implied by calling it. Change-Id: Ic79743178aa3302d38586770246ca7d749401e15 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-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