Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » show EObject in properties view(show EObject in properties view)
show EObject in properties view [message #499593] Mon, 23 November 2009 12:53 Go to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Hi there,

I build a model browser using the PDE "view" example project. My ViewContentProvider returns a TreeObject which you can think of as a wrapper for an EObject shown in a TreeViewer that's initialized in my BrowserView class.

What I'd like to achieve is to see the EMF properties view for the selected TreeObject. I've been experimenting by making my TreeObjects implement IPropertySource, but then read this http://www.eclipsezone.com/eclipse/forums/t106847.html. Utilizing the generated edit Plug-in's providers (IItemPropertySource) seems to make more sense anyways. So, I had a look into the generated editor Plug-in's Editor class. I tried to rebuild in my BrowserView what I've found there related to "propertySheetPage". With an ISelectionChanged listener I forward selection changes to the ExtendedPropertySheetPage and I build my own PropertySourceProvider to provide the EObjects from my TreeObjects. The debugger show's this is working, however not shown in the properties view.

I think I'm still missing to register my propertySheetPage at the property view somehow, but didn't find how the EMF editor exactly does this. Any help on this is apreciated.

Would there be another way to somehow register the active propery view as selection listener on a TreeViewer?

Thanks for helping

Rob
Re: show EObject in properties view [message #499617 is a reply to message #499593] Mon, 23 November 2009 14:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020609080903020008090508
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Robert,

Comments below.

Robert Wloch wrote:
> Hi there,
>
> I build a model browser using the PDE "view" example project. My
> ViewContentProvider returns a TreeObject which you can think of as a
> wrapper for an EObject shown in a TreeViewer that's initialized in my
> BrowserView class.
>
> What I'd like to achieve is to see the EMF properties view for the
> selected TreeObject. I've been experimenting by making my TreeObjects
> implement IPropertySource, but then read this
> http://www.eclipsezone.com/eclipse/forums/t106847.html Utilizing the
> generated edit Plug-in's providers (IItemPropertySource) seems to make
> more sense anyways. So, I had a look into the generated editor
> Plug-in's Editor class. I tried to rebuild in my BrowserView what I've
> found there related to "propertySheetPage". With an ISelectionChanged
> listener I forward selection changes to the ExtendedPropertySheetPage
> and I build my own PropertySourceProvider to provide the EObjects from
> my TreeObjects. The debugger show's this is working, however not shown
> in the properties view.
>
> I think I'm still missing to register my propertySheetPage at the
> property view somehow, but didn't find how the EMF editor exactly does
> this. Any help on this is apreciated.
The generator editor has this:

public Object getAdapter(Class key)
{
if (key.equals(IContentOutlinePage.class))
{
return showOutlineView() ? getContentOutlinePage() : null;
}
* else if (key.equals(IPropertySheetPage.class))
{
return getPropertySheetPage();*
}
>
> Would there be another way to somehow register the active propery view
> as selection listener on a TreeViewer?
Also note that the editor does and also listens to viewers and forwards
those as the editor's selection.

public void init(IEditorSite site, IEditorInput editorInput)
{
setSite(site);
setInputWithNotify(editorInput);
setPartName(editorInput.getName());
* site.setSelectionProvider(this);*

>
> Thanks for helping
>
> Rob

--------------020609080903020008090508
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Robert,<br>
<br>
Comments below.<br>
<br>
Robert Wloch wrote:
<blockquote cite="mid:hee0jq$nrj$1@build.eclipse.org" type="cite">Hi
there,
<br>
<br>
I build a model browser using the PDE "view" example project. My
ViewContentProvider returns a TreeObject which you can think of as a
wrapper for an EObject shown in a TreeViewer that's initialized in my
BrowserView class.
<br>
<br>
What I'd like to achieve is to see the EMF properties view for the
selected TreeObject. I've been experimenting by making my TreeObjects
implement IPropertySource, but then read this
<a class="moz-txt-link-freetext" href="http://www.eclipsezone.com/eclipse/forums/t106847.html">http://www.eclipsezone.com/eclipse/forums/t106847.html</a>. Utilizing the
generated edit Plug-in's providers (IItemPropertySource) seems to make
more sense anyways. So, I had a look into the generated editor
Plug-in's Editor class. I tried to rebuild in my BrowserView what I've
found there related to "propertySheetPage". With an ISelectionChanged
listener I forward selection changes to the ExtendedPropertySheetPage
and I build my own PropertySourceProvider to provide the EObjects from
my TreeObjects. The debugger show's this is working, however not shown
in the properties view.
<br>
<br>
I think I'm still missing to register my propertySheetPage at the
property view somehow, but didn't find how the EMF editor exactly does
this. Any help on this is apreciated.
<br>
</blockquote>
The generator editor has this:<br>
<br>
<small>    public Object getAdapter(Class key)<br>
    {<br>
        if (key.equals(IContentOutlinePage.class))<br>
        {<br>
            return showOutlineView() ? getContentOutlinePage() : null;<br>
        }<br>
<b>        else if (key.equals(IPropertySheetPage.class))<br>
        {<br>
            return getPropertySheetPage();</b><br>
        }</small><br>
<blockquote cite="mid:hee0jq$nrj$1@build.eclipse.org" type="cite"><br>
Would there be another way to somehow register the active propery view
as selection listener on a TreeViewer?
<br>
</blockquote>
Also note that the editor does and also listens to viewers and forwards
those as the editor's selection.<br>
<br>
    public void init(IEditorSite site, IEditorInput editorInput)<br>
    {<br>
        setSite(site);<br>
        setInputWithNotify(editorInput);<br>
        setPartName(editorInput.getName());<br>
<b>        site.setSelectionProvider(this);</b><br>
<br>
<blockquote cite="mid:hee0jq$nrj$1@build.eclipse.org" type="cite"><br>
Thanks for helping
<br>
<br>
Rob
<br>
</blockquote>
</body>
</html>

--------------020609080903020008090508--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: show EObject in properties view [message #499658 is a reply to message #499593] Mon, 23 November 2009 16:03 Go to previous message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Thanks Ed,

I was really close, because just one line was missing:

public void createPartControl(Composite parent) {
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL |SWT.V_SCROLL);
....
* getViewSite().setSelectionProvider(viewer);
....
}

Thanks for that hint!

Rob
Previous Topic:How to handle multiple editors for objects in a single EMF resource?
Next Topic:[CDO] Implementing StringIDStore
Goto Forum:
  


Current Time: Tue Sep 24 23:15:28 GMT 2024

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

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

Back to the top