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:
parent
9eebc9354a
commit
1c2ff9f1d9
8 changed files with 79 additions and 35 deletions
|
@ -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
|
2004-03-22 Tanya Wolff
|
||||||
Externalized names of Binary Parsers and Error Parsers
|
Externalized names of Binary Parsers and Error Parsers
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
@ -23,8 +24,17 @@ public class BinaryContainer extends Openable implements IBinaryContainer {
|
||||||
public IBinary[] getBinaries() {
|
public IBinary[] getBinaries() {
|
||||||
((BinaryContainerInfo)getElementInfo()).sync();
|
((BinaryContainerInfo)getElementInfo()).sync();
|
||||||
ICElement[] e = getChildren();
|
ICElement[] e = getChildren();
|
||||||
IBinary[] b = new IBinary[e.length];
|
ArrayList list = new ArrayList(e.length);
|
||||||
System.arraycopy(e, 0, b, 0, 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;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class BinaryRunner {
|
||||||
}
|
}
|
||||||
Archive ar = new Archive(parent, file, (IBinaryArchive)bin);
|
Archive ar = new Archive(parent, file, (IBinaryArchive)bin);
|
||||||
vlib.addChild(ar);
|
vlib.addChild(ar);
|
||||||
} else if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
|
} else {
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
parent = vbin;
|
parent = vbin;
|
||||||
}
|
}
|
||||||
|
@ -136,12 +136,11 @@ public class BinaryRunner {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cproject.isOnOutputEntry(res)) {
|
if (cproject.isOnOutputEntry(res)) {
|
||||||
return false;
|
if (res instanceof IFile) {
|
||||||
}
|
runner.addChildIfBinary((IFile)res);
|
||||||
if (res instanceof IFile) {
|
return false;
|
||||||
runner.addChildIfBinary((IFile)res);
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,13 @@ public class CElementDelta implements ICElementDelta {
|
||||||
buffer.append("ADDED TO PATHENTRY LIBRARY"); //$NON-NLS-1$
|
buffer.append("ADDED TO PATHENTRY LIBRARY"); //$NON-NLS-1$
|
||||||
prev = true;
|
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 ((changeFlags & ICElementDelta.F_SUPER_TYPES) != 0) {
|
||||||
// if (prev)
|
// if (prev)
|
||||||
// buffer.append(" | "); //$NON-NLS-1$
|
// buffer.append(" | "); //$NON-NLS-1$
|
||||||
|
|
|
@ -277,10 +277,8 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
vlib.addChild(celement);
|
vlib.addChild(celement);
|
||||||
} else {
|
} else {
|
||||||
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
celement = new Binary(cfolder, file, (IBinaryObject)bin);
|
||||||
if (bin.getType() == IBinaryFile.EXECUTABLE || bin.getType() == IBinaryFile.SHARED) {
|
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
vbin.addChild(celement);
|
||||||
vbin.addChild(celement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkIfBinary = true;
|
checkIfBinary = true;
|
||||||
|
@ -300,9 +298,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
} else {
|
} else {
|
||||||
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
BinaryContainer vbin = (BinaryContainer)cproject.getBinaryContainer();
|
||||||
IBinary binary = new Binary(vbin, file, (IBinaryObject)bin);
|
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);
|
delta.changed(container, ICElementDelta.CHANGED);
|
||||||
registerCModelDelta(delta);
|
registerCModelDelta(delta);
|
||||||
} else if (type == ICElement.C_BINARY) {
|
} else if (type == ICElement.C_BINARY) {
|
||||||
if (! ((IBinary)celement).isObject()) {
|
|
||||||
//System.out.println("RELEASE Binary " + celement.getElementName());
|
//System.out.println("RELEASE Binary " + celement.getElementName());
|
||||||
CProject cproj = (CProject)celement.getCProject();
|
CProject cproj = (CProject)celement.getCProject();
|
||||||
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
||||||
container.removeChild(celement);
|
container.removeChild(celement);
|
||||||
CElementDelta delta = new CElementDelta(getCModel());
|
CElementDelta delta = new CElementDelta(getCModel());
|
||||||
delta.changed(container, ICElementDelta.CHANGED);
|
delta.changed(container, ICElementDelta.CHANGED);
|
||||||
registerCModelDelta(delta);
|
registerCModelDelta(delta);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (celement instanceof IParent) {
|
if (celement instanceof IParent) {
|
||||||
|
@ -361,10 +355,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
releaseCElement(pinfo.vLib);
|
releaseCElement(pinfo.vLib);
|
||||||
}
|
}
|
||||||
IProject project = celement.getCProject().getProject();
|
IProject project = celement.getCProject().getProject();
|
||||||
BinaryRunner runner = (BinaryRunner) binaryRunners.remove(project);
|
removeBinaryRunner(project);
|
||||||
if (runner != null) {
|
|
||||||
runner.stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -677,6 +668,16 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
return runner;
|
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) {
|
public SourceMapper getSourceMapper(ICProject cProject) {
|
||||||
SourceMapper mapper = null;
|
SourceMapper mapper = null;
|
||||||
synchronized(sourceMappers) {
|
synchronized(sourceMappers) {
|
||||||
|
@ -941,10 +942,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
}
|
}
|
||||||
} else if (0 != (delta.getFlags() & IResourceDelta.REMOVED)) {
|
} else if (0 != (delta.getFlags() & IResourceDelta.REMOVED)) {
|
||||||
IProject project = (IProject) resource;
|
IProject project = (IProject) resource;
|
||||||
BinaryRunner runner = (BinaryRunner) binaryRunners.remove(project);
|
removeBinaryRunner(project);
|
||||||
if (runner != null) {
|
|
||||||
runner.stop();
|
|
||||||
}
|
|
||||||
binaryParsersMap.remove(project);
|
binaryParsersMap.remove(project);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -443,7 +443,7 @@ public class CProject extends Openable implements ICProject {
|
||||||
IPath path = resource.getFullPath();
|
IPath path = resource.getFullPath();
|
||||||
|
|
||||||
// ensure that folders are only excluded if all of their children are excluded
|
// 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$
|
path = path.append("*"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,4 +567,20 @@ public class CProject extends Openable implements ICProject {
|
||||||
public Object[] getNonCResources() throws CModelException {
|
public Object[] getNonCResources() throws CModelException {
|
||||||
return ((CProjectInfo) getElementInfo()).getNonCResources(getResource());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,9 @@ public class PathEntry implements IPathEntry {
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
if (path != null) {
|
||||||
|
buffer.append(path.toString()).append(' ');
|
||||||
|
}
|
||||||
buffer.append('[');
|
buffer.append('[');
|
||||||
switch (getEntryKind()) {
|
switch (getEntryKind()) {
|
||||||
case IPathEntry.CDT_LIBRARY :
|
case IPathEntry.CDT_LIBRARY :
|
||||||
|
|
|
@ -493,7 +493,7 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
protected ICElementDelta makePathEntryDelta(ICProject cproject, IPathEntry entry, boolean removed) {
|
protected ICElementDelta makePathEntryDelta(ICProject cproject, IPathEntry entry, boolean removed) {
|
||||||
int kind = entry.getEntryKind();
|
int kind = entry.getEntryKind();
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
int flag = 0;
|
int flag = ICElementDelta.F_PATHENTRY_REORDER;
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
celement = cproject;
|
celement = cproject;
|
||||||
flag = ICElementDelta.F_PATHENTRY_REORDER;
|
flag = ICElementDelta.F_PATHENTRY_REORDER;
|
||||||
|
|
Loading…
Add table
Reference in a new issue