1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 463981 Move preference loading to UI thread.

A couple of lines in the CUIPlugin.start() method load preferences.
This can only be done from the UI thread since it eventually loads up
colors which can only be done on the UI thread. This change moves
those two lines to a UIJob.

Change-Id: I692a81d5a38f63c506dc73da93df6c2e9e4b6192
This commit is contained in:
Doug Schaefer 2015-04-13 12:23:48 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 61200ab252
commit 860e0af8c8
3 changed files with 18 additions and 4 deletions

View file

@ -78,6 +78,7 @@ public final class CUIMessages extends NLS {
public static String NewCDTProjectWizard_templatePageDesc; public static String NewCDTProjectWizard_templatePageDesc;
public static String NewCDTProjectWizard_templatePageTitle; public static String NewCDTProjectWizard_templatePageTitle;
public static String NewCDTProjectWizard_windowTitle; public static String NewCDTProjectWizard_windowTitle;
public static String CUIPlugin_initPrefs;
static { static {
NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class); NLS.initializeMessages(BUNDLE_NAME, CUIMessages.class);

View file

@ -81,3 +81,5 @@ NewCDTProjectWizard_refPageTitle=Project References
NewCDTProjectWizard_templatePageDesc=Select a project template for the new project NewCDTProjectWizard_templatePageDesc=Select a project template for the new project
NewCDTProjectWizard_templatePageTitle=Project Template NewCDTProjectWizard_templatePageTitle=Project Template
NewCDTProjectWizard_windowTitle=New C/C++ Project NewCDTProjectWizard_windowTitle=New C/C++ Project
CUIPlugin_initPrefs=Initialize C/C++ UI Preferences

View file

@ -65,6 +65,7 @@ import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
import org.eclipse.ui.navigator.ICommonMenuConstants; import org.eclipse.ui.navigator.ICommonMenuConstants;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.ConfigurationElementSorter; import org.eclipse.ui.texteditor.ConfigurationElementSorter;
import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditor;
@ -90,6 +91,7 @@ import org.eclipse.cdt.internal.corext.template.c.DocCommentContextType;
import org.eclipse.cdt.internal.corext.template.c.FileTemplateContextType; import org.eclipse.cdt.internal.corext.template.c.FileTemplateContextType;
import org.eclipse.cdt.internal.ui.CElementAdapterFactory; import org.eclipse.cdt.internal.ui.CElementAdapterFactory;
import org.eclipse.cdt.internal.ui.CUIMessages;
import org.eclipse.cdt.internal.ui.ICStatusConstants; import org.eclipse.cdt.internal.ui.ICStatusConstants;
import org.eclipse.cdt.internal.ui.IContextMenuConstants; import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.ResourceAdapterFactory; import org.eclipse.cdt.internal.ui.ResourceAdapterFactory;
@ -602,10 +604,19 @@ public class CUIPlugin extends AbstractUIPlugin {
DocCommentOwnerManager.getInstance().addListener(new EditorReopener()); DocCommentOwnerManager.getInstance().addListener(new EditorReopener());
ASTRewriteAnalyzer.setCTextFileChangeFactory(new CTextFileChangeFactory()); ASTRewriteAnalyzer.setCTextFileChangeFactory(new CTextFileChangeFactory());
// A workaround for black console bug 320723. // These need to be done on the UI thread
BuildConsolePreferencePage.initDefaults(getPreferenceStore()); UIJob prefsJob = new UIJob(CUIMessages.CUIPlugin_initPrefs) {
// Initialize ContentAssistMatcherPreference. @Override
ContentAssistPreference.getInstance(); public IStatus runInUIThread(IProgressMonitor monitor) {
// A workaround for black console bug 320723.
BuildConsolePreferencePage.initDefaults(getPreferenceStore());
// Initialize ContentAssistMatcherPreference.
ContentAssistPreference.getInstance();
return Status.OK_STATUS;
}
};
prefsJob.setSystem(true);
prefsJob.schedule();
// Start make.ui plug-in, such that it can check for project conversions. // Start make.ui plug-in, such that it can check for project conversions.
Job job= new Job(Messages.CUIPlugin_jobStartMakeUI) { Job job= new Job(Messages.CUIPlugin_jobStartMakeUI) {