[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: A question about model-control-view.
|
Hi,
Both replies from you make me very clear about it.
Thank you, both.
Best regards
Michael.
"Tom Schindl" <tom.schindl@xxxxxxxxxxxxxxx> wrote in message
news:fn08g8$3dr$1@xxxxxxxxxxxxxxxxxxxx
> Jacek Pospychala schrieb:
>> Michael wrote:
>>> Hi,
>>> If we contribute an action to popup menu using the extension point:
>>> org.eclipse.ui.popupMenus, we can define an objectContribution. Then,
>>> the Eclipse know how to configure the popup menu based on type of object
>>> that is a model of the right-clicked UI elment. What I am wandering is
>>> how Eclipse know the mapping from the chosed UI element to the
>>> underlying model of this object. I really don't know what part eclipse
>>> API handle this mechinism. Do you have any idea about this?
>>> Thanks.
>>> Best regards.
>>> Michael.
>>
>> Hello Michael,
>> have a look at how selection service works in Eclipse:
>> http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html
>>
>> It's basically that, when you'd like your view to support e.g.
>> objectContribution, you first have to make it a selection provider. In
>> other words, when user selects an element in your view, you notify the
>> rest of Eclipse that new object is selected.
>> Then everyone, who's interested (e.g. context menu manger, or properties
>> view), updates it's contents. You can also listen to such selection
>> notifications by making your class implement ISelectionListener and
>> registering it appropriately.
>>
>>
>
> The internal service handling this is IMenuService. When registering the
> context menu-manager you'll also pass the SelectionProvider and before the
> menu-popups it is querying this provider (this is very highlevel
> description of course :-).
>
> Tom
>
> --
> B e s t S o l u t i o n . at
> --------------------------------------------------------------------
> Tom Schindl JFace-Committer
> --------------------------------------------------------------------