Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 403023

Summary: LWS icon changes without change in selected input type in Javadoc / Declaration view
Product: [Eclipse Project] JDT Reporter: Noopur Gupta <noopur_gupta>
Component: TextAssignee: Martin Mathew <manju656>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 4.3   
Target Milestone: 4.3 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Noopur Gupta CLA 2013-03-12 06:59:48 EDT
1. Select a java project in the package explorer.
2. In the javadoc / declaration view, click on the LWS icon multiple times until the view is cleared and LWS is enabled.
3. Now select 'src' folder in package explorer. 

The LWS icon changes even though there was no change in the selected input type for the view.
Comment 1 Martin Mathew CLA 2013-03-12 11:58:11 EDT
AbstractInfoView#setLinkingEnabled() internally invokes #computeAndDoSetInput() with the argument (resetIfInvalid = true) which forces to reset the view in case of an invalid input.This results in an empty view and a normal icon in the Info view. Now if the user selects another invalid input from the Package Explorer View, then #computeAndDoSetInput() is invoked with parameter (resetIfInvalid = false), hence the view contents remains the same but the icon is updated to show an invalid input.

One solution would be to check in the background thread initiated by #computeAndDoSetInput the content of the old input and update the icon only if #computeInput() returns a non null value.

//The actual computation
final Object input= computeInput(part, selection, je, computeProgressMonitor);
if (input == null && !resetIfInvalid && fCurrentViewInput != null) {
	IJavaElement oldElement= fCurrentViewInput;
	//update the link image only if the old input was a valid one
	Object oldInput= computeInput(null, null, oldElement, computeProgressMonitor);
	if (oldInput != null && oldElement.exists()) {
		// leave the last shown documentation until it becomes invalid
		updateLinkImage(true);
		return;
	}
}
Comment 2 Dani Megert CLA 2013-03-13 08:33:49 EDT

*** This bug has been marked as a duplicate of bug 403074 ***