[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] new ICPathEntry in core
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.78
diff -u -r1.78 ChangeLog
--- ChangeLog 27 Mar 2003 20:07:43 -0000 1.78
+++ ChangeLog 28 Mar 2003 20:54:28 -0000
@@ -1,3 +1,28 @@
+2003-03-28 David Inglis
+
+ * src/org/eclipse/cdt/core/AbstractCExtension.java
+ * src/org/eclipse/cdt/core/CCorePlugin.java
+ * src/org/eclipse/cdt/core/ICDescriptor.java
+ * src/org/eclipse/cdt/core/ICExtension.java
+ * src/org/eclipse/cdt/core/ICExtensionReference.java
+ * src/org/eclipse/cdt/core/ICOwner.java
+ * src/org/eclipse/cdt/core/ICOwnerInfo.java
+ * src/org/eclipse/cdt/core/ICPathEntry.java
+ * src/org/eclipse/cdt/internal/CCorePluginResources.properties
+ * src/org/eclipse/cdt/internal/core/CDescriptor.java
+ * src/org/eclipse/cdt/internal/core/CDescriptorManager.java
+ * src/org/eclipse/cdt/internal/core/CExtensionInfo.java
+ * src/org/eclipse/cdt/internal/core/CExtensionReference.java
+ * src/org/eclipse/cdt/internal/core/COwner.java
+ * src/org/eclipse/cdt/internal/core/CPathEntry.java
+ * src/org/eclipse/cdt/internal/core/InternalCExtension.java
+
+ Add new ICPathEntry interface with persistancy, access is via the ICDecriptor
+ which uses the .cdtproject file for the store. creation is through CCorePlugin.
+
+ - included is some copyright header changes and the move of the properties file
+ to 'internal'
+
2003-03-27 Alain Magloire
* model/org/eclipse/cdt/internal/core/model/BinaryContainer.java:
* model/org/eclipse/cdt/internal/core/model/ArchiveContainer.java:
Index: src/org/eclipse/cdt/core/AbstractCExtension.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/AbstractCExtension.java,v
retrieving revision 1.1
diff -u -r1.1 AbstractCExtension.java
--- src/org/eclipse/cdt/core/AbstractCExtension.java 6 Sep 2002 20:16:04 -0000 1.1
+++ src/org/eclipse/cdt/core/AbstractCExtension.java 28 Mar 2003 20:54:28 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.cdt.internal.core.InternalCExtension;
Index: src/org/eclipse/cdt/core/CCorePlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java,v
retrieving revision 1.13
diff -u -r1.13 CCorePlugin.java
--- src/org/eclipse/cdt/core/CCorePlugin.java 4 Mar 2003 18:25:40 -0000 1.13
+++ src/org/eclipse/cdt/core/CCorePlugin.java 28 Mar 2003 20:54:28 -0000
@@ -13,6 +13,7 @@
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.CDescriptorManager;
+import org.eclipse.cdt.internal.core.CPathEntry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
@@ -21,6 +22,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -54,9 +56,7 @@
static {
try {
- fgResourceBundle =
- ResourceBundle.getBundle(
- "org.eclipse.cdt.internal.CCorePluginResources");
+ fgResourceBundle = ResourceBundle.getBundle("org.eclipse.cdt.internal.core.CCorePluginResources");
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
@@ -77,9 +77,7 @@
}
public static String getFormattedString(String key, String arg) {
- return MessageFormat.format(
- getResourceString(key),
- new String[] { arg });
+ return MessageFormat.format(getResourceString(key), new String[] { arg });
}
public static String getFormattedString(String key, String[] args) {
@@ -133,22 +131,15 @@
public IConsole getConsole(String id) {
try {
- IExtensionPoint extension =
- getDescriptor().getExtensionPoint("CBuildConsole");
+ IExtensionPoint extension = getDescriptor().getExtensionPoint("CBuildConsole");
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements =
- extensions[i].getConfigurationElements();
+ IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
- String builderID =
- configElements[j].getAttribute("builderID");
- if ((id == null && builderID == null)
- || (id != null && builderID.equals(id))) {
- return (
- IConsole) configElements[j]
- .createExecutableExtension(
- "class");
+ String builderID = configElements[j].getAttribute("builderID");
+ if ((id == null && builderID == null) || (id != null && builderID.equals(id))) {
+ return (IConsole) configElements[j].createExecutableExtension("class");
}
}
}
@@ -210,13 +201,11 @@
return IndexModel.getDefault();
}
- public ICDescriptor getCProjectDescription(IProject project)
- throws CoreException {
+ public ICDescriptor getCProjectDescription(IProject project) throws CoreException {
return fDescriptorManager.getDescriptor(project);
}
- public void mapCProjectOwner(IProject project, String id, boolean override)
- throws CoreException {
+ public void mapCProjectOwner(IProject project, String id, boolean override) throws CoreException {
if (!override) {
fDescriptorManager.configure(project, id);
} else {
@@ -258,9 +247,7 @@
projectHandle.open(monitor);
// Add C Nature ... does not add duplicates
- CProjectNature.addCNature(
- projectHandle,
- new SubProgressMonitor(monitor, 1));
+ CProjectNature.addCNature(projectHandle, new SubProgressMonitor(monitor, 1));
mapCProjectOwner(projectHandle, projectID, false);
} finally {
//monitor.done();
@@ -279,10 +266,7 @@
* @throws CoreException
*/
- public void convertProjectFromCtoCC(
- IProject projectHandle,
- IProgressMonitor monitor)
- throws CoreException {
+ public void convertProjectFromCtoCC(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
if ((projectHandle != null)
&& projectHandle.hasNature(CCProjectNature.C_NATURE_ID)
&& !projectHandle.hasNature(CCProjectNature.CC_NATURE_ID)) {
@@ -297,10 +281,7 @@
* @param monitor
* @exception CoreException
*/
- public void addDefaultCBuilder(
- IProject projectHandle,
- IProgressMonitor monitor)
- throws CoreException {
+ public void addDefaultCBuilder(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
// Set the Default C Builder.
CProjectNature.addCBuildSpec(projectHandle, monitor);
}
@@ -319,11 +300,7 @@
* @exception CoreException
*/
- public void convertProjectToC(
- IProject projectHandle,
- IProgressMonitor monitor,
- String projectID)
- throws CoreException {
+ public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID) throws CoreException {
this.convertProjectToC(projectHandle, monitor, projectID, true);
}
@@ -342,20 +319,13 @@
* @exception CoreException
*/
- public void convertProjectToC(
- IProject projectHandle,
- IProgressMonitor monitor,
- String projectID,
- boolean addMakeBuilder)
+ public void convertProjectToC(IProject projectHandle, IProgressMonitor monitor, String projectID, boolean addMakeBuilder)
throws CoreException {
- if ((projectHandle == null)
- || (monitor == null)
- || (projectID == null)) {
+ if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
return;
}
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProjectDescription description =
- workspace.newProjectDescription(projectHandle.getName());
+ IProjectDescription description = workspace.newProjectDescription(projectHandle.getName());
description.setLocation(projectHandle.getFullPath());
createCProject(description, projectHandle, monitor, projectID);
if (addMakeBuilder) {
@@ -374,22 +344,12 @@
* @exception CoreException
*/
- public void convertProjectToCC(
- IProject projectHandle,
- IProgressMonitor monitor,
- String projectID,
- boolean addMakeBuilder)
+ public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID, boolean addMakeBuilder)
throws CoreException {
- if ((projectHandle == null)
- || (monitor == null)
- || (projectID == null)) {
+ if ((projectHandle == null) || (monitor == null) || (projectID == null)) {
return;
}
- createCProject(
- projectHandle.getDescription(),
- projectHandle,
- monitor,
- projectID);
+ createCProject(projectHandle.getDescription(), projectHandle, monitor, projectID);
// now add C++ nature
convertProjectFromCtoCC(projectHandle, monitor);
if (addMakeBuilder) {
@@ -408,11 +368,7 @@
* @exception CoreException
*/
- public void convertProjectToCC(
- IProject projectHandle,
- IProgressMonitor monitor,
- String projectID)
- throws CoreException {
+ public void convertProjectToCC(IProject projectHandle, IProgressMonitor monitor, String projectID) throws CoreException {
this.convertProjectToCC(projectHandle, monitor, projectID, true);
}
@@ -425,35 +381,82 @@
// }
public IProcessList getProcessList() {
- IExtensionPoint extension =
- getDescriptor().getExtensionPoint("ProcessList");
+ IExtensionPoint extension = getDescriptor().getExtensionPoint("ProcessList");
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
- IConfigurationElement[] configElements =
- extensions[0].getConfigurationElements();
+ IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
if (configElements.length != 0) {
try {
- return (
- IProcessList) configElements[0]
- .createExecutableExtension(
- "class");
+ return (IProcessList) configElements[0].createExecutableExtension("class");
} catch (CoreException e) {
}
}
}
return null;
}
-
+
// Preference to turn on/off the new parser
-
+
private boolean useNewParser = false;
-
+
public void setUseNewParser(boolean useNewParser) {
this.useNewParser = useNewParser;
}
-
+
public boolean useNewParser() {
return useNewParser;
}
+ /**
+ * @param path
+ * @return
+ */
+ public static ICPathEntry newProjectEntry(IPath path) {
+ return new CPathEntry(ICPathEntry.CDT_PROJECT, path, CPathEntry.NO_EXCLUSION_PATTERNS, null, null, null);
+ }
+
+ /**
+ * @param path
+ * @param sourceAttachmentPath
+ * @param sourceAttachmentRootPath
+ * @return
+ */
+ public static ICPathEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IPath sourceAttachmentRootPrefixMapping) {
+ return new CPathEntry(
+ ICPathEntry.CDT_LIBRARY,
+ path,
+ CPathEntry.NO_EXCLUSION_PATTERNS,
+ sourceAttachmentPath,
+ sourceAttachmentRootPath,
+ sourceAttachmentRootPrefixMapping);
+ }
+
+ /**
+ * @param path
+ * @param exclusionPatterns
+ * @param outputLocation
+ * @return
+ */
+ public static ICPathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
+ return new CPathEntry(ICPathEntry.CDT_SOURCE, path, exclusionPatterns, null, null, null);
+ }
+
+ /**
+ * @param path
+ * @param sourceAttachmentPath
+ * @param sourceAttachmentRootPath
+ * @return
+ */
+ public static ICPathEntry newVariableEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath) {
+ return new CPathEntry(ICPathEntry.CDT_VARIABLE, path, null, sourceAttachmentPath, sourceAttachmentRootPath, null);
+ }
+
+ /**
+ * @param path
+ * @param exclusionPatterns
+ * @return
+ */
+ public static ICPathEntry newIncludeEntry(IPath path, IPath[] exclusionPatterns) {
+ return new CPathEntry(ICPathEntry.CDT_INCLUDE, path, exclusionPatterns, null, null, null);
+ }
}
Index: src/org/eclipse/cdt/core/ICDescriptor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICDescriptor.java,v
retrieving revision 1.3
diff -u -r1.3 ICDescriptor.java
--- src/org/eclipse/cdt/core/ICDescriptor.java 19 Feb 2003 19:29:04 -0000 1.3
+++ src/org/eclipse/cdt/core/ICDescriptor.java 28 Mar 2003 20:54:28 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.core.resources.IProject;
@@ -18,4 +24,7 @@
public void remove(ICExtensionReference extension) throws CoreException;
public void remove(String extensionPoint) throws CoreException;
+
+ public void setPathEntries(ICPathEntry[] entries) throws CoreException;
+ public ICPathEntry[] getPathEntries();
}
Index: src/org/eclipse/cdt/core/ICExtension.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtension.java,v
retrieving revision 1.1
diff -u -r1.1 ICExtension.java
--- src/org/eclipse/cdt/core/ICExtension.java 6 Sep 2002 20:16:04 -0000 1.1
+++ src/org/eclipse/cdt/core/ICExtension.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.core.resources.IProject;
Index: src/org/eclipse/cdt/core/ICExtensionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICExtensionReference.java,v
retrieving revision 1.2
diff -u -r1.2 ICExtensionReference.java
--- src/org/eclipse/cdt/core/ICExtensionReference.java 19 Feb 2003 19:29:04 -0000 1.2
+++ src/org/eclipse/cdt/core/ICExtensionReference.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.core.runtime.CoreException;
Index: src/org/eclipse/cdt/core/ICOwner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwner.java,v
retrieving revision 1.3
diff -u -r1.3 ICOwner.java
--- src/org/eclipse/cdt/core/ICOwner.java 19 Feb 2003 19:29:04 -0000 1.3
+++ src/org/eclipse/cdt/core/ICOwner.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+* 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;
import org.eclipse.core.runtime.CoreException;
Index: src/org/eclipse/cdt/core/ICOwnerInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ICOwnerInfo.java,v
retrieving revision 1.2
diff -u -r1.2 ICOwnerInfo.java
--- src/org/eclipse/cdt/core/ICOwnerInfo.java 23 Sep 2002 17:08:16 -0000 1.2
+++ src/org/eclipse/cdt/core/ICOwnerInfo.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
public interface ICOwnerInfo {
Index: src/org/eclipse/cdt/core/ICPathEntry.java
===================================================================
RCS file: src/org/eclipse/cdt/core/ICPathEntry.java
diff -N src/org/eclipse/cdt/core/ICPathEntry.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/core/ICPathEntry.java 28 Mar 2003 20:54:29 -0000
@@ -0,0 +1,205 @@
+/**********************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.IPath;
+
+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;
+
+ /**
+ * Returns the kind of this path entry.
+ *
+ * @return one of:
+ * <ul>
+ * <li><code>CDT_SOURCE</code> - this entry describes a source root in
+ its project
+ * <li><code>CDT_LIBRARY</code> - this entry describes a library
+ * <li><code>CDT_PROJECT</code> - this entry describes another project
+ * <li><code>CDT_VARIABLE</code> - this entry describes a project or library
+ * indirectly via a variable in the first segment of the path
+ * <li><code>CDT_INCLUDE</code> - this entry describes a include path
+ */
+ int getEntryKind();
+
+ /**
+ * Returns the set of patterns used to exclude resources associated with
+ * this source entry.
+ * <p>
+ * Exclusion patterns allow specified portions of the resource tree rooted
+ * at this source entry's path to be filtered out. If no exclusion patterns
+ * are specified, this source entry includes all relevent files. Each path
+ * specified must be a relative path, and will be interpreted relative
+ * to this source entry's path. File patterns are case-sensitive. A file
+ * matched by one or more of these patterns is excluded from the
+ * corresponding ICContainer.
+ * </p>
+ * <p>
+ * The pattern mechanism is similar to Ant's. Each pattern is represented as
+ * a relative path. The path segments can be regular file or folder names or simple patterns
+ * involving standard wildcard characters.
+ * </p>
+ * <p>
+ * '*' matches 0 or more characters within a segment. So
+ * <code>*.c</code> matches <code>.c</code>, <code>a.c</code>
+ * and <code>Foo.c</code>, but not <code>Foo.properties</code>
+ * (does not end with <code>.c</code>).
+ * </p>
+ * <p>
+ * '?' matches 1 character within a segment. So <code>?.c</code>
+ * matches <code>a.c</code>, <code>A.c</code>,
+ * but not <code>.c</code> or <code>xyz.c</code> (neither have
+ * just one character before <code>.c</code>).
+ * </p>
+ * <p>
+ * Combinations of *'s and ?'s are allowed.
+ * </p>
+ * <p>
+ * The special pattern '**' matches zero or more segments. A path
+ * like <code>tests/</code> that ends in a trailing separator is interpreted
+ * as <code>tests/**</code>, and would match all files under the
+ * the folder named <code>tests</code>.
+ * </p>
+ * <p>
+ * Examples:
+ * <ul>
+ * <li>
+ * <code>tests/**</code> (or simply <code>tests/</code>)
+ * matches all files under a root folder
+ * named <code>tests</code>. This includes <code>tests/Foo.c</code>
+ * and <code>tests/example/Foo.c</code>, but not
+ * <code>com/example/tests/Foo.c</code> (not under a root folder named
+ * <code>tests</code>).
+ * </li>
+ * <li>
+ * <code>tests/*</code> matches all files directly below a root
+ * folder named <code>tests</code>. This includes <code>tests/Foo.c</code>
+ * and <code>tests/FooHelp.c</code>
+ * but not <code>tests/example/Foo.c</code> (not directly under
+ * a folder named <code>tests</code>) or
+ * <code>example/Foo.c</code> (not under a folder named <code>tests</code>).
+ * </li>
+ * <li>
+ * <code>**/tests/**</code> matches all files under any
+ * folder named <code>tests</code>. This includes <code>tests/Foo.c</code>,
+ * <code>examples/tests/Foo.c</code>, and
+ * <code>examples/tests/unit/Foo.c</code>, but not
+ * <code>example/Foo.c</code> (not under a folder named
+ * <code>tests</code>).
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @return the possibly empty list of resource exclusion patterns
+ * associated with this source entry, and <code>null</code> for other
+ * kinds of classpath entries
+ * @since 2.1
+ */
+ IPath[] getExclusionPatterns();
+
+ /**
+ * Returns the path of this CPathEntry entry.
+ *
+ * The meaning of the path of a classpath entry depends on its entry kind:<ul>
+ * <li>Source code in the current project (<code>CDT_SOURCE</code>) -
+ * The path associated with this entry is the absolute path to the root folder. </li>
+ * <li>A binary library in the current project (<code>CDT_LIBRARY</code>) - the path
+ * associated with this entry is the absolute path to the library, and
+ * in case it refers to an external lib, then there is no associated resource in
+ * the workbench.
+ * <li>A required project (<code>CPE_PROJECT</code>) - the path of the entry denotes the
+ * path to the corresponding project resource.</li>
+ * <li>A variable entry (<code>CPE_VARIABLE</code>) - the first segment of the path
+ * is the name of a CPath variable. If this CPath variable
+ * is bound to the path <it>P</it>, the path of the corresponding classpath entry
+ * is computed by appending to <it>P</it> the segments of the returned
+ * path without the variable.</li>
+ * <li>Include path in the current project (<code>CDT_INCLUDE</code>) -
+ * The path associated with this entry is the absolute path to the include folder. </li>
+ * </ul>
+ *
+ * @return the path of this classpath entry
+ */
+ IPath getPath();
+
+ /**
+ * Returns the path to the source archive or folder associated with this
+ * C path entry, or <code>null</code> if this C path entry has no
+ * source attachment.
+ * <p>
+ * 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.
+ * </p>
+ *
+ * @return the path to the source archive or folder, or <code>null</code> 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-<code>null</code> value
+ * if and only if <code>getSourceAttachmentPath</code> returns
+ * a non-<code>null</code> value.
+ *
+ * @return the path within the source archive or folder, or <code>null</code> 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-<code>null</code> value
+ * if and only if <code>getSourceAttachmentPath</code> returns
+ * a non-<code>null</code> value.
+ *
+ * @return the path mapping within the source archive or folder, or <code>null</code> if
+ * not applicable
+ */
+ IPath getSourceAttachmentPrefixMapping();
+}
Index: src/org/eclipse/cdt/internal/CCorePluginResources.properties
===================================================================
RCS file: src/org/eclipse/cdt/internal/CCorePluginResources.properties
diff -N src/org/eclipse/cdt/internal/CCorePluginResources.properties
--- src/org/eclipse/cdt/internal/CCorePluginResources.properties 24 Nov 2002 16:06:55 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
-################################################
-#
-# (c) Copyright QNX Software Systems Ltd. 2002.
-# All Rights Reserved.
-#
-################################################
-CBuilder.build_error= Build Error
\ No newline at end of file
Index: src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
===================================================================
RCS file: src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
diff -N src/org/eclipse/cdt/internal/core/CCorePluginResources.properties
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/core/CCorePluginResources.properties 28 Mar 2003 20:54:29 -0000
@@ -0,0 +1,7 @@
+################################################
+#
+# (c) Copyright QNX Software Systems Ltd. 2002.
+# All Rights Reserved.
+#
+################################################
+CBuilder.build_error= Build Error
\ No newline at end of file
Index: src/org/eclipse/cdt/internal/core/CDescriptor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptor.java,v
retrieving revision 1.7
diff -u -r1.7 CDescriptor.java
--- src/org/eclipse/cdt/internal/core/CDescriptor.java 28 Feb 2003 21:29:08 -0000 1.7
+++ src/org/eclipse/cdt/internal/core/CDescriptor.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import java.io.ByteArrayInputStream;
@@ -10,6 +16,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -27,6 +34,7 @@
import org.eclipse.cdt.core.ICExtension;
import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.ICOwnerInfo;
+import org.eclipse.cdt.core.ICPathEntry;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -37,6 +45,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginRegistry;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.w3c.dom.Document;
@@ -46,15 +55,18 @@
import org.w3c.dom.NodeList;
public class CDescriptor implements ICDescriptor {
+ private ICPathEntry[] fPathEntries = new ICPathEntry[0];
private COwner fOwner;
private IProject fProject;
private HashMap extMap = new HashMap(4);
private HashMap extInfoMap = new HashMap(4);
- final static String DESCRIPTION_FILE_NAME = ".cdtproject";
- private final static String PROJECT_DESCRIPTION = "cdtproject";
- private final static String PROJECT_EXTENSION = "extension";
- private final static String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
+ static final String DESCRIPTION_FILE_NAME = ".cdtproject";
+ private static final char[][] NO_CHAR_CHAR = new char[0][];
+ private static final String PROJECT_DESCRIPTION = "cdtproject";
+ private static final String PROJECT_EXTENSION = "extension";
+ private static final String PROJECT_EXTENSION_ATTRIBUTE = "attribute";
+ private static final String PATH_ENTRY = "cpathentry";
private boolean fDirty;
private boolean autoSave;
@@ -71,8 +83,9 @@
if (descriptionPath.toFile().exists()) {
IStatus status;
- readCDTProject(descriptionPath);
- if (fOwner.getID().equals(id)) {
+ String ownerID = readCDTProject(descriptionPath);
+ if (ownerID.equals(id)) {
+ fOwner = new COwner(ownerID);
status =
new Status(
IStatus.WARNING,
@@ -108,7 +121,7 @@
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
throw new CoreException(status);
}
- readCDTProject(descriptionPath);
+ fOwner = new COwner(readCDTProject(descriptionPath));
}
protected CDescriptor(IProject project, COwner owner) throws CoreException {
@@ -125,19 +138,25 @@
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "CDTProject file not found", (Throwable) null);
throw new CoreException(status);
}
+ readCDTProject(descriptionPath);
fOwner = owner;
- readProjectExtensions(getCDTProjectNode(descriptionPath));
+ setDirty();
+ }
+
+ protected COwner getOwner() {
+ return fOwner;
}
- protected Node getCDTProjectNode(IPath descriptionPath) throws CoreException {
+ private String readCDTProject(IPath descriptionPath) throws CoreException {
FileInputStream file = null;
try {
file = new FileInputStream(descriptionPath.toFile());
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(file);
Node node = document.getFirstChild();
- if (node.getNodeName().equals(PROJECT_DESCRIPTION))
- return node;
+ if (node.getNodeName().equals(PROJECT_DESCRIPTION)) {
+ return readProjectDescription(node);
+ }
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Missing cdtproject element", null);
throw new CoreException(status);
} catch (Exception e) {
@@ -153,12 +172,7 @@
}
}
- protected void readCDTProject(IPath projectLocation) throws CoreException {
- Node node = getCDTProjectNode(projectLocation);
- fOwner = readProjectDescription(node);
- }
-
- protected IPath getProjectDefaultLocation(IProject project) {
+ private IPath getProjectDefaultLocation(IProject project) {
return Platform.getLocation().append(project.getFullPath());
}
@@ -245,48 +259,6 @@
return info;
}
- protected Node searchNode(Node target, String tagName) {
- NodeList list = target.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- if (list.item(i).getNodeName().equals(tagName))
- return list.item(i);
- }
- return null;
- }
-
- protected String getString(Node target, String tagName) {
- Node node = searchNode(target, tagName);
- return node != null ? (node.getFirstChild() == null ? null : node.getFirstChild().getNodeValue()) : null;
- }
-
- private COwner readProjectDescription(Node node) throws CoreException {
- COwner owner = null;
- NamedNodeMap attrib = node.getAttributes();
- owner = new COwner(attrib.getNamedItem("id").getNodeValue());
- readProjectExtensions(node);
- return owner;
- }
-
- private void readProjectExtensions(Node node) throws CoreException {
- NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- if (list.item(i).getNodeName().equals(PROJECT_EXTENSION)) {
- NamedNodeMap attrib = list.item(i).getAttributes();
- ICExtensionReference ext =
- create(attrib.getNamedItem("point").getNodeValue(), attrib.getNamedItem("id").getNodeValue());
- NodeList extAttrib = list.item(i).getChildNodes();
- for (int j = 0; j < extAttrib.getLength(); j++) {
- if (extAttrib.item(j).getNodeName().equals(PROJECT_EXTENSION_ATTRIBUTE)) {
- attrib = extAttrib.item(j).getAttributes();
- ext.setExtensionData(
- attrib.getNamedItem("key").getNodeValue(),
- attrib.getNamedItem("value").getNodeValue());
- }
- }
- }
- }
- }
-
protected void saveInfo() throws CoreException {
String xml;
if (!isDirty()) {
@@ -310,6 +282,14 @@
fDirty = false;
}
+ public boolean isAutoSave() {
+ return autoSave;
+ }
+
+ public void setAutoSave(boolean autoSave) {
+ this.autoSave = autoSave;
+ }
+
protected void setDirty() throws CoreException {
fDirty = true;
if (isAutoSave())
@@ -325,19 +305,153 @@
OutputFormat format = new OutputFormat();
format.setIndenting(true);
format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$
-
- Serializer serializer = SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$
- format);
+ Serializer serializer =
+ SerializerFactory.getSerializerFactory(Method.XML).makeSerializer(new OutputStreamWriter(s, "UTF8"), format);
serializer.asDOMSerializer().serialize(doc);
return s.toString("UTF8"); //$NON-NLS-1$
}
+ private String readProjectDescription(Node node) throws CoreException {
+ Node childNode;
+ ArrayList pathEntries = new ArrayList();
+ String ownerID = node.getAttributes().getNamedItem("id").getNodeValue();
+ NodeList list = node.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ childNode = list.item(i);
+ if ( childNode.getNodeType() == Node.ELEMENT_NODE ) {
+ if (childNode.getNodeName().equals(PROJECT_EXTENSION)) {
+ decodeProjectExtension((Element)node);
+ } else if (childNode.getNodeName().equals(PATH_ENTRY)) {
+ ICPathEntry entry = decodePathEntry((Element)node);
+ if (entry != null) {
+ pathEntries.add(entry);
+ }
+ }
+ }
+ }
+ return ownerID;
+ }
+
+ private void decodeProjectExtension(Element element) throws CoreException {
+ ICExtensionReference ext = create(element.getAttribute("point"), element.getAttribute("id"));
+ NodeList extAttrib = element.getChildNodes();
+ for (int j = 0; j < extAttrib.getLength(); j++) {
+ if (extAttrib.item(j).getNodeName().equals(PROJECT_EXTENSION_ATTRIBUTE)) {
+ NamedNodeMap attrib = extAttrib.item(j).getAttributes();
+ ext.setExtensionData(attrib.getNamedItem("key").getNodeValue(), attrib.getNamedItem("value").getNodeValue());
+ }
+ }
+ }
+
+ private ICPathEntry decodePathEntry(Element element) throws CoreException {
+ IPath projectPath = fProject.getProject().getFullPath();
+ String kindAttr = element.getAttribute("kind"); //$NON-NLS-1$
+ String pathAttr = element.getAttribute("path"); //$NON-NLS-1$
+
+ // ensure path is absolute
+ IPath path = new Path(pathAttr);
+ int kind = CPathEntry.kindFromString(kindAttr);
+ if (kind != ICPathEntry.CDT_VARIABLE && !path.isAbsolute()) {
+ path = projectPath.append(path);
+ }
+ // source attachment info (optional)
+ IPath sourceAttachmentPath = element.hasAttribute("sourcepath") ? new Path(element.getAttribute("sourcepath")) : null;
+ IPath sourceAttachmentRootPath = element.hasAttribute("rootpath") ? new Path(element.getAttribute("rootpath")) : null;
+ IPath sourceAttachmentPrefixMapping =
+ element.hasAttribute("prefixmapping") ? new Path(element.getAttribute("prefixmapping")) : null;
+
+ // exclusion patterns (optional)
+ String exclusion = element.getAttribute("excluding"); //$NON-NLS-1$
+ IPath[] exclusionPatterns = CPathEntry.NO_EXCLUSION_PATTERNS;
+ if (!exclusion.equals("")) { //$NON-NLS-1$
+ char[][] patterns = splitOn('|', exclusion.toCharArray());
+ int patternCount;
+ if ((patternCount = patterns.length) > 0) {
+ exclusionPatterns = new IPath[patternCount];
+ for (int j = 0; j < patterns.length; j++) {
+ exclusionPatterns[j] = new Path(new String(patterns[j]));
+ }
+ }
+ }
+
+ // recreate the CP entry
+ switch (kind) {
+
+ case ICPathEntry.CDT_PROJECT :
+ return CCorePlugin.newProjectEntry(path);
+
+ case ICPathEntry.CDT_LIBRARY :
+ return CCorePlugin.newLibraryEntry(
+ path,
+ sourceAttachmentPath,
+ sourceAttachmentRootPath,
+ sourceAttachmentPrefixMapping);
+
+ case ICPathEntry.CDT_SOURCE :
+ // must be an entry in this project or specify another project
+ String projSegment = path.segment(0);
+ if (projSegment != null && projSegment.equals(fProject.getName())) { // this project
+ return CCorePlugin.newSourceEntry(path, exclusionPatterns);
+ } else { // another project
+ return CCorePlugin.newProjectEntry(path);
+ }
+
+ case ICPathEntry.CDT_VARIABLE :
+ return CCorePlugin.newVariableEntry(path, sourceAttachmentPath, sourceAttachmentRootPath);
+
+ case ICPathEntry.CDT_INCLUDE :
+ return CCorePlugin.newIncludeEntry(path, exclusionPatterns);
+
+ default :
+ {
+ IStatus status =
+ new Status(
+ IStatus.ERROR,
+ CCorePlugin.PLUGIN_ID,
+ -1,
+ "CPathEntry: unknown kind (" + kindAttr + ")",
+ (Throwable) null);
+ throw new CoreException(status);
+ }
+ }
+ }
+
+ private char[][] splitOn(char divider, char[] array) {
+ int length = array == null ? 0 : array.length;
+
+ if (length == 0)
+ return NO_CHAR_CHAR;
+
+ int wordCount = 1;
+ for (int i = 0; i < length; i++)
+ if (array[i] == divider)
+ wordCount++;
+ char[][] split = new char[wordCount][];
+ int last = 0, currentWord = 0;
+ for (int i = 0; i < length; i++) {
+ if (array[i] == divider) {
+ split[currentWord] = new char[i - last];
+ System.arraycopy(array, last, split[currentWord++], 0, i - last);
+ last = i + 1;
+ }
+ }
+ split[currentWord] = new char[length - last];
+ System.arraycopy(array, last, split[currentWord], 0, length - last);
+ return split;
+ }
+
protected String getAsXML() throws IOException {
- Element element;
Document doc = new DocumentImpl();
Element configRootElement = doc.createElement(PROJECT_DESCRIPTION);
doc.appendChild(configRootElement);
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
+ encodeProjectExtensions(doc, configRootElement);
+ encodePathEntries(doc, configRootElement);
+ return serializeDocument(doc);
+ }
+
+ private void encodeProjectExtensions(Document doc, Element configRootElement) {
+ Element element;
Iterator extIterator = extMap.values().iterator();
while (extIterator.hasNext()) {
CExtensionReference extension[] = (CExtensionReference[]) extIterator.next();
@@ -358,15 +472,58 @@
}
}
}
- return serializeDocument(doc);
}
- public boolean isAutoSave() {
- return autoSave;
+ private void encodePathEntries(Document doc, Element configRootElement) {
+ Element element;
+ IPath projectPath = fProject.getProject().getFullPath();
+ for (int i = 0; i < fPathEntries.length; i++) {
+ configRootElement.appendChild(element = doc.createElement(PATH_ENTRY));
+ element.setAttribute("kind", CPathEntry.kindToString(fPathEntries[i].getEntryKind())); //$NON-NLS-1$
+ IPath xmlPath = fPathEntries[i].getPath();
+ if (fPathEntries[i].getEntryKind() != ICPathEntry.CDT_VARIABLE) {
+ // translate to project relative from absolute (unless a device path)
+ if (xmlPath.isAbsolute()) {
+ if (projectPath != null && projectPath.isPrefixOf(xmlPath)) {
+ if (xmlPath.segment(0).equals(projectPath.segment(0))) {
+ xmlPath = xmlPath.removeFirstSegments(1);
+ xmlPath = xmlPath.makeRelative();
+ } else {
+ xmlPath = xmlPath.makeAbsolute();
+ }
+ }
+ }
+ }
+ element.setAttribute("path", xmlPath.toString()); //$NON-NLS-1$
+ if (fPathEntries[i].getSourceAttachmentPath() != null) {
+ element.setAttribute("sourcepath", fPathEntries[i].getSourceAttachmentPath().toString()); //$NON-NLS-1$
+ }
+ if (fPathEntries[i].getSourceAttachmentRootPath() != null) {
+ element.setAttribute("rootpath", fPathEntries[i].getSourceAttachmentRootPath().toString()); //$NON-NLS-1$
+ }
+ if (fPathEntries[i].getSourceAttachmentPrefixMapping() != null) {
+ element.setAttribute("prefixmapping", fPathEntries[i].getSourceAttachmentPrefixMapping().toString()); //$NON-NLS-1$
+ }
+ IPath[] exclusionPatterns = fPathEntries[i].getExclusionPatterns();
+ if (exclusionPatterns.length > 0) {
+ StringBuffer excludeRule = new StringBuffer(10);
+ for (int j = 0, max = exclusionPatterns.length; j < max; j++) {
+ if (j > 0)
+ excludeRule.append('|');
+ excludeRule.append(exclusionPatterns[j]);
+ }
+ element.setAttribute("excluding", excludeRule.toString()); //$NON-NLS-1$
+ }
+ }
}
- public void setAutoSave(boolean autoSave) {
- this.autoSave = autoSave;
+ public void setPathEntries(ICPathEntry[] entries) throws CoreException {
+ fPathEntries = entries;
+ setDirty();
+ }
+
+ public ICPathEntry[] getPathEntries() {
+ return fPathEntries;
}
protected ICExtension createExtensions(ICExtensionReference ext) throws CoreException {
Index: src/org/eclipse/cdt/internal/core/CDescriptorManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDescriptorManager.java,v
retrieving revision 1.9
diff -u -r1.9 CDescriptorManager.java
--- src/org/eclipse/cdt/internal/core/CDescriptorManager.java 28 Feb 2003 21:29:08 -0000 1.9
+++ src/org/eclipse/cdt/internal/core/CDescriptorManager.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import java.util.HashMap;
@@ -116,8 +122,7 @@
else
throw e;
}
- COwner cowner = new COwner(id);
- cowner.configure(project, cproject);
+ cproject.getOwner().configure(project, cproject);
cproject.saveInfo();
cproject.setAutoSave(true);
fDescriptorMap.put(project, cproject);
@@ -128,34 +133,10 @@
if ( fDescriptorMap == null ) {
fDescriptorMap = new HashMap();
}
- COwner cowner = new COwner(id);
- cproject = new CDescriptor(project, cowner);
- cowner.configure(project, cproject);
+ cproject = new CDescriptor(project, new COwner(id));
+ cproject.getOwner().configure(project, cproject);
cproject.saveInfo();
cproject.setAutoSave(true);
fDescriptorMap.put(project, cproject);
}
-
- /**
- * Must remove an existing .cdtproject file before we generate a new one when converting
- */
-// public static void removeExistingCdtProjectFile(IProject project){
-// IFile file = project.getFile(CDescriptor.DESCRIPTION_FILE_NAME);
-// IProgressMonitor monitor = new NullProgressMonitor();
-//
-// // update the resource content
-// if ((file != null) && file.exists()) {
-// try{
-// file.delete(true, monitor);
-// // remove reference from the fDescriptorMap
-// if (fDescriptorMap != null){
-// fDescriptorMap.remove(project);
-// }
-//
-// project.refreshLocal(1, monitor);
-// }catch(CoreException ce){
-// CCorePlugin.log(ce);
-// }
-// }
-// }
}
Index: src/org/eclipse/cdt/internal/core/CExtensionInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionInfo.java,v
retrieving revision 1.1
diff -u -r1.1 CExtensionInfo.java
--- src/org/eclipse/cdt/internal/core/CExtensionInfo.java 6 Sep 2002 20:16:04 -0000 1.1
+++ src/org/eclipse/cdt/internal/core/CExtensionInfo.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,14 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */package org.eclipse.cdt.internal.core;
+/**********************************************************************
+ * 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;
import java.util.HashMap;
Index: src/org/eclipse/cdt/internal/core/CExtensionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CExtensionReference.java,v
retrieving revision 1.2
diff -u -r1.2 CExtensionReference.java
--- src/org/eclipse/cdt/internal/core/CExtensionReference.java 19 Feb 2003 19:29:04 -0000 1.2
+++ src/org/eclipse/cdt/internal/core/CExtensionReference.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.cdt.core.ICExtension;
Index: src/org/eclipse/cdt/internal/core/COwner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/COwner.java,v
retrieving revision 1.7
diff -u -r1.7 COwner.java
--- src/org/eclipse/cdt/internal/core/COwner.java 8 Nov 2002 20:16:29 -0000 1.7
+++ src/org/eclipse/cdt/internal/core/COwner.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.cdt.core.CCorePlugin;
Index: src/org/eclipse/cdt/internal/core/CPathEntry.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/core/CPathEntry.java
diff -N src/org/eclipse/cdt/internal/core/CPathEntry.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/core/CPathEntry.java 28 Mar 2003 20:54:29 -0000
@@ -0,0 +1,263 @@
+/**********************************************************************
+ * 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;
+
+import org.eclipse.cdt.core.ICPathEntry;
+import org.eclipse.core.runtime.IPath;
+
+public class CPathEntry implements ICPathEntry {
+
+ public int entryKind;
+
+ public IPath path;
+
+ public IPath[] exclusionPatterns;
+
+ public IPath sourceAttachmentPath;
+
+ public IPath sourceAttachmentRootPath;
+
+ public IPath sourceAttachmentPrefixMapping;
+
+ private char[][] fullCharExclusionPatterns;
+ private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray()}; //$NON-NLS-1$
+
+ /**
+ * Default exclusion pattern set
+ */
+ public final static IPath[] NO_EXCLUSION_PATTERNS = {
+ };
+
+ public CPathEntry(
+ int entryKind,
+ IPath path,
+ IPath[] exclusionPatterns,
+ IPath sourceAttachmentPath,
+ IPath sourceAttachmentRootPath,
+ IPath sourceAttachmentPrefixMapping) {
+
+ this.entryKind = entryKind;
+ this.path = path;
+ this.exclusionPatterns = exclusionPatterns;
+ if (exclusionPatterns.length > 0) {
+ this.fullCharExclusionPatterns = UNINIT_PATTERNS;
+ }
+ this.sourceAttachmentPath = sourceAttachmentPath;
+ this.sourceAttachmentRootPath = sourceAttachmentRootPath;
+ this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
+ }
+
+ /*
+ * Returns a char based representation of the exclusions patterns full path.
+ */
+ public char[][] fullExclusionPatternChars() {
+
+ if (this.fullCharExclusionPatterns == UNINIT_PATTERNS) {
+ int length = this.exclusionPatterns.length;
+ this.fullCharExclusionPatterns = new char[length][];
+ IPath prefixPath = path.removeTrailingSeparator();
+ for (int i = 0; i < length; i++) {
+ this.fullCharExclusionPatterns[i] = prefixPath.append(this.exclusionPatterns[i]).toString().toCharArray();
+ }
+ }
+ return this.fullCharExclusionPatterns;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getEntryKind()
+ */
+ public int getEntryKind() {
+ return this.entryKind;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getExclusionPatterns()
+ */
+ public IPath[] getExclusionPatterns() {
+ return this.exclusionPatterns;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getPath()
+ */
+ public IPath getPath() {
+ return this.path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getSourceAttachmentPath()
+ */
+ public IPath getSourceAttachmentPath() {
+ return this.sourceAttachmentPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getSourceAttachmentRootPath()
+ */
+ public IPath getSourceAttachmentRootPath() {
+ return this.sourceAttachmentRootPath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.ICPathEntry#getSourceAttachmentPrefixMapping()
+ */
+ public IPath getSourceAttachmentPrefixMapping() {
+ return this.sourceAttachmentPrefixMapping;
+ }
+
+ /**
+ * Returns true if the given object is a classpath entry
+ * with equivalent attributes.
+ */
+ public boolean equals(Object object) {
+ if (this == object)
+ return true;
+ if (object instanceof ICPathEntry) {
+ ICPathEntry otherEntry = (ICPathEntry) object;
+
+ if (this.entryKind != otherEntry.getEntryKind())
+ return false;
+
+ if (!this.path.equals(otherEntry.getPath()))
+ return false;
+
+ IPath otherPath = otherEntry.getSourceAttachmentPath();
+ if (this.sourceAttachmentPath == null) {
+ if (otherPath != null)
+ return false;
+ } else {
+ if (!this.sourceAttachmentPath.equals(otherPath))
+ return false;
+ }
+
+ otherPath = otherEntry.getSourceAttachmentRootPath();
+ if (this.sourceAttachmentRootPath == null) {
+ if (otherPath != null)
+ return false;
+ } else {
+ if (!this.sourceAttachmentRootPath.equals(otherPath))
+ return false;
+ }
+
+ IPath[] otherExcludes = otherEntry.getExclusionPatterns();
+ if (this.exclusionPatterns != otherExcludes) {
+ int excludeLength = this.exclusionPatterns.length;
+ if (otherExcludes.length != excludeLength)
+ return false;
+ for (int i = 0; i < excludeLength; i++) {
+ // compare toStrings instead of IPaths
+ // since IPath.equals is specified to ignore trailing separators
+ if (!this.exclusionPatterns[i].toString().equals(otherExcludes[i].toString()))
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the hash code for this classpath entry
+ */
+ public int hashCode() {
+ return this.path.hashCode();
+ }
+ /**
+ * Returns the kind of a <code>PackageFragmentRoot</code> from its <code>String</code> 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;
+ return -1;
+ }
+
+ /**
+ * Returns a <code>String</code> for the kind of a class 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$
+ default :
+ return "unknown"; //$NON-NLS-1$
+ }
+ }
+ /**
+ * Returns a printable representation of this classpath entry.
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(getPath().toString());
+ buffer.append('[');
+ switch (getEntryKind()) {
+ case ICPathEntry.CDT_LIBRARY :
+ buffer.append("CPE_LIBRARY"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_PROJECT :
+ buffer.append("CPE_PROJECT"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_SOURCE :
+ buffer.append("CPE_SOURCE"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_VARIABLE :
+ buffer.append("CPE_VARIABLE"); //$NON-NLS-1$
+ break;
+ case ICPathEntry.CDT_INCLUDE :
+ buffer.append("CPE_INCLUDE"); //$NON-NLS-1$
+ break;
+ }
+ buffer.append(']');
+ if (getSourceAttachmentPath() != null) {
+ buffer.append("[sourcePath:"); //$NON-NLS-1$
+ buffer.append(getSourceAttachmentPath());
+ buffer.append(']');
+ }
+ if (getSourceAttachmentRootPath() != null) {
+ buffer.append("[rootPath:"); //$NON-NLS-1$
+ buffer.append(getSourceAttachmentRootPath());
+ buffer.append(']');
+ }
+ IPath[] patterns = getExclusionPatterns();
+ int length;
+ if ((length = patterns.length) > 0) {
+ buffer.append("[excluding:"); //$NON-NLS-1$
+ for (int i = 0; i < length; i++) {
+ buffer.append(patterns[i]);
+ if (i != length - 1) {
+ buffer.append('|');
+ }
+ }
+ buffer.append(']');
+ }
+ return buffer.toString();
+ }
+}
Index: src/org/eclipse/cdt/internal/core/InternalCExtension.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/InternalCExtension.java,v
retrieving revision 1.1
diff -u -r1.1 InternalCExtension.java
--- src/org/eclipse/cdt/internal/core/InternalCExtension.java 6 Sep 2002 20:16:04 -0000 1.1
+++ src/org/eclipse/cdt/internal/core/InternalCExtension.java 28 Mar 2003 20:54:29 -0000
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software System Ltd. 2002.
- * All Rights Reserved.
- */
+/**********************************************************************
+ * 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;
import org.eclipse.cdt.core.ICExtensionReference;