mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for PR 57287
This commit is contained in:
parent
381b012a01
commit
6e5fa262c6
5 changed files with 69 additions and 48 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2004-04-03 Alain Magloire
|
||||||
|
|
||||||
|
Fix for PR 57287
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/CModelManager.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
|
||||||
|
|
||||||
|
* model/org/eclipse/cdt/internal/core/model/PEBinaryObject.java
|
||||||
|
|
||||||
2004-04-02 Alain Magloire
|
2004-04-02 Alain Magloire
|
||||||
|
|
||||||
Use the the Job manager for the binary runner.
|
Use the the Job manager for the binary runner.
|
||||||
|
|
|
@ -412,6 +412,7 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
|
||||||
if (pinfo.vLib != null) {
|
if (pinfo.vLib != null) {
|
||||||
releaseCElement(pinfo.vLib);
|
releaseCElement(pinfo.vLib);
|
||||||
}
|
}
|
||||||
|
pinfo.resetCaches();
|
||||||
IProject project = celement.getCProject().getProject();
|
IProject project = celement.getCProject().getProject();
|
||||||
removeBinaryRunner(project);
|
removeBinaryRunner(project);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,13 +11,13 @@ import org.eclipse.cdt.core.model.IArchiveContainer;
|
||||||
import org.eclipse.cdt.core.model.IBinaryContainer;
|
import org.eclipse.cdt.core.model.IBinaryContainer;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
import org.eclipse.cdt.core.model.ICModel;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||||
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;
|
||||||
import org.eclipse.core.resources.IResourceDelta;
|
import org.eclipse.core.resources.IResourceDelta;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,12 +55,40 @@ public class DeltaProcessor {
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
|
|
||||||
|
boolean shouldProcess = true;
|
||||||
|
|
||||||
|
// Check for C nature or if the was a CNature
|
||||||
|
if (!(resource instanceof IWorkspaceRoot)) {
|
||||||
|
IProject project = resource.getProject();
|
||||||
|
if (!(manager.hasCNature(project) || manager.hasCCNature(project))) {
|
||||||
|
shouldProcess = false;
|
||||||
|
CModel root = manager.getCModel();
|
||||||
|
CModelInfo rootInfo = (CModelInfo)manager.peekAtInfo(root);
|
||||||
|
if (rootInfo != null) {
|
||||||
|
ICElement[] celements = rootInfo.getChildren();
|
||||||
|
for (int i = 0; i < celements.length; i++) {
|
||||||
|
IResource r = celements[i].getResource();
|
||||||
|
if (project.equals(r)) {
|
||||||
|
shouldProcess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shouldProcess) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ICElement celement = manager.create(resource, null);
|
ICElement celement = manager.create(resource, null);
|
||||||
|
|
||||||
// BUG 36424:
|
// BUG 36424:
|
||||||
// The Binary may only be visible in the BinaryContainers
|
// The Binary may only be visible in the BinaryContainers
|
||||||
if (celement == null) {
|
|
||||||
|
if (celement == null && resource.getType() == IResource.FILE) {
|
||||||
ICElement[] children;
|
ICElement[] children;
|
||||||
ICProject cproj = manager.create(resource.getProject());
|
ICProject cproj = manager.create(resource.getProject());
|
||||||
if (cproj != null && cproj.isOpen()) {
|
if (cproj != null && cproj.isOpen()) {
|
||||||
|
@ -79,7 +107,7 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
// BUG 36424:
|
// BUG 36424:
|
||||||
// The Archive may only be visible in the ArchiveContainers
|
// The Archive may only be visible in the ArchiveContainers
|
||||||
if (celement == null) {
|
if (celement == null && resource.getType() == IResource.FILE) {
|
||||||
ICElement[] children;
|
ICElement[] children;
|
||||||
ICProject cproj = manager.create(resource.getProject());
|
ICProject cproj = manager.create(resource.getProject());
|
||||||
if (cproj != null && cproj.isOpen()) {
|
if (cproj != null && cproj.isOpen()) {
|
||||||
|
@ -109,8 +137,7 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the Element from the CModel hastable.
|
* Release the Element and cleaning.
|
||||||
* Returns null if none was found.
|
|
||||||
*/
|
*/
|
||||||
protected void releaseCElement(ICElement celement) {
|
protected void releaseCElement(ICElement celement) {
|
||||||
CModelManager.getDefault().releaseCElement(celement);
|
CModelManager.getDefault().releaseCElement(celement);
|
||||||
|
@ -143,8 +170,9 @@ public class DeltaProcessor {
|
||||||
}
|
}
|
||||||
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
|
if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) {
|
||||||
//ICElement movedFromElement = createElement(delta.getMovedFromPath());
|
//ICElement movedFromElement = createElement(delta.getMovedFromPath());
|
||||||
if (movedFromElement == null)
|
if (movedFromElement == null) {
|
||||||
movedFromElement = createElement(delta.getMovedFromPath());
|
movedFromElement = createElement(delta.getMovedFromPath());
|
||||||
|
}
|
||||||
fCurrentDelta.movedTo(element, movedFromElement);
|
fCurrentDelta.movedTo(element, movedFromElement);
|
||||||
movedFromElement = null;
|
movedFromElement = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -306,33 +334,7 @@ public class DeltaProcessor {
|
||||||
public ICElementDelta[] processResourceDelta(IResourceDelta changes) {
|
public ICElementDelta[] processResourceDelta(IResourceDelta changes) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ICElement root = (ICModel)CModelManager.getDefault().getCModel();
|
ICElement root = CModelManager.getDefault().getCModel();
|
||||||
|
|
||||||
/*
|
|
||||||
try {
|
|
||||||
changes.accept(new IResourceDeltaVisitor() {
|
|
||||||
public boolean visit(IResourceDelta delta) {
|
|
||||||
switch (delta.getKind()) {
|
|
||||||
case IResourceDelta.ADDED :
|
|
||||||
// handle added resource
|
|
||||||
System.out.print("ADDED ");
|
|
||||||
break;
|
|
||||||
case IResourceDelta.REMOVED :
|
|
||||||
// handle removed resource
|
|
||||||
System.out.print("REMOVED ");
|
|
||||||
break;
|
|
||||||
case IResourceDelta.CHANGED :
|
|
||||||
// handle changed resource
|
|
||||||
System.out.print("CHANGED ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
System.out.println(delta.getResource());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// get the workspace delta, and start processing there.
|
// get the workspace delta, and start processing there.
|
||||||
IResourceDelta[] deltas = changes.getAffectedChildren();
|
IResourceDelta[] deltas = changes.getAffectedChildren();
|
||||||
ICElementDelta[] translatedDeltas = new CElementDelta[deltas.length];
|
ICElementDelta[] translatedDeltas = new CElementDelta[deltas.length];
|
||||||
|
@ -377,6 +379,21 @@ public class DeltaProcessor {
|
||||||
* @param delta
|
* @param delta
|
||||||
*/
|
*/
|
||||||
protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
|
protected void nonCResourcesChanged(ICElement parent, IResourceDelta delta) {
|
||||||
|
if (parent instanceof Openable && ((Openable)parent).isOpen()) {
|
||||||
|
CElementInfo info = ((Openable)parent).getElementInfo();
|
||||||
|
switch (parent.getElementType()) {
|
||||||
|
case ICElement.C_MODEL:
|
||||||
|
((CModelInfo)info).setNonCResources(null);
|
||||||
|
fCurrentDelta.addResourceDelta(delta);
|
||||||
|
return;
|
||||||
|
case ICElement.C_PROJECT:
|
||||||
|
((CProjectInfo)info).setNonCResources(null);
|
||||||
|
break;
|
||||||
|
case ICElement.C_CCONTAINER:
|
||||||
|
((CContainerInfo)info).setNonCResources(null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
CElementDelta elementDelta = fCurrentDelta.find(parent);
|
CElementDelta elementDelta = fCurrentDelta.find(parent);
|
||||||
if (elementDelta == null) {
|
if (elementDelta == null) {
|
||||||
fCurrentDelta.changed(parent, ICElementDelta.F_CONTENT);
|
fCurrentDelta.changed(parent, ICElementDelta.F_CONTENT);
|
||||||
|
@ -387,20 +404,6 @@ public class DeltaProcessor {
|
||||||
} else {
|
} else {
|
||||||
elementDelta.addResourceDelta(delta);
|
elementDelta.addResourceDelta(delta);
|
||||||
}
|
}
|
||||||
if (parent instanceof Openable && ((Openable)parent).isOpen()) {
|
|
||||||
CElementInfo info = ((Openable)parent).getElementInfo();
|
|
||||||
switch (parent.getElementType()) {
|
|
||||||
case ICElement.C_MODEL:
|
|
||||||
((CModelInfo)info).setNonCResources(null);
|
|
||||||
break;
|
|
||||||
case ICElement.C_PROJECT:
|
|
||||||
((CProjectInfo)info).setNonCResources(null);
|
|
||||||
break;
|
|
||||||
case ICElement.C_CCONTAINER:
|
|
||||||
((CContainerInfo)info).setNonCResources(null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -84,6 +84,9 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
* pathentry containers pool
|
* pathentry containers pool
|
||||||
*/
|
*/
|
||||||
public static HashMap Containers = new HashMap(5);
|
public static HashMap Containers = new HashMap(5);
|
||||||
|
|
||||||
|
static final IPathEntry[] NO_PATHENTRIES = new IPathEntry[0];
|
||||||
|
|
||||||
HashMap resolvedMap = new HashMap();
|
HashMap resolvedMap = new HashMap();
|
||||||
private static PathEntryManager pathEntryManager;
|
private static PathEntryManager pathEntryManager;
|
||||||
|
|
||||||
|
@ -145,6 +148,10 @@ public class PathEntryManager implements ICDescriptorListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry[] getRawPathEntries(ICProject cproject) throws CModelException {
|
public IPathEntry[] getRawPathEntries(ICProject cproject) throws CModelException {
|
||||||
|
CModelManager factory = CModelManager.getDefault();
|
||||||
|
if (!(factory.hasCNature(cproject.getProject()) || factory.hasCCNature(cproject.getProject()))) {
|
||||||
|
return NO_PATHENTRIES;
|
||||||
|
}
|
||||||
ArrayList pathEntries = new ArrayList();
|
ArrayList pathEntries = new ArrayList();
|
||||||
try {
|
try {
|
||||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(cproject.getProject());
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(cproject.getProject());
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class PEBinaryObject extends BinaryObjectAdapter {
|
||||||
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
|
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryFile#getType()
|
||||||
*/
|
*/
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return IBinaryFile.CORE;
|
return IBinaryFile.OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue