Cannot detect selection generated by double click in selectionChanged() [message #512695] |
Sat, 06 February 2010 12:56 |
|
I have three views ViewA, ViewB and ViewC. ViewA contains a tree viewer with files and folders. ViewB contains a TableViewer which lists the details about the selection from ViewA. ViewC contains a simple text field which is filled with the contents of the files when a file is selected in ViewA or ViewB.
In ViewA I have: getViewSite().setSelectionProvider(treeViewer);
In ViewB I have: ViewB implements I SelectionListener; getViewSite().setSelectionProvider(tableViewer); PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSele ctionService().addSelectionListener(this); tableViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { ... } });
This is working as expected, but I want the following behaviour: when a folder is double clicked in the table viewer from ViewB I want that the selection from the table to be changed to the children (files and/or folders) of the selected folder.
My problem is that in ViewB in the selectionChanged(IWorkbenchPart part, ISelection selection) method I cannot detect if the selection came from a double click or a single click.
Is there a solution/workaround for this problem or does anyone faced a similar problem? Any help would be appreciated.
Time is what you make of it.
|
|
|
Re: Cannot detect selection generated by double click in selectionChanged() [message #515696 is a reply to message #512695] |
Fri, 19 February 2010 19:46 |
|
I found the problem with my code and a working solution.
In the selectionChanged() method i was trying to get the source of the selection (single or double click) which was not available.
Instead in my double click listener a boolean was set to true when the double click event occurred and then call the selectionChanged(). Then in selectionChanged() the tableViewer input is changed only when the boolean value is set to true (after this call the boolean value is changed back to false).
Time is what you make of it.
|
|
|
Powered by
FUDForum. Page generated in 0.03242 seconds