no context menu on TableViewer [message #120887] |
Fri, 06 February 2009 09:18  |
Eclipse User |
|
|
|
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 09:48   |
Eclipse User |
|
|
|
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 #120999 is a reply to message #120956] |
Sun, 08 February 2009 01:32  |
Eclipse User |
|
|
|
Ralf Sternberg wrote:
> 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?
Hi,
As per;
http://www.vertical-visions.de/2008/04/21/firefox-enable-cus tom-javascript-context-menus/
The dom.event.contextmenu.enabled value is true.
Additionally, the context menus and right click selection are working for
my TreeViewer with the current settings - so I can't see how a general
firefox setting would apply to TableViewer and not TreeViewer.
I'm going to try it on a fedora 10 livecd boot to check whether any of my
own preferences are effecting it.
Tom
> Ralf
|
|
|
Powered by
FUDForum. Page generated in 0.08740 seconds