Skip to main content



      Home
Home » Eclipse Projects » GEF » ContextMenuProvider + selected editParts
ContextMenuProvider + selected editParts [message #157766] Fri, 12 November 2004 05:16 Go to next message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

Is it possible to know which editparts are selected in a
ContextMenuProvider? I want to be able to calculate which menus to show
based on this knowledge. Note that there is not enough information in the
SelectionAction since I need the set of (enabled) actions and the set of
selected edit parts.

Thanks.

James
Re: ContextMenuProvider + selected editParts [message #157814 is a reply to message #157766] Fri, 12 November 2004 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

What about selectionAction.getSelectedObjects(). This gives you a list
of the selected edit parts. The calculateEnabled() method of your
action(s) can use this to decide if they are enabled or not.

Guy

James Willans wrote:

> Is it possible to know which editparts are selected in a
> ContextMenuProvider? I want to be able to calculate which menus to show
> based on this knowledge. Note that there is not enough information in
> the SelectionAction since I need the set of (enabled) actions and the
> set of selected edit parts.
>
> Thanks.
>
> James
>
Re: ContextMenuProvider + selected editParts [message #157844 is a reply to message #157814] Fri, 12 November 2004 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: james.willans.xactium.com

Guy,

Yes - I'm currently using that route, I was just wondering whether the
list of selected edit parts was scoped over the ContextMenuProvider.

Thanks anyway.

James

Guy Slade wrote:

> What about selectionAction.getSelectedObjects(). This gives you a list
> of the selected edit parts. The calculateEnabled() method of your
> action(s) can use this to decide if they are enabled or not.

> Guy

> James Willans wrote:

>> Is it possible to know which editparts are selected in a
>> ContextMenuProvider? I want to be able to calculate which menus to show
>> based on this knowledge. Note that there is not enough information in
>> the SelectionAction since I need the set of (enabled) actions and the
>> set of selected edit parts.
>>
>> Thanks.
>>
>> James
>>
Re: ContextMenuProvider + selected editParts [message #157857 is a reply to message #157766] Fri, 12 November 2004 12:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I don't understand the question. ContextMenuProvider contains the
EditPartViewer, so you just need to call getSelection()

"James Willans" <james.willans@xactium.com> wrote in message
news:cn22ip$tm4$1@eclipse.org...
> Is it possible to know which editparts are selected in a
> ContextMenuProvider? I want to be able to calculate which menus to show
> based on this knowledge. Note that there is not enough information in the
> SelectionAction since I need the set of (enabled) actions and the set of
> selected edit parts.
>
> Thanks.
>
> James
>
Re: ContextMenuProvider + selected editParts [message #157872 is a reply to message #157844] Fri, 12 November 2004 13:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

Ok, I understand what you want to do. But I think the right way to do it
is through the action enabled/disabled route. If you don't want disabled
actions to show in your context menu then when your context menu
provider builds the menu prior to showing it should only add the actions
that are enabled.

Guy

James Willans wrote:
> Guy,
>
> Yes - I'm currently using that route, I was just wondering whether the
> list of selected edit parts was scoped over the ContextMenuProvider.
>
> Thanks anyway.
>
> James
>
> Guy Slade wrote:
>
>> What about selectionAction.getSelectedObjects(). This gives you a list
>> of the selected edit parts. The calculateEnabled() method of your
>> action(s) can use this to decide if they are enabled or not.
>
>
>> Guy
>
>
>> James Willans wrote:
>
>
>>> Is it possible to know which editparts are selected in a
>>> ContextMenuProvider? I want to be able to calculate which menus to
>>> show based on this knowledge. Note that there is not enough
>>> information in the SelectionAction since I need the set of (enabled)
>>> actions and the set of selected edit parts.
>>>
>>> Thanks.
>>>
>>> James
>>>
>
>
Re: ContextMenuProvider + selected editParts [message #158089 is a reply to message #157844] Mon, 15 November 2004 11:49 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

JFace already provides a filter mechanism. You need to provide the filter
processor, and fill in the rules for your actions in the plugin.xml file.

The only reason to use this mechanism would be to prevent plug-in startup.
Otherwise, I'd just use the enablement technique we use in the examples.

"James Willans" <james.willans@xactium.com> wrote in message
news:cn2r7o$dpv$1@eclipse.org...
> Guy,
>
> Yes - I'm currently using that route, I was just wondering whether the
> list of selected edit parts was scoped over the ContextMenuProvider.
>
> Thanks anyway.
>
> James
>
> Guy Slade wrote:
>
> > What about selectionAction.getSelectedObjects(). This gives you a list
> > of the selected edit parts. The calculateEnabled() method of your
> > action(s) can use this to decide if they are enabled or not.
>
> > Guy
>
> > James Willans wrote:
>
> >> Is it possible to know which editparts are selected in a
> >> ContextMenuProvider? I want to be able to calculate which menus to
show
> >> based on this knowledge. Note that there is not enough information in
> >> the SelectionAction since I need the set of (enabled) actions and the
> >> set of selected edit parts.
> >>
> >> Thanks.
> >>
> >> James
> >>
>
>
Previous Topic:connection endpoints not placed correctly
Next Topic:GEF Editor freezes when ContextMenu is to be displayed (solved)
Goto Forum:
  


Current Time: Tue Jul 22 13:16:12 EDT 2025

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

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

Back to the top