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

Fix for PR 60182

This commit is contained in:
Alain Magloire 2004-04-28 01:08:59 +00:00
parent 970cec46b6
commit 7502088090
8 changed files with 44 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2004-04-27 Alain Magloire
Fix for PR 60182
* model/org/eclipse/cdt/internal/core/model/ArchiveContainer.java
* model/org/eclipse/cdt/internal/core/model/BinarContainer.java
* model/org/eclipse/cdt/internal/core/model/CContainer.java
* model/org/eclipse/cdt/internal/core/model/CProject.java
* model/org/eclipse/cdt/internal/core/model/IncludeReference.java
* model/org/eclipse/cdt/internal/core/model/Openable.java
2004-04-26 Alain Magloire
Changes in the PathEntryStore API

View file

@ -39,6 +39,7 @@ public class ArchiveContainer extends Openable implements IArchiveContainer {
throws CModelException {
// this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject());
CModelManager.getDefault().putInfo(this, info);
return true;
}

View file

@ -49,6 +49,7 @@ public class BinaryContainer extends Openable implements IBinaryContainer {
throws CModelException {
// this will bootstrap/start the runner for the project.
CModelManager.getDefault().getBinaryRunner(getCProject());
CModelManager.getDefault().putInfo(this, info);
return true;
}

View file

@ -22,7 +22,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@ -165,10 +164,12 @@ public class CContainer extends Openable implements ICContainer {
boolean validInfo = false;
try {
IResource res = getResource();
if (res != null && (res instanceof IWorkspaceRoot || res.getProject().isOpen())) {
if (res != null && res.isAccessible()) {
// put the info now, because computing the roots requires it
CModelManager.getDefault().putInfo(this, info);
validInfo = computeChildren(info, res);
} else {
throw newNotPresentException();
}
} finally {
if (!validInfo) {

View file

@ -38,7 +38,6 @@ import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.cdt.core.model.ISourceRoot;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@ -514,10 +513,12 @@ public class CProject extends Openable implements ICProject {
boolean validInfo = false;
try {
IResource res = getResource();
if (res != null && (res instanceof IWorkspaceRoot || res.getProject().isOpen())) {
if (res != null && res.isAccessible()) {
// put the info now, because computing the roots requires it
CModelManager.getDefault().putInfo(this, info);
validInfo = computeSourceRoots(info, res);
} else {
throw newNotPresentException();
}
} finally {
if (!validInfo) {

View file

@ -74,6 +74,7 @@ public class IncludeReference extends Openable implements IIncludeReference {
* @see org.eclipse.cdt.internal.core.model.Openable#generateInfos(org.eclipse.cdt.internal.core.model.OpenableInfo, org.eclipse.core.runtime.IProgressMonitor, java.util.Map, org.eclipse.core.resources.IResource)
*/
protected boolean generateInfos(OpenableInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws CModelException {
CModelManager.getDefault().putInfo(this, info);
return computeChildren(info, underlyingResource);
}

View file

@ -6,6 +6,8 @@
*/
package org.eclipse.cdt.internal.core.model;
import java.io.File;
import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ILibraryEntry;
@ -45,7 +47,11 @@ public class LibraryReferenceArchive extends Archive implements ILibraryReferenc
* @see org.eclipse.cdt.core.model.ICElement#exists()
*/
public boolean exists() {
return getPath().toFile().exists();
File f = getPath().toFile();
if (f != null) {
return f.exists();
}
return false;
}
/* (non-Javadoc)

View file

@ -6,6 +6,8 @@
*/
package org.eclipse.cdt.internal.core.model;
import java.io.File;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ILibraryEntry;
@ -29,7 +31,11 @@ public class LibraryReferenceShared extends Binary implements ILibraryReference
* @see org.eclipse.cdt.internal.core.model.Binary#getModificationStamp()
*/
protected long getModificationStamp() {
return getPath().toFile().lastModified();
File f = getPath().toFile();
if (f != null) {
return f.lastModified();
}
return 0;
}
/* (non-Javadoc)
@ -39,6 +45,17 @@ public class LibraryReferenceShared extends Binary implements ILibraryReference
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICElement#exists()
*/
public boolean exists() {
File f = getPath().toFile();
if (f != null) {
return f.exists();
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICElement#getPath()
*/