mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Merge remote-tracking branch 'origin/master' into bug_299911
This commit is contained in:
commit
2ea54ef291
15 changed files with 442 additions and 527 deletions
|
@ -417,8 +417,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
{
|
||||||
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice());
|
CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getName(), entry.getName());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
|
@ -469,46 +468,45 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file5, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file5, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file6, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file6, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file7, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file7, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file8, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file8, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file9, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file9, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file10, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file10, languageId);
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,40 +547,18 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
CIncludePathEntry expected = new CIncludePathEntry("/path0", 0);
|
||||||
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice());
|
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
assertEquals(expected.getName(), entry.getName());
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getKind(), entry.getKind());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getFlags(), entry.getFlags());
|
||||||
assertEquals(expected.getKind(), entry.getKind());
|
assertEquals(expected, entry);
|
||||||
assertEquals(expected.getFlags(), entry.getFlags());
|
|
||||||
assertEquals(expected, entry);
|
assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
|
||||||
}
|
assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
|
||||||
{
|
assertEquals(new CIncludePathEntry("/path with spaces2", 0), entries.get(3));
|
||||||
IPath path = new Path("/path1").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/path with spaces3", 0), entries.get(4));
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(1);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/path with spaces").setDevice(project.getLocation().getDevice());
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(2);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/path with spaces2").setDevice(project.getLocation().getDevice());
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(3);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/path with spaces3").setDevice(project.getLocation().getDevice());
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path, 0);
|
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(4);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -616,18 +592,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry("/Framework", ICSettingEntry.FRAMEWORKS_MAC), entries.get(0));
|
||||||
IPath path = new Path("/Framework").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/framework/system", ICSettingEntry.FRAMEWORKS_MAC), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(0));
|
assertEquals(new CIncludePathEntry("/Framework with spaces", ICSettingEntry.FRAMEWORKS_MAC), entries.get(2));
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/framework/system").setDevice(project.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/Framework with spaces").setDevice(project.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -663,50 +630,21 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
CMacroEntry expected = new CMacroEntry("MACRO0", "", 0);
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO0", "", 0);
|
CMacroEntry entry = (CMacroEntry)entries.get(0);
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(0);
|
assertEquals(expected.getName(), entry.getName());
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getKind(), entry.getKind());
|
||||||
assertEquals(expected.getKind(), entry.getKind());
|
assertEquals(expected.getFlags(), entry.getFlags());
|
||||||
assertEquals(expected.getFlags(), entry.getFlags());
|
assertEquals(expected, entry);
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(1));
|
||||||
{
|
assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(2));
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO1", "value", 0);
|
assertEquals(new CMacroEntry("MACRO3", "value with spaces", 0), entries.get(3));
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(1);
|
assertEquals(new CMacroEntry("MACRO4", "\"quoted value\"", 0), entries.get(4));
|
||||||
assertEquals(expected, entry);
|
assertEquals(new CMacroEntry("MACRO5", "\"quoted value\"", 0), entries.get(5));
|
||||||
}
|
assertEquals(new CMacroEntry("MACRO6", "\"escape-quoted value\"", 0), entries.get(6));
|
||||||
{
|
assertEquals(new CMacroEntry("MACRO7", "'single-quoted value'", 0), entries.get(7));
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO2", "value with spaces", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(2);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO3", "value with spaces", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(3);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO4", "\"quoted value\"", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(4);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO5", "\"quoted value\"", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(5);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO6", "\"escape-quoted value\"", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(6);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
CMacroEntry expected = new CMacroEntry("MACRO7", "'single-quoted value'", 0);
|
|
||||||
CMacroEntry entry = (CMacroEntry)entries.get(7);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -735,9 +673,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.UNDEFINED), entries.get(0));
|
||||||
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.UNDEFINED), entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -770,26 +706,18 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
CIncludeFileEntry expected = new CIncludeFileEntry("/include.file1", 0);
|
||||||
IPath incFile = new Path("/include.file1").setDevice(project.getLocation().getDevice());
|
CIncludeFileEntry entry = (CIncludeFileEntry)entries.get(0);
|
||||||
CIncludeFileEntry expected = new CIncludeFileEntry(incFile, 0);
|
assertEquals(expected.getName(), entry.getName());
|
||||||
CIncludeFileEntry entry = (CIncludeFileEntry)entries.get(0);
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getKind(), entry.getKind());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getFlags(), entry.getFlags());
|
||||||
assertEquals(expected.getKind(), entry.getKind());
|
assertEquals(expected, entry);
|
||||||
assertEquals(expected.getFlags(), entry.getFlags());
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
assertEquals(new CIncludeFileEntry("/include.file with spaces", 0), entries.get(1));
|
||||||
IPath incFile = new Path("/include.file with spaces").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include.file2"), 0), entries.get(2));
|
||||||
assertEquals(new CIncludeFileEntry(incFile, 0), entries.get(1));
|
assertEquals(new CIncludeFileEntry(project.getFullPath().append("include.file3"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
||||||
}
|
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include-file-with-dashes"), 0), entries.get(4));
|
||||||
{
|
|
||||||
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include.file2"), 0), entries.get(2));
|
|
||||||
assertEquals(new CIncludeFileEntry(project.getFullPath().append("include.file3"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
|
||||||
assertEquals(new CIncludeFileEntry(project.getLocation().removeLastSegments(2).append("include-file-with-dashes"), 0), entries.get(4));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -820,22 +748,16 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
CMacroFileEntry expected = new CMacroFileEntry("/macro.file", 0);
|
||||||
IPath path = new Path("/macro.file").setDevice(project.getLocation().getDevice());
|
CMacroFileEntry entry = (CMacroFileEntry)entries.get(0);
|
||||||
CMacroFileEntry expected = new CMacroFileEntry(path, 0);
|
assertEquals(expected.getName(), entry.getName());
|
||||||
CMacroFileEntry entry = (CMacroFileEntry)entries.get(0);
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getKind(), entry.getKind());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getFlags(), entry.getFlags());
|
||||||
assertEquals(expected.getKind(), entry.getKind());
|
assertEquals(expected, entry);
|
||||||
assertEquals(expected.getFlags(), entry.getFlags());
|
|
||||||
assertEquals(expected, entry);
|
assertEquals(new CMacroFileEntry("/macro.file with spaces", 0), entries.get(1));
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/macro.file with spaces").setDevice(project.getLocation().getDevice());
|
|
||||||
CMacroFileEntry expected = new CMacroFileEntry(path, 0);
|
|
||||||
CMacroFileEntry entry = (CMacroFileEntry)entries.get(1);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -865,22 +787,15 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
CLibraryPathEntry expected = new CLibraryPathEntry("/path0", 0);
|
||||||
IPath path = new Path("/path0").setDevice(project.getLocation().getDevice());
|
CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(0);
|
||||||
CLibraryPathEntry expected = new CLibraryPathEntry(path, 0);
|
assertEquals(expected.getName(), entry.getName());
|
||||||
CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(0);
|
assertEquals(expected.getValue(), entry.getValue());
|
||||||
assertEquals(expected.getName(), entry.getName());
|
assertEquals(expected.getKind(), entry.getKind());
|
||||||
assertEquals(expected.getValue(), entry.getValue());
|
assertEquals(expected.getFlags(), entry.getFlags());
|
||||||
assertEquals(expected.getKind(), entry.getKind());
|
assertEquals(expected, entry);
|
||||||
assertEquals(expected.getFlags(), entry.getFlags());
|
|
||||||
assertEquals(expected, entry);
|
assertEquals(new CLibraryPathEntry("/path with spaces", 0), entries.get(1));
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/path with spaces").setDevice(project.getLocation().getDevice());
|
|
||||||
CLibraryPathEntry expected = new CLibraryPathEntry(path, 0);
|
|
||||||
CLibraryPathEntry entry = (CLibraryPathEntry)entries.get(1);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -953,20 +868,12 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
String device = project.getLocation().getDevice();
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
// + " -I/path0 "
|
assertEquals(new CIncludePathEntry("/path1", 0), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(new Path("/path0").setDevice(device), 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("/path with spaces", 0), entries.get(2));
|
||||||
// + " -I /path1 "
|
|
||||||
assertEquals(new CIncludePathEntry(new Path("/path1").setDevice(device), 0), entries.get(1));
|
|
||||||
// + " -I\"/path with spaces\""
|
|
||||||
assertEquals(new CIncludePathEntry(new Path("/path with spaces").setDevice(device), 0), entries.get(2));
|
|
||||||
// + " -DMACRO1=value"
|
|
||||||
assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(3));
|
assertEquals(new CMacroEntry("MACRO1", "value", 0), entries.get(3));
|
||||||
// + " -DMACRO2=\"value with spaces\""
|
|
||||||
assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(4));
|
assertEquals(new CMacroEntry("MACRO2", "value with spaces", 0), entries.get(4));
|
||||||
// + " -L/usr/lib"
|
assertEquals(new CLibraryPathEntry("/usr/lib", 0), entries.get(5));
|
||||||
assertEquals(new CLibraryPathEntry(new Path("/usr/lib").setDevice(device), 0), entries.get(5));
|
|
||||||
// + " -ldomain"
|
|
||||||
assertEquals(new CLibraryFileEntry("libdomain.a", 0), entries.get(6));
|
assertEquals(new CLibraryFileEntry("libdomain.a", 0), entries.get(6));
|
||||||
assertEquals(7, entries.size());
|
assertEquals(7, entries.size());
|
||||||
}
|
}
|
||||||
|
@ -1019,12 +926,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check entries
|
// check entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
|
||||||
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1053,12 +957,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check entries
|
// check entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(null, file, languageId).get(0));
|
||||||
{
|
assertEquals(new CIncludePathEntry(file.getParent().getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), parser.getSettingEntries(null, file, languageId).get(1));
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(null, file, languageId);
|
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
|
||||||
assertEquals(new CIncludePathEntry(file.getParent().getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1090,31 +990,14 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
// in single quotes
|
||||||
{
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file1, languageId).get(0));
|
||||||
// in single quotes
|
// in double quotes
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file2, languageId).get(0));
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
// Unix EOL
|
||||||
assertEquals(expected, entries.get(0));
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file3, languageId).get(0));
|
||||||
}
|
// Windows EOL
|
||||||
{
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file4, languageId).get(0));
|
||||||
// in double quotes
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Unix EOL
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file3, languageId);
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
// Windows EOL
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file4, languageId);
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1150,13 +1033,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check entries
|
// check entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
|
||||||
{
|
// Information from build output should take precedence over build dir
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), parser.getSettingEntries(cfgDescription, file, languageId).get(1));
|
||||||
assertEquals(new CIncludePathEntry(path0, 0), entries.get(0));
|
|
||||||
// Information from build output should take precedence over build dir
|
|
||||||
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1186,24 +1065,17 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file0, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file0, languageId);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
|
||||||
CIncludePathEntry entry = (CIncludePathEntry)entries.get(0);
|
|
||||||
assertEquals(expected, entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,13 +1145,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
// check that relative paths are relative to CWD which is the location of the project
|
||||||
// check that relative paths are relative to CWD which is the location of the project
|
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(project.getLocation().removeLastSegments(1), 0), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(project.getLocation().removeLastSegments(1), 0), entries.get(1));
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
assertEquals(new CIncludePathEntry(folderComposite.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
||||||
assertEquals(new CIncludePathEntry(folderComposite.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1313,11 +1183,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(".", 0), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(".", 0), entries.get(0));
|
assertEquals(new CIncludePathEntry("..", 0), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry("..", 0), entries.get(1));
|
assertEquals(new CIncludePathEntry("Folder", 0), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry("Folder", 0), entries.get(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1349,10 +1217,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(1, entries.size());
|
||||||
assertEquals(1, entries.size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1392,13 +1258,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
assertEquals(new CIncludePathEntry(buildDir.getLocation().removeLastSegments(3), 0), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getLocation().removeLastSegments(3), 0), entries.get(2));
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1467,11 +1331,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().removeLastSegments(1), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("Folder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("Folder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1509,12 +1371,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
IPath buildPath = new Path(uriBuildDir.getPath()).setDevice(project.getLocation().getDevice());
|
||||||
IPath buildPath = new Path(uriBuildDir.getPath()).setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry(buildPath, 0), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildPath, 0), entries.get(0));
|
assertEquals(new CIncludePathEntry(buildPath.removeLastSegments(1), 0), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(buildPath.removeLastSegments(1), 0), entries.get(1));
|
assertEquals(new CIncludePathEntry(buildPath.append("Folder"), 0), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry(buildPath.append("Folder"), 0), entries.get(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1555,13 +1415,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
assertEquals(new CIncludePathEntry(folder2.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
||||||
assertEquals(new CIncludePathEntry(folder2.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(2));
|
assertEquals(new CIncludePathEntry("/BuildDir/MissingFolder", 0), entries.get(3));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(3));
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder2"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath().append("MissingFolder2"), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(4));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1601,18 +1459,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(mappedFolder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(mappedFolder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(2));
|
||||||
}
|
assertEquals(new CIncludePathEntry("/Missing/Folder", 0), entries.get(3));
|
||||||
{
|
|
||||||
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, 0), entries.get(2));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/Missing/Folder").setDevice(file.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, 0), entries.get(3));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1654,17 +1504,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(1));
|
||||||
}
|
assertEquals(new CIncludePathEntry("/Missing/Folder", 0), entries.get(2));
|
||||||
{
|
|
||||||
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, 0), entries.get(1));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IPath path = new Path("/Missing/Folder").setDevice(file.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, 0), entries.get(2));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1713,12 +1555,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(folderInReferencedProject.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(folderInReferencedProject.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry("/Ambiguous/Folder", 0), entries.get(1));
|
||||||
|
|
||||||
IPath path = new Path("/Ambiguous/Folder").setDevice(file.getLocation().getDevice());
|
|
||||||
assertEquals(new CIncludePathEntry(path, 0), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1755,11 +1593,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
{
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
CIncludePathEntry expected = new CIncludePathEntry(dir2.removeLastSegments(1), 0);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(dir2.removeLastSegments(1), 0);
|
assertEquals(expected, entries.get(0));
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1796,11 +1632,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
{
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
CIncludePathEntry expected = new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
|
assertEquals(expected, entries.get(0));
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1841,10 +1675,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1886,11 +1718,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(buildDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(includeDir.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1964,12 +1793,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
|
||||||
{
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
contentType.removeFileSpec("x++", IContentTypeSettings.FILE_EXTENSION_SPEC);
|
contentType.removeFileSpec("x++", IContentTypeSettings.FILE_EXTENSION_SPEC);
|
||||||
|
@ -1999,12 +1823,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
IPath path0 = new Path("/path0").setDevice(project.getLocation().getDevice());
|
assertEquals(new CIncludePathEntry("/path0", 0), parser.getSettingEntries(cfgDescription, file, languageId).get(0));
|
||||||
{
|
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
|
||||||
CIncludePathEntry expected = new CIncludePathEntry(path0, 0);
|
|
||||||
assertEquals(expected, entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2039,15 +1858,15 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
parser.shutdown();
|
parser.shutdown();
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
{
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(project.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
// "/Python1025/Include" not expected to be there
|
||||||
assertEquals(new CIncludePathEntry(new Path("/Python1025/Include").setDevice(project.getLocation().getDevice()), 0), entries.get(1));
|
assertFalse(new java.io.File("/Python1025/Include").exists());
|
||||||
assertEquals(new CMacroEntry("BOOST_ALL_NO_LIB", "1", 0), entries.get(2));
|
assertEquals(new CIncludePathEntry("/Python1025/Include", 0), entries.get(1));
|
||||||
assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "", 0), entries.get(3));
|
assertEquals(new CMacroEntry("BOOST_ALL_NO_LIB", "1", 0), entries.get(2));
|
||||||
assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "", 0), entries.get(4));
|
assertEquals(new CMacroEntry("BOOST_PYTHON_SOURCE", "", 0), entries.get(3));
|
||||||
assertEquals(5, entries.size());
|
assertEquals(new CMacroEntry("BOOST_PYTHON_STATIC_LIB", "", 0), entries.get(4));
|
||||||
}
|
assertEquals(5, entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2082,11 +1901,9 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
String device = project.getLocation().getDevice();
|
||||||
String device = project.getLocation().getDevice();
|
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(folder.getFullPath(), ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED), entries.get(0));
|
assertEquals(new CIncludePathEntry(new Path("/Absolute/Folder").setDevice(device), 0), entries.get(1));
|
||||||
assertEquals(new CIncludePathEntry(new Path("/Absolute/Folder").setDevice(device), 0), entries.get(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2121,10 +1938,8 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||||
{
|
String device = project.getLocation().getDevice();
|
||||||
String device = project.getLocation().getDevice();
|
assertEquals(new CIncludePathEntry(new Path("/LocallyMappedTo/Folder").setDevice(device), 0), entries.get(0));
|
||||||
assertEquals(new CIncludePathEntry(new Path("/LocallyMappedTo/Folder").setDevice(device), 0), entries.get(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2153,14 +1968,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
||||||
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0));
|
expected.add(new CIncludePathEntry("/path0", 0));
|
||||||
|
assertEquals(expected, parser.getSettingEntries(cfgDescription, file, languageId));
|
||||||
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId));
|
||||||
assertEquals(expected, entriesFile);
|
assertEquals(null, parser.getSettingEntries(cfgDescription, project, languageId));
|
||||||
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId);
|
|
||||||
assertEquals(null, entriesFolder);
|
|
||||||
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
|
|
||||||
assertEquals(null, entriesProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2189,14 +2000,10 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
||||||
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0));
|
expected.add(new CIncludePathEntry("/path0", 0));
|
||||||
|
assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
|
||||||
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(expected, parser.getSettingEntries(cfgDescription, folder, languageId));
|
||||||
assertEquals(null, entriesFile);
|
assertEquals(null, parser.getSettingEntries(cfgDescription, project, languageId));
|
||||||
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId);
|
|
||||||
assertEquals(expected, entriesFolder);
|
|
||||||
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
|
|
||||||
assertEquals(null, entriesProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2225,14 +2032,11 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
||||||
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0));
|
expected.add(new CIncludePathEntry("/path0", 0));
|
||||||
|
|
||||||
List<ICLanguageSettingEntry> entriesFile = parser.getSettingEntries(cfgDescription, file, languageId);
|
assertEquals(null, parser.getSettingEntries(cfgDescription, file, languageId));
|
||||||
assertEquals(null, entriesFile);
|
assertEquals(null, parser.getSettingEntries(cfgDescription, folder, languageId));
|
||||||
List<ICLanguageSettingEntry> entriesFolder = parser.getSettingEntries(cfgDescription, folder, languageId);
|
assertEquals(expected, parser.getSettingEntries(cfgDescription, project, languageId));
|
||||||
assertEquals(null, entriesFolder);
|
|
||||||
List<ICLanguageSettingEntry> entriesProject = parser.getSettingEntries(cfgDescription, project, languageId);
|
|
||||||
assertEquals(expected, entriesProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2261,7 +2065,7 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||||
|
|
||||||
// check populated entries
|
// check populated entries
|
||||||
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> expected = new ArrayList<ICLanguageSettingEntry>();
|
||||||
expected.add(new CIncludePathEntry(new Path("/path0").setDevice(project.getLocation().getDevice()), 0));
|
expected.add(new CIncludePathEntry("/path0", 0));
|
||||||
assertEquals(expected, parser.getSettingEntries(null, project, languageId));
|
assertEquals(expected, parser.getSettingEntries(null, project, languageId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
package org.eclipse.cdt.managedbuilder.language.settings.providers;
|
package org.eclipse.cdt.managedbuilder.language.settings.providers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -741,38 +740,61 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The manipulations here are done to resolve "../" navigation for symbolic links where "link/.." cannot
|
* The manipulations here are done to resolve problems such as "../" navigation for symbolic links where
|
||||||
* be collapsed as it must follow the real file-system path. {@link java.io.File#getCanonicalPath()} deals
|
* "link/.." cannot be collapsed as it must follow the real file-system path. {@link java.io.File#getCanonicalPath()}
|
||||||
* with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect
|
* deals with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect here.
|
||||||
* here.
|
* Another issue being resolved here is fixing drive letters in URI syntax.
|
||||||
*/
|
*/
|
||||||
private static URI resolvePathFromBaseLocation(String name, IPath baseLocation) {
|
private static URI resolvePathFromBaseLocation(String pathStr0, IPath baseLocation) {
|
||||||
String pathName = name;
|
String pathStr = pathStr0;
|
||||||
if (baseLocation != null && !baseLocation.isEmpty()) {
|
if (baseLocation != null && !baseLocation.isEmpty()) {
|
||||||
pathName = pathName.replace(File.separatorChar, '/');
|
pathStr = pathStr.replace(File.separatorChar, '/');
|
||||||
String device = new Path(pathName).getDevice();
|
String device = new Path(pathStr).getDevice();
|
||||||
if (device==null || device.equals(baseLocation.getDevice())) {
|
if (device == null || device.equals(baseLocation.getDevice())) {
|
||||||
if (device != null && device.length() > 0) {
|
if (device != null && device.length() > 0) {
|
||||||
pathName = pathName.substring(device.length());
|
pathStr = pathStr.substring(device.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
baseLocation = baseLocation.addTrailingSeparator();
|
baseLocation = baseLocation.addTrailingSeparator();
|
||||||
if (pathName.startsWith("/")) { //$NON-NLS-1$
|
if (pathStr.startsWith("/")) { //$NON-NLS-1$
|
||||||
pathName = pathName.substring(1);
|
pathStr = pathStr.substring(1);
|
||||||
}
|
}
|
||||||
pathName = baseLocation.toString() + pathName;
|
pathStr = baseLocation.toString() + pathStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File file = new File(pathName);
|
File file = new File(pathStr);
|
||||||
file = file.getCanonicalFile();
|
file = file.getCanonicalFile();
|
||||||
return file.toURI();
|
URI uri = file.toURI();
|
||||||
} catch (IOException e) {
|
if (file.exists()) {
|
||||||
// if error just leave it as is
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPath path0 = new Path(pathStr0);
|
||||||
|
if (!path0.isAbsolute()) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
String device = path0.getDevice();
|
||||||
|
if (device == null || device.isEmpty()) {
|
||||||
|
// Avoid spurious adding of drive letters on Windows
|
||||||
|
pathStr = path0.setDevice(null).toString();
|
||||||
|
} else {
|
||||||
|
// On Windows "C:/folder/" -> "/C:/folder/"
|
||||||
|
if (pathStr.charAt(0) != IPath.SEPARATOR) {
|
||||||
|
pathStr = IPath.SEPARATOR + pathStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new URI(uri.getScheme(), uri.getAuthority(), pathStr, uri.getQuery(), uri.getFragment());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// if error will leave it as is
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return org.eclipse.core.filesystem.URIUtil.toURI(pathName);
|
return org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -916,12 +938,17 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri);
|
String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri);
|
||||||
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
||||||
|
|
||||||
try {
|
if (uri != null && uri.isAbsolute()) {
|
||||||
File file = new java.io.File(uri);
|
try {
|
||||||
String canonicalPathStr = file.getCanonicalPath();
|
File file = new java.io.File(uri);
|
||||||
return new Path(canonicalPathStr);
|
String canonicalPathStr = file.getCanonicalPath();
|
||||||
} catch (Exception e) {
|
if (new Path(pathStr).getDevice() == null) {
|
||||||
ManagedBuilderCorePlugin.log(e);
|
return new Path(canonicalPathStr).setDevice(null);
|
||||||
|
}
|
||||||
|
return new Path(canonicalPathStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2011 Intel Corporation and others.
|
* Copyright (c) 2007, 2012 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -163,6 +163,13 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
s_parallelNumber.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
|
@Override
|
||||||
|
public void getName(AccessibleEvent e) {
|
||||||
|
e.result = Messages.BuilderSettingsTab_UseParallelJobs;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
s_parallelNumber.setToolTipText(Messages.BuilderSettingsTab_UseParallelJobs);
|
||||||
|
|
||||||
b_parallelUnlimited= new Button(c3, SWT.RADIO);
|
b_parallelUnlimited= new Button(c3, SWT.RADIO);
|
||||||
b_parallelUnlimited.setText(Messages.BuilderSettingsTab_UseUnlimitedJobs);
|
b_parallelUnlimited.setText(Messages.BuilderSettingsTab_UseUnlimitedJobs);
|
||||||
|
|
|
@ -1302,6 +1302,9 @@ public class BuildOptionSettingsUI extends AbstractToolSettingUI {
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
public void setSelection(ITreeOption option) {
|
public void setSelection(ITreeOption option) {
|
||||||
if (treeRoot == getRoot(option)) { // only work in the same tree
|
if (treeRoot == getRoot(option)) { // only work in the same tree
|
||||||
selected = option;
|
selected = option;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionType;
|
import org.eclipse.cdt.core.resources.ExclusionType;
|
||||||
|
@ -29,6 +30,7 @@ import org.eclipse.cdt.core.resources.RefreshExclusion;
|
||||||
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
||||||
|
@ -408,10 +410,8 @@ public class RefreshScopeTests extends TestCase {
|
||||||
|
|
||||||
IResource config1_resource = fProject;
|
IResource config1_resource = fProject;
|
||||||
|
|
||||||
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
|
||||||
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
|
String conf_name = getCurrentConfigName();
|
||||||
ICConfigurationDescription conf = projectDescription.getActiveConfiguration();
|
|
||||||
String conf_name = conf.getName();
|
|
||||||
|
|
||||||
manager.addResourceToRefresh(fProject, conf_name, config1_resource);
|
manager.addResourceToRefresh(fProject, conf_name, config1_resource);
|
||||||
|
|
||||||
|
@ -567,6 +567,101 @@ public class RefreshScopeTests extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closeProject(ICProjectDescription projDesc) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// save the project description
|
||||||
|
CCorePlugin.getDefault().setProjectDescription(fProject, projDesc);
|
||||||
|
fProject.close(null);
|
||||||
|
} catch (CoreException e1) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openProject() {
|
||||||
|
try {
|
||||||
|
fProject.open(null);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentConfigName() {
|
||||||
|
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
||||||
|
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
|
||||||
|
ICConfigurationDescription conf = projectDescription.getActiveConfiguration();
|
||||||
|
return conf.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testEmptyRefreshScopeCloseAndReopen() {
|
||||||
|
|
||||||
|
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
||||||
|
manager.clearAllData();
|
||||||
|
|
||||||
|
String config_name = getCurrentConfigName();
|
||||||
|
|
||||||
|
// get the resources. since we are not loading ... the project should auto-magically be added by default.
|
||||||
|
List<IResource> config_resources = manager.getResourcesToRefresh(fProject, config_name);
|
||||||
|
assertEquals(1,config_resources.size());
|
||||||
|
assertEquals(true, config_resources.contains(fProject));
|
||||||
|
|
||||||
|
// now delete it.
|
||||||
|
manager.deleteResourceToRefresh(fProject, config_name, fProject);
|
||||||
|
|
||||||
|
// and make sure it is empty.
|
||||||
|
config_resources = manager.getResourcesToRefresh(fProject, config_name);
|
||||||
|
assertEquals(0,config_resources.size());
|
||||||
|
|
||||||
|
// write the persistent data.
|
||||||
|
ICProjectDescription projectDescription = CCorePlugin.getDefault().getProjectDescription(fProject);
|
||||||
|
try {
|
||||||
|
manager.persistSettings(projectDescription);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// close and reopen
|
||||||
|
closeProject(projectDescription);
|
||||||
|
openProject();
|
||||||
|
|
||||||
|
// now verify that there are no resources.
|
||||||
|
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> config_map = manager.getConfigurationToResourcesMap(fProject);
|
||||||
|
assertEquals(1,config_map.size());
|
||||||
|
config_resources = manager.getResourcesToRefresh(fProject, config_name);
|
||||||
|
assertEquals(0,config_resources.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAddEmptyConfiguration() {
|
||||||
|
final String CFG_NAME="empty_config";
|
||||||
|
|
||||||
|
CoreModel model = CoreModel.getDefault();
|
||||||
|
RefreshScopeManager manager = RefreshScopeManager.getInstance();
|
||||||
|
manager.clearAllData();
|
||||||
|
|
||||||
|
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
||||||
|
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
|
||||||
|
ICConfigurationDescription base = projectDescription.getActiveConfiguration();
|
||||||
|
|
||||||
|
ICProjectDescription propertyProjectDescription = CoreModel.getDefault().getProjectDescription(fProject);
|
||||||
|
ICConfigurationDescription propertyDefaultConfigurationDescription = propertyProjectDescription.getConfigurations()[0];
|
||||||
|
try {
|
||||||
|
projectDescription.setReadOnly(false, true);
|
||||||
|
ICConfigurationDescription newCfg = projectDescription.createConfiguration(CFG_NAME + ".id", CFG_NAME, propertyDefaultConfigurationDescription);
|
||||||
|
} catch (WriteAccessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<IResource> empty_config_resources = manager.getResourcesToRefresh(fProject, CFG_NAME);
|
||||||
|
assertEquals(1,empty_config_resources.size());
|
||||||
|
assertEquals(true,empty_config_resources.contains(fProject));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
return new TestSuite(RefreshScopeTests.class);
|
return new TestSuite(RefreshScopeTests.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -982,8 +982,10 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
try {
|
try {
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(event.getProjectName());
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(event.getProjectName());
|
||||||
|
|
||||||
// Recalculate cached settings
|
// Recalculate cached settings unless already inside CProjectDescriptionManager.setProjectDescription()
|
||||||
CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null);
|
if (!CProjectDescriptionManager.getInstance().isCurrentThreadSetProjectDescription()) {
|
||||||
|
CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null);
|
||||||
|
}
|
||||||
|
|
||||||
// Notify listeners
|
// Notify listeners
|
||||||
ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project);
|
ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Ferguson (Symbian) - Initial Implementation
|
* Andrew Ferguson (Symbian) - Initial Implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
@ -17,8 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place-holder in the AST for template arguments that are not yet
|
* Place-holder in the AST for template arguments that are not yet understood.
|
||||||
* understood.
|
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
|
||||||
*/
|
*/
|
||||||
public CPPASTAmbiguousTemplateArgument(IASTNode... nodes) {
|
public CPPASTAmbiguousTemplateArgument(IASTNode... nodes) {
|
||||||
fNodes= new ArrayList<IASTNode>(2);
|
fNodes= new ArrayList<IASTNode>(2);
|
||||||
for(IASTNode node : nodes) {
|
for (IASTNode node : nodes) {
|
||||||
if (node instanceof IASTTypeId || node instanceof IASTIdExpression) {
|
if (node instanceof IASTTypeId || node instanceof IASTIdExpression) {
|
||||||
fNodes.add(node);
|
fNodes.add(node);
|
||||||
} else if (node instanceof ICPPASTPackExpansionExpression) {
|
} else if (node instanceof ICPPASTPackExpansionExpression) {
|
||||||
|
@ -92,10 +92,10 @@ public class CPPASTAmbiguousTemplateArgument extends ASTAmbiguousNode implements
|
||||||
IASTNode[] copyNodes = new IASTNode[sizeOfNodes];
|
IASTNode[] copyNodes = new IASTNode[sizeOfNodes];
|
||||||
int arrayIndex = 0;
|
int arrayIndex = 0;
|
||||||
for (IASTNode node : fNodes) {
|
for (IASTNode node : fNodes) {
|
||||||
if (node != null){
|
if (node != null) {
|
||||||
copyNodes[arrayIndex] = node.copy(style);
|
copyNodes[arrayIndex] = node.copy(style);
|
||||||
} else {
|
} else {
|
||||||
copyNodes[arrayIndex]= null;
|
copyNodes[arrayIndex] = null;
|
||||||
}
|
}
|
||||||
arrayIndex++;
|
arrayIndex++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
|
@ -1706,6 +1707,10 @@ public class CPPTemplates {
|
||||||
IType type= expr.getExpressionType();
|
IType type= expr.getExpressionType();
|
||||||
IValue value= Value.create((IASTExpression) arg, Value.MAX_RECURSION_DEPTH);
|
IValue value= Value.create((IASTExpression) arg, Value.MAX_RECURSION_DEPTH);
|
||||||
result[i]= new CPPTemplateArgument(value, type);
|
result[i]= new CPPTemplateArgument(value, type);
|
||||||
|
} else if (arg instanceof ICPPASTAmbiguousTemplateArgument) {
|
||||||
|
throw new IllegalArgumentException(id.getRawSignature()
|
||||||
|
+ " contains an ambiguous template argument at position " + i + " in " //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ id.getContainingFilename());
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unexpected type: " + arg.getClass().getName()); //$NON-NLS-1$
|
throw new IllegalArgumentException("Unexpected type: " + arg.getClass().getName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
* Copyright (c) 2000, 2012 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -32,6 +32,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.accessibility.AccessibleAdapter;
|
||||||
|
import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
@ -184,6 +186,14 @@ public class CustomFiltersDialog extends SelectionDialog {
|
||||||
if (initialSelection != null && !initialSelection.isEmpty())
|
if (initialSelection != null && !initialSelection.isEmpty())
|
||||||
checkInitialSelections();
|
checkInitialSelections();
|
||||||
|
|
||||||
|
fCheckBoxList.getTable().getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
|
@Override
|
||||||
|
public void getName(AccessibleEvent e) {
|
||||||
|
e.result = FilterMessages.CustomFiltersDialog_filterList_label;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fCheckBoxList.getTable().setToolTipText(FilterMessages.CustomFiltersDialog_filterList_label);
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
info= new Label(parent, SWT.LEFT);
|
info= new Label(parent, SWT.LEFT);
|
||||||
info.setText(FilterMessages.CustomFiltersDialog_description_label);
|
info.setText(FilterMessages.CustomFiltersDialog_description_label);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.cdt</groupId>
|
<groupId>org.eclipse.cdt</groupId>
|
||||||
<artifactId>cdt-parent</artifactId>
|
<artifactId>cdt-parent</artifactId>
|
||||||
<version>8.1.0-SNAPSHOT</version>
|
<version>8.2.0-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,6 @@ public class ExpressionVMProvider extends AbstractDMVMProvider
|
||||||
if (input instanceof IExpressionDMContext) {
|
if (input instanceof IExpressionDMContext) {
|
||||||
IExpressionDMContext dmc = (IExpressionDMContext) input;
|
IExpressionDMContext dmc = (IExpressionDMContext) input;
|
||||||
SingleExpressionVMNode vmNode = (SingleExpressionVMNode) getChildVMNodes(getRootVMNode())[0];
|
SingleExpressionVMNode vmNode = (SingleExpressionVMNode) getChildVMNodes(getRootVMNode())[0];
|
||||||
vmNode.setExpression(dmc);
|
|
||||||
final IDMVMContext viewerInput= vmNode.createVMContext(dmc);
|
final IDMVMContext viewerInput= vmNode.createVMContext(dmc);
|
||||||
|
|
||||||
// provide access to viewer (needed by details pane)
|
// provide access to viewer (needed by details pane)
|
||||||
|
|
|
@ -15,14 +15,10 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.ExpressionVMProvider;
|
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.ExpressionsChangedEvent;
|
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.InvalidExpressionVMContext;
|
|
||||||
import org.eclipse.cdt.dsf.ui.concurrent.ViewerCountingRequestMonitor;
|
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMContext;
|
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMContext;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMNode;
|
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMNode;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
|
import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
|
||||||
|
@ -38,6 +34,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProv
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
||||||
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
|
||||||
import org.eclipse.jface.viewers.TreePath;
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,6 +87,10 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
return getVMNode().hashCode() + fDmc.hashCode();
|
return getVMNode().hashCode() + fDmc.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return fDmc.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SimpleExpression implements IExpression {
|
private static class SimpleExpression implements IExpression {
|
||||||
|
@ -141,27 +142,8 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SingleExpressionManager {
|
|
||||||
private static final IExpression[] NO_EXPRESSIONS = {};
|
|
||||||
IExpression fExpression;
|
|
||||||
public IExpression[] getExpressions() {
|
|
||||||
if (fExpression != null) {
|
|
||||||
return new IExpression[] { fExpression };
|
|
||||||
}
|
|
||||||
return NO_EXPRESSIONS;
|
|
||||||
}
|
|
||||||
public void setExpression(IExpression expression) {
|
|
||||||
fExpression = expression;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Local reference to the expression manager */
|
|
||||||
private final SingleExpressionManager fManager;
|
|
||||||
|
|
||||||
public SingleExpressionVMNode(ExpressionVMProvider provider) {
|
public SingleExpressionVMNode(ExpressionVMProvider provider) {
|
||||||
super(provider);
|
super(provider);
|
||||||
fManager = new SingleExpressionManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -173,14 +155,21 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
return (ExpressionVMProvider)getVMProvider();
|
return (ExpressionVMProvider)getVMProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IExpressionDMContext getUpdateExpressionDMC(IViewerUpdate update) {
|
||||||
|
if (update.getElement() instanceof IDMVMContext) {
|
||||||
|
IDMContext dmc = ((IDMVMContext)update.getElement()).getDMContext();
|
||||||
|
if (dmc instanceof IExpressionDMContext) {
|
||||||
|
return (IExpressionDMContext)dmc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(IHasChildrenUpdate[] updates) {
|
public void update(IHasChildrenUpdate[] updates) {
|
||||||
// Test availability of children based on whether there are any expressions
|
|
||||||
// in the manager. We assume that the getExpressions() will just read
|
|
||||||
// local state data, so we don't bother using a job to perform this
|
|
||||||
// operation.
|
|
||||||
for (int i = 0; i < updates.length; i++) {
|
for (int i = 0; i < updates.length; i++) {
|
||||||
updates[i].setHasChilren(fManager.getExpressions().length != 0);
|
updates[i].setHasChilren(getUpdateExpressionDMC(updates[i]) != null);
|
||||||
updates[i].done();
|
updates[i].done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +181,7 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
|
|
||||||
// We assume that the getExpressions() will just read local state data,
|
// We assume that the getExpressions() will just read local state data,
|
||||||
// so we don't bother using a job to perform this operation.
|
// so we don't bother using a job to perform this operation.
|
||||||
update.setChildCount(fManager.getExpressions().length);
|
update.setChildCount(getUpdateExpressionDMC(update) != null ? 1 : 0);
|
||||||
update.done();
|
update.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,62 +189,38 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
@Override
|
@Override
|
||||||
public void update(final IChildrenUpdate[] updates) {
|
public void update(final IChildrenUpdate[] updates) {
|
||||||
for (IChildrenUpdate update : updates) {
|
for (IChildrenUpdate update : updates) {
|
||||||
doUpdateChildren(update);
|
IExpressionDMContext dmc = getUpdateExpressionDMC(update);
|
||||||
|
if (dmc != null) {
|
||||||
|
doUpdateChildren(update, new SimpleExpression(dmc.getExpression()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
handleFailedUpdate(update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doUpdateChildren(final IChildrenUpdate update) {
|
public void doUpdateChildren(final IChildrenUpdate update, final IExpression expression) {
|
||||||
final IExpression[] expressions = fManager.getExpressions();
|
// getElementForExpression() accepts a IElementsUpdate as an argument.
|
||||||
|
// Construct an instance of VMElementsUpdate which will call a
|
||||||
|
// the request monitor when it is finished. The request monitor
|
||||||
|
// will in turn set the element in the update argument in this method.
|
||||||
|
((ExpressionVMProvider)getVMProvider()).update(
|
||||||
|
new VMExpressionUpdate(
|
||||||
|
update, expression,
|
||||||
|
new ViewerDataRequestMonitor<Object>(getVMProvider().getExecutor(), update) {
|
||||||
|
@Override
|
||||||
|
protected void handleSuccess() {
|
||||||
|
update.setChild(getData(), 0);
|
||||||
|
update.done();
|
||||||
|
}
|
||||||
|
|
||||||
// For each (expression) element in update, find the layout node that can
|
@Override
|
||||||
// parse it. And for each expression that has a corresponding layout node,
|
protected void handleError() {
|
||||||
// call IExpressionLayoutNode#getElementForExpression to generate a VMC.
|
update.setChild(new InvalidExpressionVMContext(SingleExpressionVMNode.this, expression), 0);
|
||||||
// Since the last is an async call, we need to create a multi-RM to wait
|
update.done();
|
||||||
// for all the calls to complete.
|
}
|
||||||
final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getVMProvider().getExecutor(), update);
|
})
|
||||||
int multiRmCount = 0;
|
);
|
||||||
|
|
||||||
int lowOffset= update.getOffset();
|
|
||||||
if (lowOffset < 0) {
|
|
||||||
lowOffset = 0;
|
|
||||||
}
|
|
||||||
int length= update.getLength();
|
|
||||||
if (length <= 0) {
|
|
||||||
length = expressions.length;
|
|
||||||
}
|
|
||||||
final int highOffset= lowOffset + length;
|
|
||||||
for (int i = lowOffset; i < highOffset && i < expressions.length + 1; i++) {
|
|
||||||
if (i < expressions.length) {
|
|
||||||
multiRmCount++;
|
|
||||||
final int childIndex = i;
|
|
||||||
final IExpression expression = expressions[i];
|
|
||||||
// getElementForExpression() accepts a IElementsUpdate as an argument.
|
|
||||||
// Construct an instance of VMElementsUpdate which will call a
|
|
||||||
// the request monitor when it is finished. The request monitor
|
|
||||||
// will in turn set the element in the update argument in this method.
|
|
||||||
((ExpressionVMProvider)getVMProvider()).update(
|
|
||||||
new VMExpressionUpdate(
|
|
||||||
update, expression,
|
|
||||||
new DataRequestMonitor<Object>(getVMProvider().getExecutor(), multiRm) {
|
|
||||||
@Override
|
|
||||||
protected void handleSuccess() {
|
|
||||||
update.setChild(getData(), childIndex);
|
|
||||||
multiRm.done();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void handleError() {
|
|
||||||
update.setChild(new InvalidExpressionVMContext(SingleExpressionVMNode.this, expression), childIndex);
|
|
||||||
multiRm.done();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no expressions were parsed, we're finished.
|
|
||||||
// Set the count to the counting RM.
|
|
||||||
multiRm.setDoneCount(multiRmCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -277,41 +242,48 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
retVal |= IModelDelta.ADDED | IModelDelta.REMOVED | IModelDelta.INSERTED | IModelDelta.CONTENT ;
|
retVal |= IModelDelta.ADDED | IModelDelta.REMOVED | IModelDelta.INSERTED | IModelDelta.CONTENT ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IExpression expression : fManager.getExpressions()) {
|
// The expression in the hover is not known here, so assume that all
|
||||||
retVal |= getExpressionVMProvider().getDeltaFlagsForExpression(expression, event);
|
// expression nodes need to provide delta flags for event. Iterate
|
||||||
|
// through them here and collect the flags.
|
||||||
|
for (IExpressionVMNode node : getExpressionVMProvider().getExpressionNodes()) {
|
||||||
|
retVal |= getDeltaFlagsForNode(node, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getDeltaFlagsForNode(IVMNode node, Object event) {
|
||||||
|
int retVal = node.getDeltaFlags(event);
|
||||||
|
for (IVMNode child : getVMProvider().getChildVMNodes(node)) {
|
||||||
|
if (!node.equals(child)) {
|
||||||
|
retVal |= getDeltaFlagsForNode(child, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildDelta(final Object event, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
|
public void buildDelta(final Object event, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor requestMonitor) {
|
||||||
if (event instanceof ExpressionsChangedEvent) {
|
if (event instanceof ExpressionsChangedEvent) {
|
||||||
buildDeltaForExpressionsChangedEvent((ExpressionsChangedEvent)event, parentDelta, nodeOffset, requestMonitor);
|
buildDeltaForExpressionsChangedEvent((ExpressionsChangedEvent)event, parentDelta, nodeOffset, requestMonitor);
|
||||||
} else {
|
} else {
|
||||||
|
Object parent = parentDelta.getElement();
|
||||||
// For each expression, find its corresponding node and ask that
|
if (parent instanceof IDMVMContext) {
|
||||||
// layout node for its delta flags for given event. If there are delta flags to be
|
IDMContext dmc = ((IDMVMContext)parent).getDMContext();
|
||||||
// generated, call the asynchronous method to do so.
|
if (dmc instanceof IExpressionDMContext) {
|
||||||
CountingRequestMonitor multiRm = new CountingRequestMonitor(getExecutor(), requestMonitor);
|
IExpression expression = new SimpleExpression( ((IExpressionDMContext)dmc).getExpression() );
|
||||||
|
int flags = getExpressionVMProvider().getDeltaFlagsForExpression(expression, event);
|
||||||
int buildDeltaForExpressionCallCount = 0;
|
// If the given expression has no delta flags, skip it.
|
||||||
|
if (flags != IModelDelta.NO_CHANGE) {
|
||||||
IExpression[] expressions = fManager.getExpressions();
|
getExpressionVMProvider().buildDeltaForExpression(
|
||||||
for (int i = 0; i < expressions.length; i++ ) {
|
expression, nodeOffset, event, parentDelta, getTreePathFromDelta(parentDelta),
|
||||||
int flags = getExpressionVMProvider().getDeltaFlagsForExpression(expressions[i], event);
|
requestMonitor);
|
||||||
// If the given expression has no delta flags, skip it.
|
return;
|
||||||
if (flags == IModelDelta.NO_CHANGE) continue;
|
}
|
||||||
|
}
|
||||||
int elementOffset = nodeOffset >= 0 ? nodeOffset + i : -1;
|
|
||||||
getExpressionVMProvider().buildDeltaForExpression(
|
|
||||||
expressions[i], elementOffset, event, parentDelta, getTreePathFromDelta(parentDelta),
|
|
||||||
new RequestMonitor(getExecutor(), multiRm));
|
|
||||||
buildDeltaForExpressionCallCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
multiRm.setDoneCount(buildDeltaForExpressionCallCount);
|
|
||||||
}
|
}
|
||||||
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildDeltaForExpressionsChangedEvent(ExpressionsChangedEvent event, VMDelta parentDelta,
|
private void buildDeltaForExpressionsChangedEvent(ExpressionsChangedEvent event, VMDelta parentDelta,
|
||||||
|
@ -340,16 +312,8 @@ public class SingleExpressionVMNode extends AbstractVMNode implements IElementLa
|
||||||
return new TreePath(elementList.toArray());
|
return new TreePath(elementList.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateElementsInSessionThread(IChildrenUpdate update) {
|
|
||||||
doUpdateChildren(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IDMVMContext createVMContext(IDMContext dmc) {
|
public IDMVMContext createVMContext(IDMContext dmc) {
|
||||||
return new RootDMVMContext(getVMProvider().getRootVMNode(), dmc);
|
return new RootDMVMContext(getVMProvider().getRootVMNode(), dmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpression(IExpressionDMContext dmc) {
|
|
||||||
String text = dmc.getExpression();
|
|
||||||
fManager.setExpression(new SimpleExpression(text));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue