Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Refresh Coolbar after creating new AbstractContributionFactory.
Refresh Coolbar after creating new AbstractContributionFactory. [message #332501] Thu, 23 October 2008 17:59 Go to next message
kevin miles is currently offline kevin milesFriend
Messages: 9
Registered: July 2009
Junior Member
I'm looking for the best method of forcing the coolbar to update/refresh
to include my newly added AbstractContributionFactory's contributions.

right now i'm doing this and it feels hacky:

coolBarManager.removeAll();

menuService.populateContributionManager(
coolBarManager,
MenuUtil.MAIN_TOOLBAR );
Re: Refresh Coolbar after creating new AbstractContributionFactory. [message #332519 is a reply to message #332501] Fri, 24 October 2008 19:23 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

kevin j miles wrote:
> I'm looking for the best method of forcing the coolbar to update/refresh
> to include my newly added AbstractContributionFactory's contributions.
>
> right now i'm doing this and it feels hacky:
>
> coolBarManager.removeAll();
>
> menuService.populateContributionManager(
> coolBarManager,
> MenuUtil.MAIN_TOOLBAR );

Gack! I nearly dropped my coffee :-) That will only cause sadness,
unfortunately.

Having an programmatic ACF added to existing ContributionManagers that
were populated isn't supported until 3.4.

I'm not sure how to tackle that in 3.3

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Refresh Coolbar after creating new AbstractContributionFactory. [message #332562 is a reply to message #332519] Tue, 28 October 2008 20:31 Go to previous messageGo to next message
kevin miles is currently offline kevin milesFriend
Messages: 9
Registered: July 2009
Junior Member
once i stopped laughing i began to fret about my current approach...
i'll let you know what i find.

kjm

Paul Webster wrote:
> kevin j miles wrote:
>> I'm looking for the best method of forcing the coolbar to
>> update/refresh to include my newly added AbstractContributionFactory's
>> contributions.
>>
>> right now i'm doing this and it feels hacky:
>>
>> coolBarManager.removeAll();
>>
>> menuService.populateContributionManager(
>> coolBarManager,
>> MenuUtil.MAIN_TOOLBAR );
>
> Gack! I nearly dropped my coffee :-) That will only cause sadness,
> unfortunately.
>
> Having an programmatic ACF added to existing ContributionManagers that
> were populated isn't supported until 3.4.
>
> I'm not sure how to tackle that in 3.3
>
> PW
>
Re: Refresh Coolbar after creating new AbstractContributionFactory. [message #332574 is a reply to message #332562] Wed, 29 October 2008 13:34 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

kevin j miles wrote:
> once i stopped laughing i began to fret about my current approach...
> i'll let you know what i find.
>

In 3.4 we keep a list of ManagerPopulationRecords, so when another ACF
is added
org.eclipse.ui.internal.menus.WorkbenchMenuService.addContri butionFactory(AbstractContributionFactory)
knows to "install" it immediately.

In 3.3 you would somehow have to take your ACF and call into
org.eclipse.ui.internal.menus.WorkbenchMenuService.processAd ditions(IServiceLocator,
Expression, ContributionManager, AbstractContributionFactory, Set) to
get it added in a "timely" manner, but that's a private method (the best
you can do in 3.3 is via reflection).

The other (totally non-portable and wacky) suggestion would be to run
some similar code from within that method, you need a ContributionRoot
and then you could fill it in yourself (having already "illegally"
obtained the CoolBarManager :-)

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Forcing repartition of document in text editor
Next Topic:Unable to create editor input
Goto Forum:
  


Current Time: Sun Jun 30 13:52:59 GMT 2024

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

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

Back to the top