Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Switching between perspectives in an e4 RCP application
Switching between perspectives in an e4 RCP application [message #1436227] Thu, 02 October 2014 15:30 Go to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
I am unsure if this is a trivial question, but after a longer search I did not find any
comprehensive method to switch between perspectives in an RCP application.

Let's say we define two Perspectives in our e4xmi file, what is the easiest way to
switch between them?
Re: Switching between perspectives in an e4 RCP application [message #1436236 is a reply to message #1436227] Thu, 02 October 2014 15:50 Go to previous message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 59
Registered: April 2014
Member
Okay, this works:

    @Execute
    public void switchPersepctive(MPerspective activePerspective, MApplication app, EPartService partService, EModelService modelService) {
        List<MPerspective> perspectives = modelService.findElements(app, null, MPerspective.class, null);
        // Assume you have only two perspectives and you always
        // switch between them
        for (MPerspective perspective : perspectives) {
            if (!perspective.equals(activePerspective)) {
                partService.switchPerspective(perspective);
            }
        }
    }


It would be nice if anyone could show me a link where this is explained.
Previous Topic:Dirtyable part in "e4view" extension point
Next Topic:OSGI service to find other services
Goto Forum:
  


Current Time: Wed Jan 20 04:24:59 GMT 2021

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

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

Back to the top