Community
Participate
Working Groups
Regarding the JAVADOC, the EPartService.switchPerpective() of org.eclipse.e4.ui.workbench.modeling is NOT intended to be referenced by clients We use this function to switch between different perspectives from our code, i.e. we are referencing this function in our client code, because we havn't found any other function! But the "API Use Report" flag it as illegal. From my perspective either the JAVADOC needs to be changed that this function can be used from clients.
(In reply to Tim Oswald from comment #0) > Regarding the JAVADOC, the EPartService.switchPerpective() of > org.eclipse.e4.ui.workbench.modeling is NOT intended to be referenced by > clients > > We use this function to switch between different perspectives from our code, > i.e. we are referencing this function in our client code, because we havn't > found any other function! Did you try org.eclipse.ui.IWorkbenchPage.setPerspective(IPerspectiveDescriptor)?
Our application is a pure e4 application and in my understanding, the IWorkbenchPage is eclipse 3.x and can not be used in e4?! Please correct me if I', wrong. Therefore I can not use this function in our environment.
> Our application is a pure e4 application Wasn't clear from your initial comment. Paul, please advise.
The javadoc [1] describes the method and then says: Restriction: This method is not intended to be referenced by clients. It seems pretty consistent to me, you *should* get an illegal use exception with the API tooling. Or are you asking why can't you use that method, because you couldn't find any other method? PW [1] http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fe4%2Fui%2Fworkbench%2Fmodeling%2FEPartService.html&anchor=switchPerspective%28org.eclipse.e4.ui.model.application.ui.advanced.MPerspective%29
So how would we want people to switch between perspectives?
Perspectives are mainly a Workbench artifact. What does it mean to even have a perspective in an Eclipse4 app? We never defined the semantics of them without the compatibility layer (which is why although there is a method there, it's not API since we don't have a complete definition of what it will do). PW
of course they have meaning in e4 - perspectives are a valid but not mandatory concept in e4
(In reply to Thomas Schindl from comment #7) > of course they have meaning in e4 - perspectives are a valid but not > mandatory concept in e4 I'm not saying they don't have meaning, I'm saying that meaning is not well defined. i.e. can I find a wiki page that describes how to set up 2 perspectives in an Eclipse4 application? And that still doesn't change the fact that switchPerspective(*) is not ready to be API because since I don't know the proper usecase to switch perspectives, I can't say what it'll do. PW
(In reply to Paul Webster from comment #6) > Perspectives are mainly a Workbench artifact. > > What does it mean to even have a perspective in an Eclipse4 app? We never > defined the semantics of them without the compatibility layer (which is why > although there is a method there, it's not API since we don't have a > complete definition of what it will do). > > PW We're using the "Perspective Stack" and different "Perspectives" as childs in the e4xmi model and we need a method to switch between the different perspectives. The switchPerspective() method from the EPartService works fine just with the exception, that it should not be used from the JAVADOC.
(In reply to Paul Webster from comment #8) > (In reply to Thomas Schindl from comment #7) > > of course they have meaning in e4 - perspectives are a valid but not > > mandatory concept in e4 > > I'm not saying they don't have meaning, I'm saying that meaning is not well > defined. i.e. can I find a wiki page that describes how to set up 2 > perspectives in an Eclipse4 application? I'm sorry but I can't follow this argumentation - there are many things in e4 that are not document completely - and I can/will fix that for MPerspective. The MPerspective element is API and can & is be used - what do you see as not defined for it? I don't see what is not defined for MPerspective/MPerspectiveStack it acts and works the same way it did in 3.x or the compat layer and most complex e4 apps make use of them including MPlaceholder.
(In reply to Thomas Schindl from comment #10) > (In reply to Paul Webster from comment #8) > > (In reply to Thomas Schindl from comment #7) > > > of course they have meaning in e4 - perspectives are a valid but not > > > mandatory concept in e4 > > > > I'm not saying they don't have meaning, I'm saying that meaning is not well > > defined. i.e. can I find a wiki page that describes how to set up 2 > > perspectives in an Eclipse4 application? > > I'm sorry but I can't follow this argumentation - there are many things in > e4 that are not document completely - and I can/will fix that for > MPerspective. > > The MPerspective element is API and can & is be used - what do you see as > not defined for it? MPerspective is API, and of course people are free to use it. switchPerspective(*) is not. Right now, switchPerspective(*) sets up the model as we understand it to support switching perspectives for the Workbench, where the Workbench does work before and after that's called. I'm not saying it can never be made API, if someone is willing to make it clean for Eclipse4 while supporting perspective switching in the Workbench, but that's definitely not its state right now. And why is it being called now anyway? When you set your MPerspective as selected in your MPerspectiveStack, you should get switchPerspective(*) called for free. PW
> MPerspective is API, and of course people are free to use it. > switchPerspective(*) is not. Right now, switchPerspective(*) sets up the > model as we understand it to support switching perspectives for the > Workbench, where the Workbench does work before and after that's called. > right and I don't see why that should be different on e4 - the workbench is simply a big e4 app - if someone is not happy in how we interpret perspective switching he can push his own EPartService > I'm not saying it can never be made API, if someone is willing to make it > clean for Eclipse4 while supporting perspective switching in the Workbench, > but that's definitely not its state right now. > Why is it not clean in Eclipse4 the current implementation works just fine and does what people expect. > And why is it being called now anyway? When you set your MPerspective as > selected in your MPerspectiveStack, you should get switchPerspective(*) > called for free. right the PerspectiveStackRenderer calls it when the selectedElement is changed.
As we have migrated to e4, we have followed the samples from Lars Vogel, which were very helpul. In his sample below, he describes how to switch perspectives and that's the way we have implemented it. http://www.vogella.com/tutorials/Eclipse4Services/article.html#selectedservices_partservice4
(In reply to Tim Oswald from comment #13) > As we have migrated to e4, we have followed the samples from Lars Vogel, > which were very helpul. In his sample below, he describes how to switch > perspectives That's not the way to do it. Switching perspectives should use the model API, which means setting the selected element on the MPerspectiveStack. PW
I more and more doubt this method should be available at all - i think the renderers or an internal service would be the appropriate place then. The compat layer would then simply do the same thing and set a new selectedElement in the model.
Or let me put it differently: a) we keep switchPerspective() but remove the logic in there all it does is check if the given MPerspective is a child of the stack b) we move the logic to the renderer
(In reply to Paul Webster from comment #14) > (In reply to Tim Oswald from comment #13) > > As we have migrated to e4, we have followed the samples from Lars Vogel, > > which were very helpul. In his sample below, he describes how to switch > > perspectives > > That's not the way to do it. Switching perspectives should use the model > API, which means setting the selected element on the MPerspectiveStack. > > PW That's right - the following code works: MPerspective element = ..... // Now switch perspective if(element != null && element.getParent() != null){ Object parent = element.getParent(); if(parent instanceof MPerspectiveStack){ MPerspectiveStack mps = (MPerspectiveStack)parent; mps.setSelectedElement(element); } } In regards that all MPerspective objects in the model will be kept by a MPerspectiveStack, the stack can actually do the stuff
Lots of my customers using the switchPerspective in their e4 RCP application. I agree with Tom that we should release the switchPerspective method as API.
New Gerrit change created: https://git.eclipse.org/r/60773
Well isn't there discussion in some thread that switchPerspective fails with shared-parts somehow. So why making it public when we maybe might Deprecate it?
(In reply to Thomas Schindl from comment #20) > Well isn't there discussion in some thread that switchPerspective fails with > shared-parts somehow. So why making it public when we maybe might Deprecate > it? Switch perspective works fine with shared parts. I think you referencing to the cloneSnippet bug, which is completely unrelated to switchPerspective
Ah you are right
Gerrit change https://git.eclipse.org/r/60773 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ebcf884f9501466c499fb8d8b083dcd7b5ae105f
.