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

Thanks for the responses,,,

Infact i cant share my source code, but i am using IClasspathEntry and IClasspath classes already to differentitate what type of classpath entry is that in .classpath...

Suppose if classpathentry kind is CPE_LIBRARY i am doing it some way,, if it is CPE_SOURCE i am manipulating my path some how,,

But wha ti am hoping for is a general strategy what ever may be the entry in .classpath file, read the library or source and get its full path,, in other sense ,,

Can I get the path platform takes for building,,,, ?  What path eclipse sets for itself and compiler to compile,, that path i want,,,

can i get it,,
so that one shot ,, every thing will be done,,

Thanks
Regards






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.

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


ForwardSourceID:NT0000623A    
DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery
of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. 
Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services on any subject matter.
Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message 
that do not relate to the official business of Tata Consultancy Services shall be understood as neither given nor endorsed by Tata Consultancy Services or any affiliate of Tata Consultancy Services. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail. Thank you.


Back to the top