diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java index e692d867a8b..a610e13c7fd 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java @@ -1104,7 +1104,10 @@ public class BuildDescriptionModelTests extends TestCase { //in this the build system is initiating the core settings update (ICProjectDescription cache refresh) //the refresh is scheduled as a job, so in case we do not wait here the job may not be completed by the time //the test is run - + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + } CCorePlugin.getIndexManager().joinIndexer(-1, new NullProgressMonitor()); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java index 511836a45da..7f1d872740a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java @@ -336,7 +336,11 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen project.delete(false, true, new NullProgressMonitor()); project = root.getProject(projectName); + assertFalse(project.exists()); + assertFalse(project.isOpen()); des = coreModel.getProjectDescription(project); + assertFalse(project.exists()); + assertFalse(project.isOpen()); assertNull("project description is not null for removed project", des); project = createProject(projectName); @@ -376,6 +380,8 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen project.delete(false, true, new NullProgressMonitor()); project = root.getProject(projectName); + assertFalse(project.exists()); + assertFalse(project.isOpen()); des = coreModel.getProjectDescription(project); assertNull("project description is not null for removed project", des); diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/BackwardCompatibilityTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/BackwardCompatibilityTests.java index b1ee8bece1d..10df00b8052 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/BackwardCompatibilityTests.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/settings/model/BackwardCompatibilityTests.java @@ -10,6 +10,12 @@ *******************************************************************************/ package org.eclipse.cdt.core.settings.model; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import junit.framework.TestSuite; import org.eclipse.cdt.core.dom.IPDOMManager; @@ -20,11 +26,12 @@ import org.eclipse.cdt.core.testplugin.CProjectHelper; import org.eclipse.cdt.core.testplugin.util.BaseTestCase; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; public class BackwardCompatibilityTests extends BaseTestCase { private static final String PROJ_NAME_PREFIX = "BackwardCompatibilityTests_"; - ICProject p1; + ICProject p1, p2; public static TestSuite suite() { return suite(BackwardCompatibilityTests.class, "_"); @@ -54,7 +61,6 @@ public class BackwardCompatibilityTests extends BaseTestCase { CoreModel.newSourceEntry(project.getFullPath()), CoreModel.newOutputEntry(project.getFullPath()), }; - assertEquals(expectedRawEntries.length, entries.length); checkEntriesMatch(expectedRawEntries, entries); IPathEntry[] expectedResolvedEntries = new IPathEntry[]{ @@ -67,7 +73,6 @@ public class BackwardCompatibilityTests extends BaseTestCase { CoreModel.newIncludeEntry(project.getFullPath(), project.getFullPath().makeRelative(), new Path("g/h/i")), CoreModel.newIncludeEntry(project.getFullPath(), new Path("j"), new Path("k/l")), }; - assertEquals(expectedResolvedEntries.length, resolvedentries.length); checkEntriesMatch(expectedResolvedEntries, resolvedentries); IPathEntry[] newEntries = new IPathEntry[entries.length + 1]; @@ -81,7 +86,6 @@ public class BackwardCompatibilityTests extends BaseTestCase { CoreModel.setRawPathEntries(p1, newEntries, null); entries = CoreModel.getRawPathEntries(p1); - assertEquals(newExpectedRawEntries.length, entries.length); checkEntriesMatch(entries, newExpectedRawEntries); IPathEntry[] newExpectedResolved = new IPathEntry[resolvedentries.length + 1]; @@ -89,9 +93,125 @@ public class BackwardCompatibilityTests extends BaseTestCase { newExpectedResolved[resolvedentries.length] = CoreModel.newIncludeEntry(project.getFullPath().append("d"), null, new Path("/C/d/e"), true, new Path[]{new Path("a"), new Path("b")}, false); resolvedentries = CoreModel.getResolvedPathEntries(p1); checkEntriesMatch(resolvedentries, newExpectedResolved); + + entries = concatEntries(entries, new IPathEntry[]{ + CoreModel.newSourceEntry(project.getFullPath().append("test_src")), + CoreModel.newOutputEntry(project.getFullPath().append("test_out")),}); + + newExpectedRawEntries = concatEntries(newExpectedRawEntries, new IPathEntry[]{ + CoreModel.newSourceEntry(project.getFullPath().append("test_src")), + CoreModel.newOutputEntry(project.getFullPath().append("test_out")),}); + + for(int i = 0; i < newExpectedRawEntries.length; i++){ + IPathEntry entry = newExpectedRawEntries[i]; + if(entry.getEntryKind() == IPathEntry.CDT_SOURCE && entry.getPath().equals(project.getFullPath())){ + newExpectedRawEntries[i] = CoreModel.newSourceEntry(project.getFullPath(), new Path[]{new Path("test_src")}); + } +// if(entry.getEntryKind() == IPathEntry.CDT_OUTPUT && entry.getPath().equals(project.getFullPath())){ +// newExpectedRawEntries[i] = CoreModel.newOutputEntry(project.getFullPath(), new Path[]{new Path("test_out")}); +// } + } + + newExpectedResolved = concatEntries(newExpectedResolved, new IPathEntry[]{ + CoreModel.newSourceEntry(project.getFullPath().append("test_src")), + CoreModel.newOutputEntry(project.getFullPath().append("test_out")),}); + + for(int i = 0; i < newExpectedResolved.length; i++){ + IPathEntry entry = newExpectedResolved[i]; + if(entry.getEntryKind() == IPathEntry.CDT_SOURCE && entry.getPath().equals(project.getFullPath())){ + newExpectedResolved[i] = CoreModel.newSourceEntry(project.getFullPath(), new Path[]{new Path("test_src")}); + } +// if(entry.getEntryKind() == IPathEntry.CDT_OUTPUT && entry.getPath().equals(project.getFullPath())){ +// newExpectedResolved[i] = CoreModel.newOutputEntry(project.getFullPath(), new Path[]{new Path("test_out")}); +// } + } + + CoreModel.setRawPathEntries(p1, entries, null); + + entries = CoreModel.getRawPathEntries(p1); + resolvedentries = CoreModel.getResolvedPathEntries(p1); + + checkEntriesMatch(newExpectedRawEntries, entries); + checkEntriesMatch(newExpectedResolved, resolvedentries); + + CoreModel.setRawPathEntries(p1, expectedRawEntries, null); + entries = CoreModel.getRawPathEntries(p1); + resolvedentries = CoreModel.getResolvedPathEntries(p1); + + checkEntriesMatch(expectedRawEntries, entries); + checkEntriesMatch(expectedResolvedEntries, resolvedentries); + + //check to see that setting the same entries do not give errors + CoreModel.setRawPathEntries(p1, expectedRawEntries, null); + entries = CoreModel.getRawPathEntries(p1); + resolvedentries = CoreModel.getResolvedPathEntries(p1); + + checkEntriesMatch(expectedRawEntries, entries); + checkEntriesMatch(expectedResolvedEntries, resolvedentries); } - private void checkEntriesMatch(IPathEntry[] e1, IPathEntry[] e2){ + public void testCPathEntriesForOldStyle() throws Exception { + p2 = CProjectHelper.createCCProject(PROJ_NAME_PREFIX + "b", null, IPDOMManager.ID_NO_INDEXER); + ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); + IProject project = p2.getProject(); + ICProjectDescription des = mngr.getProjectDescription(project, false); + assertNotNull(des); + assertEquals(1, des.getConfigurations().length); + assertFalse(mngr.isNewStyleProject(des)); + assertFalse(mngr.isNewStyleProject(project)); + + IPathEntry[] entries = CoreModel.getRawPathEntries(p2); + entries = concatEntries(entries, new IPathEntry[]{ + CoreModel.newSourceEntry(project.getFullPath().append("test_src")), + CoreModel.newOutputEntry(project.getFullPath().append("test_out")),}); + + CoreModel.setRawPathEntries(p2, entries, null); + + ICSourceEntry[] expectedSourceEntries = new ICSourceEntry[]{ + new CSourceEntry(project.getFullPath(), new IPath[] {new Path("test_src")}, ICSettingEntry.RESOLVED), + new CSourceEntry(project.getFullPath().append("test_src"), null, ICSettingEntry.RESOLVED), + }; + + ICOutputEntry[] expectedOutputEntries = new ICOutputEntry[]{ + new COutputEntry(project.getFullPath(), null, ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH), + new COutputEntry(project.getFullPath().append("test_out"), null, ICSettingEntry.RESOLVED | ICSettingEntry.VALUE_WORKSPACE_PATH), + }; + + des = mngr.getProjectDescription(project, false); + ICConfigurationDescription cfg = des.getDefaultSettingConfiguration(); + ICSourceEntry[] sEntries = cfg.getSourceEntries(); + ICOutputEntry[] oEntries = cfg.getBuildSetting().getOutputDirectories(); + + checkCEntriesMatch(expectedSourceEntries, sEntries); + checkCEntriesMatch(expectedOutputEntries, oEntries); + + des = mngr.getProjectDescription(project, true); + cfg = des.getDefaultSettingConfiguration(); + sEntries = cfg.getSourceEntries(); + oEntries = cfg.getBuildSetting().getOutputDirectories(); + + checkCEntriesMatch(expectedSourceEntries, sEntries); + checkCEntriesMatch(expectedOutputEntries, oEntries); + } + + public static IPathEntry[] concatEntries(IPathEntry[] entries1, IPathEntry[] entries2){ + List list = new ArrayList(entries1.length + entries2.length); + list.addAll(Arrays.asList(entries1)); + list.addAll(Arrays.asList(entries2)); + return (IPathEntry[])list.toArray(new IPathEntry[list.size()]); + } + + public static void checkCEntriesMatch(ICSettingEntry[] e1, ICSettingEntry[] e2){ + if(e1.length != e2.length) + fail("entries num do not match"); + + Set set = new HashSet(Arrays.asList(e1)); + set.removeAll(Arrays.asList(e2)); + if(set.size() != 0) + fail("entries do not match"); + } + + public static void checkEntriesMatch(IPathEntry[] e1, IPathEntry[] e2){ if(e1.length != e2.length) fail("entries arrays have different length \ne1: " + dumpArray(e1) +"\ne2:" + dumpArray(e2) + "\n"); @@ -110,7 +230,7 @@ public class BackwardCompatibilityTests extends BaseTestCase { } } - private String dumpArray(Object array[]){ + public static String dumpArray(Object array[]){ if(array == null) return "null"; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/extension/impl/CDataFacroty.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/extension/impl/CDataFacroty.java index 0f1ec27d2b1..eb96979b311 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/extension/impl/CDataFacroty.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/extension/impl/CDataFacroty.java @@ -128,6 +128,8 @@ public class CDataFacroty { } public void setModified(CDataObject data, boolean modified){ + if(data == null) + return; switch (data.getType()) { case ICSettingBase.SETTING_CONFIGURATION: ((CDefaultConfigurationData)data).setModified(modified); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java index d5631d80258..c9e9a1455ba 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/CDataUtil.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.core.settings.model.util; +import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -758,7 +759,7 @@ public class CDataUtil { return adjustEntries(entries, false, null); } - private static ICSourceEntry[] getDefaultEntries(boolean absolute, IProject project){ + private static ICSourceEntry[] getDefaultSourceEntries(boolean absolute, IProject project){ ICSourceEntry entry; if(absolute){ if(project != null) @@ -770,10 +771,30 @@ public class CDataUtil { } return new ICSourceEntry[]{entry}; } + + private static ICOutputEntry[] getDefaultOutputEntries(boolean absolute, IProject project){ + ICOutputEntry entry; + if(absolute){ + if(project != null) + entry = new COutputEntry(project.getFullPath(), null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED); + else + entry = new COutputEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED); + } else { + entry = new COutputEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED); + } + return new ICOutputEntry[]{entry}; + } + + public static ICOutputEntry[] adjustEntries(ICOutputEntry entries[], boolean makeAbsolute, IProject project){ + if(entries == null || entries.length == 0) + return getDefaultOutputEntries(makeAbsolute, project); + + return makeAbsolute ? checkMakeAbsolute(project, entries) : checkMakeRelative(project, entries); + } public static ICSourceEntry[] adjustEntries(ICSourceEntry entries[], boolean makeAbsolute, IProject project){ - if(entries == null) - return getDefaultEntries(makeAbsolute, project); + if(entries == null || entries.length == 0) + return getDefaultSourceEntries(makeAbsolute, project); ICSourceEntry ei, ej; LinkedHashMap map = new LinkedHashMap(); @@ -837,31 +858,35 @@ public class CDataUtil { } public static ICSourceEntry makeAbsolute(IProject project, ICSourceEntry entry){ - if(project == null) - return entry; - - IPath path = new Path(entry.getName()); - if(path.isAbsolute()) - return entry; - - path = project.getFullPath().append(path); - - return new CSourceEntry(path, entry.getExclusionPatterns(), entry.getFlags()); + return (ICSourceEntry)makeAbsolute(project, entry, true); } public static ICSourceEntry makeRelative(IProject project, ICSourceEntry entry){ - IPath path = new Path(entry.getName()); - if(!path.isAbsolute()) - return entry; - -// if(project != null){ -// -// IPath projPath = project.getFullPath(); -// -// } -// if(pro) - - return new CSourceEntry(path.removeFirstSegments(1).makeRelative(), entry.getExclusionPatterns(), entry.getFlags()); + return (ICSourceEntry)makeRelative(project, entry, true); + } + + public static ICSourceEntry[] makeRelative(IProject project, ICSourceEntry[] entries){ + return (ICSourceEntry[])makeRelative(project, entries, true); + } + + public static ICSourceEntry[] makeAbsolute(IProject project, ICSourceEntry[] entries){ + return (ICSourceEntry[])makeAbsolute(project, entries, true); + } + + public static ICOutputEntry checkMakeAbsolute(IProject project, ICOutputEntry entry){ + return (ICOutputEntry)makeAbsolute(project, entry, false); + } + + public static ICOutputEntry checkMakeRelative(IProject project, ICOutputEntry entry){ + return (ICOutputEntry)makeRelative(project, entry, false); + } + + public static ICOutputEntry[] checkMakeAbsolute(IProject project, ICOutputEntry[] entries){ + return (ICOutputEntry[])makeAbsolute(project, entries, false); + } + + public static ICOutputEntry[] checkMakeRelative(IProject project, ICOutputEntry[] entries){ + return (ICOutputEntry[])makeRelative(project, entries, false); } private static Collection removePrefix(IPath prefix, Collection paths, Collection result){ @@ -984,4 +1009,56 @@ public class CDataUtil { set.removeAll(Arrays.asList(o2)); return set; } + + public static ICExclusionPatternPathEntry makeAbsolute(IProject project, ICExclusionPatternPathEntry entry, boolean force){ + if(!entry.isValueWorkspacePath() && !force) + return entry; + + IPath path = new Path(entry.getName()); + IPath projPath = project.getFullPath(); + if(!path.isAbsolute() || (force && !projPath.isPrefixOf(path))){ + path = projPath.append(path).makeAbsolute(); + return (ICExclusionPatternPathEntry)CDataUtil.createEntry(entry.getKind(), path.toString(), null, entry.getExclusionPatterns(), entry.getFlags()); + } + return entry; + } + + public static ICExclusionPatternPathEntry makeRelative(IProject project, ICExclusionPatternPathEntry entry, boolean force){ + if(!entry.isValueWorkspacePath() && !force) + return entry; + + IPath path = new Path(entry.getName()); + IPath projPath = project.getFullPath(); + + if(path.isAbsolute()){ + if(projPath.isPrefixOf(path)) + path = path.removeFirstSegments(projPath.segmentCount()).makeRelative(); + else if (force) + path = path.makeRelative(); + return (ICExclusionPatternPathEntry)CDataUtil.createEntry(entry.getKind(), entry.getName(), entry.getValue(), entry.getExclusionPatterns(), entry.getFlags()); + } + return entry; + } + + public static ICExclusionPatternPathEntry[] makeRelative(IProject project, ICExclusionPatternPathEntry[] entries, boolean force){ + if(entries == null) + return null; + + ICExclusionPatternPathEntry[] relEntries = (ICExclusionPatternPathEntry[])Array.newInstance(entries.getClass().getComponentType(), entries.length); + for(int i = 0; i < entries.length; i++){ + relEntries[i] = makeRelative(project, entries[i], force); + } + return relEntries; + } + + public static ICExclusionPatternPathEntry[] makeAbsolute(IProject project, ICExclusionPatternPathEntry[] entries, boolean force){ + if(entries == null) + return null; + + ICExclusionPatternPathEntry[] relEntries = (ICExclusionPatternPathEntry[])Array.newInstance(entries.getClass().getComponentType(), entries.length); + for(int i = 0; i < entries.length; i++){ + relEntries[i] = makeAbsolute(project, entries[i], force); + } + return relEntries; + } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java index 2ea41ae36ec..b4032d22e7b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/PathEntryTranslator.java @@ -35,6 +35,7 @@ import org.eclipse.cdt.core.model.IIncludeFileEntry; import org.eclipse.cdt.core.model.ILibraryEntry; import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IMacroFileEntry; +import org.eclipse.cdt.core.model.IOutputEntry; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.core.model.ISourceEntry; import org.eclipse.cdt.core.resources.IPathEntryVariableManager; @@ -44,6 +45,7 @@ import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.CLibraryFileEntry; import org.eclipse.cdt.core.settings.model.CMacroEntry; import org.eclipse.cdt.core.settings.model.CMacroFileEntry; +import org.eclipse.cdt.core.settings.model.COutputEntry; import org.eclipse.cdt.core.settings.model.CSourceEntry; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICExclusionPatternPathEntry; @@ -969,12 +971,13 @@ public class PathEntryTranslator { // fCfg = cfg; fProject = project; } - + public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){ Map map = getEntriesMap(kind, true); Map nameKeyMap = getEntriesNameKeyMap(kind, true); for(int i = 0; i < entries.length; i++){ ICExclusionPatternPathEntry entry = entries[i]; + entry = CDataUtil.makeAbsolute(fProject, entry, kind == ICSettingEntry.SOURCE_PATH); EntryNameKey nameKey = new EntryNameKey(entry); PathEntryComposer old = (PathEntryComposer)nameKeyMap.get(nameKey); if(old != null){ @@ -1510,6 +1513,7 @@ public class PathEntryTranslator { List projList = new ArrayList(); List exportSettingsList = new ArrayList(); ICSourceEntry srcEntries[] = null; + ICOutputEntry outEntries[] = null; // PathSettingsContainer child; ResolvedEntry rEntry; IPath projPath; @@ -1525,7 +1529,7 @@ public class PathEntryTranslator { srcList.add(rEntry.fEntry); break; case IPathEntry.CDT_OUTPUT: - outList.add(rEntry); + outList.add(rEntry.fEntry); break; case IPathEntry.CDT_PROJECT: projList.add(rEntry); @@ -1551,6 +1555,11 @@ public class PathEntryTranslator { if(srcList.size() != 0){ srcEntries = toCSourceEntries(srcList); } else { +// srcPaths = new IPath[]{new Path("")}; //$NON-NLS-1$ + } + if(outList.size() != 0){ + outEntries = toCOutputEntries(outList); + } else { // srcPaths = new IPath[]{new Path("")}; //$NON-NLS-1$ } @@ -1575,6 +1584,7 @@ public class PathEntryTranslator { //applying settings //applySourcePaths(srcPaths, op); + applyOutputEntries(outEntries, op); applySourceEntries(srcEntries, op); applyLangSettings(cr, op); @@ -1611,6 +1621,15 @@ public class PathEntryTranslator { return entries; } + private static ICOutputEntry[] toCOutputEntries(List list){ + ICOutputEntry[] entries = new ICOutputEntry[list.size()]; + for(int i = 0; i < entries.length; i++){ + entries[i] = toCOutputEntry((IOutputEntry)list.get(i), true); + } + return entries; + } + + private static ICSourceEntry toCSourceEntry(ISourceEntry entry, boolean makeProjRelative){ IPath path = entry.getPath(); if(makeProjRelative && path.isAbsolute()) @@ -1621,6 +1640,16 @@ public class PathEntryTranslator { | ICSourceEntry.RESOLVED); } + private static ICOutputEntry toCOutputEntry(IOutputEntry entry, boolean makeProjRelative){ + IPath path = entry.getPath(); + if(makeProjRelative && path.isAbsolute()) + path = path.removeFirstSegments(1); + return new COutputEntry(path, + entry.getExclusionPatterns(), + ICSettingEntry.VALUE_WORKSPACE_PATH + | ICSourceEntry.RESOLVED); + } + private static ICSettingEntry[] replaceUserEntries(ICSettingEntry[] oldEntries, ICSettingEntry[] newUsrEntries){ Set set = new LinkedHashSet(); Class componentType = null; @@ -1655,23 +1684,23 @@ public class PathEntryTranslator { private void applySourceEntries(ICSourceEntry entries[], int op){ ICSourceEntry[] oldEntries = fCfgData.getSourceEntries(); + oldEntries = (ICSourceEntry[])CDataUtil.makeRelative(fProject, oldEntries, true); + entries = (ICSourceEntry[])CDataUtil.makeRelative(fProject, entries, true); entries = (ICSourceEntry[])replaceUserEntries(oldEntries, entries); switch (op) { case OP_ADD: if(entries != null && entries.length != 0){ - ICSourceEntry curEntries[] = fCfgData.getSourceEntries(); Set set = new LinkedHashSet(); - set.addAll(Arrays.asList(curEntries)); + set.addAll(Arrays.asList(oldEntries)); set.addAll(Arrays.asList(entries)); fCfgData.setSourceEntries((ICSourceEntry[])set.toArray(new ICSourceEntry[set.size()])); } break; case OP_REMOVE: if(entries != null && entries.length != 0){ - ICSourceEntry curEntries[] = fCfgData.getSourceEntries(); Set set = new HashSet(); - set.addAll(Arrays.asList(curEntries)); + set.addAll(Arrays.asList(oldEntries)); set.removeAll(Arrays.asList(entries)); fCfgData.setSourceEntries((ICSourceEntry[])set.toArray(new ICSourceEntry[set.size()])); } @@ -1687,6 +1716,46 @@ public class PathEntryTranslator { } } + private void applyOutputEntries(ICOutputEntry entries[], int op){ + CBuildData bData = fCfgData.getBuildData(); + if(bData == null){ + CCorePlugin.log("PathEntryTranslator: failed to apply output entries: Build Data is null, ignoring.."); + return; + } + + ICOutputEntry[] oldEntries = bData.getOutputDirectories(); + oldEntries = (ICOutputEntry[])CDataUtil.makeRelative(fProject, oldEntries, false); + entries = (ICOutputEntry[])CDataUtil.makeRelative(fProject, entries, false); + entries = (ICOutputEntry[])replaceUserEntries(oldEntries, entries); + + switch (op) { + case OP_ADD: + if(entries != null && entries.length != 0){ + Set set = new LinkedHashSet(); + set.addAll(Arrays.asList(oldEntries)); + set.addAll(Arrays.asList(entries)); + bData.setOutputDirectories((ICOutputEntry[])set.toArray(new ICOutputEntry[set.size()])); + } + break; + case OP_REMOVE: + if(entries != null && entries.length != 0){ + Set set = new HashSet(); + set.addAll(Arrays.asList(oldEntries)); + set.removeAll(Arrays.asList(entries)); + bData.setOutputDirectories((ICOutputEntry[])set.toArray(new ICOutputEntry[set.size()])); + } + break; + case OP_REPLACE: + default: + if(entries != null){ + bData.setOutputDirectories(entries); + } else { + bData.setOutputDirectories(new ICOutputEntry[0]); + } + break; + } + } + private void applyLangSettings(PathSettingsContainer cr, int op){ PathSettingsContainer crs[] = cr.getChildren(true); for(int i = 0; i < crs.length; i++){ @@ -2492,7 +2561,4 @@ public class PathEntryTranslator { PathEntryCollector cr = collectEntries(project, cfg); return cr.getEntries(flags, cfg); } -// -// private - } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ThreadLocalMap.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ThreadLocalMap.java new file mode 100644 index 00000000000..d72385d2b58 --- /dev/null +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ThreadLocalMap.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2007 Intel Corporation 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Intel Corporation - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.core.settings.model.util; + +import java.util.HashMap; +import java.util.Map; + +public class ThreadLocalMap { + private ThreadLocal fLocal = new ThreadLocal(); + + public Object get(Object key){ + Map map = getMap(false); + return map != null ? map.get(key) : null; + } + + public void set(Object key, Object value){ + if(value == null) + clear(key); + else { + Map map = getMap(true); + map.put(key, value); + } + } + + public void clear(Object key){ + Map map = getMap(false); + if(map != null){ + map.remove(key); + if(map == null) + fLocal.set(null); + } + } + + private Map getMap(boolean create){ + Map map = (Map)fLocal.get(); + if(map == null && create){ + map = new HashMap(); + fLocal.set(map); + } + return map; + } +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java index ca3b1a32fc8..423daf47691 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java @@ -53,6 +53,7 @@ import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.settings.model.util.PathEntryResolveInfo; import org.eclipse.cdt.core.settings.model.util.PathEntryResolveInfoElement; +import org.eclipse.cdt.core.settings.model.util.ThreadLocalMap; import org.eclipse.cdt.internal.core.settings.model.AbstractCExtensionProxy; import org.eclipse.cdt.internal.core.settings.model.ConfigBasedPathEntryStore; import org.eclipse.core.resources.IMarker; @@ -112,6 +113,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange // Synchronized the access of the cache entries. protected Map resolvedMap = new Hashtable(); private Map resolvedInfoMap = new Hashtable(); + private ThreadLocalMap resolveInfoValidState = new ThreadLocalMap(); // Accessing the map is synch with the class private Map storeMap = new HashMap(); @@ -415,10 +417,23 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange if(info == null){ getResolvedPathEntries(cproject); info = (PathEntryResolveInfo)resolvedInfoMap.get(cproject); + } else if(!getResolveInfoValidState(cproject)){ + Object[] resolved = getResolvedPathEntries(cproject, false, false); + if(resolved != null) + info = (PathEntryResolveInfo)resolved[1]; } return info; } - + + private void setResolveInfoValidState(ICProject cproject, boolean valid){ + Object v = valid ? null : Boolean.FALSE; + resolveInfoValidState.set(cproject, v); + } + + private boolean getResolveInfoValidState(ICProject cproject){ + return resolveInfoValidState.get(cproject) == null; + } + protected IPathEntry[] removeCachedResolvedPathEntries(ICProject cproject) { ArrayList resolvedListEntries = (ArrayList)resolvedMap.remove(cproject); resolvedInfoMap.remove(cproject); @@ -485,7 +500,19 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange * @throws CModelException */ private ArrayList getResolvedPathEntries(ICProject cproject, boolean generateMarkers) throws CModelException { - ArrayList resolvedEntries = (ArrayList)resolvedMap.get(cproject); + Object[] result = getResolvedPathEntries(cproject, generateMarkers, true); + if(result != null) + return (ArrayList)result[0]; + return null; + } + + private Object[] getResolvedPathEntries(ICProject cproject, boolean generateMarkers, boolean useCache) throws CModelException { + ArrayList resolvedEntries = null; + PathEntryResolveInfo rInfo = null; + if(useCache){ + resolvedEntries = (ArrayList)resolvedMap.get(cproject); + rInfo = (PathEntryResolveInfo)resolvedInfoMap.get(cproject); + } if (resolvedEntries == null) { List resolveInfoList = new ArrayList(); IPath projectPath = cproject.getPath(); @@ -561,10 +588,13 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange resolvedEntries.removeAll(dups); } - resolvedMap.put(cproject, resolvedEntries); - resolvedInfoMap.put(cproject, new PathEntryResolveInfo(resolveInfoList)); + rInfo = new PathEntryResolveInfo(resolveInfoList); + if(useCache){ + resolvedMap.put(cproject, resolvedEntries); + resolvedInfoMap.put(cproject, rInfo); + } } - return resolvedEntries; + return new Object[]{resolvedEntries, rInfo}; } public void setRawPathEntries(ICProject cproject, IPathEntry[] newEntries, IProgressMonitor monitor) throws CModelException { @@ -944,7 +974,9 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange list.toArray(newRawEntries); IProject project = cproject.getProject(); IPathEntryStore store = getPathEntryStore(project, true); + setResolveInfoValidState(cproject, false); store.setRawPathEntries(newRawEntries); + setResolveInfoValidState(cproject, true); } catch (CoreException e) { throw new CModelException(e); } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSetting.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSetting.java index a2184ca20d2..0ad7c081b38 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSetting.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSetting.java @@ -16,6 +16,7 @@ import org.eclipse.cdt.core.settings.model.ICOutputEntry; import org.eclipse.cdt.core.settings.model.ICSettingBase; import org.eclipse.cdt.core.settings.model.extension.CBuildData; import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; public class CBuildSetting extends CDataProxy implements ICBuildSetting { @@ -40,7 +41,10 @@ public class CBuildSetting extends CDataProxy implements ICBuildSetting { public ICOutputEntry[] getOutputDirectories() { CBuildData data = getBuildData(false); - return data.getOutputDirectories(); + ICOutputEntry[] entries = data.getOutputDirectories(); + IProject project = getProject(); + entries = CDataUtil.adjustEntries(entries, true, project); + return entries; } public void setBuilderCWD(IPath path) { @@ -55,12 +59,17 @@ public class CBuildSetting extends CDataProxy implements ICBuildSetting { public void setOutputDirectories(ICOutputEntry[] entries) { CBuildData data = getBuildData(true); + IProject project = getProject(); + if(entries != null){ + entries = CDataUtil.adjustEntries(entries, false, project); + } + data.setOutputDirectories(entries); if(entries == null){ CExternalSettingsManager.getInstance().restoreOutputEntryDefaults(getConfiguration()); } } - + public final int getType() { return ICSettingBase.SETTING_BUILD; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSettingCache.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSettingCache.java index 41eef47d4e2..d6363535e6e 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSettingCache.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CBuildSettingCache.java @@ -20,6 +20,7 @@ import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultBuildData; import org.eclipse.cdt.core.settings.model.util.CDataUtil; import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager; import org.eclipse.cdt.utils.envvar.StorableEnvironment; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; public class CBuildSettingCache extends CDefaultBuildData implements @@ -27,6 +28,7 @@ public class CBuildSettingCache extends CDefaultBuildData implements private CConfigurationDescriptionCache fCfgCache; private StorableEnvironment fEnvironment; private StorableEnvironment fResolvedEnvironment; + private ICOutputEntry[] fProjOutputEntries; private ICOutputEntry[] fResolvedOutputEntries; CBuildSettingCache(CBuildData base, CConfigurationDescriptionCache cfgCache){ @@ -97,4 +99,22 @@ public class CBuildSettingCache extends CDefaultBuildData implements return fResolvedOutputEntries; } + public ICOutputEntry[] getOutputDirectories() { + initOutputEntries(); + return (ICOutputEntry[])fProjOutputEntries.clone(); + } + + private void initOutputEntries(){ + if(fProjOutputEntries == null){ + IProject project = getProject(); + fProjOutputEntries = CDataUtil.adjustEntries(fOutputEntries, true, project); + } + } + + private IProject getProject(){ + ICConfigurationDescription cfg = getConfiguration(); + return cfg.isPreferenceConfiguration() ? null : cfg.getProjectDescription().getProject(); + } + + } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java index e4054d1abf3..3e42b8f50dc 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDescription.java @@ -476,130 +476,15 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC public void setSourceEntries(ICSourceEntry[] entries) throws CoreException { CConfigurationData data = getConfigurationData(true); IProject project = fIsPreference ? null : getProjectDescription().getProject(); - boolean restoreDefault = false; - if(entries == null) - restoreDefault = true; - else if(entries.length == 0) - entries = null; - entries = CDataUtil.adjustEntries(entries, false, project); - data.setSourceEntries(entries); + if(entries != null){ + entries = CDataUtil.adjustEntries(entries, false, project); + } - if(restoreDefault){ + data.setSourceEntries(entries); + + if(entries == null){ CExternalSettingsManager.getInstance().restoreSourceEntryDefaults(this); } -// ICSourceEntry entry; -// IPath entryPath; -// IPath paths[]; -// PathSettingsContainer cr = PathSettingsContainer.createRootContainer(); -// cr.setValue(Boolean.valueOf(getRootFolderDescription().isExcluded())); -// Set srcPathSet = new HashSet(); -// IProject project = fIsPreference ? null : getProjectDescription().getProject(); -// IPath projPath = project != null ? project.getFullPath() : null; -//// Map exclusionMap = new HashMap(); -// -//// HashSet pathSet = new HashSet(); -// -// if(entries == null){ -// IPath pasePath = projPath != null ? projPath : Path.EMPTY; -// entries = new ICSourceEntry[]{new CSourceEntry(pasePath, null, ICLanguageSettingEntry.RESOLVED | ICLanguageSettingEntry.VALUE_WORKSPACE_PATH)}; -// } -// -// for(int i = 0 ; i < entries.length; i++){ -// entry = entries[i]; -// entryPath = entry.getFullPath(); -// if(projPath != null){ -// if(projPath.isPrefixOf(entryPath)){ -// entryPath = entryPath.removeFirstSegments(projPath.segmentCount()); -// } else { -// continue; -// } -// } -//// else { -//// if(entryPath.segmentCount() > 0) -//// entryPath = entryPath.removeFirstSegments(1); -//// else -//// continue; -//// } -// if(srcPathSet.add(entryPath)){ -// // exclusionMap.put(entryPath, Boolean.TRUE); -// PathSettingsContainer entryCr = cr.getChildContainer(entryPath, true, true); -// entryCr.setValue(Boolean.TRUE); -// -// -// paths = entry.getExclusionPatterns(); -// -// -// for(int j = 0; j < paths.length; j++){ -// IPath path = paths[j]; -// PathSettingsContainer exclusion = entryCr.getChildContainer(path, true, true); -// if(exclusion.getValue() == null) -// exclusion.setValue(Boolean.FALSE); -// // if(null == exclusionMap.get(path)) -// // exclusionMap.put(path, Boolean.FALSE); -// } -// } -// } -// -// CConfigurationData data = getConfigurationData(true); -// data.setSourcePaths((IPath[])srcPathSet.toArray(new IPath[srcPathSet.size()])); -// ICResourceDescription rcDess[] = getResourceDescriptions(); -// ICResourceDescription rcDes; -// Set pathSet = new HashSet(); -// -// for(int i = 0; i < rcDess.length; i++){ -// rcDes = rcDess[i]; -// IPath path = rcDes.getPath(); -// pathSet.add(path); -//// Boolean b = (Boolean)exclusionMap.remove(path); -// Boolean b = (Boolean)cr.getChildContainer(path, false, false).getValue(); -// assert (b != null); -// if(Boolean.TRUE == b) { -// if(rcDes.isExcluded()) -// rcDes.setExcluded(false); -// } else { -// if(/*(rcDes.getType() == ICSettingBase.SETTING_FILE -// || !((ICFolderDescription)rcDes).isRoot()) -// &&*/ !rcDes.isExcluded()) -// rcDes.setExcluded(true); -// } -// } -// -// PathSettingsContainer crs[] = cr.getChildren(true); -// for(int i= 0; i < crs.length; i++){ -// PathSettingsContainer c = crs[i]; -// IPath path = c.getPath(); -// if(!pathSet.remove(path)){ -// Boolean b = (Boolean)c.getValue(); -// assert (b != null); -// ICResourceDescription base = getResourceDescription(path, false); -// if(b == Boolean.TRUE){ -// if(base.isExcluded()){ -// ICResourceDescription newDes = createResourceDescription(path, base); -// if(newDes == null){ -// ICResourceDescription fo = getResourceDescription(path, false); -// if(fo.getType() == ICSettingBase.SETTING_FILE){ -// fo = getResourceDescription(path.removeLastSegments(1), false); -// } -// newDes = createFolderDescription(path, (ICFolderDescription)fo); -// } -// newDes.setExcluded(false); -// } -// } else { -// if(!base.isExcluded()){ -// ICResourceDescription newDes = createResourceDescription(path, base); -// if(newDes == null){ -// ICResourceDescription fo = getResourceDescription(path, false); -// if(fo.getType() == ICSettingBase.SETTING_FILE){ -// fo = getResourceDescription(path.removeLastSegments(1), false); -// } -// newDes = createFolderDescription(path, (ICFolderDescription)fo); -// } -// newDes.setExcluded(true); -// } -// } -// } -// } -// } // private ICResourceDescription createResourceDescription(IPath path, ICResourceDescription base){ diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CDataProxy.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CDataProxy.java index 6f4c4baaea6..e5f4d5b5b65 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CDataProxy.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CDataProxy.java @@ -11,9 +11,11 @@ package org.eclipse.cdt.internal.core.settings.model; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICSettingContainer; import org.eclipse.cdt.core.settings.model.ICSettingObject; import org.eclipse.cdt.core.settings.model.extension.CDataObject; +import org.eclipse.core.resources.IProject; public abstract class CDataProxy implements ICSettingObject { protected ICDataProxyContainer fParent; @@ -152,4 +154,16 @@ public abstract class CDataProxy implements ICSettingObject { public boolean isReadOnly() { return false; } + + protected IProject getProject(){ + ICConfigurationDescription cfg = getConfiguration(); + if(cfg == null) + return null; + + ICProjectDescription projDes = cfg.getProjectDescription(); + if(projDes == null) + return null; + + return projDes.getProject(); + } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CLanguageSetting.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CLanguageSetting.java index c8b008d2532..7c6e84a8b44 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CLanguageSetting.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CLanguageSetting.java @@ -91,10 +91,6 @@ public class CLanguageSetting extends CDataProxy implements return (getSupportedEntryKinds() & kind) == kind; } - private IProject getProject(){ - return getConfiguration().getProjectDescription().getProject(); - } - /* public String[] getHeaderExtensions() { CLanguageData data = getCLanguageData(false); IContentType type = data.getHeaderContentType(); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java index 6bcaf37ad02..6a324402429 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescription.java @@ -216,6 +216,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon cache.applyData(factory); } catch (CoreException e) { CCorePlugin.log(e); + e.printStackTrace(); iter.remove(); } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java index 5afbbf11618..08884feedc2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java @@ -422,7 +422,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { des = getDescriptionApplying(project); - if(des == null) + if(des == null && project.isOpen()) des = getLoaddedDescription(project); if(des == null) @@ -892,10 +892,15 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { if(!overwriteIfExists && fDescriptionMap.get(project) != null) return false; - if(des != null) - fDescriptionMap.put(project, des); - else + if(des != null){ + if(project.exists() && project.isOpen()){ + fDescriptionMap.put(project, des); + } else { + CCorePlugin.log("attempt to set description for the non-openned project"); + } + }else { fDescriptionMap.remove(project); + } return true; //// try { @@ -2527,7 +2532,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager { // } ICConfigurationDescription oldIndexCfg = oldDes.getDefaultSettingConfiguration(); ICDescriptionDelta indexDelta; - if(oldIndexCfg.getId().equals(indexCfg.getId())){ + if(oldIndexCfg != null && oldIndexCfg.getId().equals(indexCfg.getId())){ indexDelta = findDelta(indexCfg.getId(), projDesDelta); } else { indexDelta = createDelta(indexCfg, oldIndexCfg); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java index 2852e4fe125..5387f3c685b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/PathEntryConfigurationDataProvider.java @@ -235,9 +235,13 @@ public class PathEntryConfigurationDataProvider extends IProgressMonitor monitor) throws CoreException { //TODO: check external/reference info here as well. - if(!fFactory.isModified(base)) + if(!fFactory.isModified(base)){ + try { + return createData(des); + } catch (Exception e){ + } return base; - + } IProject project = des.getProjectDescription().getProject(); @@ -250,7 +254,7 @@ public class PathEntryConfigurationDataProvider extends List list = new ArrayList(); list.addAll(Arrays.asList(entries)); for(int i = 0; i < curRawEntries.length; i++){ - if(curRawEntries[i].getEntryKind() == IPathEntry.CDT_CONTAINER){ + if(curRawEntries[i].getEntryKind() != IPathEntry.CDT_CONTAINER){ list.add(curRawEntries[i]); } }