mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Use URIUtil.toURI() instead of File.toURI(), related to bug 252744
This commit is contained in:
parent
7fb63c36d6
commit
450e32afb8
4 changed files with 18 additions and 5 deletions
|
@ -37,6 +37,7 @@ import org.eclipse.cdt.core.model.ICElement;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.core.resources.ResourceLookup;
|
||||
import org.eclipse.cdt.internal.core.util.MementoTokenizer;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
|
@ -340,7 +341,7 @@ public class Binary extends Openable implements IBinary {
|
|||
if (wkspFile != null)
|
||||
tu = new TranslationUnit(this, wkspFile, id);
|
||||
else
|
||||
tu = new ExternalTranslationUnit(this, file.toURI(), id);
|
||||
tu = new ExternalTranslationUnit(this, Path.fromOSString(filename), id);
|
||||
|
||||
if (! info.includesChild(tu))
|
||||
info.addChild(tu);
|
||||
|
|
|
@ -16,12 +16,22 @@ package org.eclipse.cdt.internal.core.model;
|
|||
import java.net.URI;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.core.filesystem.URIUtil;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
/**
|
||||
* ExternalTranslationUnit
|
||||
*/
|
||||
public class ExternalTranslationUnit extends TranslationUnit {
|
||||
|
||||
public ExternalTranslationUnit(ICElement parent, java.io.File file, String contentTypeID) {
|
||||
this(parent, URIUtil.toURI(file.getAbsolutePath()), contentTypeID);
|
||||
}
|
||||
|
||||
public ExternalTranslationUnit(ICElement parent, IPath location, String contentTypeID) {
|
||||
super(parent, URIUtil.toURI(location), contentTypeID);
|
||||
}
|
||||
|
||||
public ExternalTranslationUnit(ICElement parent, URI uri, String contentTypeID) {
|
||||
super(parent, uri, contentTypeID);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class AbsolutePathSourceContainer extends AbstractSourceContainer {
|
|||
{
|
||||
IPath path = Path.fromOSString(file.getCanonicalPath());
|
||||
String id = CoreModel.getRegistedContentTypeId(project.getProject(), path.lastSegment());
|
||||
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, file.toURI(), id) };
|
||||
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, path, id) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 2008 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2008 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -99,8 +99,9 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
|||
{
|
||||
String id;
|
||||
try {
|
||||
id = CoreModel.getRegistedContentTypeId(project.getProject(), Path.fromOSString(file.getCanonicalPath()).lastSegment());
|
||||
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, file.toURI(), id) };
|
||||
final IPath location= Path.fromOSString(file.getCanonicalPath());
|
||||
id = CoreModel.getRegistedContentTypeId(project.getProject(), location.lastSegment());
|
||||
return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, location, id) };
|
||||
} catch (IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +148,7 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
|
|||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( !(o instanceof MapEntrySourceContainer ) )
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue