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

Remove the references to BinaryFileAdapter

and BinarContainerAdapter.
This commit is contained in:
Alain Magloire 2003-02-23 19:23:40 +00:00
parent 61bb9b156d
commit ca33847526
3 changed files with 42 additions and 51 deletions

View file

@ -5,11 +5,9 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IArchive;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.core.model.parser.BinaryContainerAdapter;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
@ -26,13 +24,6 @@ public class Archive extends CFile implements IArchive {
super (parent, path);
}
public IResource getResource() throws CModelException {
if (archive == null) {
archive = new BinaryContainerAdapter(getArchiveInfo().getBinaryArchive());
}
return archive;
}
public IBinary[] getBinaries() {
ICElement[] e = getChildren();
IBinary[] b = new IBinary[e.length];

View file

@ -13,8 +13,6 @@ 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.cdt.internal.core.model.parser.BinaryFileAdapter;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -41,14 +39,11 @@ class ArchiveInfo extends CFileInfo {
res = getElement().getResource();
} catch (CModelException e) {
}
if (res != null && res instanceof IContainer) {
IContainer container = (IContainer)res;
IBinaryArchive ar = getBinaryArchive();
IBinaryObject[] objects = ar.getObjects();
for (int i = 0; i < objects.length; i++) {
final IBinaryObject obj = objects[i];
IFile file = new BinaryFileAdapter(container, obj);
Binary binary = new Binary(getElement(), file) {
Binary binary = new Binary(getElement(), res.getLocation().append(obj.getName())) {
public CElementInfo createElementInfo() {
return new BinaryInfo(this) {
/**
@ -60,10 +55,11 @@ class ArchiveInfo extends CFileInfo {
};
}
};
BinaryInfo info = (BinaryInfo)binary.getElementInfo();
info.loadChildren();
addChild(binary);
}
}
}
return super.getChildren();
}

View file

@ -38,25 +38,7 @@ class BinaryInfo extends CFileInfo {
public ICElement[] getChildren() {
if (hasChanged()) {
if (hash == null) {
hash = new HashMap();
}
hash.clear();
removeChildren();
setIsStructureKnown(true);
IBinaryObject bin = getBinaryObject();
ISymbol[] symbols = bin.getSymbols();
for (int i = 0; i < symbols.length; i++) {
switch (symbols[i].getType()) {
case ISymbol.FUNCTION :
addFunction(symbols[i]);
break;
case ISymbol.VARIABLE :
addVariable(symbols[i]);
break;
}
}
loadChildren();
}
return super.getChildren();
}
@ -157,6 +139,28 @@ class BinaryInfo extends CFileInfo {
return false;
}
void loadChildren() {
if (hash == null) {
hash = new HashMap();
}
hash.clear();
removeChildren();
setIsStructureKnown(true);
IBinaryObject bin = getBinaryObject();
ISymbol[] symbols = bin.getSymbols();
for (int i = 0; i < symbols.length; i++) {
switch (symbols[i].getType()) {
case ISymbol.FUNCTION :
addFunction(symbols[i]);
break;
case ISymbol.VARIABLE :
addVariable(symbols[i]);
break;
}
}
}
IBinaryObject getBinaryObject() {
if (binary == null) {
IProject project = getElement().getCProject().getProject();