mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Workaround for platform bug 206343, project preferences marked dirty on project import.
This commit is contained in:
parent
4c6457c39d
commit
29eafddce0
4 changed files with 7 additions and 20 deletions
|
@ -423,7 +423,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
public void setIndexerId(final ICProject project, String indexerId) {
|
||||
IProject prj= project.getProject();
|
||||
IndexerPreferences.set(prj, IndexerPreferences.KEY_INDEXER_ID, indexerId);
|
||||
CCoreInternals.savePreferences(prj);
|
||||
CCoreInternals.savePreferences(prj, IndexerPreferences.getScope(prj) == IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
}
|
||||
|
||||
protected void onPreferenceChange(ICProject cproject, PreferenceChangeEvent event) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -81,7 +80,7 @@ public class IndexerPreferences {
|
|||
if (get(project, scope, KEY_INDEXER_ID, null) == null) {
|
||||
scope= SCOPE_INSTANCE;
|
||||
ppp.putInt(KEY_INDEXER_PREFS_SCOPE, scope);
|
||||
CCoreInternals.savePreferences(project);
|
||||
CCoreInternals.savePreferences(project, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,20 +231,8 @@ public class IndexerPreferences {
|
|||
if (prjPrefs.get(KEY_INDEXER_ID, null) != null) {
|
||||
scope= SCOPE_PROJECT_SHARED;
|
||||
}
|
||||
else {
|
||||
Preferences oldStyle= prjPrefs.parent();
|
||||
String id= oldStyle.get(KEY_INDEXER_ID, null);
|
||||
if (id != null) {
|
||||
prjPrefs.put(KEY_INDEXER_ID, id);
|
||||
String value= oldStyle.get(KEY_INDEX_ALL_FILES, null);
|
||||
if (value != null) {
|
||||
prjPrefs.put(KEY_INDEX_ALL_FILES, value);
|
||||
}
|
||||
scope= SCOPE_PROJECT_SHARED;
|
||||
}
|
||||
}
|
||||
getLocalPreferences(project).putInt(KEY_INDEXER_PREFS_SCOPE, scope);
|
||||
CCoreInternals.savePreferences(project);
|
||||
CCoreInternals.savePreferences(project, false);
|
||||
return scope;
|
||||
}
|
||||
|
||||
|
@ -378,7 +365,7 @@ public class IndexerPreferences {
|
|||
public static void setIndexImportLocation(IProject project, String location) {
|
||||
if (!location.equals(getIndexImportLocation(project))) {
|
||||
getProjectPreferences(project).put(KEY_INDEX_IMPORT_LOCATION, location);
|
||||
CCoreInternals.savePreferences(project);
|
||||
CCoreInternals.savePreferences(project, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ public class CCoreInternals {
|
|||
* @param project the project for which to save preferences, may be <code>null</code>
|
||||
* @since 4.0
|
||||
*/
|
||||
public static void savePreferences(final IProject project) {
|
||||
public static void savePreferences(final IProject project, final boolean saveSharedPrefs) {
|
||||
Job job= new Job(CCorePlugin.getResourceString("CCoreInternals.savePreferencesJob")) { //$NON-NLS-1$
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
if (project != null) {
|
||||
new LocalProjectScope(project).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
if (project.isOpen()) {
|
||||
if (saveSharedPrefs && project.isOpen()) {
|
||||
new ProjectScope(project).getNode(CCorePlugin.PLUGIN_ID).flush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
}
|
||||
prjDescMgr.setProjectDescription(getProject(), prefs);
|
||||
}
|
||||
CCoreInternals.savePreferences(project);
|
||||
CCoreInternals.savePreferences(project, scope == IndexerPreferences.SCOPE_PROJECT_SHARED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue