Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Force Refresh of Project Classpath Status(Trying to force a refresh operation whihc affects imported libraries)
Force Refresh of Project Classpath Status [message #648946] Sun, 16 January 2011 06:22 Go to next message
Ryan O'Meara is currently offline Ryan O'Meara
Messages: 8
Registered: July 2009
Junior Member
Background:

I am writing plug-ins which allow for the creation of a specific type of Java project, and add a custom classpath. These plug-ins also include views which access the Java model and display project data.

Problem:

The libraries the classpath references can become "missing" - however, there is already code in place to resolve the issue, which automatically checks for it and executes when the problem is detected. However, in order for the errors relating to imports and classes not being found to be recognized as resolved, I must manually click in the package explorer window, and refresh. The views which display data about the project are unable to correctly display their data until this happens, as the java model cannot resolve the classes fully until then. What I wish to do is programmically, from within the plug-in, trigger that refresh. I am running the code which would do this from a seperate thread, however I can force code to execute form the display thread if necessary via Display.syncExec (or asyncExec).

Attempted Solutions:

I have tried using IResource.refreshLocal(DEPTH_INFINITE) on both the affect projects and the workspace as a whole

I have tried setRawClasspath(getRawClasspath) as suggested in the IJavaProject documentation

I have tried retrieving the PackageExplorerPart (successfully; the part i received was not null) and invoking its refresh method

None of these methods has resulted in the error symbols in the editor and on the project folder automatically being resolved once the code to fix the libraries is complete; and none of them has allowed the views to perform their task either. However, every time I was able to resolve the errors by refreshing the package explorer view.

Desired Result:

I wish to automatically handle the errors and have them automatically resolve (in the same way as refreshing the package explorer window) once the library has been dealt with.

Thanks in advance for any help you can offer
Re: Force Refresh of Project Classpath Status [message #648985 is a reply to message #648946] Sun, 16 January 2011 23:47 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 16/01/11 4:52 PM, Ryan O'Meara wrote:
> I wish to automatically handle the errors and have them automatically
> resolve (in the same way as refreshing the package explorer window) once
> the library has been dealt with.
> Thanks in advance for any help you can offer

What happens if you do a project.build(), after resolving the library
issue?

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: Force Refresh of Project Classpath Status [message #648989 is a reply to message #648946] Mon, 17 January 2011 00:59 Go to previous messageGo to next message
Jayaprakash Arthanareeswaran is currently offline Jayaprakash Arthanareeswaran
Messages: 7
Registered: July 2009
Junior Member
Are the libraries added as external ones? If so, the symptoms sound lot like this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=305172

This has already been fixed for 3.7 M4. Could you please try a newer code base/build?
Re: Force Refresh of Project Classpath Status [message #648996 is a reply to message #648989] Mon, 17 January 2011 02:21 Go to previous message
Ryan O'Meara is currently offline Ryan O'Meara
Messages: 8
Registered: July 2009
Junior Member
My issue is slightly different. I tried the build, and in combination with some information I gained from the bug report, I was able to make a solution. I will reevaluate the need for my code once 3.7 is released for general use.

Thanks you for your help!
Previous Topic:Cannot not start Java program in eclipse
Next Topic:Tomorrow's Tech Today: HTML 5 by Scott Davis at GIDS 2011
Goto Forum:
  


Current Time: Fri Aug 01 05:52:23 EDT 2014

Powered by FUDForum. Page generated in 0.02232 seconds