Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » ASTParser setEnvironment which paths to use
ASTParser setEnvironment which paths to use [message #715517] Sun, 14 August 2011 05:55 Go to next message
Eclipse UserFriend
Hi

I am having trouble setting up my ASTParser for parsing from char[] Source.

I need resolvedBindings so I decided to use the new setEnvironment Method but Im stuck with the paths.

When I got the following directory structure:

WORKSPACE/project/src/org/ep/tests
WORKSPACE/project/src/org/ep/tests/after
WORKSPACE/project/src/org/ep/tests/before

what are my classpathEntries and sourcepathEntries?

It says to pass absolute paths, does that mean from / or from the root of the Workspace?

Do I need to pass both? Or would the sources be enough to resolve the bindings?

Thanks in advance!
Re: ASTParser setEnvironment which paths to use [message #716067 is a reply to message #715517] Tue, 16 August 2011 07:45 Go to previous messageGo to next message
Eclipse UserFriend
Absolute paths always means from /. You could mention sourcePathEntries as WORKSPACE/project/src. Note that you could stop at src. BTW, if your application is an Eclipse plugin, you could also just call setProject() rather than setEnvironment.
Re: ASTParser setEnvironment which paths to use [message #716362 is a reply to message #715517] Wed, 17 August 2011 03:35 Go to previous messageGo to next message
Eclipse UserFriend
Hm, so I will have to start those paths from the beginning of my filesystem root directory? Wouldnt they work in a diffferent environment?

About the setProject: yes I tried to use that, but I couldnt find an easy way to get the current Project, do you know how to obtain that?

Best
Re: ASTParser setEnvironment which paths to use [message #716444 is a reply to message #716362] Wed, 17 August 2011 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Yes, the full path will change, but programmaticaly you will be able to a way to find the full path. By the way, you could get the project by calling something like
JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject("ProjectName"));
Re: ASTParser setEnvironment which paths to use [message #716933 is a reply to message #715517] Thu, 18 August 2011 16:35 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, but thats whats not working for me. I run the plugin as Junit Plugin Test and I get an open but empty Workspace. No projects in it, so it cant open any project that I would want to open with your piece of code.

No idea why is this though... cant find a decent tutorial or help online as well...
Re: ASTParser setEnvironment which paths to use [message #717168 is a reply to message #716933] Fri, 19 August 2011 10:02 Go to previous message
Eclipse UserFriend
The statement will give access to the IProject handle for already existing projects. If you want to create a project, http://www.pushing-pixels.org/2008/11/18/extending-eclipse-creating-a-java-project-without-displaying-a-wizard.html could probably help.
Previous Topic:Multithread Debuging Problem
Next Topic:Problem using Java Search Engine
Goto Forum:
  


Current Time: Sun Mar 23 07:54:37 EDT 2025

Powered by FUDForum. Page generated in 0.04303 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top