summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Oberhuber2013-04-30 06:03:27 (EDT)
committerSergey Prigogin2013-04-30 23:19:06 (EDT)
commit41edb9360b518bd89f94482feeaed78b7efef184 (patch)
tree24ff6ae88125437b26e7a1bb5ffe0f12d88ca851
parent1c022521464557d46491424bccdeb20b1aa78744 (diff)
downloadorg.eclipse.cdt-41edb9360b518bd89f94482feeaed78b7efef184.zip
org.eclipse.cdt-41edb9360b518bd89f94482feeaed78b7efef184.tar.gz
org.eclipse.cdt-41edb9360b518bd89f94482feeaed78b7efef184.tar.bz2
Bug 406783 - [spell-check] Support variables for CDT user dictionary.
Simply copied the respective code from JDT SpellCheckEngine, which was introduced with the fix for bug 70410 on 9-Jul-2007 , http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=d235827d8379f62fd5c488aabdec635fbb5005a2 Change-Id: I7139f6288112dd311d9cc72e15cc67f70cb9d013 Reviewed-on: https://git.eclipse.org/r/12377 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java
index 63abfbf..e4c197c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/spelling/SpellCheckEngine.java
@@ -22,10 +22,13 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -339,7 +342,19 @@ public class SpellCheckEngine implements ISpellCheckEngine, IPropertyChangeListe
fUserDictionary= null;
}
- final String filePath= SpellingPreferences.getSpellingUserDictionary();
+ String filePath= SpellingPreferences.getSpellingUserDictionary();
+
+ VariablesPlugin variablesPlugin= VariablesPlugin.getDefault();
+ if (variablesPlugin == null)
+ return;
+
+ IStringVariableManager variableManager= variablesPlugin.getStringVariableManager();
+ try {
+ filePath= variableManager.performStringSubstitution(filePath);
+ } catch (CoreException e) {
+ CUIPlugin.log(e);
+ return;
+ }
if (filePath.length() > 0) {
try {
File file= new File(filePath);