Community
Participate
Working Groups
JavaTextTools adds a preference store listener when created (in constructor). It needs to have dipose() called somewhere to remove the listener.
Amy ... you're still our "config" expert, right?
StructuredTextViewerConfiguration does not have a dispose method in the API so I'm not sure when to get rid of JavaTextTools. Option #1: add a dispose method to StructuredTextViewerConfiguration so that StructuredTextViewerConfigurationJSP can override it and call dispose on JavaTextTools Option B: create 1 instance of JavaTextTools for the entire JSP UI plugin and add something like the following to JSPUIPlugin: public synchronized JavaTextTools getJavaTextTools() { if (fJavaTextTools == null) fJavaTextTools= new JavaTextTools(getPreferenceStore(), JavaCore.getPlugin().getPluginPreferences()); return fJavaTextTools; } This is what JDT does. and then when the JDT UI plugin/bundle stops, the java text tools is disposed. B seems safer/better because it keeps everything internal and does not create API. I would only go for #1 if there are other reasons why we want a dispose method on the viewerconfig interface.
*** Bug 151910 has been marked as a duplicate of this bug. ***
According to bug 151910 this sounds rather bad, and the fix (Option B) sounds like a relatively safe fix, so targetting to 1.5.1.
Actually, I found a solution that is 50x better. Since all our viewer configuration really needs is the colormanager from the JavaTextTools, I discovered that there is a public API to get the color manager from the jdt plugin. JavaUI.getColorManager() We can just call that, and we will no longer need to create an instance of JavaTextTools.
Created attachment 47121 [details] org.eclipse.jst.jsp.ui.patch
Fix released to 1.5.1 M1 & head. Jeffrey, since you opened a duplicate and Phil is no longer able to verify bugs, do you mind verifying and marking as verified when you have done so? Thanks.
Sure, I'll verify it in this week's I-build.
verified WTP1.5.3 SDK 200701311336