Switching between activated views [message #665192] |
Wed, 13 April 2011 15:25 |
Eclipse User |
|
|
|
Originally posted by: rth_morpheus.web.de
Hi there,
I'm working on a small RCP-Application. This application consists of a
tree view containing three different types of data, and a stack of three
views, each one linked to one of these data types. The views in the
stack implement the SelectionListener, so each time an item from the
tree is selected, the corresponding view loads its information. What I
now would like to do, is switching the view corresponding to the data
type when I select an item in the tree. I tried doing so by using
getSite().getPage().showView(viewId);
using the ids of the views, but, besides getting an Exception, it
doesn't seem to work as I hoped.
Does anyone know of a better approach?
Thanks
Robert
|
|
|
|
Re: Switching between activated views [message #665264 is a reply to message #665227] |
Wed, 13 April 2011 22:29 |
Eclipse User |
|
|
|
Originally posted by: rth_morpheus.web.de
Am 13.04.2011 20:17, schrieb Paul Webster:
> On 04/13/2011 11:25 AM, Robert Hälke wrote:
>>
>> getSite().getPage().showView(viewId);
>
> This is the correct API. What exception are you getting?
>
> PW
>
>
I get a RuntimeException:
java.lang.RuntimeException: WARNING: Prevented recursive attempt to
activate part de.unirostock.bives.gui.views.versionDetailsView while
still in the middle of activating part
de.unirostock.bives.gui.views.modelTreeView
at
org.eclipse.ui.internal.WorkbenchPage.setActivePart(Workbenc hPage.java:3487)
at
org.eclipse.ui.internal.WorkbenchPage.internalActivate(Workb enchPage.java:617)
at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage .java:589)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:1096)
at
org.eclipse.ui.internal.WorkbenchPage.busyShowView(Workbench Page.java:1066)
at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.j ava:3822)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:3819)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage .java:3795)
[...]
The problem appears to be connected to the tree view, from which I
select the different data types. The selectionChanged method I have
implemented in all three views appears to be called twice each time I
select a different data type, once from the old view currently active,
and once from the new view.
Robert
|
|
|
|
Re: Switching between activated views [message #665429 is a reply to message #665353] |
Thu, 14 April 2011 15:19 |
Eclipse User |
|
|
|
Originally posted by: rth_morpheus.web.de
Am 14.04.2011 14:14, schrieb Paul Webster:
> On 04/13/2011 06:29 PM, Robert Hälke wrote:
>> I get a RuntimeException:
>>
>> java.lang.RuntimeException: WARNING: Prevented recursive attempt to
>> activate part de.unirostock.bives.gui.views.versionDetailsView while
>> still in the middle of activating part
>> de.unirostock.bives.gui.views.modelTreeView
>
> Does the secondary view have to be activated, or just brought to the
> top? You could just make it visible in the other stack and have the user
> click on it if they want to interact with it.
All views are activated, I just want to switch the visibility.
> ex: you could use page.showView("id", null, IWorkbenchPage.VIEW_VISIBLE);
That did the trick, the views are now switching as intende.
> The other alternative is to restrict those calls to something like a
> "double-click", or if you notice a change in selection, schedule a UIJob
> (on step up from an asyncExec) to make the showView(*) call in the next
> display loop.
>
> PW
>
>
Thanks a lot for your help, Paul!
Regards
Robert
|
|
|
|
Powered by
FUDForum. Page generated in 0.04141 seconds