From 47a0ffc0e96e0189a0450183831988577b73fe27 Mon Sep 17 00:00:00 2001
From: Alain Magloire
+ * A project entry is used to denote a prerequisite project.
+ * The ICPathEntry[] entries of the project will be contributed.
+ *
+ * The prerequisite project is referred to using an absolute path relative to the workspace root.
+ *
+ * The resulting entry is not exported to dependent projects. This method is equivalent to
+ *
+ *
+ * @param path the absolute path of the binary archive
+ * @return a new project entry
+ *
+ * @see CoreModel#newProjectEntry(IPath, boolean)
+ */
+ public static IProjectEntry newProjectEntry(IPath path) {
+ return newProjectEntry(path, false);
+ }
+
+ /**
+ * Creates and returns a new entry of kind
+ * A project entry is used to denote a prerequisite project.
+ * All the ICPathEntries of the project will be contributed as a whole.
+ * The prerequisite project is referred to using an absolute path relative to the workspace root.
+ *
+ *
+ * @param path the absolute path of the prerequisite project
+ * @param isExported indicates whether this entry is contributed to dependent
+ * projects in addition to the output location
+ * @return a new project entry
+ */
+ public static IProjectEntry newProjectEntry(IPath path, boolean isExported) {
+ return new ProjectEntry(path, isExported);
+ }
+
+ /**
+ * Creates and returns a new entry of kind
+ * The resulting entry is not exported to dependent projects. This method is equivalent to
+ *
+ * @param containerPath the id of the container
+ * @return a new container entry
+ *
+ */
+ public static IContainerEntry newContainerEntry(String id) {
+ return newContainerEntry(id, false);
+ }
+
+ /**
+ * Creates and returns a new entry of kind
+ * The resulting entry is not exported to dependent projects. This method is equivalent to
+ *
+ */
+ public static IContainerEntry newContainerEntry(String id, boolean isExported) {
+ return new ContainerEntry(id, isExported);
+ }
+
+ /**
+ * Creates and returns a new non-exported entry of kind
+ * The resulting entry is not exported to dependent projects. This method is equivalent to
+ *
+ * @param path the absolute path of the binary archive
+ * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+ * or
+ * @param path the absolute path of the binary archive
+ * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+ * or
+ * The source folder is referred to using an absolute path relative to the
+ * workspace root, e.g. CDT_PROJECT
+ * for the project identified by the given absolute path.
+ * newProjectEntry(path,false)
.
+ * CDT_PROJECT
+ * for the project identified by the given absolute path.
+ * CDT_CONTAINER
+ * for the given path. The path of the container will be used during resolution so as to map this
+ * container entry to a set of other entries the container is acting for.
+ * newContainerEntry(path,false)
.
+ * CDT_CONTAINER
+ * for the given path. The path of the container will be used during resolution so as to map this
+ * container entry to a set of other entries the container is acting for.
+ * newContainerEntry(path,false)
.
+ * CDT_LIBRARY
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.
+ * newLibraryEntry(-,-,-,false)
.
+ * null
if none.
+ * @param sourceAttachmentRootPath the location of the root within the source archive or folder
+ * or null
.
+ * @param sourceAttachmentPrefixMapping prefix mapping
+ * or null
.
+ * @return a new library entry
+ *
+ */
+ public static ILibraryEntry newLibraryEntry(
+ IPath path,
+ IPath sourceAttachmentPath,
+ IPath sourceAttachmentRootPath,
+ IPath sourceAttachmentPrefixMapping) {
+ return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, false);
+ }
+
+ /**
+ * Creates and returns a new non-exported entry of kind CDT_LIBRARY
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.
+ * null
if none.
+ * @param sourceAttachmentRootPath the location of the root within the source archive or folder
+ * or null
.
+ * @param sourceAttachmentPrefixMapping prefix mapping
+ * or null
.
+ * @return a new library entry
+ *
+ */
+ public static ILibraryEntry newLibraryEntry(
+ IPath path,
+ IPath sourceAttachmentPath,
+ IPath sourceAttachmentRootPath,
+ IPath sourceAttachmentPrefixMapping,
+ boolean isExported) {
+ return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping, isExported);
+ }
+
+ /**
+ * Creates and returns a new entry of kind CDT_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path.
+ * /Project/src
. A project's source
+ * folders are located with that project. That is, a source
+ * entry specifying the path /P1/src
is only usable for
+ * project P1
.
+ *
+ * Note that all sources/binaries inside a project are contributed as a whole through
+ * a project entry (see newProjectEntry
). Particular
+ * source entries cannot be selectively exported.
+ *
CDT_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns. This specifies that all package
+ * fragments within the root will have children of type
+ * ICompilationUnit
.
+ *
+ * The source folder is referred to using an absolute path relative to the
+ * workspace root, e.g. /Project/src
. A project's source
+ * folders are located with that project. That is, a source
+ * entry specifying the path /P1/src
is only usable for
+ * project P1
.
+ *
CDT_SOURCE
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns. This specifies that all package
+ * fragments within the root will have children of type
+ * ICompilationUnit
.
+ *
+ * The source folder is referred to using an absolute path relative to the
+ * workspace root, e.g. /Project/src
. A project's source
+ * folders are located with that project. That is, a source
+ * entry specifying the path /P1/src
is only usable for
+ * project P1
.
+ *
null
if using project default ouput location)
+ * @return a new source entry with the given exclusion patterns
+ */
+ public static ISourceEntry newSourceEntry(IPath path, IPath outputLocation, IPath[] exclusionPatterns) {
+ return new SourceEntry(path, outputLocation, true, exclusionPatterns);
+ }
+
+ /**
+ * Creates and returns a new entry of kind CDT_INCLUDE
+ * @param path the affected worksapce-relative resource path
+ * @param includePath the absolute path of the include
+ * @return
+ */
+ public static IIncludeEntry newIncludeEntry(IPath path, IPath includePath) {
+ return newIncludeEntry(path, includePath, false);
+ }
+
+ /**
+ * Creates and returns a new entry of kind CDT_INCLUDE
+ * @param path the affected workspace-relative resource path
+ * @param includePath the absolute path of the include
+ * @param isSystemInclude wheter this include path should be consider the system include path
+ * @return
+ */
+ public static IIncludeEntry newIncludeEntry(IPath path, IPath includePath, boolean isSystemInclude) {
+ return newIncludeEntry(path, includePath, isSystemInclude, true, IncludeEntry.NO_EXCLUSION_PATTERNS, true);
+ }
+
+ /**
+ * Creates and returns a new entry of kind CDT_INCLUDE
+ *
+ * @param path the affected workspace-relative resource path
+ * @param includePath the absolute 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
+ * @param isExported whether this cpath is exported.
+ * @return
+ */
+ public static IIncludeEntry newIncludeEntry(
+ IPath path,
+ IPath includePath,
+ boolean isSystemInclude,
+ boolean isRecursive,
+ IPath[] exclusionPatterns,
+ boolean isExported) {
+ return new IncludeEntry(path, includePath, isSystemInclude, isRecursive, exclusionPatterns, isExported);
+ }
+
+ /**
+ * Creates and returns an entry kind CDT_MACRO
+ * @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 path, String macroName, String macroValue) {
+ return newMacroEntry(path, macroName, macroValue, true, MacroEntry.NO_EXCLUSION_PATTERNS, true);
+ }
+
+ /**
+ * Creates and returns an entry kind CDT_MACRO
+ * @param path the affected workspace-relative resource path
+ * @param macroName the name of the macro
+ * @param macroValue the value of the macro
+ * @param isRecursive if the resource is a folder the include applied to all recursively
+ * @param exclusionPatterns exclusion patterns in the resource if a container
+ * @param isExported whether this cpath is exported.
+ * @return
+ */
+ public static IMacroEntry newMacroEntry(
+ IPath path,
+ String macroName,
+ String macroValue,
+ boolean isRecursive,
+ IPath[] exclusionPatterns,
+ boolean isExported) {
+ return new MacroEntry(path, macroName, macroValue, isRecursive, exclusionPatterns, isExported);
+ }
+
/**
* TODO: this is a temporary hack until, the CDescriptor manager is
* in place and could fire deltas of Parser change.
@@ -206,7 +482,6 @@ public class CoreModel {
private CoreModel() {
}
-
public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
if (workspace.isTreeLocked()) {
@@ -216,13 +491,12 @@ public class CoreModel {
workspace.run(new BatchOperation(action), monitor);
}
}
-
- public void startIndexing()
- {
- manager.getIndexManager().reset();
+
+ public void startIndexing() {
+ manager.getIndexManager().reset();
}
-
- public IndexManager getIndexManager(){
+
+ public IndexManager getIndexManager() {
return manager.getIndexManager();
}
}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICPathEntry.java
new file mode 100644
index 00000000000..2a0562a8c8a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICPathEntry.java
@@ -0,0 +1,96 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+
+public interface ICPathEntry {
+
+ /**
+ * Entry kind constant describing a path entry identifying a
+ * library. A library is an archive containing
+ * consisting of pre-compiled binaries.
+ */
+ int CDT_LIBRARY = 1;
+
+ /**
+ * Entry kind constant describing a path entry identifying a
+ * required project.
+ */
+ int CDT_PROJECT = 2;
+
+ /**
+ * Entry kind constant describing a path entry identifying a
+ * folder containing source code to be compiled.
+ */
+ int CDT_SOURCE = 3;
+
+ /*
+ * Entry kind constant describing a path entry defined using
+ * a path that begins with a variable reference.
+ */
+ int CDT_VARIABLE = 4;
+
+ /**
+ * Entry kind constant describing a path entry identifying a
+ * include path.
+ */
+ int CDT_INCLUDE = 5;
+
+ /**
+ * Entry kind constant describing a path entry representing
+ * a container id.
+ *
+ */
+ int CDT_CONTAINER = 6;
+
+ /**
+ * Entry kind constant describing a path entry representing
+ * a macro definition.
+ *
+ */
+ int CDT_MACRO = 7;
+
+ /**
+ * Entry kind constant describing output location
+ *
+ */
+ int CDT_OUTPUT = 8;
+
+ /**
+ * Returns the kind of this path entry.
+ *
+ * @return one of:
+ * CDT_SOURCE
- this entry describes a source root in
+ its project
+ * CDT_LIBRARY
- this entry describes a library
+ * CDT_PROJECT
- this entry describes another project
+ * CDT_VARIABLE
- this entry describes a project or library
+ * indirectly via a variable in the first segment of the path
+ * CDT_INCLUDE
- this entry describes a include path
+ * CDT_MACRO
- this entry describes a macro definition
+ * CDT_CONTAINER
- this entry describes a container id
+ * CDT_OUTPUT
- this entry describes output location
+ */
+ int getEntryKind();
+
+ /**
+ * Returns whether this entry is exported to dependent projects.
+ * Always returns false
for source entries (kind
+ * CPE_SOURCE
), which cannot be exported.
+ *
+ * @return true
if exported, and false
otherwise
+ */
+ boolean isExported();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IContainerEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IContainerEntry.java
new file mode 100644
index 00000000000..08d88fd0da8
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IContainerEntry.java
@@ -0,0 +1,23 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+public interface IContainerEntry extends ICPathEntry {
+
+ /**
+ * Returns the id identifying this container.
+ * @return String
+ */
+ String getId();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IIncludeEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IIncludeEntry.java
new file mode 100644
index 00000000000..029bc6a0b51
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IIncludeEntry.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IIncludeEntry extends ICPathEntry {
+
+ /**
+ * Returns the affected resource by the include.
+ * @return IPath
+ */
+ IPath getResourcePath();
+
+ /**
+ * Returns the include path
+ * @return IPath
+ */
+ IPath getIncludePath();
+
+ /**
+ * Whether or not it a system include path
+ * @return boolean
+ */
+ boolean isSystemInclude();
+
+ /**
+ * Whether or not the include affects the resource(if it is a folder)
+ * recursively
+ * @return boolean
+ */
+ boolean isRecursive();
+
+ /**
+ * If isRecursive() is true, specify an exclude file patterns.
+ * @return IPath
+ */
+ IPath[] getExclusionPatterns();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryEntry.java
new file mode 100644
index 00000000000..70fd16522e9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ILibraryEntry.java
@@ -0,0 +1,66 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface ILibraryEntry extends ICPathEntry {
+
+ /**
+ * Returns the absolute path of the library
+ * @return String
+ */
+ IPath getLibraryPath();
+
+ /**
+ * Returns the path to the source archive or folder associated with this
+ * C path entry, or null
if this C path entry has no
+ * source attachment.
+ * + * Only library and variable C path entries may have source attachments. + * For library C path entries, the result path (if present) locates a source + * archive or folder. This archive or folder can be located in a project of the + * workspace or outside thr workspace. For variable c path entries, the + * result path (if present) has an analogous form and meaning as the + * variable path, namely the first segment is the name of a c path variable. + *
+ * + * @return the path to the source archive or folder, ornull
if none
+ */
+ IPath getSourceAttachmentPath();
+
+ /**
+ * Returns the path within the source archive or folder where source
+ * are located. An empty path indicates that packages are located at
+ * the root of the source archive or folder. Returns a non-null
value
+ * if and only if getSourceAttachmentPath
returns
+ * a non-null
value.
+ *
+ * @return the path within the source archive or folder, or null
if
+ * not applicable
+ */
+ IPath getSourceAttachmentRootPath();
+
+ /**
+ * Returns the path to map the source paths with to the source achive or folder
+ * An empty path indicates that the is a one-to-one mapping of source paths to the
+ * source achive or folder path. Returns a non-null
value
+ * if and only if getSourceAttachmentPath
returns
+ * a non-null
value.
+ *
+ * @return the path mapping within the source archive or folder, or null
if
+ * not applicable
+ */
+ IPath getSourceAttachmentPrefixMapping();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacroEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacroEntry.java
new file mode 100644
index 00000000000..09fe86024da
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IMacroEntry.java
@@ -0,0 +1,51 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IMacroEntry extends ICPathEntry {
+
+ /**
+ * Returns the absolute path from the worskspace root or
+ * relative path of the affected resource.
+ * @return String
+ */
+ IPath getResourcePath();
+
+ /**
+ * Returns the macro name.
+ * @return String
+ */
+ String getMacroName();
+
+ /**
+ * Returns the macro value.
+ * @return String
+ */
+ String getMacroValue();
+
+ /**
+ * Whether or not the macro is applied recursively.
+ * @return boolean
+ */
+ boolean isRecursive();
+
+ /**
+ * Returns an array of inclusion paths affecting the
+ * resource when looking for files recursively.
+ * @return IPath
+ */
+ IPath[] getExclusionPatterns();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IProjectEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IProjectEntry.java
new file mode 100644
index 00000000000..8f71cc8460b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/IProjectEntry.java
@@ -0,0 +1,26 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+
+public interface IProjectEntry extends ICPathEntry {
+
+ /**
+ * Returns the absolute path relative to the workspace root.
+ * @return IPath
+ */
+ IPath getProjectPath();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceEntry.java
new file mode 100644
index 00000000000..8c8ba72a824
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ISourceEntry.java
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface ISourceEntry extends ICPathEntry {
+
+ /**
+ * Returns the absolute path from the worskspace root or
+ * relative path of the source folder.
+ * @return String
+ */
+ IPath getSourcePath();
+
+ /**
+ * Whether or not to look recursively in the folder.
+ * @return boolean
+ */
+ boolean isRecursive();
+
+ /**
+ * Returns an array of inclusion paths affecting the
+ * source folder when looking for files recursively.
+ * @return IPath
+ */
+ IPath[] getExclusionPatterns();
+
+ /**
+ * Binary output location for this source folder.
+ * @return IPath, null
means to use the
+ * default output location of the project.
+ */
+ IPath getOutputLocation();
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ACPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ACPathEntry.java
new file mode 100644
index 00000000000..78410049aac
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ACPathEntry.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * Created on 25-Mar-2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.core.runtime.IPath;
+
+public abstract class ACPathEntry extends CPathEntry {
+
+ public static IPath[] NO_EXCLUSION_PATTERNS = {};
+ IPath[] exclusionPatterns;
+ boolean isRecursive;
+
+ public ACPathEntry (int kind, boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
+ super(kind, isExported);
+ this.exclusionPatterns = exclusionPatterns;
+ this.isRecursive = isRecursive;
+ }
+
+ /**
+ * Returns the exclusion patterns
+ * @return IPath[]
+ */
+ public IPath[] getExclusionPatterns() {
+ return exclusionPatterns;
+ }
+
+ /**
+ * Whether or not it is recursive
+ * @return boolean
+ */
+ public boolean isRecursive() {
+ return isRecursive;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CPathEntry.java
new file mode 100644
index 00000000000..78e6a1b3d2d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CPathEntry.java
@@ -0,0 +1,133 @@
+/**********************************************************************
+ * Created on 25-Mar-2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.ICPathEntry;
+
+public class CPathEntry implements ICPathEntry {
+
+ public int entryKind;
+ public boolean isExported;
+
+ public CPathEntry(int entryKind, boolean isExported) {
+
+ this.entryKind = entryKind;
+ this.isExported = isExported;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getEntryKind()
+ */
+ public int getEntryKind() {
+ return entryKind;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#isExported()
+ */
+ public boolean isExported() {
+ return isExported;
+ }
+
+ public boolean equals(ICPathEntry otherEntry) {
+ return entryKind == otherEntry.getEntryKind();
+ }
+
+ public boolean equals(Object object) {
+ if (object instanceof ICPathEntry) {
+ return equals((ICPathEntry)object);
+ }
+ return super.equals(object);
+ }
+
+ /**
+ * Returns the kind from its String
form.
+ */
+ static int kindFromString(String kindStr) {
+
+ if (kindStr.equalsIgnoreCase("prj")) //$NON-NLS-1$
+ return ICPathEntry.CDT_PROJECT;
+ if (kindStr.equalsIgnoreCase("var")) //$NON-NLS-1$
+ return ICPathEntry.CDT_VARIABLE;
+ if (kindStr.equalsIgnoreCase("src")) //$NON-NLS-1$
+ return ICPathEntry.CDT_SOURCE;
+ if (kindStr.equalsIgnoreCase("lib")) //$NON-NLS-1$
+ return ICPathEntry.CDT_LIBRARY;
+ if (kindStr.equalsIgnoreCase("inc")) //$NON-NLS-1$
+ return ICPathEntry.CDT_INCLUDE;
+ if (kindStr.equalsIgnoreCase("mac")) //$NON-NLS-1$
+ return ICPathEntry.CDT_MACRO;
+ if (kindStr.equalsIgnoreCase("con")) //$NON-NLS-1$
+ return ICPathEntry.CDT_CONTAINER;
+ return -1;
+ }
+
+ /**
+ * Returns a String
for the kind of a path entry.
+ */
+ static String kindToString(int kind) {
+
+ switch (kind) {
+ case ICPathEntry.CDT_PROJECT :
+ return "prj";
+ case ICPathEntry.CDT_SOURCE :
+ return "src"; //$NON-NLS-1$
+ case ICPathEntry.CDT_LIBRARY :
+ return "lib"; //$NON-NLS-1$
+ case ICPathEntry.CDT_VARIABLE :
+ return "var"; //$NON-NLS-1$
+ case ICPathEntry.CDT_INCLUDE :
+ return "inc"; //$NON-NLS-1$
+ case ICPathEntry.CDT_MACRO :
+ return "mac"; //$NON-NLS-1$
+ case ICPathEntry.CDT_CONTAINER :
+ return "con"; //$NON-NLS-1$
+ default :
+ return "unknown"; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns a printable representation of this classpath entry.
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append('[');
+ switch (getEntryKind()) {
+ case ICPathEntry.CDT_LIBRARY :
+ buffer.append("CDT_LIBRARY"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_PROJECT :
+ buffer.append("CDT_PROJECT"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_SOURCE :
+ buffer.append("CDT_SOURCE"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_VARIABLE :
+ buffer.append("CDT_VARIABLE"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_INCLUDE :
+ buffer.append("CDT_INCLUDE"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_MACRO :
+ buffer.append("CDT_MACRO"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_CONTAINER :
+ buffer.append("CDT_CONTAINER"); //$NON-NLS-1$
+ break;
+ }
+ buffer.append(']');
+ return buffer.toString();
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ContainerEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ContainerEntry.java
new file mode 100644
index 00000000000..e34fb365f3f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ContainerEntry.java
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.IContainerEntry;
+
+public class ContainerEntry extends CPathEntry implements IContainerEntry {
+
+ String id;
+
+ public ContainerEntry(String id, boolean isExported) {
+ super(IContainerEntry.CDT_CONTAINER, isExported);
+ this.id = id;
+ }
+
+ /**
+ * Returns the id identifying this container.
+ * @return String
+ */
+ public String getId() {
+ return id;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
new file mode 100644
index 00000000000..58bca6a6b60
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/IncludeEntry.java
@@ -0,0 +1,56 @@
+/**********************************************************************
+ * Created on 25-Mar-2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.IIncludeEntry;
+import org.eclipse.core.runtime.IPath;
+
+public class IncludeEntry extends ACPathEntry implements IIncludeEntry {
+
+ IPath resourcePath;
+ IPath includePath;
+ boolean isSystemInclude;
+
+ public IncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude,
+ boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
+ super(IIncludeEntry.CDT_INCLUDE, isRecursive, exclusionPatterns, isExported);
+ this.resourcePath = resourcePath;
+ this.includePath = includePath;
+ this.isSystemInclude = isSystemInclude;
+ }
+
+ /**
+ * Returns the affected resource by the include.
+ * @return IPath
+ */
+ public IPath getResourcePath() {
+ return resourcePath;
+ }
+
+ /**
+ * Returns the include path
+ * @return IPath
+ */
+ public IPath getIncludePath() {
+ return includePath;
+ }
+
+ /**
+ * Whether or not it a system include path
+ * @return boolean
+ */
+ public boolean isSystemInclude() {
+ return isSystemInclude;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
new file mode 100644
index 00000000000..46c055097b6
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/LibraryEntry.java
@@ -0,0 +1,89 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.ILibraryEntry;
+import org.eclipse.core.runtime.IPath;
+
+public class LibraryEntry extends CPathEntry implements ILibraryEntry {
+
+ IPath libraryPath;
+ IPath sourceAttachmentPath;
+ IPath sourceAttachmentRootPath;
+ IPath sourceAttachmentPrefixMapping;
+
+ public LibraryEntry(IPath libraryPath, IPath sourceAttachmentPath,
+ IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
+ super(ILibraryEntry.CDT_LIBRARY, isExported);
+ this.libraryPath = libraryPath;
+ this.sourceAttachmentPath = sourceAttachmentPath;
+ this.sourceAttachmentRootPath = sourceAttachmentRootPath;
+ this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
+ }
+
+ /**
+ * Returns the absolute path of the library
+ * @return String
+ */
+ public IPath getLibraryPath() {
+ return libraryPath;
+ }
+
+ /**
+ * Returns the path to the source archive or folder associated with this
+ * C path entry, or null
if this C path entry has no
+ * source attachment.
+ * + * Only library and variable C path entries may have source attachments. + * For library C path entries, the result path (if present) locates a source + * archive or folder. This archive or folder can be located in a project of the + * workspace or outside thr workspace. For variable c path entries, the + * result path (if present) has an analogous form and meaning as the + * variable path, namely the first segment is the name of a c path variable. + *
+ * + * @return the path to the source archive or folder, ornull
if none
+ */
+ public IPath getSourceAttachmentPath() {
+ return sourceAttachmentPath;
+ }
+
+ /**
+ * Returns the path within the source archive or folder where source
+ * are located. An empty path indicates that packages are located at
+ * the root of the source archive or folder. Returns a non-null
value
+ * if and only if getSourceAttachmentPath
returns
+ * a non-null
value.
+ *
+ * @return the path within the source archive or folder, or null
if
+ * not applicable
+ */
+ public IPath getSourceAttachmentRootPath() {
+ return sourceAttachmentRootPath;
+ }
+
+ /**
+ * Returns the path to map the source paths with to the source achive or folder
+ * An empty path indicates that the is a one-to-one mapping of source paths to the
+ * source achive or folder path. Returns a non-null
value
+ * if and only if getSourceAttachmentPath
returns
+ * a non-null
value.
+ *
+ * @return the path mapping within the source archive or folder, or null
if
+ * not applicable
+ */
+ public IPath getSourceAttachmentPrefixMapping() {
+ return sourceAttachmentPrefixMapping;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java
new file mode 100644
index 00000000000..48662fd1c49
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MacroEntry.java
@@ -0,0 +1,57 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.IMacroEntry;
+import org.eclipse.core.runtime.IPath;
+
+public class MacroEntry extends ACPathEntry implements IMacroEntry {
+
+ IPath resourcePath;
+ String macroName;
+ String macroValue;
+
+ public MacroEntry (IPath resourcePath, String macroName, String macroValue,
+ boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
+ super(IMacroEntry.CDT_MACRO, isRecursive, exclusionPatterns, isExported);
+ this.resourcePath = resourcePath;
+ this.macroName = macroName;
+ this.macroValue = macroValue;
+ }
+
+ /**
+ * Returns the absolute path from the worskspace root or
+ * relative path of the affected resource.
+ * @return String
+ */
+ public IPath getResourcePath() {
+ return resourcePath;
+ }
+
+ /**
+ * Returns the macro name.
+ * @return String
+ */
+ public String getMacroName() {
+ return macroName;
+ }
+
+ /**
+ * Returns the macro value.
+ * @return String
+ */
+ public String getMacroValue() {
+ return macroName;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ProjectEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ProjectEntry.java
new file mode 100644
index 00000000000..4fa1e47bebb
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ProjectEntry.java
@@ -0,0 +1,36 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.IProjectEntry;
+import org.eclipse.core.runtime.IPath;
+
+
+public class ProjectEntry extends CPathEntry implements IProjectEntry {
+
+ IPath projectPath;
+
+ public ProjectEntry(IPath projectPath, boolean isExported) {
+ super(IProjectEntry.CDT_PROJECT, isExported);
+ this.projectPath = projectPath;
+ }
+
+ /**
+ * Returns the absolute path relative to the workspace root.
+ * @return IPath
+ */
+ public IPath getProjectPath() {
+ return projectPath;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceEntry.java
new file mode 100644
index 00000000000..9dc82ab1741
--- /dev/null
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceEntry.java
@@ -0,0 +1,47 @@
+/**********************************************************************
+ * Created on Mar 25, 2003
+ *
+ * Copyright (c) 2002,2003 QNX Software Systems Ltd. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.model;
+
+import org.eclipse.cdt.core.model.ISourceEntry;
+import org.eclipse.core.runtime.IPath;
+
+public class SourceEntry extends ACPathEntry implements ISourceEntry {
+
+ IPath sourcePath;
+ IPath outputLocation;
+
+ public SourceEntry(IPath sourcePath, IPath outputLocation, boolean isRecursive, IPath[] exclusionPatterns) {
+ super(ISourceEntry.CDT_SOURCE, isRecursive, exclusionPatterns, false);
+ this.sourcePath = sourcePath;
+ this.outputLocation = outputLocation;
+ }
+
+ /**
+ * Returns the absolute path from the worskspace root or
+ * relative path of the source folder.
+ * @return String
+ */
+ public IPath getSourcePath() {
+ return sourcePath;
+ }
+
+ /**
+ * Binary output location for this source folder.
+ * @return IPath, null
means to use the
+ * default output location of the project.
+ */
+ public IPath getOutputLocation() {
+ return outputLocation;
+ }
+
+}