Bug 101677 - [call hierarchy] Cannot cancel tree expansion jobs except in jobs view
Summary: [call hierarchy] Cannot cancel tree expansion jobs except in jobs view
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Markus Keller CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-24 12:53 EDT by Markus Keller CLA Friend
Modified: 2005-09-02 11:58 EDT (History)
2 users (show)

See Also:


Attachments
possible fix (6.70 KB, patch)
2005-06-24 12:55 EDT, Markus Keller CLA Friend
no flags Details | Diff
Better fix (14.83 KB, patch)
2005-08-08 09:43 EDT, Markus Keller CLA Friend
no flags Details | Diff
Fix without extension point for adapter (12.29 KB, patch)
2005-08-10 12:14 EDT, Markus Keller CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA Friend 2005-06-24 12:53:47 EDT
3.1 RC4

See bug 101625: Had to disable cancelling due to NPEs.
Comment 1 Markus Keller CLA Friend 2005-06-24 12:55:17 EDT
Created attachment 23953 [details]
possible fix
Comment 2 Markus Keller CLA Friend 2005-08-08 09:43:00 EDT
Created attachment 25830 [details]
Better fix

This is a better fix that also cancels a pending tree node expansion in tree
depth > 2. Patch released to HEAD.

Here's a class for manual testing. The first fix did not cancel the search when
expanding toString in this caller hierarchy:
take(Object)
+ run()
- run2()
  - toString()
      ...
  + hashCode()


public class CallHierarchyTest {
	public void take(Object o) { //start CH here
	}
	
	public void run() {
		take("A");
	}
	
	void run2() {
		take("B");
	}
	
	public String toString() {
		run();
		run2();
		return super.toString();
	}
	public int hashCode() {
		run();
		run2();
		return super.hashCode();
	}
}
Comment 3 Dirk Baeumer CLA Friend 2005-08-08 10:31:19 EDT
Markus, can you please step by an explain the patch to me. I don't see what the
advantage is of creating the wrapper via an extension point now. Code wise it
doesn't look too different.
Comment 4 Markus Keller CLA Friend 2005-08-10 12:14:30 EDT
Created attachment 25980 [details]
Fix without extension point for adapter
Comment 5 Dirk Baeumer CLA Friend 2005-08-11 06:25:38 EDT
Patch looks good for me. One little thing: shouldn't we assist in
MethodWrapperWorkbenchAdapter that the methodWrapper is not null.

Martin, can you please have a look as well ?
Comment 6 Markus Keller CLA Friend 2005-08-11 10:47:08 EDT
Yes, we could add an assert to check that the MethodWrapper is not null.
However, this is currently guaranteed by construction and we also didn't have it
in DeferredMethodWrapper. I'll add it when I release to HEAD.

Explanation for Martin: The MethodWrapperWorkbenchAdapter is necessary because
of the way the DeferredTreeContentManager determines the Jobs to cancel:
- We request cancellation of the tree root MethodWrapper
- The DeferredTreeContentManager asks all running jobs whether thy run on a
child of the element to cancel. To determine the parent of a tree element, it
tries to adapt each parent element to IWorkbenchAdapter and then asks the
adapter for its parent.
Comment 7 Martin Aeschlimann CLA Friend 2005-08-11 10:59:49 EDT
patch reviewed, ok to release.
Comment 8 Markus Keller CLA Friend 2005-08-11 12:13:44 EDT
Released to 3.1.1.
Released to HEAD with assert in MethodWrapperWorkbenchAdapter.
Comment 9 Dirk Baeumer CLA Friend 2005-09-02 11:43:17 EDT
start verifying...
Comment 10 Dirk Baeumer CLA Friend 2005-09-02 11:58:40 EDT
Verified that the first top level search any any search caused be expanding a
node can be canceled.

Verified on M20050831-1200 + plug-in export.