Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Cannot detect selection generated by double click in selectionChanged()
Cannot detect selection generated by double click in selectionChanged() [message #512695] Sat, 06 February 2010 12:56 Go to next message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

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 Go to previous message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

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.
Previous Topic:Show a subset of preference pages and options in RCP App
Next Topic:virtual tables, DAOs and the Job API: how to combine?
Goto Forum:
  


Current Time: Tue Apr 23 05:29:36 GMT 2024

Powered by FUDForum. Page generated in 0.03242 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top