|
Re: open perspective menu: add all perspectives [message #437135 is a reply to message #437133] |
Thu, 22 September 2005 10:31 |
Eclipse User |
|
|
|
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 #437137 is a reply to message #437136] |
Thu, 22 September 2005 12:04 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03422 seconds