Community
Participate
Working Groups
A normal call to a core API, i.e., EclipsePreferences.put() for key "instance/org.eclipse.ui.ide/WORKSPACE_NAME", leads to this exception in the UI: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:4397) at org.eclipse.swt.SWT.error(SWT.java:4312) at org.eclipse.swt.SWT.error(SWT.java:4283) at org.eclipse.swt.widgets.Widget.error(Widget.java:472) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:363) at org.eclipse.swt.widgets.Decorations.getText(Decorations.java:747) at org.eclipse.ui.internal.WorkbenchWindowConfigurer.getTitle(WorkbenchWindowConfigurer.java:301) at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor.recomputeTitle(IDEWorkbenchWindowAdvisor.java:421) at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor.updateTitle(IDEWorkbenchWindowAdvisor.java:498) at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor.access$3(IDEWorkbenchWindowAdvisor.java:461) at org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor$5.propertyChange(IDEWorkbenchWindowAdvisor.java:353) at org.eclipse.ui.preferences.ScopedPreferenceStore$3.run(ScopedPreferenceStore.java:375) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:372) at org.eclipse.ui.preferences.ScopedPreferenceStore$2.preferenceChange(ScopedPreferenceStore.java:194) at org.eclipse.core.internal.preferences.EclipsePreferences$3.run(EclipsePreferences.java:896) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.preferences.EclipsePreferences.firePreferenceEvent(EclipsePreferences.java:899) at org.eclipse.core.internal.preferences.EclipsePreferences.put(EclipsePreferences.java:912) The private method IDEWorkbenchWindowAdvisor.recomputeTitle() seems to assume that it's always being called on the UI thread, but it's not.
That preference key is considered an "internal detail" (i.e. it's not published in org.eclipse.ui.IWorkbenchPreferenceConstants) and does expect to be set/processed on the UI thread. PW
Any idea why it's private?
It's the other way around :-) It was never made public as their was no reason to make that pref API. It's a user pref, and there was never a request to set it in plugin_customization.ini or one of the other mechanisms. You can fix the UI thread issue by changing the pref in an a/syncExec(*). PW
(In reply to comment #3) > You can fix the UI thread issue by changing the pref in an a/syncExec(*). Sure, I did it already ;-) > It's the other way around :-) It was never made public as their was no > reason to make that pref API. It's a user pref, and there was never a > request to set it in plugin_customization.ini or one of the other mechanisms. Given the current complaints about lack of user preference scopes I am trying to automate the setting of preferences (and various other things) from an external workspace setup model. To identify the correct keys of preferences it is handy to export the preferences into two .epf files and compare the two. That's why I never thought about "public visibility". Do you think it would make sense to add this specific preference to the set of public preferences and add the Display.asyncExec() call to IDEWorkbenchWindowAdvisor.recomputeTitle()? If so I would change this bugzilla to an enhancement request, otherwise I can close it as worksforme.
(In reply to comment #4) > Do > you think it would make sense to add this specific preference to the set of > public preferences and add the Display.asyncExec() call to > IDEWorkbenchWindowAdvisor.recomputeTitle()? I can consider making this public pref constant for Luna, but leave it as a UI preference (it should only be changed on the UI thread). recomputeTitle() is called frequently enough that I don't want to put a sync guard around it. PW
> I can consider making this public pref constant for Luna, That would be great. I've changed the bugzilla accordingly. > but leave it as a > UI preference (it should only be changed on the UI thread). > recomputeTitle() is called frequently enough that I don't want to put a sync > guard around it. I think I can live with this restriction. Is there a way to find out programmatically what preferences are "UI Preferences"?
Released http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=828d765394e7a0af8fca85bc324ad0afcde295ad PW
Thank you Paul!
2 problems: 1) I can't find IIDEPreferenceConstants in the javadoc of Help>Help Contents>Platform Plug-in Development>Reference>API References>org.eclipse.ui.ide 2) apparently it should go into org.eclipse.ui.ide.IDE.Preferences PW
Reverted the fix and release http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=71023d72f43850f9ef4929877c27b8c353c1e05f PW
In 4.4.0.I20140123-1600