mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 22:55:26 +02:00
Remove reference to the old ICPathEntry implementation.
This commit is contained in:
parent
887fa350de
commit
a5ae618c54
5 changed files with 0 additions and 684 deletions
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.core.resources.IConsole;
|
|||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.cdt.internal.core.CDTLogWriter;
|
||||
import org.eclipse.cdt.internal.core.CDescriptorManager;
|
||||
import org.eclipse.cdt.internal.core.CPathEntry;
|
||||
import org.eclipse.cdt.internal.core.model.BufferManager;
|
||||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||
import org.eclipse.cdt.internal.core.model.DeltaProcessor;
|
||||
|
@ -41,7 +40,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
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;
|
||||
|
@ -709,59 +707,6 @@ public class CCorePlugin extends Plugin {
|
|||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
private static final String MODEL = CCorePlugin.PLUGIN_ID + "/debug/model" ; //$NON-NLS-1$
|
||||
private static final String INDEXER = CCorePlugin.PLUGIN_ID + "/debug/indexer";
|
||||
private static final String INDEX_MANAGER = CCorePlugin.PLUGIN_ID + "/debug/indexmanager";
|
||||
|
|
|
@ -26,9 +26,6 @@ public interface ICDescriptor {
|
|||
public void remove(ICExtensionReference extension) throws CoreException;
|
||||
public void remove(String extensionPoint) throws CoreException;
|
||||
|
||||
public void setPathEntries(ICPathEntry[] entries) throws CoreException;
|
||||
public ICPathEntry[] getPathEntries();
|
||||
|
||||
public Element getProjectData(String id) throws CoreException;
|
||||
public void saveProjectData() throws CoreException;
|
||||
}
|
||||
|
|
|
@ -1,205 +0,0 @@
|
|||
/**********************************************************************
|
||||
* 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();
|
||||
}
|
|
@ -35,7 +35,6 @@ import org.eclipse.cdt.core.ICDescriptor;
|
|||
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;
|
||||
|
@ -46,7 +45,6 @@ import org.eclipse.core.runtime.IExtensionPoint;
|
|||
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;
|
||||
|
@ -56,7 +54,6 @@ import org.w3c.dom.Node;
|
|||
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);
|
||||
|
@ -332,12 +329,6 @@ public class CDescriptor implements ICDescriptor {
|
|||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
} else if (childNode.getNodeName().equals(PATH_ENTRY)) {
|
||||
try {
|
||||
pathEntries.add(decodePathEntry((Element) childNode));
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
} else if (childNode.getNodeName().equals(PROJECT_DATA)) {
|
||||
try {
|
||||
decodeProjectData((Element)childNode);
|
||||
|
@ -347,7 +338,6 @@ public class CDescriptor implements ICDescriptor {
|
|||
}
|
||||
}
|
||||
}
|
||||
fPathEntries = (ICPathEntry[]) pathEntries.toArray(new ICPathEntry[0]);
|
||||
}
|
||||
|
||||
private void decodeProjectExtension(Element element) throws CoreException {
|
||||
|
@ -361,102 +351,6 @@ public class CDescriptor implements ICDescriptor {
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
Document doc = new DocumentImpl();
|
||||
|
@ -464,7 +358,6 @@ public class CDescriptor implements ICDescriptor {
|
|||
doc.appendChild(configRootElement);
|
||||
configRootElement.setAttribute("id", fOwner.getID()); //$NON-NLS-1$
|
||||
encodeProjectExtensions(doc, configRootElement);
|
||||
encodePathEntries(doc, configRootElement);
|
||||
encodeProjectData(doc, configRootElement);
|
||||
return serializeDocument(doc);
|
||||
}
|
||||
|
@ -493,57 +386,6 @@ public class CDescriptor implements ICDescriptor {
|
|||
}
|
||||
}
|
||||
|
||||
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 setPathEntries(ICPathEntry[] entries) throws CoreException {
|
||||
fPathEntries = entries;
|
||||
setDirty();
|
||||
}
|
||||
|
||||
public ICPathEntry[] getPathEntries() {
|
||||
return fPathEntries;
|
||||
}
|
||||
|
||||
protected ICExtension createExtensions(ICExtensionReference ext) throws CoreException {
|
||||
InternalCExtension cExtension = null;
|
||||
|
|
|
@ -1,263 +0,0 @@
|
|||
/**********************************************************************
|
||||
* 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue