Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » PerspectiveSwitcher in a pure e4 app(PerspectiveSwitcher in a pure e4 app)
PerspectiveSwitcher in a pure e4 app [message #894860] Tue, 10 July 2012 15:57 Go to next message
PK Missing name is currently offline PK Missing name
Messages: 24
Registered: July 2009
Junior Member
Hello,
I am new to Eclipse 4. I have created a new sample app with multiple perspective. How do I enable the PerspectiveSwitcher to allow switching between the perspectives?

Thanks,
PK
Re: PerspectiveSwitcher in a pure e4 app [message #894894 is a reply to message #894860] Tue, 10 July 2012 19:57 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

The current PerspectiveSwitcher depends on a number of 3.x utilities. You would want to create a ToolControl (not a ToolBar) in the top level trim bar and reference:

bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher

And AFAIK this will only work with a 3.x app in the compat layer. I'll create a new post here in the next day or so with the status of the Eclipse4 implementation.
Re: PerspectiveSwitcher in a pure e4 app [message #895043 is a reply to message #894894] Wed, 11 July 2012 09:55 Go to previous messageGo to next message
PK Missing name is currently offline PK Missing name
Messages: 24
Registered: July 2009
Junior Member
Thanks Joseph. Appreciate the feedback regarding the pure e4 implementation.
Re: PerspectiveSwitcher in a pure e4 app [message #895586 is a reply to message #895043] Fri, 13 July 2012 13:03 Go to previous messageGo to next message
PK Missing name is currently offline PK Missing name
Messages: 24
Registered: July 2009
Junior Member
I was able to figure out a way to switch to any user defined perspective, and manually populating my toolbar with a button for each perspective. Later either I will implement and share a dynamic menu OR use the pure e4 implementation.

Shown below is the handler that I use to switch to a perspective using it's id.

CAN SOMEBODY PLEASE TELL ME, HOW TO RESET A GIVEN PERSPECTIVE? I want to be able to restore the original layout of a perspective. The resetPerspective in the modelService doesn't seem to work.


Handler code for switching to a perspective:
package e4test.handlers;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;

public class SwitchPerspectiveHandlerThis
{
	@Execute
	public void execute(MApplication app, EModelService modelService,
			EPartService partService)
	{
		MPerspective thisElement = (MPerspective) modelService
				.find("This", app);

		partService.switchPerspective(thisElement);
	}
}
Re: PerspectiveSwitcher in a pure e4 app [message #895902 is a reply to message #895586] Mon, 16 July 2012 09:12 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There should be a reset on the org.eclipse.e4.ui.workbench.modeling.EModelService

PW


Re: PerspectiveSwitcher in a pure e4 app [message #895912 is a reply to message #894860] Mon, 16 July 2012 09:33 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

It's not finished yet, but close enough to have a look:

http://github.com/jd-carroll/e4-perspective-switcher

Re: PerspectiveSwitcher in a pure e4 app [message #896489 is a reply to message #895912] Wed, 18 July 2012 10:02 Go to previous messageGo to next message
PK Missing name is currently offline PK Missing name
Messages: 24
Registered: July 2009
Junior Member
Joseph,
That is a lot of code. Thanks for the superlative effort. When i tried to run the code, I ran into the unimplemented method asIterable in UIEvents. From another post, I figured out that there is code in a later version of e4. I am in the process of checking out all the e4 projects.

When will you merge this perspective switcher into the e4 codebase?

Is there a way to put a link up that will make it easier to download the latest e4 codebase that can be used?

Unfortunately I am starting my work at a point where I can neither use the stable 3.X RCP not the e4 (because of difficulties in setting up a working e4 environment).
Re: PerspectiveSwitcher in a pure e4 app [message #896494 is a reply to message #896489] Wed, 18 July 2012 10:10 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph Carroll
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

When I finalize the perspective switcher I will post it. As far as release, that would be up to other folks, it would have to be given a target milestone.

Not sure I understand why you are unable to use 3.x or 4.x.
Re: PerspectiveSwitcher in a pure e4 app [message #896535 is a reply to message #896494] Wed, 18 July 2012 14:19 Go to previous messageGo to next message
PK Missing name is currently offline PK Missing name
Messages: 24
Registered: July 2009
Junior Member
I apologize for any ignorance on my part. Let me start with the e4 installation process. First off, e4 is not available to be installed as a part of the 4.2(Juno - http://download.eclipse.org/releases/juno) link. I installed e4 using this link (Eclipse E4 Tooling - http://download.eclipse.org/e4/downloads/drops/I20120620-1100/repository). That appears to be the most recent code. I had to search around a bit, before I found that link. If e4 has moved out of the incubator, it doesn't seem to be available as a part of Juno either. The only link I could find for e4 was from the incubating e4 project.

Secondly, the latest e4 does not work with your perspective switcher. It depends on a more recent version of e4. It looks like, the only way I can get the latest e4 is by checking out the e4 projects into the project (it looks like I cannot install the latest e4 it into the workbench). What is the best way to get the latest e4 code that will work with your perspective switcher?

Re: PerspectiveSwitcher in a pure e4 app [message #896537 is a reply to message #896535] Wed, 18 July 2012 14:29 Go to previous message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

Most of what you call e4 code is now in 4.2 through the platform.ui and platform.runtime plugins. The only code remaining in e4 project (in incubation) is the e4.tools in which you have stuff like app model editor, css editors etc.

If you want to have the latest code of Eclipse 4.2 (which includes platform.ui and platform.runtime) get this code (use EGit) from http://git.eclipse.org by cloning:

git://git.eclipse.org/gitroot/platform/eclipse.platform.ui.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.runtime.git

Also the e4 *tools* repository is here:

git://git.eclipse.org/gitroot/e4/org.eclipse.e4.tools.git

If anyone is working on stuff regarding 4.2 or e4 tools they will be working with the master branch of these repositories.
Previous Topic:Dragging Views & Editors
Next Topic:Where is the Equivalent to applicationclass implementing IApplication
Goto Forum:
  


Current Time: Mon Jul 28 16:45:27 EDT 2014

Powered by FUDForum. Page generated in 0.07669 seconds