diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index ee402cfb748..33fdc5b44c4 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -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 diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java index 2f15e1cfb3c..bc65b1c174c 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryContainer.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java index 257121d87e3..d93b8e1262b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryRunner.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java index ac88d6708d3..10c1916d91f 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDelta.java @@ -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$ 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 19ba0165edb..ec3d41c6f37 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 @@ -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; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java index d281be7fa20..e3c25d288d9 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CProject.java @@ -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); + } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java index d5b77636678..541d74392ec 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntry.java @@ -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 : diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java index 7d430bbd09b..180f314c0fe 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryManager.java @@ -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;