1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Use Path.EMPTY for empty paths

This commit is contained in:
Alain Magloire 2004-05-06 20:23:14 +00:00
parent da672cbe13
commit 8ca7329e88
5 changed files with 9 additions and 8 deletions

View file

@ -13,6 +13,7 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public abstract class APathEntry extends PathEntry { public abstract class APathEntry extends PathEntry {
@ -34,8 +35,8 @@ public abstract class APathEntry extends PathEntry {
*/ */
public APathEntry (int kind, IPath basePath, IPath baseRef, IPath path, IPath[] exclusionPatterns, boolean isExported) { public APathEntry (int kind, IPath basePath, IPath baseRef, IPath path, IPath[] exclusionPatterns, boolean isExported) {
super(kind, path, isExported); super(kind, path, isExported);
this.basePath = (basePath == null) ? EMPTY_PATH : basePath; this.basePath = (basePath == null) ? Path.EMPTY : basePath;
this.baseRef = (baseRef == null) ? EMPTY_PATH : baseRef; this.baseRef = (baseRef == null) ? Path.EMPTY : baseRef;
this.exclusionPatterns = (exclusionPatterns == null) ? NO_EXCLUSION_PATTERNS : exclusionPatterns; this.exclusionPatterns = (exclusionPatterns == null) ? NO_EXCLUSION_PATTERNS : exclusionPatterns;
} }

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class IncludeEntry extends APathEntry implements IIncludeEntry { public class IncludeEntry extends APathEntry implements IIncludeEntry {
IPath includePath; IPath includePath;
@ -24,7 +25,7 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
public IncludeEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath includePath, boolean isSystemInclude, public IncludeEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath includePath, boolean isSystemInclude,
IPath[] exclusionPatterns, boolean isExported) { IPath[] exclusionPatterns, boolean isExported) {
super(IIncludeEntry.CDT_INCLUDE, basePath, baseRef, resourcePath, exclusionPatterns, isExported); super(IIncludeEntry.CDT_INCLUDE, basePath, baseRef, resourcePath, exclusionPatterns, isExported);
this.includePath = (includePath == null) ? EMPTY_PATH : includePath; this.includePath = (includePath == null) ? Path.EMPTY : includePath;
this.isSystemInclude = isSystemInclude; this.isSystemInclude = isSystemInclude;
} }

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.model.ILibraryEntry;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
public class LibraryEntry extends APathEntry implements ILibraryEntry { public class LibraryEntry extends APathEntry implements ILibraryEntry {
@ -37,7 +38,7 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
public LibraryEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath, public LibraryEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) { IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, resourcePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported); super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, resourcePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
this.libraryPath = (libraryPath == null) ? EMPTY_PATH : libraryPath; this.libraryPath = (libraryPath == null) ? Path.EMPTY : libraryPath;
this.sourceAttachmentPath = sourceAttachmentPath; this.sourceAttachmentPath = sourceAttachmentPath;
this.sourceAttachmentRootPath = sourceAttachmentRootPath; this.sourceAttachmentRootPath = sourceAttachmentRootPath;
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping; this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;

View file

@ -22,10 +22,8 @@ public class PathEntry implements IPathEntry {
protected boolean isExported; protected boolean isExported;
protected IPath path; protected IPath path;
public final static IPath EMPTY_PATH = new Path("");
public PathEntry(int entryKind, IPath path, boolean isExported) { public PathEntry(int entryKind, IPath path, boolean isExported) {
this.path = (path == null) ? EMPTY_PATH : path; this.path = (path == null) ? Path.EMPTY : path;
this.entryKind = entryKind; this.entryKind = entryKind;
this.isExported = isExported; this.isExported = isExported;
} }

View file

@ -234,7 +234,7 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
if (container != null) { if (container != null) {
IPathEntry[] entries = container.getPathEntries(); IPathEntry[] entries = container.getPathEntries();
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
if (entries[i].getEntryKind() == IPathEntry.CDT_INCLUDE) { if (entries[i].getEntryKind() == IPathEntry.CDT_LIBRARY) {
ILibraryEntry refEntry = (ILibraryEntry)entries[i]; ILibraryEntry refEntry = (ILibraryEntry)entries[i];
if (refEntry.getPath().equals(libraryPath)) { if (refEntry.getPath().equals(libraryPath)) {
return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(), return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),