Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 265049 - [CommonNavigator] ClassCastException from WorkingSetFilterActionGroup (that should not happen)
Summary: [CommonNavigator] ClassCastException from WorkingSetFilterActionGroup (that s...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Francis Upton IV CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 265320 268248 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-16 14:26 EST by Fabio Zadrozny CLA
Modified: 2009-06-03 13:10 EDT (History)
3 users (show)

See Also:


Attachments
Traceback when changing the working set. (2.69 KB, text/plain)
2009-02-16 14:26 EST, Fabio Zadrozny CLA
no flags Details
Traceback when setting the selection (5.53 KB, text/plain)
2009-02-16 14:27 EST, Fabio Zadrozny CLA
no flags Details
Patch removing those casts (2.00 KB, patch)
2009-03-27 16:43 EDT, Fabio Zadrozny CLA
emoffatt: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2009-02-16 14:26:25 EST
Created attachment 125810 [details]
Traceback when changing the working set.

Build ID:  I20090202-1535

Steps To Reproduce:
With Eclipse 3.5M5, install Pydev, open a pydev package explorer and select/deselect a working set.

Note that the exception happens in Pydev, but the bug is in th CNF (Common Navigator Framework)

More information:
1. I'm in PydevPackageExplorer -- which is based on the CNF (Common Navigator Framework)
2. I set a selection in the tree viewer and it ends up with a stack trace (attached)
or
2. A working set is selected/deselected

I'm not sure why this is happening now (it works without problems on 3.4.1), but the problem seems to be that org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider (which apparently is responsible for adding the working set actions) thinks it's dealing with the ProjectExplorer and not with some other navigator that uses the CNF.
Comment 1 Fabio Zadrozny CLA 2009-02-16 14:27:21 EST
Created attachment 125811 [details]
Traceback when setting the selection
Comment 2 Fabio Zadrozny CLA 2009-02-16 14:35:58 EST
I just saw that in the Project explorer when the Working set changes, it's updated with the name of the working set (this seems to be a new feature), so, it probably was introduced at that time.

Those methods (setWorkingSetLabel / getWorkingSetLabel) should probably be in the CommonNavigator class and that action should cast to CommonNavigator -- which is something the CNF expects.
Comment 3 Francis Upton IV CLA 2009-02-16 14:36:43 EST
Yes, this was changed in 3.5M5, some of the working set support is now dependent on the use of the ProjectExplorer class (which is a subclass of CommonNavigator).  Clearly something needs to be done, but I need to look into it more to see the direction to take.  The solution might be to require clients to subclass ProjectExplorer if they are going to use the working set support.  This is an acceptable API change because prior to 3.5 we did not support subclassing the CommonNavigator class at all.

However I will look into the possibility of moving some of the support up to CommonNavigator so even though clients that have illegally subclassed CommonNavigator will continue to work.
Comment 4 Francis Upton IV CLA 2009-02-16 14:37:34 EST
(In reply to comment #2)
> I just saw that in the Project explorer when the Working set changes, it's
> updated with the name of the working set (this seems to be a new feature), so,
> it probably was introduced at that time.
> 
> Those methods (setWorkingSetLabel / getWorkingSetLabel) should probably be in
> the CommonNavigator class and that action should cast to CommonNavigator --
> which is something the CNF expects.
> 

Seems reasonable.  When I get some time I will check this out more.
Comment 5 Francis Upton IV CLA 2009-03-05 17:14:50 EST
*** Bug 265320 has been marked as a duplicate of this bug. ***
Comment 6 Francis Upton IV CLA 2009-03-05 17:18:30 EST
Released to HEAD N20090305-2000, 35M6
Comment 7 Francis Upton IV CLA 2009-03-12 00:03:15 EDT
*** Bug 268248 has been marked as a duplicate of this bug. ***
Comment 8 Fabio Zadrozny CLA 2009-03-15 21:38:01 EDT
I've just gotten version: Build id: I20090313-0100 and the bug still appears to be there.

I took a look at http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetActionProvider.java?view=markup...

It seems that even though you can do viewer.getCommonNavigator().setWorkingSetLabel, there are still some references that try to cast to the ProjectExplorer before doing so.

Namely lines: 155, 158, 160, 163 and 165 (just removing the ProjectExplorer import shoud signal those).

Comment 9 Fabio Zadrozny CLA 2009-03-17 14:06:26 EDT
Any chance those casts can be removed for 3.5M7?

Thanks.
Comment 10 Francis Upton IV CLA 2009-03-17 14:42:03 EDT
(In reply to comment #9)
> Any chance those casts can be removed for 3.5M7?

I will have a look at this soon, and if it's a problem it will be fixed for M7.
Comment 11 Fabio Zadrozny CLA 2009-03-27 16:43:29 EDT
Created attachment 130145 [details]
Patch removing those casts

Just added a patch against the current head removing those casts.

Best Regards,

Fabio
Comment 12 Francis Upton IV CLA 2009-03-27 17:51:09 EDT
Sorry about that, released the removal of the casts to HEAD, N20090327-2000, 35M7

I don't have tests for this, so if you can take the nightly and verify this bug I would appreciate it.
Comment 13 Fabio Zadrozny CLA 2009-03-29 10:38:47 EDT
I updated to HEAD here (instead of getting the nightly) and it worked for me (marking as VERIFIED).

Thanks,

Fabio