Community
Participate
Working Groups
I user an view with a TableViewer in some perspectives. If I select something in the View on perspective A and use than a command I get the current selection. Afterwards I switch to perspective 2, where I see the view to and use than the same command I get a null as current selection, although the view shows a selected object. It is easy repoducable with: Generate a new project with the template: RCP application with a view Inside the View.java -> set the TableViewer as SelectionProvider ( getViewSite().setSelectionProvider(viewer); ) Activate the PerspectiveBar inside the ApplicationWorkbenchWindowAdvisor ( configurer.setShowPerspectiveBar(true);) Define a second perspective Define a Command and a Handler and define it, to show the command inside the view toolbar Read the current selection inside the Handler method .execute(ExecutionEvent event) with: HandlerUtil.getCurrentSelection(event); Running the application I get: nothing selected at the viewer -> push command -> <empty selection> select entry <One> -> push command -> <One> switch to the other perspective: (<One> is inside the ui marked as selected) -> push command -> null
Are you sure that the view providing the selection is the one with the focus after you've switched the perspective?
Yes I do, I test it inside the Handler : System.out.println(HandlerUtil.getVariable(event, "activeWorkbenchWindow.activePerspective") + " / "+ HandlerUtil.getActivePartId(event) + " / " + HandlerUtil.getCurrentSelection(event)); I get zzz.test.selection.perspective / zzz.test.selection.view / [One] -> switching perspective -> zzz.test.selection.perspective2 / zzz.test.selection.view / null
Created attachment 186931 [details] Project to test
Created attachment 186932 [details] Patch v01
Created attachment 186970 [details] Patch v02 Patch v01 + test
Patch v02 released to HEAD
Verified in I20110124-1800
Could anyone direct me to download the version of the build where this bug is fixed. I tried in eclipse 3.8M6, but this issue can be recreated.