Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Given a view id can I find the Perspective(s) it is in
Given a view id can I find the Perspective(s) it is in [message #754846] Fri, 04 November 2011 11:30 Go to next message
Josh Davis is currently offline Josh Davis
Messages: 20
Registered: August 2011
Junior Member
Is is possible to find the open perspectives that reference a particular view in e4?

This is how we did it in eclipse 3.6 using groovy
  
	public Set<String> getActivePerspectiveIdsForGadgetId(String id){		
		Set<String> perspectives = new HashSet<String>();
		def window = workbench.getActiveWorkbenchWindow();
		def page = window.getActivePage();
		def openPerspectives = page.getOpenPerspectives();
		for (def openPerspective : openPerspectives) {
			def perspective = page.findPerspective(openPerspective);
			for (def iViewReference : perspective.getViewReferences()) {
				if (id.equals(iViewReference.getId())) {
					perspectives.add(openPerspective.getId());
				}
			}
		}
		return perspectives;
	}

In e4 page.findPerspective(openPerspective) doesn't work because the method is no longer on the IWorkbenchPage API.

I couldn't find anything in the IWorkBenchPage API that would allow me to do this now.

Any suggestions?
Re: Given a view id can I find the Perspective(s) it is in [message #755230 is a reply to message #754846] Mon, 07 November 2011 13:23 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

No Message Body

Re: Given a view id can I find the Perspective(s) it is in [message #755234 is a reply to message #755230] Mon, 07 November 2011 13:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ooops, sorry.

I would work with the org.eclipse.e4.ui.workbench.modeling.EModelService in Eclipse 4.

IWorkbenchPage never had an findPerspective(*) method, that was an implementation detail on WorkbenchPage (an internal class).

PW



Re: Given a view id can I find the Perspective(s) it is in [message #787364 is a reply to message #755234] Tue, 31 January 2012 08:57 Go to previous message
Lars Vogel is currently offline Lars Vogel
Messages: 1048
Registered: July 2009
Senior Member

I added an example how to find the perspective of a given View ID to my Eclipse 4 Service Tutorial.

I hope this helps.
Previous Topic:Contributing to e4
Next Topic:"Handler service cannot be null" exception in launching eclipse product.
Goto Forum:
  


Current Time: Thu Jul 31 23:45:46 EDT 2014

Powered by FUDForum. Page generated in 0.02126 seconds