mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 394756 - Reduce number of ScopedPreferenceStore instances
This commit is contained in:
parent
8450d8e366
commit
461a07cf73
5 changed files with 26 additions and 19 deletions
|
@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.editor.IMakefileDocumentProvider;
|
||||
import org.eclipse.cdt.make.internal.ui.editor.MakefileDocumentProvider;
|
||||
import org.eclipse.cdt.make.internal.ui.editor.WorkingCopyManager;
|
||||
|
@ -26,6 +27,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceConverter;
|
||||
|
@ -36,6 +38,7 @@ import org.eclipse.ui.IWorkbenchPage;
|
|||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.editors.text.EditorsUI;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
@ -50,6 +53,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
|
||||
private IWorkingCopyManager fWorkingCopyManager;
|
||||
private IMakefileDocumentProvider fMakefileDocumentProvider;
|
||||
private ScopedPreferenceStore fCorePreferenceStore;
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
|
@ -269,6 +273,16 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
return chainedStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a preference store for org.eclipse.cdt.make.core preferences
|
||||
* @return the preference store
|
||||
*/
|
||||
public IPreferenceStore getCorePreferenceStore() {
|
||||
if (fCorePreferenceStore == null) {
|
||||
fCorePreferenceStore= new ScopedPreferenceStore(InstanceScope.INSTANCE, MakeCorePlugin.PLUGIN_ID);
|
||||
}
|
||||
return fCorePreferenceStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2010 QNX Software Systems and others.
|
||||
* Copyright (c) 2002, 2012 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -13,8 +13,8 @@
|
|||
package org.eclipse.cdt.make.internal.ui.preferences;
|
||||
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.make.ui.IMakeHelpContextIds;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PathEditor;
|
||||
|
@ -23,7 +23,6 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
|
||||
/**
|
||||
* MakePreferencePage
|
||||
|
@ -37,7 +36,7 @@ public class MakefileSettingsPreferencePage extends FieldEditorPreferencePage im
|
|||
|
||||
public MakefileSettingsPreferencePage() {
|
||||
super(GRID);
|
||||
IPreferenceStore store = new ScopedPreferenceStore(new InstanceScope(), MakeCorePlugin.PLUGIN_ID);
|
||||
IPreferenceStore store = MakeUIPlugin.getDefault().getCorePreferenceStore();
|
||||
setPreferenceStore(store);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.core.runtime.content.IContentType;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.help.IContext;
|
||||
import org.eclipse.help.IContextProvider;
|
||||
import org.eclipse.jface.action.GroupMarker;
|
||||
|
@ -149,7 +148,6 @@ import org.eclipse.ui.part.EditorActionBarContributor;
|
|||
import org.eclipse.ui.part.IShowInSource;
|
||||
import org.eclipse.ui.part.IShowInTargetList;
|
||||
import org.eclipse.ui.part.ShowInContext;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
|
||||
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
|
||||
import org.eclipse.ui.texteditor.AnnotationPreference;
|
||||
|
@ -3649,7 +3647,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
|
|||
}
|
||||
|
||||
stores.add(CUIPlugin.getDefault().getPreferenceStore());
|
||||
stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, CCorePlugin.PLUGIN_ID));
|
||||
stores.add(CUIPlugin.getDefault().getCorePreferenceStore());
|
||||
stores.add(EditorsUI.getPreferenceStore());
|
||||
|
||||
return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Jens Elmenthaler and others
|
||||
* Copyright (c) 2011, 2012 Jens Elmenthaler and others
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -15,16 +15,13 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
/**
|
||||
* A preference that on preference from the UI plugin, as well the CDT core.
|
||||
|
@ -49,8 +46,8 @@ public abstract class AbstractMixedPreferencePage extends AbstractPreferencePage
|
|||
};
|
||||
|
||||
public AbstractMixedPreferencePage() {
|
||||
corePrefsOverlayStore = new OverlayPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE,
|
||||
CCorePlugin.PLUGIN_ID), createCorePrefsOverlayStoreKeys());
|
||||
corePrefsOverlayStore = new OverlayPreferenceStore(CUIPlugin.getDefault().getCorePreferenceStore(),
|
||||
createCorePrefsOverlayStoreKeys());
|
||||
}
|
||||
|
||||
protected Button addCorePrefsCheckBox(Composite parent, String label, String key, int indentation) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -14,9 +14,9 @@ package org.eclipse.cdt.ui.dialogs;
|
|||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.layout.PixelConverter;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
@ -26,13 +26,12 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
||||
import org.eclipse.cdt.core.dom.CDOM;
|
||||
import org.eclipse.cdt.core.parser.CodeReaderCache;
|
||||
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||
|
@ -140,7 +139,7 @@ public class CacheSizeBlock extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
private void initializeValues() {
|
||||
ScopedPreferenceStore prefStore= new ScopedPreferenceStore(InstanceScope.INSTANCE, CCorePlugin.PLUGIN_ID);
|
||||
IPreferenceStore prefStore= CUIPlugin.getDefault().getCorePreferenceStore();
|
||||
|
||||
fDBLimitPct.setPreferenceStore(prefStore);
|
||||
fDBLimitPct.setPropertyChangeListener(validityChangeListener);
|
||||
|
|
Loading…
Add table
Reference in a new issue