Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367419 - Explicit cast to ViewActionsBars when disposing a view part
Summary: Explicit cast to ViewActionsBars when disposing a view part
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-22 08:35 EST by Florina Craciunescu CLA
Modified: 2012-01-24 12:45 EST (History)
4 users (show)

See Also:


Attachments
Patch (3.01 KB, patch)
2011-12-22 08:36 EST, Florina Craciunescu CLA
no flags Details | Diff
Patch for ViewReference class (2.82 KB, patch)
2012-01-06 11:03 EST, Florina Craciunescu CLA
no flags Details | Diff
Patch 2 for ViewReference class (3.00 KB, patch)
2012-01-10 08:28 EST, Florina Craciunescu CLA
pwebster: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florina Craciunescu CLA 2011-12-22 08:35:20 EST
Build Identifier: 20110916-0149

In the method doDisposePart(), from the class ViewReference (org.eclipse.ui.workbench) an explicit cast is made to ViewActionsBars (forcing the use of this class from an internal package).

However, no specific method is used from ViewActionsBars, only the dispose() method available in the superclass SubActionBars.

A patch was provided.

Reproducible: Always
Comment 1 Florina Craciunescu CLA 2011-12-22 08:36:23 EST
Created attachment 208730 [details]
Patch
Comment 2 Paul Webster CLA 2011-12-22 09:51:36 EST
That's correct.  This interface is not designed to be substituted.  IViewSite/IActionBars is not a contract for the framework to use amongst its implementation, but a contract that exposes part of the framework services to the client code.

What are you trying to do that you want to substitute this?

PW
Comment 3 Florina Craciunescu CLA 2011-12-22 10:15:28 EST
I wanted to provide my own implementation of IActionBars, to use it from an action contributor to the context menu of a view.

I tried to subclass from SubActionBars, but I get a ClassCastException, from the method doDisposePart(), from ViewReference class.
Comment 4 Paul Webster CLA 2011-12-22 10:29:50 EST
(In reply to comment #3)
> I wanted to provide my own implementation of IActionBars, to use it from an
> action contributor to the context menu of a view.

IActionBars aren't really involved with context menus, only with the view toolbar and the view dropdown menu.

What do you want the IActionBars to do?

PW
Comment 5 Florina Craciunescu CLA 2011-12-22 10:45:31 EST
(In reply to comment #4)
> (In reply to comment #3)
> > I wanted to provide my own implementation of IActionBars, to use it from an
> > action contributor to the context menu of a view.
> 
> IActionBars aren't really involved with context menus, only with the view
> toolbar and the view dropdown menu.
> 
> What do you want the IActionBars to do?
> 
> PW


I wanted to contribute, using my implementation of IActionBars to the context menu of a view, that displays information in a table (with actions available on lines and columns), in a similar and uniform way with the contribution to a view's toolbar and dropdown menu.

Indeed, it is stated that the IActionBars interface is not intended to be implemented by clients, but is the explicit cast made in doDisposePart() useful ?
Comment 6 Paul Webster CLA 2011-12-22 10:49:01 EST
(In reply to comment #5)
> Indeed, it is stated that the IActionBars interface is not intended to be
> implemented by clients, but is the explicit cast made in doDisposePart() useful
> ?

It's symmetric.  Even in that one class, I was able to find  (ContributionManager) getActionBars.getMenuManager() etc.

And in 4.2, it won't work at all as the internal implementation changes.

PW
Comment 7 Paul Webster CLA 2011-12-22 19:41:24 EST
We use git now for our source (it looks like you created your patch against CVS).  By inspection, your patch seems harmless.  If you could re-submit it against our git stream (the R3_development branch of eclipse.platform.ui git repo) I'll include it in 3.8

See http://wiki.eclipse.org/Platform_UI/How_to_Contribute for instructions.

PW
Comment 8 Florina Craciunescu CLA 2012-01-05 06:28:06 EST
(In reply to comment #7)
> We use git now for our source (it looks like you created your patch against
> CVS).  By inspection, your patch seems harmless.  If you could re-submit it
> against our git stream (the R3_development branch of eclipse.platform.ui git
> repo) I'll include it in 3.8
> 
> See http://wiki.eclipse.org/Platform_UI/How_to_Contribute for instructions.
> 
> PW

(In reply to comment #7)
> We use git now for our source (it looks like you created your patch against
> CVS).  By inspection, your patch seems harmless.  If you could re-submit it
> against our git stream (the R3_development branch of eclipse.platform.ui git
> repo) I'll include it in 3.8
> 
> See http://wiki.eclipse.org/Platform_UI/How_to_Contribute for instructions.
> 
> PW

Hello Paul and Happy New Year!

I'm not sure if I understood correctly how to create the patch if you are not a commiter. In order to create the patch against git, do I have to create a branch, commit the change and then create the patch?
Comment 9 Thomas Schindl CLA 2012-01-05 06:30:55 EST
Yes - the latest build from egit should support direct patch creation. See bug #341036
Comment 10 Florina Craciunescu CLA 2012-01-06 11:02:36 EST
I created a patch with the latest build from egit and attached it. Hope it is a valid file.
Comment 11 Florina Craciunescu CLA 2012-01-06 11:03:16 EST
Created attachment 209137 [details]
Patch for ViewReference class
Comment 12 Paul Webster CLA 2012-01-10 07:34:40 EST
(In reply to comment #11)
> Created attachment 209137 [details]
> Patch for ViewReference class

Hi Florina, and thanx for the patch.  Comments:

You release the menu manager twice and forgot to release the toolbar manager.  Aside from that it's good.  If you provide another patch, I should be able to get it in.

PW
Comment 13 Florina Craciunescu CLA 2012-01-10 08:28:58 EST
Created attachment 209258 [details]
Patch 2 for ViewReference class
Comment 14 Paul Webster CLA 2012-01-10 09:40:29 EST
Released to R3_development only.  Thank you for the patch.
PW
Comment 15 Paul Webster CLA 2012-01-24 12:45:01 EST
In I20120123-1800
PW