Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to contribute actions to own SWT control?
How to contribute actions to own SWT control? [message #261976] Fri, 16 July 2004 07:38 Go to next message
Eclipse UserFriend
Hi,

I have an SWT-control called 'Outline', which I want to use in my
plugin-application.

I made some wrapper called 'OutlineViewer' which extends Outline and
implements ISelectionProvider.

Then I want to add a popup-menu action which would popup when something
is selected in Outline.

Here is the View code:

public void createPartControl(final Composite aParent)
{
//--- cut ----
getSite().setSelectionProvider(m_OutlineViewer);
createContextMenu();
}
private void createContextMenu()
{
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener()
{
public void menuAboutToShow(IMenuManager mgr)
{
fillContextMenu(mgr);
}
});
Menu menu = menuMgr.createContextMenu(m_OutlineViewer.getCanvas());

m_OutlineViewer.getCanvas().setMenu(menu);

// Register menu for extension.
getSite().registerContextMenu(menuMgr, m_OutlineViewer); }
private void fillContextMenu(IMenuManager mgr)
{
mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}


OutlineViewer implements all neccesary methods, and they are even called
by the framework when i make a right-click on my viewer :-)
The problem is that menu manager doesnt get selection from the control,
though 'getSelection' method is called and always returns a consistent
object instance.

The action contribution is 100% correct: when i use the TableViewer
class instead of my viewer everything works fine...

What can be wrong?

Thank you,
Ilya
Re: How to contribute actions to own SWT control? [message #262090 is a reply to message #261976] Fri, 16 July 2004 13:33 Go to previous messageGo to next message
Eclipse UserFriend
Ilya Shinkarenko wrote:
> I have an SWT-control called 'Outline', which I want to use in my
> plugin-application.

Try asking in eclipse.platform.swt.
Re: How to contribute actions to own SWT control? [message #262295 is a reply to message #262090] Mon, 19 July 2004 07:00 Go to previous message
Eclipse UserFriend
The soultion was to implement IStructuredSelection interface (but not
ISelection) for the selection object.

Tom Roche wrote:
> Ilya Shinkarenko wrote:
>
>> I have an SWT-control called 'Outline', which I want to use in my
>> plugin-application.
>
>
> Try asking in eclipse.platform.swt.
Previous Topic:problem with preference page
Next Topic:Location of extension objects
Goto Forum:
  


Current Time: Thu Jul 24 02:24:36 EDT 2025

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

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

Back to the top