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. * All Rights Reserved.
*/ */
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IArchive; import org.eclipse.cdt.core.model.IArchive;
import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement; 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.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -26,13 +24,6 @@ public class Archive extends CFile implements IArchive {
super (parent, path); super (parent, path);
} }
public IResource getResource() throws CModelException {
if (archive == null) {
archive = new BinaryContainerAdapter(getArchiveInfo().getBinaryArchive());
}
return archive;
}
public IBinary[] getBinaries() { public IBinary[] getBinaries() {
ICElement[] e = getChildren(); ICElement[] e = getChildren();
IBinary[] b = new IBinary[e.length]; 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.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; 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.IFile;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -41,27 +39,25 @@ class ArchiveInfo extends CFileInfo {
res = getElement().getResource(); res = getElement().getResource();
} catch (CModelException e) { } catch (CModelException e) {
} }
if (res != null && res instanceof IContainer) { IBinaryArchive ar = getBinaryArchive();
IContainer container = (IContainer)res; IBinaryObject[] objects = ar.getObjects();
IBinaryArchive ar = getBinaryArchive(); for (int i = 0; i < objects.length; i++) {
IBinaryObject[] objects = ar.getObjects(); final IBinaryObject obj = objects[i];
for (int i = 0; i < objects.length; i++) { Binary binary = new Binary(getElement(), res.getLocation().append(obj.getName())) {
final IBinaryObject obj = objects[i]; public CElementInfo createElementInfo() {
IFile file = new BinaryFileAdapter(container, obj); return new BinaryInfo(this) {
Binary binary = new Binary(getElement(), file) { /**
public CElementInfo createElementInfo() { * @see org.eclipse.cdt.internal.core.model.BinaryInfo#getBinaryObject()
return new BinaryInfo(this) { */
/** IBinaryObject getBinaryObject() {
* @see org.eclipse.cdt.internal.core.model.BinaryInfo#getBinaryObject() return obj;
*/ }
IBinaryObject getBinaryObject() { };
return obj; }
} };
}; BinaryInfo info = (BinaryInfo)binary.getElementInfo();
} info.loadChildren();
}; addChild(binary);
addChild(binary);
}
} }
} }
return super.getChildren(); return super.getChildren();

View file

@ -38,25 +38,7 @@ class BinaryInfo extends CFileInfo {
public ICElement[] getChildren() { public ICElement[] getChildren() {
if (hasChanged()) { if (hasChanged()) {
if (hash == null) { loadChildren();
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;
}
}
} }
return super.getChildren(); return super.getChildren();
} }
@ -157,6 +139,28 @@ class BinaryInfo extends CFileInfo {
return false; 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() { IBinaryObject getBinaryObject() {
if (binary == null) { if (binary == null) {
IProject project = getElement().getCProject().getProject(); IProject project = getElement().getCProject().getProject();