1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Move the getPath() method in the IPathEntry base class.

This commit is contained in:
Alain Magloire 2004-02-24 22:21:11 +00:00
parent b4309ac47a
commit 6904bc4b71
22 changed files with 74 additions and 150 deletions

View file

@ -1,3 +1,18 @@
2004-02-24 Alain Magloire
Bug fix the binary runner thread could get interrupted
on shutdown we should check:
Thread.getCurrentThread().isInterrupted()
and bring down the thread.
* model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
2004-02-23 Alain Magloire
Another refactoring, to make the API lighter
move the the getPath() method to the base IPathEntry class
Too many files to enumerate(JDT refactoris ... is great!)
2004-02-23 Alain Magloire
Support for IPathEntry deltas in the ICElementDelta

View file

@ -12,14 +12,7 @@
***********************************************************************/
package org.eclipse.cdt.core.model;
import org.eclipse.core.runtime.IPath;
public interface IContainerEntry extends IPathEntry {
/**
* Returns the id identifying this container.
* @return IPath
*/
IPath getPath();
}

View file

@ -16,12 +16,6 @@ import org.eclipse.core.runtime.IPath;
public interface IIncludeEntry extends IPathEntry {
/**
* Returns the affected resource by the include.
* @return IPath
*/
IPath getResourcePath();
/**
* Returns the include path
* @return IPath

View file

@ -16,12 +16,6 @@ import org.eclipse.core.runtime.IPath;
public interface ILibraryEntry extends IPathEntry {
/**
* Returns the absolute path of the library
* @return String
*/
IPath getLibraryPath();
/**
* Returns the path to the source archive or folder associated with this
* C path entry, or <code>null</code> if this C path entry has no

View file

@ -16,13 +16,6 @@ import org.eclipse.core.runtime.IPath;
public interface IMacroEntry extends IPathEntry {
/**
* Returns the absolute path from the worskspace root or
* relative path of the affected resource.
* @return String
*/
IPath getResourcePath();
/**
* Returns the macro name.
* @return String

View file

@ -12,6 +12,8 @@
***********************************************************************/
package org.eclipse.cdt.core.model;
import org.eclipse.core.runtime.IPath;
public interface IPathEntry {
@ -71,8 +73,7 @@ public interface IPathEntry {
*
* @return one of:
* <ul>
* <li><code>CDT_SOURCE</code> - this entry describes a source root in
its project
* <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_INCLUDE</code> - this entry describes a include path
@ -83,12 +84,12 @@ public interface IPathEntry {
int getEntryKind();
/**
* Returns whether this entry is exported to dependent projects.
* Always returns <code>false</code> for source entries (kind
* <code>CPE_SOURCE</code>), which cannot be exported.
* Returns the affected IPath
*
* @return <code>true</code> if exported, and <code>false</code> otherwise
* @return IPath
*/
boolean isExported();
IPath getPath();
}

View file

@ -12,15 +12,8 @@
***********************************************************************/
package org.eclipse.cdt.core.model;
import org.eclipse.core.runtime.IPath;
public interface IProjectEntry extends IPathEntry {
/**
* Returns the absolute path relative to the workspace root.
* @return IPath
*/
IPath getProjectPath();
}

View file

@ -16,13 +16,6 @@ import org.eclipse.core.runtime.IPath;
public interface ISourceEntry extends IPathEntry {
/**
* Returns the absolute path from the worskspace root or
* relative path of the source folder.
* @return String
*/
IPath getSourcePath();
/**
* Whether or not to look recursively in the folder.
* @return boolean

View file

@ -20,8 +20,8 @@ public abstract class APathEntry extends PathEntry {
IPath[] exclusionPatterns;
boolean isRecursive;
public APathEntry (int kind, boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
super(kind, isExported);
public APathEntry (int kind, IPath path, boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
super(kind, path, isExported);
this.exclusionPatterns = exclusionPatterns;
this.isRecursive = isRecursive;
}

View file

@ -28,6 +28,9 @@ public class BinaryRunner {
runner = new Thread(new Runnable() {
public void run() {
ICProject cproject = CModelManager.getDefault().create(project);
if (cproject == null || Thread.currentThread().isInterrupted()) {
return;
}
ArchiveContainer clib;
BinaryContainer cbin;
cbin = (BinaryContainer)cproject.getBinaryContainer();

View file

@ -105,7 +105,7 @@ public class CProject extends CContainer implements ICProject {
if (binParser != null) {
IBinaryFile bin;
try {
bin = binParser.getBinary(entry.getLibraryPath());
bin = binParser.getBinary(entry.getPath());
if (bin.getType() == IBinaryFile.ARCHIVE) {
lib = new LibraryReferenceArchive(this, entry, (IBinaryArchive)bin);
} else {

View file

@ -17,19 +17,8 @@ import org.eclipse.core.runtime.IPath;
public class ContainerEntry extends PathEntry implements IContainerEntry {
IPath path;
public ContainerEntry(IPath path, boolean isExported) {
super(IContainerEntry.CDT_CONTAINER, isExported);
this.path = path;
}
/**
* Returns the id identifying this container.
* @return IPath
*/
public IPath getPath() {
return path;
super(IContainerEntry.CDT_CONTAINER, path, isExported);
}
public boolean equals(Object obj) {

View file

@ -17,27 +17,16 @@ import org.eclipse.core.runtime.IPath;
public class IncludeEntry extends APathEntry implements IIncludeEntry {
IPath resourcePath;
IPath includePath;
boolean isSystemInclude;
public IncludeEntry(IPath resourcePath, IPath includePath, boolean isSystemInclude, boolean isRecursive,
public IncludeEntry(IPath path, IPath includePath, boolean isSystemInclude, boolean isRecursive,
IPath[] exclusionPatterns) {
super(IIncludeEntry.CDT_INCLUDE, isRecursive, exclusionPatterns, resourcePath == null);
this.resourcePath = resourcePath;
super(IIncludeEntry.CDT_INCLUDE, path, isRecursive, exclusionPatterns, path == null);
this.includePath = includePath;
this.isSystemInclude = isSystemInclude;
}
/**
* Returns the affected resource by the include.
*
* @return IPath
*/
public IPath getResourcePath() {
return resourcePath;
}
/**
* Returns the include path
*
@ -62,12 +51,12 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
if (!super.equals(otherEntry)) {
return false;
}
if (resourcePath == null) {
if (otherEntry.getResourcePath() != null) {
if (path == null) {
if (otherEntry.getPath() != null) {
return false;
}
} else {
if (!resourcePath.toString().equals(otherEntry.getResourcePath().toString())) {
if (!path.toString().equals(otherEntry.getPath().toString())) {
return false;
}
}

View file

@ -22,23 +22,14 @@ public class LibraryEntry extends PathEntry implements ILibraryEntry {
IPath sourceAttachmentRootPath;
IPath sourceAttachmentPrefixMapping;
public LibraryEntry(IPath libraryPath, IPath sourceAttachmentPath,
public LibraryEntry(IPath path, IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
super(ILibraryEntry.CDT_LIBRARY, isExported);
this.libraryPath = libraryPath;
super(ILibraryEntry.CDT_LIBRARY, path, isExported);
this.sourceAttachmentPath = sourceAttachmentPath;
this.sourceAttachmentRootPath = sourceAttachmentRootPath;
this.sourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping;
}
/**
* Returns the absolute path of the library
* @return String
*/
public IPath getLibraryPath() {
return libraryPath;
}
/**
* Returns the path to the source archive or folder associated with this
* C path entry, or <code>null</code> if this C path entry has no

View file

@ -20,7 +20,7 @@ public class LibraryReference extends Parent implements ILibraryReference {
ILibraryEntry entry;
public LibraryReference(ICElement parent, ILibraryEntry e) {
super(parent, e.getLibraryPath().lastSegment(), ICElement.C_VCONTAINER);
super(parent, e.getPath().lastSegment(), ICElement.C_VCONTAINER);
entry = e;
}
@ -42,7 +42,7 @@ public class LibraryReference extends Parent implements ILibraryReference {
* @see org.eclipse.cdt.core.model.ICElement#getPath()
*/
public IPath getPath() {
return entry.getLibraryPath();
return entry.getPath();
}
}

View file

@ -21,7 +21,7 @@ public class LibraryReferenceArchive extends Archive implements ILibraryReferenc
ILibraryEntry entry;
public LibraryReferenceArchive(ICElement parent, ILibraryEntry e, IBinaryArchive ar) {
super(parent, e.getLibraryPath(), ar);
super(parent, e.getPath(), ar);
setElementType(ICElement.C_VCONTAINER);
entry = e;
}
@ -38,7 +38,7 @@ public class LibraryReferenceArchive extends Archive implements ILibraryReferenc
* @see org.eclipse.cdt.core.model.ICElement#getPath()
*/
public IPath getPath() {
return entry.getLibraryPath();
return entry.getPath();
}
}

View file

@ -21,7 +21,7 @@ public class LibraryReferenceShared extends Binary implements ILibraryReference
ILibraryEntry entry;
public LibraryReferenceShared(ICElement parent, ILibraryEntry e, IBinaryFile bin) {
super(parent, e.getLibraryPath(), bin);
super(parent, e.getPath(), bin);
setElementType(ICElement.C_VCONTAINER);
entry = e;
}
@ -44,7 +44,7 @@ public class LibraryReferenceShared extends Binary implements ILibraryReference
* @see org.eclipse.cdt.core.model.ICElement#getPath()
*/
public IPath getPath() {
return entry.getLibraryPath();
return entry.getPath();
}
}

View file

@ -17,27 +17,16 @@ import org.eclipse.core.runtime.IPath;
public class MacroEntry extends APathEntry implements IMacroEntry {
IPath resourcePath;
String macroName;
String macroValue;
public MacroEntry (IPath resourcePath, String macroName, String macroValue,
public MacroEntry (IPath path, String macroName, String macroValue,
boolean isRecursive, IPath[] exclusionPatterns, boolean isExported) {
super(IMacroEntry.CDT_MACRO, isRecursive, exclusionPatterns, isExported);
this.resourcePath = resourcePath;
super(IMacroEntry.CDT_MACRO, path, isRecursive, exclusionPatterns, isExported);
this.macroName = macroName;
this.macroValue = macroValue;
}
/**
* Returns the absolute path from the worskspace root or
* relative path of the affected resource.
* @return String
*/
public IPath getResourcePath() {
return resourcePath;
}
/**
* Returns the macro name.
* @return String

View file

@ -13,18 +13,27 @@
package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.runtime.IPath;
public class PathEntry implements IPathEntry {
public int entryKind;
public boolean isExported;
public IPath path;
public PathEntry(int entryKind, boolean isExported) {
public PathEntry(int entryKind, IPath path, boolean isExported) {
this.path = path;
this.entryKind = entryKind;
this.isExported = isExported;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IPathEntry#getEntryKind()
*/
public IPath getPath() {
return path;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IPathEntry#getEntryKind()
*/

View file

@ -369,7 +369,7 @@ public class PathEntryManager {
for (int i = 0, length = entries.length; i < length; i++) {
if (entries[i].getEntryKind() == IPathEntry.CDT_PROJECT) {
IProjectEntry entry = (IProjectEntry)entries[i];
prerequisites.add(entry.getProjectPath().lastSegment());
prerequisites.add(entry.getPath().lastSegment());
}
}
int size = prerequisites.size();
@ -468,7 +468,7 @@ public class PathEntryManager {
int flag = 0;
if (kind == IPathEntry.CDT_SOURCE) {
ISourceEntry source = (ISourceEntry) entry;
IPath path = source.getSourcePath();
IPath path = source.getPath();
celement = CoreModel.getDefault().create(path);
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_SOURCE : ICElementDelta.F_ADDED_PATHENTRY_SOURCE;
} else if (kind == IPathEntry.CDT_LIBRARY) {
@ -483,12 +483,12 @@ public class PathEntryManager {
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_PROJECT : ICElementDelta.F_ADDED_PATHENTRY_PROJECT;
} else if (kind == IPathEntry.CDT_INCLUDE) {
IIncludeEntry include = (IIncludeEntry) entry;
IPath path = include.getResourcePath();
IPath path = include.getPath();
celement = CoreModel.getDefault().create(path);
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_INCLUDE : ICElementDelta.F_ADDED_PATHENTRY_INCLUDE;
} else if (kind == IPathEntry.CDT_MACRO) {
IMacroEntry macro = (IMacroEntry) entry;
IPath path = macro.getResourcePath();
IPath path = macro.getPath();
celement = CoreModel.getDefault().create(path);
flag = (removed) ? ICElementDelta.F_REMOVED_PATHENTRY_MACRO : ICElementDelta.F_ADDED_PATHENTRY_MACRO;
} else if (kind == IPathEntry.CDT_CONTAINER) {
@ -673,7 +673,7 @@ public class PathEntryManager {
if (kind == IPathEntry.CDT_SOURCE) {
ISourceEntry source = (ISourceEntry) entries[i];
IPath path = source.getSourcePath();
IPath path = source.getPath();
element.setAttribute(ATTRIBUTE_PATH, path.toString());
IPath output = source.getOutputLocation();
if (output != null && output.isEmpty()) {
@ -681,7 +681,7 @@ public class PathEntryManager {
}
} else if (kind == IPathEntry.CDT_LIBRARY) {
ILibraryEntry lib = (ILibraryEntry) entries[i];
IPath path = lib.getLibraryPath();
IPath path = lib.getPath();
element.setAttribute(ATTRIBUTE_PATH, path.toString());
if (lib.getSourceAttachmentPath() != null) {
element.setAttribute(ATTRIBUTE_SOURCEPATH, lib.getSourceAttachmentPath().toString());
@ -694,11 +694,11 @@ public class PathEntryManager {
}
} else if (kind == IPathEntry.CDT_PROJECT) {
IProjectEntry pentry = (IProjectEntry) entries[i];
IPath path = pentry.getProjectPath();
IPath path = pentry.getPath();
element.setAttribute(ATTRIBUTE_PATH, path.toString());
} else if (kind == IPathEntry.CDT_INCLUDE) {
IIncludeEntry include = (IIncludeEntry) entries[i];
IPath path = include.getResourcePath();
IPath path = include.getPath();
element.setAttribute(ATTRIBUTE_PATH, path.toString());
IPath includePath = include.getIncludePath();
element.setAttribute(ATTRIBUTE_INCLUDE, includePath.toString());
@ -707,7 +707,7 @@ public class PathEntryManager {
}
} else if (kind == IPathEntry.CDT_MACRO) {
IMacroEntry macro = (IMacroEntry) entries[i];
IPath path = macro.getResourcePath();
IPath path = macro.getPath();
element.setAttribute(ATTRIBUTE_PATH, path.toString());
element.setAttribute(ATTRIBUTE_NAME, macro.getMacroName());
element.setAttribute(ATTRIBUTE_VALUE, macro.getMacroValue());

View file

@ -18,19 +18,8 @@ import org.eclipse.core.runtime.IPath;
public class ProjectEntry extends PathEntry implements IProjectEntry {
IPath projectPath;
public ProjectEntry(IPath projectPath, boolean isExported) {
super(IProjectEntry.CDT_PROJECT, isExported);
this.projectPath = projectPath;
}
/**
* Returns the absolute path relative to the workspace root.
* @return IPath
*/
public IPath getProjectPath() {
return projectPath;
public ProjectEntry(IPath path, boolean isExported) {
super(IProjectEntry.CDT_PROJECT, path, isExported);
}
public boolean equals(Object obj) {
@ -39,12 +28,12 @@ public class ProjectEntry extends PathEntry implements IProjectEntry {
if (!super.equals(otherEntry)) {
return false;
}
if (projectPath == null) {
if (otherEntry.getProjectPath() != null) {
if (path == null) {
if (otherEntry.getPath() != null) {
return false;
}
} else {
if (!projectPath.toString().equals(otherEntry.getProjectPath().toString())) {
if (!path.toString().equals(otherEntry.getPath().toString())) {
return false;
}
}

View file

@ -17,24 +17,13 @@ import org.eclipse.core.runtime.IPath;
public class SourceEntry extends APathEntry implements ISourceEntry {
IPath sourcePath;
IPath outputLocation;
public SourceEntry(IPath sourcePath, IPath outputLocation, boolean isRecursive, IPath[] exclusionPatterns) {
super(ISourceEntry.CDT_SOURCE, isRecursive, exclusionPatterns, false);
this.sourcePath = sourcePath;
public SourceEntry(IPath path, IPath outputLocation, boolean isRecursive, IPath[] exclusionPatterns) {
super(ISourceEntry.CDT_SOURCE, path, isRecursive, exclusionPatterns, false);
this.outputLocation = outputLocation;
}
/**
* Returns the absolute path from the worskspace root or
* relative path of the source folder.
* @return String
*/
public IPath getSourcePath() {
return sourcePath;
}
/**
* Binary output location for this source folder.
* @return IPath, <code>null</code> means to use the
@ -50,12 +39,12 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
if (!super.equals(otherEntry)) {
return false;
}
if (sourcePath == null) {
if (otherEntry.getSourcePath() != null) {
if (path == null) {
if (otherEntry.getPath() != null) {
return false;
}
} else {
if (!sourcePath.toString().equals(otherEntry.getSourcePath().toString())) {
if (!path.toString().equals(otherEntry.getPath().toString())) {
return false;
}
}