Home » Eclipse Projects » Rich Client Platform (RCP) » How to use multi tableviewers as SelectionProvider?
How to use multi tableviewers as SelectionProvider? [message #453429] |
Mon, 31 July 2006 09:15 |
Jian Lee Messages: 21 Registered: July 2009 |
Junior Member |
|
|
In my RCP application, there is a CTabFolder in the view, containing
three CTabItems: bookstore,category and books, and each CTabItem has a
Composite as its control, also, each Composite contains a TableViewer to
show some informations.
There is some menuitems in the menu such as: "add bookstore","delete
bookstore","add category","delete category",etc.
And, what I want to implement is: if I click the content of
bookstoreTable, the "delete bookstore" action should be enabled, and If
I click the content of categoryTable, the "delete catagory" action
should be enabled and "delete bookstore" action should be disabled, etc.
If there's only one CTabItem, I can easily deal with it by
add a line:
getSite().setSelectionProvider(tableviewer)
to the view class and implement a ISelectionListener together with the
selectionChanged() method.
But there're three tableviewers, I don't know what to do now.
Thank you very much.
|
|
|
Re: How to use multi tableviewers as SelectionProvider? [message #453432 is a reply to message #453429] |
Mon, 31 July 2006 10:30 |
Eclipse User |
|
|
|
Originally posted by: tom.seidel.spiritlink.de
Chandler Li wrote:
> In my RCP application, there is a CTabFolder in the view, containing
> three CTabItems: bookstore,category and books, and each CTabItem has a
> Composite as its control, also, each Composite contains a TableViewer to
> show some informations.
>
> There is some menuitems in the menu such as: "add bookstore","delete
> bookstore","add category","delete category",etc.
>
> And, what I want to implement is: if I click the content of
> bookstoreTable, the "delete bookstore" action should be enabled, and If
> I click the content of categoryTable, the "delete catagory" action
> should be enabled and "delete bookstore" action should be disabled, etc.
>
> If there's only one CTabItem, I can easily deal with it by
> add a line:
> getSite().setSelectionProvider(tableviewer)
> to the view class and implement a ISelectionListener together with the
> selectionChanged() method.
>
> But there're three tableviewers, I don't know what to do now.
>
> Thank you very much.
Hi,
define your own ISelectionChangedListener with the scope of one TableViewer
something like:
myBookStoreTable.addSelectionChangedListener(new
ISelectionChangedListener() {
public void selectionChanged(event) {
if (!event.getSelection().isEmpty() {
deleteBookstoreAction.setEnabled(true);
myOtherAction.setEnabled(false);
//disable other actions...
} else {
//handle deselect
}
}
});
--
Cheerz,
Tom
|
|
| | | |
Goto Forum:
Current Time: Mon Dec 30 18:01:28 GMT 2024
Powered by FUDForum. Page generated in 0.02810 seconds
|