Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349511 - Project-level preferences are being applied to all projects in a workspace
Summary: Project-level preferences are being applied to all projects in a workspace
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 19:28 EDT by Alex Ruiz CLA
Modified: 2017-09-19 18:14 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Ruiz CLA 2011-06-15 19:28:22 EDT
Build Identifier: I20110526-1708

When changing preferences for a particular project, the changes get saved to all the projects in the workspace.

After some debugging, I think the problem is in PreferenceStoreAccessImpl, in the method getWritablePreferenceStore(Object), line 59:

Code: [Select all] [Show/ hide]
	public IPreferenceStore getWritablePreferenceStore(Object context) {
		lazyInitialize();
		if (context instanceof IFileEditorInput) {
			context = ((IFileEditorInput) context).getFile().getProject();
		}
		if (context instanceof IProject) {
			ProjectScope projectScope = new ProjectScope((IProject) context);
			ScopedPreferenceStore result = new ScopedPreferenceStore(projectScope, getQualifier());
			result.setSearchContexts(new IScopeContext[] {
				projectScope,
				new InstanceScope(),
				new ConfigurationScope()
			});
		}
		return getWritablePreferenceStore();
	}


when the context is a IProject, this method creates a ScopedPreferenceStore using the passed IProject as one of the scopes. I think the problem is, the created ScopedPreferenceStore is never returned, instead, this method always returns the one from getWritablePreferenceStore().


Reproducible: Always

Steps to Reproduce:
This is my use case. I have a Xtext-based editor that has preference pages at the project level. Every time I save preferences for one project, the rest of projects in the same workspace get such preferences as well.

Reference: http://www.eclipse.org/forums/index.php/m/677591/#msg_677591
Comment 1 Sebastian Zarnekow CLA 2011-06-16 14:48:34 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 18:04:18 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 18:14:21 EDT
Closing all bugs that were set to RESOLVED before Neon.0