no context menu on TableViewer [message #120887] |
Fri, 06 February 2009 14:18 |
Tom H Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi,
I have a table viewer which I have added a menu;
public void createPartControl(final Composite parent) {
Composite contents = new Composite(parent, SWT.NONE);
contents.setLayout(new GridLayout(1, false));
viewer = new TableViewer(contents, SWT.NONE);
Table table = viewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer.setContentProvider(new SecurityListContentProvider());
SecurityListLabelProvider lp = new SecurityListLabelProvider();
lp.createColumns(viewer);
viewer.setLabelProvider(lp);
//viewer.addDoubleClickListener(this);
table.setLinesVisible(false);
viewer.setInput(getViewSite());
Menu menu = new Menu( table );
MenuItem menuItem = new MenuItem( menu, SWT.NONE );
menuItem.setText( "Menu for Table" );
table.setMenu( menu );
}
However, I don't get any menu popup. My menu is working on the TreeViewer,
and my version of the rap demo has a context menu for a "Table" control -
which is where I took the sample code from.
I found a bug; which looks similar
https://bugs.eclipse.org/bugs/show_bug.cgi?id=187503
But that was closed in 2007 apparently.
I noticed also that right clicking on a list, a TreeViewer or a Table,
causes selection of the item, TreeObject or row etc. however by default
right clicking is not having any selection effect on my TableViewer. Could
that be the problem?
Many Thanks in advance for any help!
Tom
|
|
|
Re: no context menu on TableViewer [message #120896 is a reply to message #120887] |
Fri, 06 February 2009 14:48 |
|
Hi Tom,
I cannot reproduce this problem. I added a context menu to the
TableViewer tab in the controls demo (same code as you) and it's working
as expected. I also cannot reproduce that right-clicks do not select items.
Which version of RAP do you use? Which browser?
Regards, Ralf
Tom H wrote:
> Hi,
>
> I have a table viewer which I have added a menu;
>
> public void createPartControl(final Composite parent) {
>
> Composite contents = new Composite(parent, SWT.NONE);
> contents.setLayout(new GridLayout(1, false));
> viewer = new TableViewer(contents, SWT.NONE);
> Table table = viewer.getTable();
> table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
>
> viewer.setContentProvider(new SecurityListContentProvider());
> SecurityListLabelProvider lp = new SecurityListLabelProvider();
>
> lp.createColumns(viewer);
> viewer.setLabelProvider(lp);
> //viewer.addDoubleClickListener(this);
> table.setLinesVisible(false);
> viewer.setInput(getViewSite());
>
> Menu menu = new Menu( table );
> MenuItem menuItem = new MenuItem( menu, SWT.NONE );
> menuItem.setText( "Menu for Table" );
> table.setMenu( menu );
> }
>
>
> However, I don't get any menu popup. My menu is working on the
> TreeViewer, and my version of the rap demo has a context menu for a
> "Table" control - which is where I took the sample code from.
>
> I found a bug; which looks similar
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=187503
> But that was closed in 2007 apparently.
>
> I noticed also that right clicking on a list, a TreeViewer or a Table,
> causes selection of the item, TreeObject or row etc. however by default
> right clicking is not having any selection effect on my TableViewer.
> Could that be the problem?
>
> Many Thanks in advance for any help!
>
> Tom
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
Re: no context menu on TableViewer [message #120956 is a reply to message #120929] |
Fri, 06 February 2009 16:43 |
|
Tom H wrote:
>
> it looks like the TableViewer event handlier never sees any right-click
> events in firefox 3.0.5 on fedora.
Strange, as it works on FF 3.0.5 on Ubuntu. Sure that it doesn't relate
to some FF preferences? I remember there is one setting to allow
Javascript to override context menus... Could you try to start FF with a
new profile?
Ralf
|
|
|
|
Powered by
FUDForum. Page generated in 0.03420 seconds