Take the 2-minute tour ×

As per here I've implemented an IIntroAction that will open a perspective in Eclipse from the introductory page (my action is pretty much exactly the same).

Mine is a little different to the one shown there but essentially it is invoked (as a url) follows: http://org.eclipse.ui.intro/runAction?class=my.plugin.actions.OpenPerspectiveAction&amp;pluginId=my.plugin&amp;pId=my.other.plugin.MyPerspective

where pId is the id of the perspective I'd like to open. (and this works!...most of the time.)

As is stated in the link above, the problem with this Action is that if MyPerspective is open underneath the Welcome page, then it will not be opened (or rather the Welcome page won't be closed...).

How can I show the desired perspective upon the action invocation, even if it's open underneath the Welcome page?

Some paths to possible solutions I explored (not fully so I might have missed something):

  • doing something with the PerspectiveRegistry (didn't see any results though...)
  • checking the Workbench to see what the open perspective is and switch from it
  • checking the Workbench to see what is the open perspective and if it is the desired perspective

These are conceptual solutions only --- I don't know if they can actually be implemented! I would appreciate if anyone could shed some insight as to how I can solve this problem.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The following code is working fine in my RCP project.

Intro page link:

<a id="a-ism" href="http://org.eclipse.ui.intro/runAction?pluginId=sernet.gs.ui.rcp.main&#38;class=sernet.gs.ui.rcp.main.actions.ShowISMPerspectiveIntroAction">

Action class:

public class ShowISMPerspectiveIntroAction extends ShowPerspectiveIntroAction {

  public String getCheatSheetId() {
    return "sernet.gs.ui.rcp.main.cheatsheet1";

  public String getPerspectiveId() {
    return Iso27kPerspective.ID;

Action base class:

import  org.eclipse.ui.intro.config.IIntroAction;

public abstract class ShowPerspectiveIntroAction implements IIntroAction {

  private static final Logger LOG = Logger.getLogger(ShowPerspectiveIntroAction.class);

  public void run(IIntroSite arg0, Properties arg1) {
    // Switch to perspective
    final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IPerspectiveDescriptor activePerspective = workbenchWindow.getActivePage().getPerspective();
    if(activePerspective==null || !activePerspective.getId().equals(getPerspectiveId())) {           
        Display.getCurrent().asyncExec(new Runnable() {
            public void run() {
                // switch perspective           
                try {
                } catch (WorkbenchException e) {
                    LOG.error("Can not switch to perspective: " + getPerspectiveId(), e);

    // close intro/welcome page
    final IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager().getIntro(); 

    // Show CheatSheet
    ShowCheatSheetAction action = new ShowCheatSheetAction("Show security assessment cheat sheet", getCheatSheetId());

  public abstract String getCheatSheetId();
  public abstract String getPerspectiveId();
share|improve this answer
This works much better than what I had previously. Thank you for your help! –  blahman Jul 9 '12 at 1:23
add comment

Your Answer


