Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:55 Go to next message
Fabian  is currently offline Fabian Friend
Messages: 4
Registered: August 2011
Junior Member
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 11:45 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
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 07:35 Go to previous messageGo to next message
Fabian  is currently offline Fabian Friend
Messages: 4
Registered: August 2011
Junior Member
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 12:26 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
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 20:35 Go to previous messageGo to next message
Fabian  is currently offline Fabian Friend
Messages: 4
Registered: August 2011
Junior Member
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 14:02 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
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: Thu Apr 25 12:52:46 GMT 2024

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

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

Back to the top