Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [pde-dev] Resolving fullpaths from .classfile

Hi boss,

 ok now look this method in a different angle.

 IProject myWebProject = myWorkspaceRoot.getProject("Myproject");

this will give instance of any project either closed or open / referenced or not refernced that is in work space. ok . what you've to do is give any project name here, (itwill return null if the project doesnot exist in work space)else give you a IProject instance of that project..... proceeed....

for example you want to refer a file in the project ABC which is not refered by the current project, at this time also you can use this method, to get instance of ABC, once u get the IProject you can use this

IFolder getFolder(String name) from IProject. where name is again project name,

which will give you where the project is mapped to hard drive, then you can get absolute path of the project and blah blah....

after getting absolute path write a small utility using JDK to get llist of files present in the directory then include in them in classpath if they are java and resource files and enjoy.

if this is also not working for you, there is a straightaway method to retrieve all the classpath entries from a project can you try this. i will look in to this tomorw, and get back to you bcas i m going home now,

if you need this urgently pl. look into the api of these classes i've specified below i am sure, i've used it once(with out refferring .classpath). can you please look into API of IClasspath/IClasspathEntry....>??? let me know if both are not working ....... from IClasspath entry you can get the absolute path also.

hope now yours seems ok now, if not mail me, i will try my best. Nothing is impossible...

regards,
Pradheep.

----Original Message Follows----
From: ravikanth.bhamidipati@xxxxxxx
Reply-To: pde-dev@xxxxxxxxxxx
To: "PRADHEEP THIRUVENGADAM" <pradheept@xxxxxxxxxxx>
CC: pde-dev@xxxxxxxxxxx
Subject: RE: [pde-dev] Resolving fullpaths from .classfile
Date: Wed, 28 Apr 2004 15:51:55 +0530

> does my previous inputs helped u. ? if so. im happy,
yeah pradeep they did help me alot thanks for that..

> 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\.....


Yeah you are right till there..

>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,
>

i was already using getReferencedProjects()  to get all the projects being
referenced. ..But the problem lies here , it only gives me the project
referenced,,,i.e   if i specify my project "Project1" depends on
"Project2" , but i didnt specify this instead i specified in the java
buildpath , my project "Project1" is dependent on  some class folder of
project2 i.e in my case "Project2/bin"  .

so no way i can get the project name from getReferencedProjects();
Another case is that if i keep my class files in some folder and then say
addclassfolder from java buildpath then it will ask me to enter a physical
name and asks me to map this name to the actual locaiton , at that time,,
it becomes even more difficult for me to find the actual full path..
 <classpathentry kind="lib" path="myclassses"/>
where myclasses is the name i have given to the platform and actually this
myclasses points to c:\myeclipseclasses\bin folder.

how can i resolve if the case is above

Thanks for continuous help

Rk

<< InterScan_Disclaimer.txt >>

_________________________________________________________________
Pay Cash on delivery of  products. http://go.msnserver.com/IN/47509.asp Free Registration on Baazee.com



Back to the top