mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add support for Base Reference in the PathEntry
This commit is contained in:
parent
03144000c4
commit
0aa20e710b
16 changed files with 281 additions and 238 deletions
|
@ -1,3 +1,7 @@
|
|||
2004-04-21 Alain Magloire
|
||||
Update the PathEntry test.
|
||||
* model/org/eclipse/cdt/core/model/tests/CPatEntryTest.java
|
||||
|
||||
2004-04-21 John Camelon
|
||||
Moved testBug39703() from ASTFailedTests to QuickParseASTTest.
|
||||
Added ScannerTestCase::testBug39698().
|
||||
|
|
|
@ -144,9 +144,9 @@ public class CPathEntryTest extends TestCase {
|
|||
// 2) the default outputEntry becomes the project
|
||||
assertTrue("No cpathentries", entries.length == 2);
|
||||
entries = new IPathEntry[3];
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("cpaththest/foo.c"), new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(new Path("/usr/lib/libc.so.1"), null, null, null);
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("cpaththest/foo.c"), null, new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, false);
|
||||
testProject.setRawPathEntries(entries, new NullProgressMonitor());
|
||||
entries = testProject.getResolvedPathEntries();
|
||||
// We always have at least two entries:
|
||||
|
@ -169,9 +169,9 @@ public class CPathEntryTest extends TestCase {
|
|||
}
|
||||
CProjectHelper.addCContainer(testProject, "foo");
|
||||
IPathEntry[] entries = new IPathEntry[3];
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("foo"), new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(new Path("/usr/lib/libc.so.1"), null, null, null);
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("foo"), null, new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, false);
|
||||
CElementListener listener = new CElementListener();
|
||||
CoreModel.getDefault().addElementChangedListener(listener);
|
||||
testProject.setRawPathEntries(entries, new NullProgressMonitor());
|
||||
|
@ -196,9 +196,9 @@ public class CPathEntryTest extends TestCase {
|
|||
|
||||
public IPathEntry[] getPathEntries() {
|
||||
IPathEntry[] entries = new IPathEntry[3];
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("foo.c"), new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(new Path("/usr/lib/libc.so.1"), null, null, null);
|
||||
entries[0] = CoreModel.newIncludeEntry(new Path(""), null, new Path("/usr/include"), true);
|
||||
entries[1] = CoreModel.newIncludeEntry(new Path("foo.c"), null, new Path("/usr/include"), true);
|
||||
entries[2] = CoreModel.newLibraryEntry(null, new Path("/usr/lib/libc.so.1"), null, null, null, true);
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
2004-04-21 Alain Magloire
|
||||
|
||||
Added support for Base Reference Attribute in the PathEntry
|
||||
|
||||
* model/org/eclipse/cdt/core/model/CoreModel.java
|
||||
* model/org/eclipse/cdt/core/model/IncludeEntry.java
|
||||
* model/org/eclipse/cdt/core/model/ILibraryEntry.java
|
||||
* model/org/eclipse/cdt/core/model/IMacroEntry.java
|
||||
* model/org/eclipse/cdt/core/model/IPathEntry.java
|
||||
|
||||
* model/org/eclipse/cdt/internal/core/model/APathEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/MacroEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/OutputEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/PathEntry.java
|
||||
* model/org/eclipse/cdt/internal/core/model/SourceEntry.java
|
||||
|
||||
2004-04-20 David Inglis
|
||||
|
||||
Fixed up some small bugs with the macro paths
|
||||
|
|
|
@ -196,7 +196,7 @@ public class CoreModel {
|
|||
* for the project identified by the given absolute path.
|
||||
* <p>
|
||||
* A project entry is used to denote a prerequisite project. The
|
||||
* IPathEntry[] entries of the project will be contributed.
|
||||
* exported IPathEntry[] entries of the project will be contributed.
|
||||
* <p>
|
||||
* The prerequisite project is referred to using an absolute path relative
|
||||
* to the workspace root.
|
||||
|
@ -205,19 +205,19 @@ public class CoreModel {
|
|||
* is equivalent to <code>newProjectEntry(path,false)</code>.
|
||||
* <p>
|
||||
*
|
||||
* @param path
|
||||
* the absolute path of the binary archive
|
||||
* @param projectPath
|
||||
* the workspace-relative path of the project
|
||||
* @return a new project entry
|
||||
*
|
||||
* @see CoreModel#newProjectEntry(IPath, boolean)
|
||||
*/
|
||||
public static IProjectEntry newProjectEntry(IPath path) {
|
||||
return newProjectEntry(path, false);
|
||||
public static IProjectEntry newProjectEntry(IPath projectPath) {
|
||||
return newProjectEntry(projectPath, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_PROJECT</code> for
|
||||
* the project identified by the given absolute path.
|
||||
* the project identified by the given workspace-relative path.
|
||||
* <p>
|
||||
* A project entry is used to denote a prerequisite project. All the
|
||||
* IPathEntries of the project will be contributed as a whole. The
|
||||
|
@ -225,15 +225,15 @@ public class CoreModel {
|
|||
* the workspace root.
|
||||
* <p>
|
||||
*
|
||||
* @param path
|
||||
* the absolute path of the prerequisite project
|
||||
* @param projectPath
|
||||
* the absolute workspace-relative path of the prerequisite project
|
||||
* @param isExported
|
||||
* indicates whether this entry is contributed to dependent
|
||||
* projects in addition to the output location
|
||||
* projects
|
||||
* @return a new project entry
|
||||
*/
|
||||
public static IProjectEntry newProjectEntry(IPath path, boolean isExported) {
|
||||
return new ProjectEntry(path, isExported);
|
||||
public static IProjectEntry newProjectEntry(IPath projectPath, boolean isExported) {
|
||||
return new ProjectEntry(projectPath, isExported);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,60 +270,48 @@ public class CoreModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new non-exported entry of kind <code>CDT_LIBRARY</code>
|
||||
* Creates and returns a new entry of kind <code>CDT_LIBRARY</code>
|
||||
* for the archive or folder identified by the given absolute path.
|
||||
*
|
||||
* Note that this operation does not attempt to validate or access the
|
||||
* resources at the given paths.
|
||||
* <p>
|
||||
* The resulting entry is not exported to dependent projects. This method
|
||||
* is equivalent to <code>newLibraryEntry(-,-,-,false)</code>.
|
||||
* <p>
|
||||
*
|
||||
* @param path
|
||||
* the absolute path of the library
|
||||
* @param basePath
|
||||
* the base path of the library
|
||||
* @param libraryPath
|
||||
* the path of the library
|
||||
* @param sourceAttachmentPath
|
||||
* the absolute path of the corresponding source archive or
|
||||
* the project-relative path of the corresponding source archive or
|
||||
* folder, or <code>null</code> if none.
|
||||
* @param sourceAttachmentRootPath
|
||||
* the location of the root within the source archive or folder
|
||||
* or <code>null</code>.
|
||||
* @param sourceAttachmentPrefixMapping
|
||||
* prefix mapping or <code>null</code>.
|
||||
* @param isExported
|
||||
* whether the entry is exported
|
||||
* @return a new library entry
|
||||
*
|
||||
*/
|
||||
public static ILibraryEntry newLibraryEntry(IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
||||
IPath sourceAttachmentPrefixMapping) {
|
||||
return newLibraryEntry(libraryPath, null, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, false);
|
||||
public static ILibraryEntry newLibraryEntry(IPath basePath, IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
||||
IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
||||
return new LibraryEntry(basePath, null, libraryPath, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new non-exported entry of kind <code>CDT_LIBRARY</code>
|
||||
* Creates and returns a new entry of kind <code>CDT_LIBRARY</code>
|
||||
* for the archive or folder identified by the given absolute path.
|
||||
*
|
||||
* Note that this operation does not attempt to validate or access the
|
||||
* resources at the given paths.
|
||||
* <p>
|
||||
*
|
||||
* @param path
|
||||
* the path of the library
|
||||
* @param path
|
||||
* the base path of the library
|
||||
* @param sourceAttachmentPath
|
||||
* the absolute path of the corresponding source archive or
|
||||
* folder, or <code>null</code> if none.
|
||||
* @param sourceAttachmentRootPath
|
||||
* the location of the root within the source archive or folder
|
||||
* or <code>null</code>.
|
||||
* @param sourceAttachmentPrefixMapping
|
||||
* prefix mapping or <code>null</code>.
|
||||
* @param baseRef
|
||||
* the base reference path to find the library
|
||||
* @param libraryPath
|
||||
* the library name.
|
||||
* @return a new library entry
|
||||
*
|
||||
*/
|
||||
public static ILibraryEntry newLibraryEntry(IPath libraryPath, IPath basePath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
|
||||
IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
||||
return new LibraryEntry(libraryPath, basePath, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
|
||||
public static ILibraryEntry newLibraryRefEntry(IPath baseRef, IPath libraryPath) {
|
||||
return new LibraryEntry(null, baseRef, libraryPath, null, null, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,28 +319,28 @@ public class CoreModel {
|
|||
* the project's output folder
|
||||
* <p>
|
||||
*
|
||||
* @param path
|
||||
* the project-relative path of a binary folder
|
||||
* @param outputPath
|
||||
* the project-relative path of a folder
|
||||
* @return a new source entry with not exclusion patterns
|
||||
*
|
||||
*/
|
||||
public static IOutputEntry newOutputEntry(IPath path) {
|
||||
return newOutputEntry(path, OutputEntry.NO_EXCLUSION_PATTERNS);
|
||||
public static IOutputEntry newOutputEntry(IPath outputPath) {
|
||||
return newOutputEntry(outputPath, OutputEntry.NO_EXCLUSION_PATTERNS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_OUPUT</code> for
|
||||
* the project
|
||||
*
|
||||
* @param path
|
||||
* the absolute project-relative path of a binary folder
|
||||
* @param outputPath
|
||||
* the project-relative path of a folder
|
||||
* @param exclusionPatterns
|
||||
* the possibly empty list of exclusion patterns represented as
|
||||
* relative paths
|
||||
* @return a new source entry with the given exclusion patterns
|
||||
*/
|
||||
public static IOutputEntry newOutputEntry(IPath path, IPath[] exclusionPatterns) {
|
||||
return new OutputEntry(path, exclusionPatterns, false);
|
||||
public static IOutputEntry newOutputEntry(IPath outputPath, IPath[] exclusionPatterns) {
|
||||
return new OutputEntry(outputPath, exclusionPatterns, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,13 +361,13 @@ public class CoreModel {
|
|||
* Particular source entries cannot be selectively exported.
|
||||
* </p>
|
||||
*
|
||||
* @param path
|
||||
* @param sourcePath
|
||||
* the project-relative path of a source folder
|
||||
* @return a new source entry with not exclusion patterns
|
||||
*
|
||||
*/
|
||||
public static ISourceEntry newSourceEntry(IPath path) {
|
||||
return newSourceEntry(path, SourceEntry.NO_EXCLUSION_PATTERNS);
|
||||
public static ISourceEntry newSourceEntry(IPath sourcePath) {
|
||||
return newSourceEntry(sourcePath, SourceEntry.NO_EXCLUSION_PATTERNS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,61 +384,56 @@ public class CoreModel {
|
|||
* <code>P1</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param path
|
||||
* the absolute workspace-relative path of a source folder
|
||||
* @param sourcePath
|
||||
* the absolute project-relative path of a source folder
|
||||
* @param exclusionPatterns
|
||||
* the possibly empty list of exclusion patterns represented as
|
||||
* relative paths
|
||||
* @return a new source entry with the given exclusion patterns
|
||||
*/
|
||||
public static ISourceEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
|
||||
return new SourceEntry(path, exclusionPatterns);
|
||||
public static ISourceEntry newSourceEntry(IPath sourcePath, IPath[] exclusionPatterns) {
|
||||
return new SourceEntry(sourcePath, exclusionPatterns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param includePath
|
||||
* the absolute path of the include
|
||||
* @return IIncludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath includePath) {
|
||||
return newIncludeEntry(null, includePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param path
|
||||
* @param resourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param basePath
|
||||
* the base path of the includePath
|
||||
* @param includePath
|
||||
* the absolute path of the include
|
||||
* @return IIncludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath) {
|
||||
return newIncludeEntry(resourcePath, includePath, false);
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath) {
|
||||
return newIncludeEntry(resourcePath, basePath, includePath, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* * Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param path
|
||||
* @param resourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param basePath
|
||||
* the base path of the includePath
|
||||
* @param includePath
|
||||
* the absolute path of the include
|
||||
* @param isSystemInclude
|
||||
* whether this include path should be consider a system include path
|
||||
* @return IIncludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude) {
|
||||
return newIncludeEntry(resourcePath, includePath, isSystemInclude, IncludeEntry.NO_EXCLUSION_PATTERNS);
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath, boolean isSystemInclude) {
|
||||
return newIncludeEntry(resourcePath, basePath, includePath, isSystemInclude, IncludeEntry.NO_EXCLUSION_PATTERNS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param path
|
||||
* @param resoourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param basePath
|
||||
* the base path of the includePath
|
||||
* @param includePath
|
||||
* the absolute path of the include
|
||||
* @param isSystemInclude
|
||||
|
@ -460,43 +443,19 @@ public class CoreModel {
|
|||
* exclusion patterns in the resource if a container
|
||||
* @return IIincludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude, IPath[] exclusionPathterns) {
|
||||
return newIncludeEntry(resourcePath, includePath, null, isSystemInclude, exclusionPathterns);
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath, boolean isSystemInclude, IPath[] exclusionPathterns) {
|
||||
return newIncludeEntry(resourcePath, basePath, includePath, isSystemInclude, exclusionPathterns, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param path
|
||||
* @param resourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param includePath
|
||||
* the path of the include
|
||||
* @param basePath
|
||||
* the base path of the include
|
||||
* @param isSystemInclude
|
||||
* wheter this include path should be consider the system
|
||||
* include path
|
||||
* @param isRecursive
|
||||
* if the resource is a folder the include applied to all
|
||||
* recursively
|
||||
* @param exclusionPatterns
|
||||
* exclusion patterns in the resource if a container
|
||||
* @return IIincludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, IPath basePath, boolean isSystemInclude,
|
||||
IPath[] exclusionPatterns) {
|
||||
return newIncludeEntry(resourcePath, includePath, basePath, isSystemInclude, exclusionPatterns, resourcePath == null || resourcePath.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param path
|
||||
* the affected project-relative resource path
|
||||
* @param includePath
|
||||
* the path of the include
|
||||
* @param basePath
|
||||
* the base path of the include
|
||||
* @param isSystemInclude
|
||||
* wheter this include path should be consider the system
|
||||
* include path
|
||||
|
@ -506,44 +465,31 @@ public class CoreModel {
|
|||
* if the entry ix exported to reference projects
|
||||
* @return IIincludeEntry
|
||||
*/
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath includePath, IPath basePath, boolean isSystemInclude,
|
||||
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath, boolean isSystemInclude,
|
||||
IPath[] exclusionPatterns, boolean isExported) {
|
||||
return new IncludeEntry(resourcePath, includePath, basePath, isSystemInclude, exclusionPatterns, isExported);
|
||||
return new IncludeEntry(resourcePath, basePath, null, includePath, isSystemInclude, exclusionPatterns, isExported);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
* Creates and returns a new entry of kind <code>CDT_INCLUDE</code>
|
||||
*
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
* @param macroValue
|
||||
* the value of the macro
|
||||
* @return
|
||||
* @param resourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param baseRef
|
||||
* the base reference path of the include
|
||||
* @param includePath
|
||||
* the path of the include
|
||||
* @return IIincludeEntry
|
||||
*/
|
||||
public static IMacroEntry newMacroEntry(String macroName, String macroValue) {
|
||||
return newMacroEntry(null, macroName, macroValue);
|
||||
public static IIncludeEntry newIncludeRefEntry(IPath resourcePath, IPath baseRef, IPath includePath) {
|
||||
return new IncludeEntry(resourcePath, null, baseRef, includePath, false, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
*
|
||||
* @param path
|
||||
* the affected workspace-relative resource path
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
* @param macroValue
|
||||
* the value of the macro
|
||||
* @return
|
||||
*/
|
||||
public static IMacroEntry newMacroEntry(IPath basePath, String macroName) {
|
||||
return newMacroEntry(null, basePath, macroName, null, MacroEntry.NO_EXCLUSION_PATTERNS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
*
|
||||
* @param path
|
||||
* the affected workspace-relative resource path
|
||||
* the affected project-relative resource path
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
* @param macroValue
|
||||
|
@ -557,8 +503,8 @@ public class CoreModel {
|
|||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
*
|
||||
* @param path
|
||||
* the affected workspace-relative resource path
|
||||
* @param resourcePath
|
||||
* the affected project-relative resource path
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
* @param macroValue
|
||||
|
@ -568,13 +514,13 @@ public class CoreModel {
|
|||
* @return
|
||||
*/
|
||||
public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||
return newMacroEntry(resourcePath, null, macroName, macroValue, exclusionPatterns);
|
||||
return newMacroEntry(resourcePath, macroName, macroValue, exclusionPatterns, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
*
|
||||
* @param path
|
||||
* @param resourcePath
|
||||
* the affected workspace-relative resource path
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
|
@ -584,9 +530,25 @@ public class CoreModel {
|
|||
* exclusion patterns in the resource if a container
|
||||
* @return
|
||||
*/
|
||||
public static IMacroEntry newMacroEntry(IPath resourcePath, IPath basePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||
return new MacroEntry(resourcePath, basePath, macroName, macroValue, exclusionPatterns);
|
||||
public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue, IPath[] exclusionPatterns, boolean isExported) {
|
||||
return new MacroEntry(resourcePath, null, macroName, macroValue, exclusionPatterns, isExported);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an entry kind <code>CDT_MACRO</code>
|
||||
*
|
||||
* @param resourcePath
|
||||
* the affected workspace-relative resource path
|
||||
* @param baseRef
|
||||
* the base reference path
|
||||
* @param macroName
|
||||
* the name of the macro
|
||||
* @return
|
||||
*/
|
||||
public static IMacroEntry newMacroRefEntry(IPath resourcePath, IPath baseRef, String macroName) {
|
||||
return new MacroEntry(resourcePath, baseRef, macroName, null, MacroEntry.NO_EXCLUSION_PATTERNS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Answers the project specific value for a given container. In case this
|
||||
* container path could not be resolved, then will answer <code>null</code>.
|
||||
|
|
|
@ -28,6 +28,13 @@ public interface IIncludeEntry extends IPathEntry {
|
|||
*/
|
||||
IPath getBasePath();
|
||||
|
||||
/**
|
||||
* Return the reference path
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IPath getBaseReference();
|
||||
|
||||
/**
|
||||
* Whether or not it a system include path
|
||||
* @return boolean
|
||||
|
|
|
@ -63,4 +63,11 @@ public interface ILibraryEntry extends IPathEntry {
|
|||
*/
|
||||
IPath getBasePath();
|
||||
|
||||
/**
|
||||
* Return the base reference.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IPath getBaseReference();
|
||||
|
||||
}
|
||||
|
|
|
@ -41,4 +41,10 @@ public interface IMacroEntry extends IPathEntry {
|
|||
*/
|
||||
IPath getBasePath();
|
||||
|
||||
/**
|
||||
* return the base reference
|
||||
* IMacroEntry
|
||||
*/
|
||||
IPath getBaseReference();
|
||||
|
||||
}
|
||||
|
|
|
@ -84,6 +84,10 @@ public interface IPathEntry {
|
|||
*/
|
||||
boolean isExported();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return IPath
|
||||
*/
|
||||
IPath getPath();
|
||||
|
||||
}
|
||||
|
|
|
@ -13,23 +13,32 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public abstract class APathEntry extends PathEntry {
|
||||
|
||||
public static IPath[] NO_EXCLUSION_PATTERNS = {};
|
||||
public final static IPath EMPTY_PATH = new Path("");
|
||||
IPath[] exclusionPatterns;
|
||||
IPath basePath;
|
||||
IPath baseRef;
|
||||
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
|
||||
char[][]fullCharExclusionPatterns = UNINIT_PATTERNS;
|
||||
|
||||
public APathEntry (int kind, IPath path, IPath basePath, IPath[] exclusionPatterns, boolean isExported) {
|
||||
/**
|
||||
*
|
||||
* @param kind
|
||||
* @param basePath
|
||||
* @param baseRef
|
||||
* @param path
|
||||
* @param exclusionPatterns
|
||||
* @param isExported
|
||||
*/
|
||||
public APathEntry (int kind, IPath basePath, IPath baseRef, IPath path, IPath[] exclusionPatterns, boolean isExported) {
|
||||
super(kind, path, isExported);
|
||||
this.basePath = basePath;
|
||||
if (exclusionPatterns == null) {
|
||||
this.exclusionPatterns = NO_EXCLUSION_PATTERNS;
|
||||
} else {
|
||||
this.exclusionPatterns = exclusionPatterns;
|
||||
}
|
||||
this.basePath = (basePath == null) ? EMPTY_PATH : basePath;
|
||||
this.baseRef = (baseRef == null) ? EMPTY_PATH : baseRef;
|
||||
this.exclusionPatterns = (exclusionPatterns == null) ? NO_EXCLUSION_PATTERNS : exclusionPatterns;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,6 +57,14 @@ public abstract class APathEntry extends PathEntry {
|
|||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IPath getBaseReference() {
|
||||
return baseRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a char based representation of the exclusions patterns full path.
|
||||
*/
|
||||
|
|
|
@ -19,9 +19,9 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
|
|||
IPath includePath;
|
||||
boolean isSystemInclude;
|
||||
|
||||
public IncludeEntry(IPath resourcePath, IPath includePath, IPath basePath, boolean isSystemInclude,
|
||||
public IncludeEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath includePath, boolean isSystemInclude,
|
||||
IPath[] exclusionPatterns, boolean isExported) {
|
||||
super(IIncludeEntry.CDT_INCLUDE, resourcePath, basePath, exclusionPatterns, isExported);
|
||||
super(IIncludeEntry.CDT_INCLUDE, basePath, baseRef, resourcePath, exclusionPatterns, isExported);
|
||||
this.includePath = includePath;
|
||||
this.isSystemInclude = isSystemInclude;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,19 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
|
|||
IPath sourceAttachmentRootPath;
|
||||
IPath sourceAttachmentPrefixMapping;
|
||||
|
||||
public LibraryEntry(IPath libraryPath, IPath basePath, IPath sourceAttachmentPath,
|
||||
/**
|
||||
*
|
||||
* @param basePath
|
||||
* @param baseRef
|
||||
* @param libraryPath
|
||||
* @param sourceAttachmentPath
|
||||
* @param sourceAttachmentRootPath
|
||||
* @param sourceAttachmentPrefixMapping
|
||||
* @param isExported
|
||||
*/
|
||||
public LibraryEntry(IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath,
|
||||
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
|
||||
super(ILibraryEntry.CDT_LIBRARY, libraryPath, basePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
|
||||
super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, libraryPath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
|
||||
this.sourceAttachmentPath = sourceAttachmentPath;
|
||||
this.sourceAttachmentRootPath = sourceAttachmentRootPath;
|
||||
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
|
||||
|
|
|
@ -20,8 +20,8 @@ public class MacroEntry extends APathEntry implements IMacroEntry {
|
|||
String macroName;
|
||||
String macroValue;
|
||||
|
||||
public MacroEntry (IPath path, IPath basePath, String macroName, String macroValue, IPath[] exclusionPatterns) {
|
||||
super(IMacroEntry.CDT_MACRO, path, basePath, exclusionPatterns, path == null);
|
||||
public MacroEntry (IPath path, IPath baseRef, String macroName, String macroValue, IPath[] exclusionPatterns, boolean isExported) {
|
||||
super(IMacroEntry.CDT_MACRO, null, baseRef, path, exclusionPatterns, isExported);
|
||||
this.macroName = macroName;
|
||||
this.macroValue = macroValue;
|
||||
}
|
||||
|
|
|
@ -20,12 +20,11 @@ public class OutputEntry extends APathEntry implements IOutputEntry {
|
|||
/**
|
||||
* @param kind
|
||||
* @param path
|
||||
* @param isRecursive
|
||||
* @param exclusionPatterns
|
||||
* @param isExported
|
||||
*/
|
||||
public OutputEntry(IPath path, IPath[] exclusionPatterns, boolean isExported) {
|
||||
super(CDT_OUTPUT, path, null, exclusionPatterns, isExported);
|
||||
super(CDT_OUTPUT, null, null, path, exclusionPatterns, isExported);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
|
|
|
@ -65,7 +65,8 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
static String PATH_ENTRY_ID = "org.eclipse.cdt.core.pathentry"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_KIND = "kind"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_PATH = "path"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_BASE_PATH = "base"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_BASE_PATH = "base-path"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_BASE_REF = "base-ref"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_EXPORTED = "exported"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_SOURCEPATH = "sourcepath"; //$NON-NLS-1$
|
||||
static String ATTRIBUTE_ROOTPATH = "roopath"; //$NON-NLS-1$
|
||||
|
@ -665,19 +666,18 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
isExported = element.getAttribute(ATTRIBUTE_EXPORTED).equals(VALUE_TRUE);
|
||||
}
|
||||
|
||||
// ensure path is absolute
|
||||
//boolean hasPath = element.hasAttribute(ATTRIBUTE_PATH);
|
||||
String pathAttr = element.getAttribute(ATTRIBUTE_PATH);
|
||||
IPath path = new Path(pathAttr);
|
||||
// get path and ensure it is absolute
|
||||
//String pathAttr = element.getAttribute(ATTRIBUTE_PATH);
|
||||
IPath path = new Path(element.getAttribute(ATTRIBUTE_PATH));
|
||||
if (!path.isAbsolute()) {
|
||||
path = projectPath.append(path);
|
||||
}
|
||||
|
||||
// check fo the base path
|
||||
IPath basePath = new Path(""); //$NON-NLS-1$
|
||||
if (element.hasAttribute(ATTRIBUTE_BASE_PATH)) {
|
||||
basePath = new Path(element.getAttribute(ATTRIBUTE_BASE_PATH));
|
||||
}
|
||||
IPath basePath = new Path(element.getAttribute(ATTRIBUTE_BASE_PATH));
|
||||
|
||||
// get the base ref
|
||||
IPath baseRef = new Path(element.getAttribute(ATTRIBUTE_BASE_REF));
|
||||
|
||||
// source attachment info (optional)
|
||||
IPath sourceAttachmentPath = element.hasAttribute(ATTRIBUTE_SOURCEPATH) ? new Path(
|
||||
|
@ -706,7 +706,10 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
case IPathEntry.CDT_PROJECT :
|
||||
return CoreModel.newProjectEntry(path, isExported);
|
||||
case IPathEntry.CDT_LIBRARY :
|
||||
return CoreModel.newLibraryEntry(path, basePath, sourceAttachmentPath, sourceAttachmentRootPath,
|
||||
if (!baseRef.isEmpty()) {
|
||||
return CoreModel.newLibraryRefEntry(baseRef, path);
|
||||
}
|
||||
return CoreModel.newLibraryEntry(basePath, path, sourceAttachmentPath, sourceAttachmentRootPath,
|
||||
sourceAttachmentPrefixMapping, isExported);
|
||||
case IPathEntry.CDT_SOURCE :
|
||||
{
|
||||
|
@ -727,21 +730,25 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
case IPathEntry.CDT_INCLUDE :
|
||||
{
|
||||
// include path info
|
||||
IPath includePath = element.hasAttribute(ATTRIBUTE_INCLUDE)
|
||||
? new Path(element.getAttribute(ATTRIBUTE_INCLUDE))
|
||||
: null;
|
||||
IPath includePath = new Path(element.getAttribute(ATTRIBUTE_INCLUDE));
|
||||
// isSysteminclude
|
||||
boolean isSystemInclude = false;
|
||||
if (element.hasAttribute(ATTRIBUTE_SYSTEM)) {
|
||||
isSystemInclude = element.getAttribute(ATTRIBUTE_SYSTEM).equals(VALUE_TRUE);
|
||||
}
|
||||
return CoreModel.newIncludeEntry(path, includePath, basePath, isSystemInclude, exclusionPatterns, isExported);
|
||||
if (!baseRef.isEmpty()) {
|
||||
return CoreModel.newIncludeRefEntry(path, baseRef, includePath);
|
||||
}
|
||||
return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported);
|
||||
}
|
||||
case IPathEntry.CDT_MACRO :
|
||||
{
|
||||
String macroName = element.getAttribute(ATTRIBUTE_NAME);
|
||||
String macroValue = element.getAttribute(ATTRIBUTE_VALUE);
|
||||
return CoreModel.newMacroEntry(path, basePath, macroName, macroValue, exclusionPatterns);
|
||||
if (!baseRef.isEmpty()) {
|
||||
return CoreModel.newMacroRefEntry(path, baseRef, macroName);
|
||||
}
|
||||
return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns, isExported);
|
||||
}
|
||||
case IPathEntry.CDT_CONTAINER :
|
||||
{
|
||||
|
@ -785,17 +792,18 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
}
|
||||
}
|
||||
|
||||
// Save the path
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
|
||||
// Specifics to the entries
|
||||
if (kind == IPathEntry.CDT_SOURCE) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
} else if (kind == IPathEntry.CDT_OUTPUT) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
} else if (kind == IPathEntry.CDT_LIBRARY) {
|
||||
switch(kind) {
|
||||
case IPathEntry.CDT_SOURCE:
|
||||
case IPathEntry.CDT_OUTPUT:
|
||||
case IPathEntry.CDT_PROJECT:
|
||||
case IPathEntry.CDT_CONTAINER:
|
||||
break;
|
||||
case IPathEntry.CDT_LIBRARY: {
|
||||
ILibraryEntry lib = (ILibraryEntry) entries[i];
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
if (lib.getBasePath() != null) {
|
||||
element.setAttribute(ATTRIBUTE_BASE_PATH, lib.getBasePath().toString());
|
||||
}
|
||||
IPath sourcePath = lib.getSourceAttachmentPath();
|
||||
if (sourcePath != null) {
|
||||
// translate to project relative from absolute
|
||||
|
@ -813,38 +821,38 @@ public class PathEntryManager implements ICDescriptorListener {
|
|||
if (lib.getSourceAttachmentPrefixMapping() != null) {
|
||||
element.setAttribute(ATTRIBUTE_PREFIXMAPPING, lib.getSourceAttachmentPrefixMapping().toString());
|
||||
}
|
||||
} else if (kind == IPathEntry.CDT_PROJECT) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
} else if (kind == IPathEntry.CDT_INCLUDE) {
|
||||
break;
|
||||
}
|
||||
case IPathEntry.CDT_INCLUDE: {
|
||||
IIncludeEntry include = (IIncludeEntry) entries[i];
|
||||
if (!xmlPath.isEmpty()) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
}
|
||||
if (include.getBasePath() != null) {
|
||||
element.setAttribute(ATTRIBUTE_BASE_PATH, include.getBasePath().toString());
|
||||
}
|
||||
IPath includePath = include.getIncludePath();
|
||||
element.setAttribute(ATTRIBUTE_INCLUDE, includePath.toString());
|
||||
if (include.isSystemInclude()) {
|
||||
element.setAttribute(ATTRIBUTE_SYSTEM, VALUE_TRUE);
|
||||
}
|
||||
} else if (kind == IPathEntry.CDT_MACRO) {
|
||||
break;
|
||||
}
|
||||
case IPathEntry.CDT_MACRO: {
|
||||
IMacroEntry macro = (IMacroEntry) entries[i];
|
||||
if (!xmlPath.isEmpty()) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, macro.getPath().toString());
|
||||
}
|
||||
if (macro.getBasePath() != null) {
|
||||
element.setAttribute(ATTRIBUTE_BASE_PATH, macro.getBasePath().toString());
|
||||
}
|
||||
element.setAttribute(ATTRIBUTE_NAME, macro.getMacroName());
|
||||
element.setAttribute(ATTRIBUTE_VALUE, macro.getMacroValue());
|
||||
} else if (kind == IPathEntry.CDT_CONTAINER) {
|
||||
element.setAttribute(ATTRIBUTE_PATH, xmlPath.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entries[i] instanceof APathEntry) {
|
||||
APathEntry entry = (APathEntry) entries[i];
|
||||
|
||||
// save the basePath or the baseRef
|
||||
IPath basePath = entry.getBasePath();
|
||||
IPath baseRef = entry.getBaseReference();
|
||||
if (basePath != null && !basePath.isEmpty()) {
|
||||
element.setAttribute(ATTRIBUTE_BASE_PATH, basePath.toString());
|
||||
} else if (baseRef != null && !baseRef.isEmpty()) {
|
||||
element.setAttribute(ATTRIBUTE_BASE_REF, baseRef.toString());
|
||||
}
|
||||
|
||||
// Save the exclusions attributes
|
||||
if (entries[i] instanceof APathEntry) {
|
||||
APathEntry entry = (APathEntry) entries[i];
|
||||
IPath[] exclusionPatterns = entry.getExclusionPatterns();
|
||||
if (exclusionPatterns.length > 0) {
|
||||
StringBuffer excludeRule = new StringBuffer(10);
|
||||
|
|
|
@ -17,8 +17,13 @@ import org.eclipse.core.runtime.IPath;
|
|||
|
||||
public class SourceEntry extends APathEntry implements ISourceEntry {
|
||||
|
||||
public SourceEntry(IPath path, IPath[] exclusionPatterns) {
|
||||
super(ISourceEntry.CDT_SOURCE, path, null, exclusionPatterns, false);
|
||||
/**
|
||||
*
|
||||
* @param path
|
||||
* @param exclusionPatterns
|
||||
*/
|
||||
public SourceEntry(IPath sourcePath, IPath[] exclusionPatterns) {
|
||||
super(ISourceEntry.CDT_SOURCE, null, null, sourcePath, exclusionPatterns, false);
|
||||
}
|
||||
|
||||
public boolean equals (Object obj) {
|
||||
|
|
|
@ -34,8 +34,8 @@ public class CPListElement {
|
|||
public static final String SYSTEM_INCLUDE = "systeminclude"; //$NON-NLS-1$
|
||||
public static final String MACRO_NAME = "macroname"; //$NON-NLS-1$
|
||||
public static final String MACRO_VALUE = "macrovalue"; //$NON-NLS-1$
|
||||
public static final String BASE_REF = "baseref"; //$NON-NLS-1$
|
||||
public static final String BASE = "base"; //$NON-NLS-1$
|
||||
public static final String BASE_REF = "base-ref"; //$NON-NLS-1$
|
||||
public static final String BASE = "base-path"; //$NON-NLS-1$
|
||||
|
||||
private ICProject fProject;
|
||||
|
||||
|
@ -123,25 +123,21 @@ public class CPListElement {
|
|||
return CoreModel.newSourceEntry(fPath, exclusionPattern);
|
||||
case IPathEntry.CDT_LIBRARY:
|
||||
IPath attach = (IPath) getAttribute(SOURCEATTACHMENT);
|
||||
return CoreModel.newLibraryEntry(fPath, base, attach, null, null, isExported());
|
||||
return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported());
|
||||
case IPathEntry.CDT_PROJECT:
|
||||
return CoreModel.newProjectEntry(fPath, isExported());
|
||||
case IPathEntry.CDT_CONTAINER:
|
||||
return CoreModel.newContainerEntry(fPath, isExported());
|
||||
case IPathEntry.CDT_INCLUDE:
|
||||
if (base != null) {
|
||||
return CoreModel.newIncludeEntry(fPath, (IPath) getAttribute(INCLUDE), base,
|
||||
return CoreModel.newIncludeEntry(fPath, base, (IPath) getAttribute(INCLUDE),
|
||||
((Boolean) getAttribute(SYSTEM_INCLUDE)).booleanValue(), exclusionPattern);
|
||||
} else {
|
||||
|
||||
}
|
||||
case IPathEntry.CDT_MACRO:
|
||||
if (base != null) {
|
||||
return CoreModel.newMacroEntry(fPath, base, (String) getAttribute(MACRO_NAME),
|
||||
return CoreModel.newMacroEntry(fPath, (String) getAttribute(MACRO_NAME),
|
||||
(String) getAttribute(MACRO_VALUE), exclusionPattern);
|
||||
} else {
|
||||
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue