suprith
suprith

Reputation: 589

Eclipse RCP - Opening perspective on button click

im buliding an eclipse rcp application. i have 2 perspective, Perspective1 which is default open when application is launched and Perspective2.i have a task where i have to open perspective2 on button click and close the opened Perspective1. how to do it ?

Upvotes: 2

Views: 627

Answers (1)

greg-449
greg-449

Reputation: 111217

Get the workbench from somewhere, for example:

IWorkbench workbench = PlatformUI.getWorkbench();

Get the workbench window you want to open the perspective in from somewhere, for example:

IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();

Show the perspective:

workbench.showPerspective("perspective-id", window);

Upvotes: 2

Related Questions