Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorangelozerr2018-11-09 08:21:05 +0000
committerMickael Istria2018-11-16 14:56:41 +0000
commitf5e429604d63d8b053effc10503065c3eb00923c (patch)
treeecccfe1d8a5c8280f459f7b5c1715a3d4e2a7e2a
parent1451c934039475c4415853cc28613c5c16e357f4 (diff)
downloadeclipse.platform.text-I20181117-0600.tar.gz
eclipse.platform.text-I20181117-0600.tar.xz
eclipse.platform.text-I20181117-0600.zip
Bug 540950 - [codemining] Setting new code mining providers can leadI20181117-0600I20181116-1800
former ones to exception Change-Id: I4b74bb6895d51e4392a3b27c8fea0209538e5dc6 Signed-off-by: angelozerr <angelo.zerr@gmail.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.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/internal/text/codemining/CodeMiningManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
index 0e9cc07fb..34e86434d 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2017 Angelo ZERR.
- *
+ *
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -96,6 +96,10 @@ public class CodeMiningManager implements Runnable {
* @param codeMiningProviders the codemining providers.
*/
public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) {
+ cancel();
+ if (fCodeMiningProviders != null) {
+ fCodeMiningProviders.stream().forEach(ICodeMiningProvider::dispose);
+ }
fCodeMiningProviders= Arrays.asList(codeMiningProviders);
}
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 fc51c3844..f52244bb8 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
@@ -1267,11 +1267,6 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
@Override
public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) {
- if (fCodeMiningProviders != null) {
- for (ICodeMiningProvider contentMiningProvider : fCodeMiningProviders) {
- contentMiningProvider.dispose();
- }
- }
boolean enable= codeMiningProviders != null && codeMiningProviders.length > 0;
fCodeMiningProviders= codeMiningProviders;
if (enable) {
@@ -1299,7 +1294,9 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
fInlinedAnnotationSupport= new InlinedAnnotationSupport();
fInlinedAnnotationSupport.install(this, fAnnotationPainter);
}
- fCodeMiningManager= new CodeMiningManager(this, fInlinedAnnotationSupport, fCodeMiningProviders);
+ if (fCodeMiningManager == null) {
+ fCodeMiningManager= new CodeMiningManager(this, fInlinedAnnotationSupport, fCodeMiningProviders);
+ }
// now trigger an update
updateCodeMinings();
}

Back to the top