-1

I am trying to use the configurer.setSaveAndRestore(true); feature of perspectives in RCP (Eclipse 3) to save the layout of the views, but I want it always to start up on a specific perspective.

What I am after is a place during startup (possibly overriding something in the activation classes somewhere) where I can safely call:

        PlatformUI.getWorkbench().showPerspective(id,
                PlatformUI.getWorkbench().getActiveWorkbenchWindow());

such that the application will switch to that perspective and the user won't know anything happened.

Edit:

I've tried to to i in the postWindowOpen method and this does switch, but you can see it doing it and it initialises all the views on the original perspective first, which I don't really want to happen.

Link19
  • 586
  • 1
  • 18
  • 47
  • Have you seen [Is there a way to force Eclipse to open in the default perspective?](https://stackoverflow.com/q/4604267/1744774) already? – Gerold Broser Nov 25 '17 at 19:20
  • Yes sorry I wasn't very specific, thanks for your help. Command line arguments won't cut it for me. – Link19 Nov 25 '17 at 19:31

1 Answers1

2

See Making an Eclipse RCP/RAP application with multiple Perspectives:

First, we have to set the private static final String PERSPECTIVE_ID. The ID will be the ID of the Perspective Extension you want as default. So in our case this would be benl.smartapps.maildemo.perspective. Then we add the public String getInitialWindowPerspectiveId() returning the PERSPECTIVE_ID. This would result in the following code:

Making an Eclipse RCP/RAP application with multiple Perspectives

Now the application will always open the default perspective by default if the user has not saved the state of the workbench.

Community
  • 1
  • 1
Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • My problem is that I want it to open to that perspective EVEN IF the user has saved the state of the workbench – Link19 Nov 25 '17 at 18:07
  • @Link19 I fervently hate software that tries to be more clever than me, i.e. that presents me a default state though I explicitely saved my preferred one before. But that might be a personal POV. – Gerold Broser Nov 25 '17 at 18:16
  • Appreciate that, however this software has some perspectives that are only accessible during a certain process and that process requires certain steps to have been taken before they get to that perspective. So the software opening up there would not be a good or expected user experience at all, not one bit. – Link19 Nov 25 '17 at 18:32