Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to programmatically add a shortcut to the perspective switching bar ...
How to programmatically add a shortcut to the perspective switching bar ... [message #448898] Sat, 06 May 2006 17:21 Go to next message
Eclipse UserFriend
Hi,

I'm writing an Eclipse plug-in for the RCP. I wrote some perspectives
and I would like to programmatically disable the "Open Perspective..."
button and add shortcuts directly on the perspective switching bar.
Could anyone help me?

Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448905 is a reply to message #448898] Sun, 07 May 2006 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eric,

try this short static method:

/**
* Adds all known perspectives as perspective shortcuts to the given
* layout.
*/
public static void addAllPerspectiveShortcuts(IPageLayout layout)
{
IPerspectiveDescriptor[] perspectives =
PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspe ctives();
for (int i = 0; i < perspectives.length; i++)
layout.addPerspectiveShortcut(perspectives[i].getId());
}


We call this in the createInitialLayout(IPageLayout) of the
implementation of IPerspectiveFactory.

Hope that helps.

Best regards
Alex


Eric wrote:
> Hi,
>
> I'm writing an Eclipse plug-in for the RCP. I wrote some perspectives
> and I would like to programmatically disable the "Open Perspective..."
> button and add shortcuts directly on the perspective switching bar.
> Could anyone help me?
>
> Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448910 is a reply to message #448905] Sun, 07 May 2006 12:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I tried it but it still does not work. I got shortcuts in the popup menu
which appears when I click on the "Open perspective..." button in the
perspective switching bar but no shortcut buttons on the perspective
switching bar itself (as I would get if I select once each perspective
via "Open Perspective...").

Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448913 is a reply to message #448905] Sun, 07 May 2006 12:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I tried it but it still does not work. I got shortcuts in the popup menu
which appears when I click on the "Open perspective..." button in the
perspective switching bar but no shortcut buttons on the perspective
switching bar itself (as I would get if I select once each perspective
via "Open Perspective...").

Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448914 is a reply to message #448905] Sun, 07 May 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I tried it but it still does not work. I got shortcuts in the popup menu
which appears when I click on the "Open perspective..." button in the
perspective switching bar but no shortcut buttons on the perspective
switching bar itself (as I would get if I select once each perspective
via "Open Perspective...").

Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448915 is a reply to message #448905] Sun, 07 May 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

I tried it but it still does not work. I got shortcuts in the popup menu
which appears when I click on the "Open perspective..." button in the
perspective switching bar but no shortcut buttons on the perspective
switching bar itself (as I would get if I select once each perspective
via "Open Perspective...").

Eric
Re: How to programmatically add a shortcut to the perspective switching bar ... [message #448976 is a reply to message #448910] Mon, 08 May 2006 07:28 Go to previous message
Eclipse UserFriend
Eric wrote:
> Hi Alex,
>
> I tried it but it still does not work. I got shortcuts in the popup menu
> which appears when I click on the "Open perspective..." button in the
> perspective switching bar but no shortcut buttons on the perspective
> switching bar itself (as I would get if I select once each perspective
> via "Open Perspective...").

The perspective switcher bar has the list of open perspectives.
Shortcuts are only for the popup menu.

You can get the perspectives you want in the perspective bar by opening
them programmatically. Of course you'll have the associated time and
resource hit when you first open all the perspectives.

Use IWorkbenchPage#setPerspective(IPerspectiveDescriptor)

Later,
PW
Previous Topic:context menu for component within an editor
Next Topic:Rich Text Edit
Goto Forum:
  


Current Time: Sat Aug 30 22:16:16 EDT 2025

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

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

Back to the top