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
Even I tried the same, but jere is how the eclipse is doing (this i tried with debug on eclipse source once , when i was given the task of computing classpath for a given project) reads the .classpath and prepares IClasspathEntry out of it and finds what kind of entry it is, is it a lib or source folder or some other refrenced project(s) , ....

it is ding what we want , but what a pity thing is it is in the internal package. as you know so we are not suppose to use the classes which starts with internal keyword since they are not supported and can be changed in future release, that logic was nothing but a way i told u in prev mail using a utility class to find out all the list of class files in a folder, (but eclipse does using IFolder concept not using jdk)

so for my task i followd the logic as I said in the previous mail. upto my knowledge this is and till now its is the way. i will search for some other stuffs, in the mean time better implement that logic in a abstract class/interface and carry on. if i found that i will send it to u and then replace the code. lets see ....

       if you still want that code execute a this method in debug mode,
project.build(IProgressMonitor), this will take you finally to the code which is in internal package. it will read classpath entry and prepare absolute path etc... but for me complete debug took nearly 45 mins to get in to the flow and understand what it does ...since all of them are eclipse specific classes. instead of doing that simply with in 50-100 lines you can do it using JDK utilities.

if you find any alternative do pl. mail me.

cheers,
Pradheep.

----Original Message Follows----
From: ravikanth.bhamidipati@xxxxxxx
Reply-To: pde-dev@xxxxxxxxxxx
To: pde-dev@xxxxxxxxxxx
CC: pradheept@xxxxxxxxxxx
Subject: RE: [pde-dev] Resolving fullpaths from .classfile
Date: Thu, 29 Apr 2004 13:16:50 +0530

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