Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » open perspective menu: add all perspectives
open perspective menu: add all perspectives [message #437133] Thu, 22 September 2005 09:21 Go to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
hi,
i would like to have all available perspectives as shortcuts in the "open
perspective"
menu.
with the PerpectiveRegistry i get descriptors for all perspectives -- but
how do i add the shortcuts?
in the WorkbenchWindowAdvisor i can't access the perspectives themselves
and their layouts (no layout.addPerspectiveShortcut()) and in the
Perspective's createInitialLayout() i can't access the PerspectiveRegistry
so i don't know about other perspectives :-(

any hint appreciated.
Re: open perspective menu: add all perspectives [message #437135 is a reply to message #437133] Thu, 22 September 2005 10:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fleque.users.nospam.sf.net

Hi,

we wanted to have all perspectives available from all perspectives as
well and do it the following way. We have the following util method:

public static void addAllPerspectiveShortcuts(IPageLayout layout)
{
IConfigurationElement[] configPerspectives =
Platform.getExtensionRegistry().getConfigurationElementsFor( "org.eclipse.ui.perspectives");
for(int i = 0; i < configPerspectives.length; i++)

layout.addPerspectiveShortcut(configPerspectives[i].getAttri bute( "id"));
}

and we do the following in our IPerspectiveFactory(s)

public void createInitialLayout(IPageLayout layout)
{
RCPUtil.addAllPerspectiveShortcuts(layout);
}

So we access the extension directly via the ExtensionRegistry. Might not
be the best way (hardcoded extension point String) but works.

Regards Alex



arne anka wrote:
> hi,
> i would like to have all available perspectives as shortcuts in the
> "open perspective"
> menu.
> with the PerpectiveRegistry i get descriptors for all perspectives --
> but how do i add the shortcuts?
> in the WorkbenchWindowAdvisor i can't access the perspectives
> themselves and their layouts (no layout.addPerspectiveShortcut()) and
> in the Perspective's createInitialLayout() i can't access the
> PerspectiveRegistry so i don't know about other perspectives :-(
>
> any hint appreciated.
Re: open perspective menu: add all perspectives [message #437136 is a reply to message #437135] Thu, 22 September 2005 11:50 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
hi,
finally i came to nearly the same solution (albeit a static method in
WorkbenchWindowADvisor rather then an entire new class), but instead of

> Platform.getExtensionRegistry().getConfigurationElementsFor( "org.eclipse.ui.perspectives");

i use

PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspe ctives();

and thus ...

> So we access the extension directly via the ExtensionRegistry. Might not
> be the best way (hardcoded extension point String) but works.

.... prevent hardcoding (albeit i don't expect any problems -- the
extensionpoint's name should be virtually immutable).

regards
Re: open perspective menu: add all perspectives [message #437137 is a reply to message #437136] Thu, 22 September 2005 12:04 Go to previous message
Eclipse UserFriend
Originally posted by: fleque.users.nospam.sf.net

Thanks,

I've changed this in our RCPUtil as well to use
IWorkbench.getPerspectivceRegistry()

Regards Alex


arne anka wrote:
> hi,
> finally i came to nearly the same solution (albeit a static method in
> WorkbenchWindowADvisor rather then an entire new class), but instead of
>
>> Platform.getExtensionRegistry().getConfigurationElementsFor( "org.eclipse.ui.perspectives");
>>
>
>
> i use
>
> PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspe ctives();
>
> and thus ...
>
>> So we access the extension directly via the ExtensionRegistry. Might
>> not be the best way (hardcoded extension point String) but works.
>
>
> ... prevent hardcoding (albeit i don't expect any problems -- the
> extensionpoint's name should be virtually immutable).
>
> regards
Previous Topic:How to invoke a RCP Standalone APP with JAVA Code
Next Topic:stickyView -- how to?
Goto Forum:
  


Current Time: Fri Dec 06 17:26:33 GMT 2024

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

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

Back to the top