mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Use consistent format for the file paths of code-readers.
This commit is contained in:
parent
950b1db4f2
commit
042f8dc2d3
1 changed files with 17 additions and 3 deletions
|
@ -311,6 +311,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return URIUtil.toPath(location);
|
return URIUtil.toPath(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public URI getLocationURI() {
|
public URI getLocationURI() {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
IFile file = getFile();
|
IFile file = getFile();
|
||||||
|
@ -369,6 +370,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return sourceManipulationInfo;
|
return sourceManipulationInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected CElementInfo createElementInfo() {
|
protected CElementInfo createElementInfo() {
|
||||||
return new TranslationUnitInfo(this);
|
return new TranslationUnitInfo(this);
|
||||||
}
|
}
|
||||||
|
@ -381,6 +383,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
*
|
*
|
||||||
* @see Object#equals(java.lang.Object)
|
* @see Object#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof ITranslationUnit)) return false;
|
if (!(o instanceof ITranslationUnit)) return false;
|
||||||
return super.equals(o) && !((ITranslationUnit) o).isWorkingCopy();
|
return super.equals(o) && !((ITranslationUnit) o).isWorkingCopy();
|
||||||
|
@ -401,15 +404,17 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return (WorkingCopy) perFactoryWorkingCopies.get(this);
|
return (WorkingCopy) perFactoryWorkingCopies.get(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized CElementInfo getElementInfo(IProgressMonitor monitor) throws CModelException {
|
public synchronized CElementInfo getElementInfo(IProgressMonitor monitor) throws CModelException {
|
||||||
return super.getElementInfo(monitor);
|
return super.getElementInfo(monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws CModelException {
|
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws CModelException {
|
||||||
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
|
TranslationUnitInfo unitInfo = (TranslationUnitInfo) info;
|
||||||
|
|
||||||
// We reuse the general info cache in the CModelBuilder, We should not do this
|
// We reuse the general info cache in the CModelBuilder, We should not do this
|
||||||
// and instead create the info explicitely(see JDT).
|
// and instead create the info explicitly(see JDT).
|
||||||
// So to get by we need to remove in the LRU all the info of this handle
|
// So to get by we need to remove in the LRU all the info of this handle
|
||||||
CModelManager.getDefault().removeChildrenInfo(this);
|
CModelManager.getDefault().removeChildrenInfo(this);
|
||||||
|
|
||||||
|
@ -492,10 +497,12 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
/**
|
/**
|
||||||
* Returns true if this element may have an associated source buffer.
|
* Returns true if this element may have an associated source buffer.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected boolean hasBuffer() {
|
protected boolean hasBuffer() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void openParent(Object childInfo, Map newElements, IProgressMonitor pm) throws CModelException {
|
protected void openParent(Object childInfo, Map newElements, IProgressMonitor pm) throws CModelException {
|
||||||
try {
|
try {
|
||||||
super.openParent(childInfo, newElements, pm);
|
super.openParent(childInfo, newElements, pm);
|
||||||
|
@ -507,10 +514,12 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isConsistent() throws CModelException {
|
public boolean isConsistent() throws CModelException {
|
||||||
return isOpen() && CModelManager.getDefault().getElementsOutOfSynchWithBuffers().get(this) == null;
|
return isOpen() && CModelManager.getDefault().getElementsOutOfSynchWithBuffers().get(this) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void makeConsistent(IProgressMonitor monitor, boolean forced) throws CModelException {
|
public void makeConsistent(IProgressMonitor monitor, boolean forced) throws CModelException {
|
||||||
makeConsistent(forced, monitor);
|
makeConsistent(forced, monitor);
|
||||||
}
|
}
|
||||||
|
@ -560,6 +569,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean isSourceElement() {
|
protected boolean isSourceElement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -568,6 +578,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
|
protected IBuffer openBuffer(IProgressMonitor pm) throws CModelException {
|
||||||
|
|
||||||
// create buffer - translation units only use default buffer factory
|
// create buffer - translation units only use default buffer factory
|
||||||
|
@ -690,6 +701,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId);
|
return CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
IResource res = getResource();
|
IResource res = getResource();
|
||||||
if (res != null)
|
if (res != null)
|
||||||
|
@ -744,6 +756,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
contentTypeId = id;
|
contentTypeId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void closing(Object info) throws CModelException {
|
protected void closing(Object info) throws CModelException {
|
||||||
IContentType cType = CCorePlugin.getContentType(getCProject().getProject(), getElementName());
|
IContentType cType = CCorePlugin.getContentType(getCProject().getProject(), getElementName());
|
||||||
if (cType != null) {
|
if (cType != null) {
|
||||||
|
@ -889,11 +902,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
reader= new CodeReader(getContents());
|
reader= new CodeReader(getContents());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reader= new CodeReader(location.toOSString(), getContents());
|
reader= new CodeReader(location.toString(), getContents());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reader= ParserUtil.createReader(location.toOSString(), null);
|
reader= ParserUtil.createReader(location.toString(), null);
|
||||||
}
|
}
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
@ -929,6 +942,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
||||||
return result != null ? result : getLanguage();
|
return result != null ? result : getLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPath getPath() {
|
public IPath getPath() {
|
||||||
if (getFile() != null) {
|
if (getFile() != null) {
|
||||||
return super.getPath();
|
return super.getPath();
|
||||||
|
|
Loading…
Add table
Reference in a new issue