1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-08 02:53:12 +02:00

2004-09-14 Alain Magloire

Try to find the function in the header.
	* model/org/eclipse/cdt/internal/core/model/BinaryElement.java
	* model/org/eclipse/cdt/internal/core/model/BinaryFunction.java
	* model/org/eclipse/cdt/internal/core/model/BinaryModule.java
This commit is contained in:
Alain Magloire 2004-09-14 18:16:39 +00:00
parent 8a6f84fc72
commit ebecafa648
4 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2004-09-14 Alain Magloire
Try to find the function in the header.
* model/org/eclipse/cdt/internal/core/model/BinaryElement.java
* model/org/eclipse/cdt/internal/core/model/BinaryFunction.java
* model/org/eclipse/cdt/internal/core/model/BinaryModule.java
2004-09-14 Alain Magloire 2004-09-14 Alain Magloire
Define for the contentType extensions for Define for the contentType extensions for

View file

@ -113,6 +113,9 @@ public class BinaryElement extends CElement implements IBinaryElement, ISourceMa
tu = (ITranslationUnit)e; tu = (ITranslationUnit)e;
} }
} }
// do not give up yet in C++ the methods may be inline in the headers
ICProject cproject = getCProject();
tu = mgr.createTranslationUnitFrom(cproject, path);
} else { } else {
// TODO-model: handle non-absolute paths when finding source files // TODO-model: handle non-absolute paths when finding source files
// ??? assert() // ??? assert()

View file

@ -11,12 +11,12 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IBinaryFunction;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IFunction;
/** /**
*/ */
public class BinaryFunction extends BinaryElement implements IFunction { public class BinaryFunction extends BinaryElement implements IBinaryFunction {
public BinaryFunction(ICElement parent, String name, long a) { public BinaryFunction(ICElement parent, String name, long a) {
super(parent, name, ICElement.C_FUNCTION, a); super(parent, name, ICElement.C_FUNCTION, a);

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.core.model.IBinaryElement;
import org.eclipse.cdt.core.model.IBinaryModule; import org.eclipse.cdt.core.model.IBinaryModule;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -26,11 +27,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
*/ */
public class BinaryModule extends Parent implements IBinaryModule { public class BinaryModule extends Parent implements IBinaryModule {
IPath path; IPath fPath;
public BinaryModule(Binary parent, IPath p) { public BinaryModule(Binary parent, IPath p) {
super(parent, p.lastSegment(), ICElement.C_VCONTAINER); super(parent, p.lastSegment(), ICElement.C_VCONTAINER);
path = p; fPath = p;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -61,6 +62,11 @@ public class BinaryModule extends Parent implements IBinaryModule {
* @see org.eclipse.cdt.core.model.ICElement#getResource() * @see org.eclipse.cdt.core.model.ICElement#getResource()
*/ */
public IResource getResource() { public IResource getResource() {
IWorkspaceRoot root = getCModel().getWorkspace().getRoot();
IPath path = getPath();
if (path != null) {
return root.getFileForLocation(fPath);
}
return null; return null;
} }
@ -82,7 +88,7 @@ public class BinaryModule extends Parent implements IBinaryModule {
* @see org.eclipse.cdt.core.model.ICElement#getPath() * @see org.eclipse.cdt.core.model.ICElement#getPath()
*/ */
public IPath getPath() { public IPath getPath() {
return path; return fPath;
} }
/* (non-Javadoc) /* (non-Javadoc)