Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » PerspectiveBarManager: how to avoid Discouraged access?
PerspectiveBarManager: how to avoid Discouraged access? [message #653415] Wed, 09 February 2011 17:01 Go to next message
Marco Lopes is currently offline Marco LopesFriend
Messages: 61
Registered: September 2010
Member
Is there a "correct" way to avoid the Discouraged access: The method getPerspectiveBar() from the type WorkbenchWindow is not accessible due to restriction on required library C:\eclipse\plugins\org.eclipse.ui.workbench_3.6.1.M20100826- 1330.jar

This is the code i use to DISABLE the Perspective Toolbar context Menu:

private void disablePerspectiveToolbarMenu() {

PerspectiveBarManager perspectiveBarManager = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getPer spectiveBar();

//perspectiveBar existe?
if (perspectiveBarManager!=null){
ToolBar toolBar = perspectiveBarManager.getControl();
Listener[] listeners = toolBar.getListeners(SWT.MenuDetect);
if (listeners != null){
for (Listener listener : listeners){
toolBar.removeListener(SWT.MenuDetect, listener);
}
}
}
}

Thanks.

[Updated on: Wed, 09 February 2011 17:05]

Report message to a moderator

Re: PerspectiveBarManager: how to avoid Discouraged access? [message #653444 is a reply to message #653415] Wed, 09 February 2011 18:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

No, you've hacked into internals. That code won't function on eclipse
4.1, for example, where the PerspectiveBarManager has been replaced with
something completely different.

You can choose to have the perspective switcher or not using
org.eclipse.ui.application.IWorkbenchWindowConfigurer.setSho wPerspectiveBar(boolean)
but it is not customizable beyond that (except possibly with some minor
preferences).

PW


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


Re: PerspectiveBarManager: how to avoid Discouraged access? [message #653446 is a reply to message #653444] Wed, 09 February 2011 19:21 Go to previous messageGo to next message
Marco Lopes is currently offline Marco LopesFriend
Messages: 61
Registered: September 2010
Member
I think it would be very useful to implement a way to have a more versatile "PerspectiveBar".

Im my case, for instance, i just need a PLAIN simple perspective bar. No context menus, no extra options, nothing.

Thanks.
Re: PerspectiveBarManager: how to avoid Discouraged access? [message #653454 is a reply to message #653446] Wed, 09 February 2011 20:03 Go to previous messageGo to next message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

Hello Marco

Maybe this will help you achieve what you want:
http://eclipsesource.com/blogs/2009/03/31/replacing-the-pers pective-switcher-in-rcp-apps/

HTH
Catalin


Time is what you make of it.
Re: PerspectiveBarManager: how to avoid Discouraged access? [message #653486 is a reply to message #653454] Wed, 09 February 2011 22:30 Go to previous message
Marco Lopes is currently offline Marco LopesFriend
Messages: 61
Registered: September 2010
Member
Catalin Gerea wrote on Wed, 09 February 2011 15:03
Hello Marco

Maybe this will help you achieve what you want:
http://eclipsesource.com/blogs/2009/03/31/replacing-the-pers pective-switcher-in-rcp-apps/

HTH
Catalin


Thanks. I've looked into it, tried to adapt to my code, but the result was not what i was expecting. Too far from the original PerspectiveBar behavior which i think should be more versatile.
Previous Topic:branding win32/linux rcp using ant
Next Topic:How can I enable/disable main tool bar buttons?
Goto Forum:
  


Current Time: Fri Apr 26 07:24:49 GMT 2024

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

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

Back to the top