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

Save the binary Object on the BinaryContainer.

This commit is contained in:
Alain Magloire 2004-03-24 01:13:28 +00:00
parent 9eebc9354a
commit 1c2ff9f1d9
8 changed files with 79 additions and 35 deletions

View file

@ -1,3 +1,15 @@
2004-03-23 Alain Magloire
Show the objects on the IOuputEntry path should
be save in the BinaryContainer.
* model/org/eclipse/cdt/internal/core/model/BinaryContainer.java
* model/org/eclipse/cdt/internal/core/model/BinaryRunner.java
* model/org/eclipse/cdt/internal/core/model/CElementDelta.java
* model/org/eclipse/cdt/internal/core/model/CProject.java
* model/org/eclipse/cdt/internal/core/model/PathEntry.java
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
2004-03-22 Tanya Wolff
Externalized names of Binary Parsers and Error Parsers

View file

@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.core.model;
* All Rights Reserved.
*/
import java.util.ArrayList;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CModelException;
@ -23,8 +24,17 @@ public class BinaryContainer extends Openable implements IBinaryContainer {
public IBinary[] getBinaries() {
((BinaryContainerInfo)getElementInfo()).sync();
ICElement[] e = getChildren();
IBinary[] b = new IBinary[e.length];
System.arraycopy(e, 0, b, 0, e.length);
ArrayList list = new ArrayList(e.length);
for (int i = 0; i < e.length; i++) {
if (e[i] instanceof IBinary) {
IBinary bin = (IBinary)e[i];
if (bin.isExecutable() || bin.isSharedLib()) {
list.add(bin);
}
}
}
IBinary[] b = new IBinary[list.size()];
list.toArray(b);
return b;
}

View file

@ -114,7 +114,7 @@ public class BinaryRunner {
}
Archive ar = new Archive(parent, file, (IBinaryArchive)bin);
vlib.addChild(ar);
} else if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
} else {
if (parent == null) {
parent = vbin;
}
@ -136,12 +136,11 @@ public class BinaryRunner {
if (Thread.currentThread().isInterrupted()) {
return false;
}
if (!cproject.isOnOutputEntry(res)) {
return false;
}
if (res instanceof IFile) {
runner.addChildIfBinary((IFile)res);
return false;
if (cproject.isOnOutputEntry(res)) {
if (res instanceof IFile) {
runner.addChildIfBinary((IFile)res);
return false;
}
}
return true;
}

View file

@ -694,7 +694,13 @@ public class CElementDelta implements ICElementDelta {
buffer.append("ADDED TO PATHENTRY LIBRARY"); //$NON-NLS-1$
prev = true;
}
if ((changeFlags & ICElementDelta.F_PATHENTRY_REORDER) != 0) {
if (prev)
buffer.append(" | "); //$NON-NLS-1$
buffer.append("PATHENTRY REORDER"); //$NON-NLS-1$
prev = true;
}
//if ((changeFlags & ICElementDelta.F_SUPER_TYPES) != 0) {
// if (prev)
// buffer.append(" | "); //$NON-NLS-1$

View file

@ -277,10 +277,8 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
vlib.addChild(celement);
} else {
celement = new Binary(cfolder, file, (IBinaryObject)bin);
if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
vbin.addChild(celement);
}
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
vbin.addChild(celement);
}
}
checkIfBinary = true;
@ -300,9 +298,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
} else {
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
IBinary binary = new Binary(vbin, file, (IBinaryObject)bin);
if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
vbin.addChild(binary);
}
vbin.addChild(binary);
}
}
}
@ -331,15 +327,13 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
delta.changed(container, ICElementDelta.CHANGED);
registerCModelDelta(delta);
} else if (type == ICElement.C_BINARY) {
if (! ((IBinary)celement).isObject()) {
//System.out.println("RELEASE Binary " + celement.getElementName());
CProject cproj = (CProject)celement.getCProject();
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
container.removeChild(celement);
CElementDelta delta = new CElementDelta(getCModel());
delta.changed(container, ICElementDelta.CHANGED);
registerCModelDelta(delta);
}
CProject cproj = (CProject)celement.getCProject();
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
container.removeChild(celement);
CElementDelta delta = new CElementDelta(getCModel());
delta.changed(container, ICElementDelta.CHANGED);
registerCModelDelta(delta);
}
if (celement instanceof IParent) {
@ -361,10 +355,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
releaseCElement(pinfo.vLib);
}
IProject project = celement.getCProject().getProject();
BinaryRunner runner = (BinaryRunner) binaryRunners.remove(project);
if (runner != null) {
runner.stop();
}
removeBinaryRunner(project);
}
}
} else {
@ -677,6 +668,16 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
return runner;
}
public void removeBinaryRunner(ICProject cproject) {
removeBinaryRunner(cproject.getProject());
}
public void removeBinaryRunner(IProject project) {
BinaryRunner runner = (BinaryRunner) binaryRunners.remove(project);
if (runner != null) {
runner.stop();
}
}
public SourceMapper getSourceMapper(ICProject cProject) {
SourceMapper mapper = null;
synchronized(sourceMappers) {
@ -941,10 +942,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
}
} else if (0 != (delta.getFlags() & IResourceDelta.REMOVED)) {
IProject project = (IProject) resource;
BinaryRunner runner = (BinaryRunner) binaryRunners.remove(project);
if (runner != null) {
runner.stop();
}
removeBinaryRunner(project);
binaryParsersMap.remove(project);
}
break;

View file

@ -443,7 +443,7 @@ public class CProject extends Openable implements ICProject {
IPath path = resource.getFullPath();
// ensure that folders are only excluded if all of their children are excluded
if (resource.getType() == IResource.FOLDER) {
if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) {
path = path.append("*"); //$NON-NLS-1$
}
@ -567,4 +567,20 @@ public class CProject extends Openable implements ICProject {
public Object[] getNonCResources() throws CModelException {
return ((CProjectInfo) getElementInfo()).getNonCResources(getResource());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.model.CElement#closing(java.lang.Object)
*/
protected void closing(Object info) throws CModelException {
if (info instanceof CProjectInfo) {
CProjectInfo pinfo = (CProjectInfo)info;
if (pinfo.vBin != null) {
pinfo.vBin.close();
}
if (pinfo.vLib != null) {
pinfo.vLib.close();
}
CModelManager.getDefault().removeBinaryRunner(this);
}
super.closing(info);
}
}

View file

@ -118,6 +118,9 @@ public class PathEntry implements IPathEntry {
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
if (path != null) {
buffer.append(path.toString()).append(' ');
}
buffer.append('[');
switch (getEntryKind()) {
case IPathEntry.CDT_LIBRARY :

View file

@ -493,7 +493,7 @@ public class PathEntryManager implements ICDescriptorListener {
protected ICElementDelta makePathEntryDelta(ICProject cproject, IPathEntry entry, boolean removed) {
int kind = entry.getEntryKind();
ICElement celement = null;
int flag = 0;
int flag = ICElementDelta.F_PATHENTRY_REORDER;
if (entry == null) {
celement = cproject;
flag = ICElementDelta.F_PATHENTRY_REORDER;