Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 Build Identifier: I20091117-1545 Dictionary remains in memory after spell checking is turned off. However when eclipse is restarted after disabling spell checking the dictionary is not loaded Reproducible: Always Steps to Reproduce: 1. Start Eclipse and open an editor 2. Turn on spell checking 3. Take a memory snapshot. SpellCheckEngine , LocaleSensitiveSpellDictioanry and other dictionary related object types are present. 4. Turn off spell checking 5. Objects mentioned in point 3 are still present.
Created attachment 156204 [details] fix Created a listener on preference store, which shuts down the spellcheck engine when the spell check is disabled
Direction looks good. Two issues: - Please use the same pattern as used for the JDT listener. - Since each instance listens it should only shutdown itself and not the static instance. Just assume the class allows the creation of more than one SpellCheckEngine: in that case you would only shutdown the global instance.
Created attachment 156214 [details] fix (In reply to comment #2) > Direction looks good. Two issues: > - Please use the same pattern as used for the JDT listener. Done > - Since each instance listens it should only shutdown itself and not the static > instance. Just assume the class allows the creation of more than one > SpellCheckEngine: in that case you would only shutdown the global instance. Using shutdown() in place of SpellCheckEngine.shutdownInstance() causes a problem. In getInstance() fgEngine is not null when the spell check is enabled again after disabling it once. This results is spell check remaining disabled and eclipse needs to be restarted to enable spell check again.
As said before: each instance has to call shutdown on itself. To fix the issue you mentioned you can call the static method in case the instance itself is the singleton. You're lucky that the default state of the engine is enabled, otherwise setting the values back to default (Restore Defaults) would cause a CCE because the property would be a string with value "false". Please read org.eclipse.jface.preference.IPreferenceStore.addPropertyChangeListener(IPropertyChangeListener) for details. The safest way to get the new value is to get the current value from the store.
Created attachment 156221 [details] fix
Committed patch to HEAD. Available in builds > N20100117-2000.
Verified for 3.6M5 with I20100126-0800.