[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [pde-dev] Resolving fullpaths from .classfile
|
Hi,
does my previous inputs helped u. ? if so. im happy, solving your current
problem is simple. i've explained with scenario, do mail me if i m wrong / i
m deviating from ur issue. i will try my best. This is a long reply, even
more procedural also.
I think the problem will get solved if you get the absolute
location of a project right?
for eg. there is a Project called myProject in workspace, i want to get the
absolute path
where it get mapped to eg the project myProject may refer
d:\ravikanth\myproject\.....
If above said is the problem it can be easily solved. I am giving solution
based my understanding as said above.
1. get the workspace first
IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
2. get the instance of current working project which you want to build
IProject myWebProject = myWorkspaceRoot.getProject("Myproject");
3. get the list of projects used by the current project if any.
IProject[] getReferencedProjects()
Returns the projects referenced by this project. iterate throu
all the projects in the workspace,
for each iteration do the following
if classpathentry.projectname matches IProject[i]
then get the absolute path of the project. // where
classpathentry.projectname is
// the one which you found in .classpath
here is how u get the absolute path ? ? IProject has a method,
getFolder(String)
IFolder getFolder(String name)
this will Returns a handle to the folder with the given name
in this project.
this will return null if the name doesn't exist refer
IProject API
give the project name in our case Myproject it will give you the
IFolder, keep this IFolder in referencence, for eg. you want to include
XYZ.java in classpath just give filename to the respective IFolder instance,
it will give you the instance of IFile from that u can easily get the
absolute path of the java file. which is equal to the reference of a class
file,
if you need only full path of a project u will get it directly by
getFullPathMethod(), then concat with the entries present in .classpath.
eg.<classpath>
<classpathentry kind="lib" path="/Project2/bin"/>
</classpath>
if Project2 is project get the full path of this project2 from the above
method. then replace the project name Projec2 with full path.
suggest u to go thro IProject,IAdaptable, IContainer, IResource for
complete info.
Note : from absolute path of the project you can do what ever you want. you
can take some files from that project and compile it and add it in to
classpath what ever it may be. even jar files also. but it is recomended
that all the reffering/ reffered project to be in open state before
compiling/building to avoid resource conflicts.
this is the convention that eclipse build is following, it will not compile
the source if the reffered project(s) is in closed state even though its
possible to refer/load the class files in a project that is in closed state.
expecting reply,
Pradheep
----Original Message Follows----
From: ravikanth.bhamidipati@xxxxxxx
Reply-To: pde-dev@xxxxxxxxxxx
To: pde-dev@xxxxxxxxxxx
Subject: [pde-dev] Resolving fullpaths from .classfile
Date: Wed, 28 Apr 2004 10:43:41 +0530
Thanks pradheep for your replies,,
But some how my problem is not still solved, i was not able to get the
full resolved paths from .classpath.
for my customised compiler to run, i need to give full classpath, which i
am settingup programtically by reading the .classpath file. But my
problem comes in these type of scenarios , i will explain,,
Suppose i have one project named "Project1" and its classpath file looks
like this,
<classpath>
<classpathentry kind="src" path="srcfold"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Project2/bin"/>
<classpathentry kind="output" path="bin"/>
</classpath>ForwardSourceID:NT000061DE
I didnt specify that my project " Project1" depends on Project2, but i
specified in buildpath, add this external class folder "project2/bin" so
the classpath like above has formed.
Now i need to resolve the classpath of the above classpathentry of type
CPE_LIBRARY . This project2 is not in default work space it is somewhere
on my disk. How can i resolve these sort of classpaths.
This is only one scenariio,, but i have so many problems resolving
relative paths.
Can any one please help me how to resolve these sort of relative paths.
makeAbsolute() method seems to be not working fine. it is not giving me
the absolute path.
Thanks in advance...
Rk
kjksdfsdkljfd
<< InterScan_Disclaimer.txt >>
_________________________________________________________________
Ready cash in just 72 hours. Apply Now !!!
http://go.msnserver.com/IN/46922.asp