Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » SelectionProvider is not set in the WindowSelectionService
SelectionProvider is not set in the WindowSelectionService [message #334587] Thu, 19 February 2009 09:45 Go to next message
Maghen Calinghee is currently offline Maghen CalingheeFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

I'm designing a RCP application with views and editor parts. In some part,
i'm using the SelectionService mechanism and i set SelectionProvider
object on their site "getSite().setSelectionProvider(provider)".
In a other hand, i'm using the "org.eclipse.ui.menus" to display popup
menu with command. Each command refered to a
"org.eclipse.core.expressions.definitions" extension point to test if we
display the command or not. I use the expression "selection" and it seems
to do not work correctly. At the initialization of the RCP, the
"selection" is not updated and the item associated to the command is not
displayed in the popup menu.
I need to re-activate the part to make it work. I've seen that there are
two SelectionService which are declared at the beginning :
PageSelectionService and WindowSelectionService. The
WindowSelectionService does not call its setActivePart() method at the
initialization of the application so the provider is not set for this
service. So the selection is not updated for the
"org.eclipse.core.expressions.definitions" extension point. And i think
it's the reason why it is not working properly but i might be wrong.

If someone knows a way to make it work correctly without reactivating the
part everytime we have to launch the application, i would appreciate it.

Thanks.
Re: SelectionProvider is not set in the WindowSelectionService [message #334588 is a reply to message #334587] Thu, 19 February 2009 10:09 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

a) Check that you implemented the setFocus() method appropriately
b) Wouldn't it be better if the Popup-Menu and its commands use the
selection from use the activeMenuSelection

Tom

Maghen Calinghee schrieb:
> Hi,
>
> I'm designing a RCP application with views and editor parts. In some
> part, i'm using the SelectionService mechanism and i set
> SelectionProvider object on their site
> "getSite().setSelectionProvider(provider)".
> In a other hand, i'm using the "org.eclipse.ui.menus" to display popup
> menu with command. Each command refered to a
> "org.eclipse.core.expressions.definitions" extension point to test if we
> display the command or not. I use the expression "selection" and it
> seems to do not work correctly. At the initialization of the RCP, the
> "selection" is not updated and the item associated to the command is not
> displayed in the popup menu. I need to re-activate the part to make it
> work. I've seen that there are two SelectionService which are declared
> at the beginning : PageSelectionService and WindowSelectionService. The
> WindowSelectionService does not call its setActivePart() method at the
> initialization of the application so the provider is not set for this
> service. So the selection is not updated for the
> "org.eclipse.core.expressions.definitions" extension point. And i think
> it's the reason why it is not working properly but i might be wrong.
>
> If someone knows a way to make it work correctly without reactivating
> the part everytime we have to launch the application, i would appreciate
> it.
>
> Thanks.
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: SelectionProvider is not set in the WindowSelectionService [message #334613 is a reply to message #334588] Fri, 20 February 2009 14:40 Go to previous messageGo to next message
Maghen Calinghee is currently offline Maghen CalingheeFriend
Messages: 23
Registered: July 2009
Junior Member
a) I've implemented correctly the setFocus() method.
b) I don't understand how to use the "activeMenuSelection" variable. I am
using the "selection" variable in the
"org.eclipse.expressions.definitions" extension point to know if the
selection is valid but the selection is not updated.
Re: SelectionProvider is not set in the WindowSelectionService [message #334614 is a reply to message #334588] Fri, 20 February 2009 14:44 Go to previous messageGo to next message
Maghen Calinghee is currently offline Maghen CalingheeFriend
Messages: 23
Registered: July 2009
Junior Member
Hi Tom,

Thanks you for replying.

a) I've implemented correctly the setFocus() method correctly
b) I don't understand how to use the "activeMenuSelection" variable
whereas I need to use the "selection" variable to check if the selection
is valid to display the Popup-Menu.


Maghen.
Re: SelectionProvider is not set in the WindowSelectionService [message #334626 is a reply to message #334614] Fri, 20 February 2009 16:05 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

"selection" is the global eclipse selection, usually based on the active
part.

activeMenuSelection is the selection that is available during a context
(popup) menu. It is not necessarily the same as the "selection"
variable, since it comes from the selection provider set in
getSite().registerContextMenu(*)

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: SelectionProvider is not set in the WindowSelectionService [message #334637 is a reply to message #334626] Sat, 21 February 2009 08:53 Go to previous message
Maghen Calinghee is currently offline Maghen CalingheeFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

I've used the "activeMenuSelection" and it works well, thanks you Paul and
Tom. But i'm trying to understand how the "selection" works. I have a view
with a viewer which contributes to the selection service as selection
provider. And i have created another view which listens to this provider.
I would like to display in this view the same menu items which appear in
the pop up menu of the first view when i do a selection in that part. I
would to use the extension point "org.eclipse.expressions.definitions"
where i defined the rules which allow to display the menu item or not. But
this time, i use the "selection" variable to know the selection in the
first view. And it does not work properly, i need to re-activate the first
view to make it work correctly. I'm wondering how can i do this correctly.
Moreover i use in the first view a "dynamic selection provider" because i
have several viewers. But i don't think it is linked to my problem.

Maghen.
Previous Topic:[Databinding] Problem with AggregateValidationStatus
Next Topic:Get InputStream for resource defined in extension point.
Goto Forum:
  


Current Time: Fri Dec 27 10:02:24 GMT 2024

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

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

Back to the top