From add6587020e65a2f296b128cb12166b94d4b9524 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Wed, 26 Feb 2003 21:38:44 +0000 Subject: [PATCH] IBinaryParser interface change the methos: public IBinaryFile getBinary(IFile) to public IBinaryFile getBinary(IPath) --- .../cdt/internal/core/model/ArchiveInfo.java | 6 +- .../cdt/internal/core/model/BinaryInfo.java | 5 +- .../internal/core/model/CModelManager.java | 10 +- .../core/model/parser/ElfBinaryArchive.java | 26 ++--- .../core/model/parser/ElfBinaryFile.java | 38 +++--- .../internal/core/model/parser/ElfParser.java | 12 +- .../core/model/parser/PEBinaryArchive.java | 37 +++--- .../core/model/parser/PEBinaryFile.java | 108 +++++++++--------- .../internal/core/model/parser/PEParser.java | 12 +- .../org/eclipse/cdt/core/IBinaryParser.java | 6 +- 10 files changed, 124 insertions(+), 136 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java index 76fb050a7d1..702824f722e 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ArchiveInfo.java @@ -13,9 +13,9 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; /** * Info for ICProject. @@ -73,8 +73,8 @@ class ArchiveInfo extends CFileInfo { IBinaryParser parser = CModelManager.getDefault().getBinaryParser(project); if (parser != null) { try { - IFile file = (IFile) getElement().getUnderlyingResource(); - IBinaryFile bfile = parser.getBinary(file); + IPath path = getElement().getUnderlyingResource().getLocation(); + IBinaryFile bfile = parser.getBinary(path); if (bfile instanceof IBinaryArchive) { archive = (IBinaryArchive) bfile; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java index 1b08929d56a..6e00fe12654 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java @@ -18,7 +18,6 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryShared; import org.eclipse.cdt.core.IBinaryParser.ISymbol; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -167,8 +166,8 @@ class BinaryInfo extends CFileInfo { IBinaryParser parser = CModelManager.getDefault().getBinaryParser(project); if (parser != null) { try { - IFile file = (IFile) getElement().getUnderlyingResource(); - IBinaryFile bfile = parser.getBinary(file); + IPath path = getElement().getUnderlyingResource().getLocation(); + IBinaryFile bfile = parser.getBinary(path); if (bfile instanceof IBinaryObject) { binary = (IBinaryObject) bfile; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java index 1db915a2799..918f292da11 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java @@ -461,7 +461,7 @@ public class CModelManager implements IResourceChangeListener { public boolean isSharedLib(IFile file) { try { IBinaryParser parser = getBinaryParser(file.getProject()); - IBinaryFile bin = parser.getBinary(file); + IBinaryFile bin = parser.getBinary(file.getLocation()); return (bin.getType() == IBinaryFile.SHARED); } catch (IOException e) { //e.printStackTrace(); @@ -472,7 +472,7 @@ public class CModelManager implements IResourceChangeListener { public boolean isObject(IFile file) { try { IBinaryParser parser = getBinaryParser(file.getProject()); - IBinaryFile bin = parser.getBinary(file); + IBinaryFile bin = parser.getBinary(file.getLocation()); return (bin.getType() == IBinaryFile.OBJECT); } catch (IOException e) { //e.printStackTrace(); @@ -483,7 +483,7 @@ public class CModelManager implements IResourceChangeListener { public boolean isExecutable(IFile file) { try { IBinaryParser parser = getBinaryParser(file.getProject()); - IBinaryFile bin = parser.getBinary(file); + IBinaryFile bin = parser.getBinary(file.getLocation()); return (bin.getType() == IBinaryFile.EXECUTABLE); } catch (IOException e) { //e.printStackTrace(); @@ -494,7 +494,7 @@ public class CModelManager implements IResourceChangeListener { public boolean isBinary(IFile file) { try { IBinaryParser parser = getBinaryParser(file.getProject()); - IBinaryFile bin = parser.getBinary(file); + IBinaryFile bin = parser.getBinary(file.getLocation()); return (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.OBJECT || bin.getType() == IBinaryFile.SHARED @@ -508,7 +508,7 @@ public class CModelManager implements IResourceChangeListener { public boolean isArchive(IFile file) { try { IBinaryParser parser = getBinaryParser(file.getProject()); - IBinaryFile bin = parser.getBinary(file); + IBinaryFile bin = parser.getBinary(file.getLocation()); return (bin.getType() == IBinaryFile.ARCHIVE); } catch (IOException e) { //e.printStackTrace(); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryArchive.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryArchive.java index d6de29a0f52..4ec3a24ea9a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryArchive.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryArchive.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.internal.core.model.parser; */ import java.io.ByteArrayInputStream; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -14,8 +15,6 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; import org.eclipse.cdt.utils.elf.AR; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.PlatformObject; @@ -23,12 +22,12 @@ import org.eclipse.core.runtime.PlatformObject; */ public class ElfBinaryArchive extends PlatformObject implements IBinaryArchive { - IFile file; + IPath path; ArrayList children; long timestamp; - public ElfBinaryArchive(IFile f) { - file = f; + public ElfBinaryArchive(IPath p) { + path = p; children = new ArrayList(5); } @@ -38,14 +37,13 @@ public class ElfBinaryArchive extends PlatformObject implements IBinaryArchive { public IBinaryObject[] getObjects() { if (hasChanged()) { children.clear(); - IPath location = file.getLocation(); - if (location != null) { + if (path != null) { AR ar = null; try { - ar = new AR(location.toOSString()); + ar = new AR(path.toOSString()); AR.ARHeader[] headers = ar.getHeaders(); for (int i = 0; i < headers.length; i++) { - IBinaryObject bin = new ElfBinaryFile(file, headers[i]); + IBinaryObject bin = new ElfBinaryFile(path, headers[i]); children.add(bin); } } catch (IOException e) { @@ -63,8 +61,8 @@ public class ElfBinaryArchive extends PlatformObject implements IBinaryArchive { /** * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile() */ - public IFile getFile() { - return file; + public IPath getPath() { + return path; } /** @@ -79,14 +77,14 @@ public class ElfBinaryArchive extends PlatformObject implements IBinaryArchive { */ public InputStream getContents() { try { - return file.getContents(); - } catch (CoreException e) { + return new FileInputStream(path.toFile()); + } catch (IOException e) { } return new ByteArrayInputStream(new byte[0]); } boolean hasChanged() { - long modif = file.getModificationStamp(); + long modif = path.toFile().lastModified(); boolean changed = modif != timestamp; timestamp = modif; return changed; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java index 81cebdc6bf8..29f82f78cc2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfBinaryFile.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.internal.core.model.parser; */ import java.io.ByteArrayInputStream; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -20,16 +21,13 @@ import org.eclipse.cdt.utils.elf.Elf; import org.eclipse.cdt.utils.elf.ElfHelper; import org.eclipse.cdt.utils.elf.Elf.Attribute; import org.eclipse.cdt.utils.elf.ElfHelper.Sizes; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.PlatformObject; /** */ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinaryObject, IBinaryExecutable, IBinaryShared { - IFile file; + IPath path; AR.ARHeader header; long timestamp; String soname; @@ -38,13 +36,13 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar Attribute attribute; ArrayList symbols; - public ElfBinaryFile(IFile f) throws IOException { - this(f, null); + public ElfBinaryFile(IPath p) throws IOException { + this(p, null); } - public ElfBinaryFile(IFile f, AR.ARHeader h) throws IOException { + public ElfBinaryFile(IPath p, AR.ARHeader h) throws IOException { header = h; - file = f; + path = p; loadInformation(); hasChanged(); } @@ -52,8 +50,8 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar /** * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile() */ - public IFile getFile() { - return file; + public IPath getPath() { + return path; } /** @@ -204,15 +202,15 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar public InputStream getContents() { InputStream stream = null; // Archive ? - if (file != null && header != null) { + if (path != null && header != null) { try { stream = new ByteArrayInputStream(header.getObjectData()); } catch (IOException e) { } - } else if (file != null && file.exists()) { + } else if (path != null) { try { - stream = file.getContents(); - } catch (CoreException e) { + stream = new FileInputStream(path.toFile()); + } catch (IOException e) { } } if (stream == null) { @@ -228,8 +226,8 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar if (header != null) { return header.getObjectName(); } - if (file != null) { - return file.getName(); + if (path != null) { + return path.lastSegment().toString(); } return ""; } @@ -259,7 +257,7 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar } boolean hasChanged() { - long modification = file.getModificationStamp(); + long modification = path.toFile().lastModified(); boolean changed = modification != timestamp; timestamp = modification; return changed; @@ -269,11 +267,7 @@ public class ElfBinaryFile extends PlatformObject implements IBinaryFile, IBinar // Archive ? if (header != null) { return new ElfHelper(header.getElf()); - } else if (file != null && file.exists()) { - IPath path = file.getLocation(); - if (path == null) { - path = new Path(""); - } + } else if (path != null) { return new ElfHelper(path.toOSString()); } throw new IOException("No file assiocated with Binary"); diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java index da46d199af4..2adb4acaa2e 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java @@ -10,7 +10,7 @@ import java.io.IOException; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.utils.elf.AR; import org.eclipse.cdt.utils.elf.Elf; -import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; /** */ @@ -19,17 +19,17 @@ public class ElfParser implements IBinaryParser { /** * @see org.eclipse.cdt.core.model.IBinaryParser#getBinary(IPath) */ - public IBinaryFile getBinary(IFile file) throws IOException { + public IBinaryFile getBinary(IPath path) throws IOException { try { - Elf e = new Elf(file.getLocation().toOSString()); + Elf e = new Elf(path.toOSString()); e.dispose(); - return new ElfBinaryFile(file); + return new ElfBinaryFile(path); } catch (IOException e) { } // Is it an Archive. - AR ar = new AR(file.getLocation().toOSString()); + AR ar = new AR(path.toOSString()); ar.dispose(); - return new ElfBinaryArchive(file); + return new ElfBinaryArchive(path); } /** diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryArchive.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryArchive.java index ddb564d148a..d18f0fd8cd5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryArchive.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryArchive.java @@ -6,6 +6,8 @@ package org.eclipse.cdt.internal.core.model.parser; */ import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -14,8 +16,6 @@ import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive; import org.eclipse.cdt.core.IBinaryParser.IBinaryFile; import org.eclipse.cdt.core.IBinaryParser.IBinaryObject; import org.eclipse.cdt.utils.coff.PEArchive; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.PlatformObject; @@ -23,12 +23,12 @@ import org.eclipse.core.runtime.PlatformObject; */ public class PEBinaryArchive extends PlatformObject implements IBinaryArchive { - IFile file; + IPath path; ArrayList children; long timestamp; - public PEBinaryArchive(IFile f) { - file = f; + public PEBinaryArchive(IPath p) { + path = p; children = new ArrayList(5); } @@ -38,14 +38,13 @@ public class PEBinaryArchive extends PlatformObject implements IBinaryArchive { public IBinaryObject[] getObjects() { if (hasChanged()) { children.clear(); - IPath location = file.getLocation(); - if (location != null) { + if (path != null) { PEArchive ar = null; try { - ar = new PEArchive(location.toOSString()); + ar = new PEArchive(path.toOSString()); PEArchive.ARHeader[] headers = ar.getHeaders(); for (int i = 0; i < headers.length; i++) { - IBinaryObject bin = new PEBinaryFile(file, headers[i].getObjectName()); + IBinaryObject bin = new PEBinaryFile(path, headers[i].getObjectName()); children.add(bin); } } catch (IOException e) { @@ -63,8 +62,8 @@ public class PEBinaryArchive extends PlatformObject implements IBinaryArchive { /** * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile() */ - public IFile getFile() { - return file; + public IPath getPath() { + return path; } /** @@ -79,17 +78,21 @@ public class PEBinaryArchive extends PlatformObject implements IBinaryArchive { */ public InputStream getContents() { try { - return file.getContents(); - } catch (CoreException e) { + return new FileInputStream(path.toFile()); + } catch (IOException e) { } return new ByteArrayInputStream(new byte[0]); } boolean hasChanged() { - long modif = file.getModificationStamp(); - boolean changed = modif != timestamp; - timestamp = modif; - return changed; + File file = path.toFile(); + if (file != null && file.exists()) { + long modification = file.lastModified(); + boolean changed = modification != timestamp; + timestamp = modification; + return changed; + } + return false; } /** * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryArchive#add(IBinaryObject[]) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryFile.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryFile.java index 6a6d08ac76c..2c4dd50a0c3 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryFile.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEBinaryFile.java @@ -5,6 +5,8 @@ package org.eclipse.cdt.internal.core.model.parser; */ import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -18,10 +20,7 @@ import org.eclipse.cdt.utils.coff.Coff; import org.eclipse.cdt.utils.coff.PE; import org.eclipse.cdt.utils.coff.PEArchive; import org.eclipse.cdt.utils.coff.PE.Attribute; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.PlatformObject; /** @@ -29,18 +28,18 @@ import org.eclipse.core.runtime.PlatformObject; public class PEBinaryFile extends PlatformObject implements IBinaryFile, IBinaryObject, IBinaryExecutable, IBinaryShared { - IFile file; + IPath path; long timestamp; PE.Attribute attribute; String objectName; ArrayList symbols; - public PEBinaryFile(IFile file) throws IOException { - this(file, null); + public PEBinaryFile(IPath p) throws IOException { + this(p, null); } - public PEBinaryFile(IFile file, String o) throws IOException { - this.file = file; + public PEBinaryFile(IPath p, String o) throws IOException { + path = p; objectName = o; loadInformation(); hasChanged(); @@ -51,30 +50,28 @@ public class PEBinaryFile extends PlatformObject implements IBinaryFile, */ public InputStream getContents() { InputStream stream = null; - if (file != null && objectName != null) { - IPath location = file.getLocation(); - if (location != null) { - PEArchive ar = null; - try { - ar = new PEArchive(file.getLocation().toOSString()); - PEArchive.ARHeader[] headers = ar.getHeaders(); - for (int i = 0; i < headers.length; i++) { - PEArchive.ARHeader hdr = headers[i]; - if (objectName.equals(hdr.getObjectName())) { - stream = new ByteArrayInputStream(hdr.getObjectData()); - break; - } + if (path != null && objectName != null) { + PEArchive ar = null; + try { + ar = new PEArchive(path.toOSString()); + PEArchive.ARHeader[] headers = ar.getHeaders(); + for (int i = 0; i < headers.length; i++) { + PEArchive.ARHeader hdr = headers[i]; + if (objectName.equals(hdr.getObjectName())) { + stream = new ByteArrayInputStream(hdr.getObjectData()); + break; } - } catch (IOException e) { } + } catch (IOException e) { + } finally { if (ar != null) { ar.dispose(); } } - } else if (file != null && file.exists()) { + } else if (path != null) { try { - stream = file.getContents(); - } catch (CoreException e) { + stream = new FileInputStream (path.toFile()); + } catch (IOException e) { } } if (stream == null) { @@ -86,8 +83,8 @@ public class PEBinaryFile extends PlatformObject implements IBinaryFile, /** * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getFile() */ - public IFile getFile() { - return file; + public IPath getPath() { + return path; } /** @@ -149,8 +146,8 @@ public class PEBinaryFile extends PlatformObject implements IBinaryFile, public String getName() { if (objectName != null) { return objectName; - } else if (file != null) { - return file.getName(); + } else if (path != null) { + return path.lastSegment().toString(); } return ""; } @@ -215,35 +212,28 @@ public class PEBinaryFile extends PlatformObject implements IBinaryFile, } protected PE getPE() throws IOException { - if (file != null && objectName != null) { - IPath location = file.getLocation(); - if (location != null) { - PE pe = null; - PEArchive ar = null; - try { - ar = new PEArchive(file.getLocation().toOSString()); - PEArchive.ARHeader[] headers = ar.getHeaders(); - for (int i = 0; i < headers.length; i++) { - PEArchive.ARHeader hdr = headers[i]; - if (objectName.equals(hdr.getObjectName())) { - pe = hdr.getPE(); - break; - } - } - } finally { - if (ar != null) { - ar.dispose(); + if (path != null && objectName != null) { + PE pe = null; + PEArchive ar = null; + try { + ar = new PEArchive(path.toOSString()); + PEArchive.ARHeader[] headers = ar.getHeaders(); + for (int i = 0; i < headers.length; i++) { + PEArchive.ARHeader hdr = headers[i]; + if (objectName.equals(hdr.getObjectName())) { + pe = hdr.getPE(); + break; } } - if (pe != null) { - return pe; + } finally { + if (ar != null) { + ar.dispose(); } } - } else if (file != null && file.exists()) { - IPath path = file.getLocation(); - if (path == null) { - path = new Path(""); + if (pe != null) { + return pe; } + } else if (path != null) { return new PE(path.toOSString()); } throw new IOException("No file assiocated with Binary"); @@ -299,10 +289,14 @@ public class PEBinaryFile extends PlatformObject implements IBinaryFile, } boolean hasChanged() { - long modification = file.getModificationStamp(); - boolean changed = modification != timestamp; - timestamp = modification; - return changed; + File file = path.toFile(); + if (file != null && file.exists()) { + long modification = file.lastModified(); + boolean changed = modification != timestamp; + timestamp = modification; + return changed; + } + return false; } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEParser.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEParser.java index 4af962020df..6cfe3a0e5ad 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEParser.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/PEParser.java @@ -10,7 +10,7 @@ import java.io.IOException; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.utils.coff.PE; import org.eclipse.cdt.utils.coff.PEArchive; -import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; /** */ @@ -19,17 +19,17 @@ public class PEParser implements IBinaryParser { /** * @see org.eclipse.cdt.core.model.IBinaryParser#getBinary(IFile) */ - public IBinaryFile getBinary(IFile file) throws IOException { + public IBinaryFile getBinary(IPath path) throws IOException { try { - PE pe = new PE(file.getLocation().toOSString()); + PE pe = new PE(path.toOSString()); pe.dispose(); - return new PEBinaryFile(file); + return new PEBinaryFile(path); } catch (IOException e) { } // Is it an Archive. - PEArchive ar = new PEArchive(file.getLocation().toOSString()); + PEArchive ar = new PEArchive(path.toOSString()); ar.dispose(); - return new PEBinaryArchive(file); + return new PEBinaryArchive(path); } /** diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java index 10a1c8e9ac3..38c4fd1d748 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IBinaryParser.java @@ -8,8 +8,8 @@ package org.eclipse.cdt.core; import java.io.IOException; import java.io.InputStream; -import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; /** */ @@ -25,7 +25,7 @@ public interface IBinaryParser { public int ARCHIVE = 0x08; public int CORE = 0x10; - public IFile getFile(); + public IPath getPath(); public int getType(); public InputStream getContents(); } @@ -84,7 +84,7 @@ public interface IBinaryParser { public int getType(); } - public IBinaryFile getBinary(IFile file) throws IOException; + public IBinaryFile getBinary(IPath path) throws IOException; public String getFormat(); }