Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Coolbar Only Shown When The Workbench Window Is Resized, Redux
Coolbar Only Shown When The Workbench Window Is Resized, Redux [message #840172] Mon, 09 April 2012 19:06 Go to next message
Rob Hatcherson is currently offline Rob HatchersonFriend
Messages: 33
Registered: July 2009
Location: Fort Worth, TX, USA
Member
I've encountered some trim creation and layout issues, one of which is similar to discussion in this thread from 2009 (sorry, it wouldn't let me make a real link here):

www.eclipse.org/forums/index.php/mv/msg/140033/


The IDE version I have says:

Version: 3.7.2.v20120207-1839-9gF7UHPDFxGjd-PqDr2jX_4yKaumkoHTz04_q-q
Build id: M20120208-0800

...and as far as I know everything in Eclipse proper is up to date.


The issues are:

1) I have at least one plugin.xml file that makes coolbar contributions, but after the workbench window initially pops up the coolbar remains hidden until the main window is resized. At that point the coolbar pops in, looks like I expect, and functions normally. This behavior is similar to that discussed in message 140033 noted above.

2) That same plugin.xml attempts to make a contribution to the status bar but the contribution never shows up. I set a breakpoint on the contribution's createControl method but it never got hit. So... in this case the contribution seems to be totally ignored.


Problem 1) suggests some kind of trim layout issue, while Problem 2) is more like a trim creation problem.


For reasons probably not worth getting into here I'm loading contributions from various plugin.xml files via "interim" public API:

RegistryFactory.getRegistry().addContribution(...args...)

The plugin.xml files being loaded make typical contributions, e.g. views, perspectives, menus/toolbars/etc. Other than the technique being used to load them nothing unusual is going on.

I have an IRegistryEventListener in the loop and it shows the contributions being processed from the plugin.xml, including the status bar contribution that is never realized.


I have at least one other app that loads contributions via the RegistryFactory.getRegistry().addContribution(...args...) method, and its coolbar shows up as soon as the workbench window springs to life though it also exhibits Problem 2) noted above. I'm still looking for what the working app is doing that the broken app might not be doing regarding the coolbar, but so far no revelations.


I've spent a good chunk of the last few days snooping around in TrimContributionManager trying to figure out what's going on, but I am a relative noob on RCP internals and don't yet know what to expect to see at various points as the workbench springs to life.


Anybody have any theories about:

- What might be going wrong with contributions loaded through this interim API that would cause either of the problems mentioned above? Limitations, calls I should be making after addContribution() that might be missing, etc.?

- Anything in particular in TrimContributionManager and/or related classes that I can examine to help identify the root cause(s)?

- A way to force the main window to recompute its layout? I've tried some indirect hacks like calling setPerspectiveBarLocation("topLeft") on the window, which in turn calls updateLayoutDataForContents() and getShell().layout(). I didn't expect this to fix Problem 2) noted above, but thought it might stimulate a re-layout of the window to "fix" Problem 1) even though it's a pretty big hammer to use (obviously finding the root cause would be preferred, but I'm also fishing for workarounds). It's possible this may yet work and I'm just calling it too early.


Rob
Re: Coolbar Only Shown When The Workbench Window Is Resized, Redux [message #840179 is a reply to message #840172] Mon, 09 April 2012 19:16 Go to previous messageGo to next message
Rob Hatcherson is currently offline Rob HatchersonFriend
Messages: 33
Registered: July 2009
Location: Fort Worth, TX, USA
Member
I forgot to mention that this was GTK on Fedora 12.
Re: Coolbar Only Shown When The Workbench Window Is Resized, Redux [message #841054 is a reply to message #840179] Tue, 10 April 2012 21:10 Go to previous messageGo to next message
Rob Hatcherson is currently offline Rob HatchersonFriend
Messages: 33
Registered: July 2009
Location: Fort Worth, TX, USA
Member
I've discovered that making this call:

((WorkbenchWindow)HandlerUtil.getActiveWorkbenchWindow(event)).setPerspectiveBarLocation("topLeft")

...significantly after the addContribution call is made - such as from a command handler tied e.g. to a menu item as in this example - then the status bar contribution (re Problem 2 in the original post) pops in but the cool bar still does not.

This is a hack that relies on a side effect - in this case knowledge that this call causes layout activity in the window.

I've tried various calls to force the cool bar in there but so far no luck; only resizing the window makes it show up.

Obviously none of this is a respectable solution. I'm still trying to figure out why the loop isn't getting closed upstream between the registry and the parts of the workbench that control the instantiation and layout of the contributions.
Re: Coolbar Only Shown When The Workbench Window Is Resized, Redux [message #849290 is a reply to message #841054] Thu, 19 April 2012 02:54 Go to previous message
Rob Hatcherson is currently offline Rob HatchersonFriend
Messages: 33
Registered: July 2009
Location: Fort Worth, TX, USA
Member
I have since fiddled with this some more and discovered that if I push the RegistryFactory.getRegistry().addContribution(...args...) call closer to the application start rather than further away from it then the problem disappears. I was motivated to do this by noting in the debugger that the /plugin.xml of the app was loaded very early.

The first thing I tried was calling ...addContribution... in the workbench advisor's initialize(IWorkbenchConfigurer) method, but that still didn't work.

However, if I moved the call to the workbench advisor's constructor then the problem cleared up.

So... there appears to be a period of time somewhere between the workbench advisor's constructor and the point where the workbench and associated windows are all the way up where calling ...addContribution... may do unexpected things.

Note that ...addContribution... calls made once the workbench was up all the way also worked as expected.

I don't know if this is a bug or a feature. The naive reaction is that if the workbench has gotten itself together enough that very early contributions work, then any contributions made downstream of that should work too.
Previous Topic:Can I change .log to a different file?
Next Topic:Commands and System Tray
Goto Forum:
  


Current Time: Fri Mar 29 01:41:21 GMT 2024

Powered by FUDForum. Page generated in 0.02468 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top