Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart(Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart)
Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart [message #988505] Fri, 30 November 2012 04:59 Go to next message
Christoph Miksovic is currently offline Christoph Miksovic
Messages: 12
Registered: March 2010
Junior Member
Dear readers,

I have an EMF-based RCP-application that was originally generated using the genmodel-generator. The application thus has EMF.Edit end EMF.Editor components. When I run the application, I basically have an editor and a property sheet. When I select an object in the editor, the property sheet shows its properties, as expected.
Now I added a custom view part that contains a Tree viewer. Essentially the code is as follows:

public class MyCustomViewPart extends ViewPart
(...)
private ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
(...)
public void partActivated(IWorkbenchPartReference arg0) {
(...)
treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
treeViewer.setInput(editingDomain.getResourceSet());
(...)
}

public void createPartControl(Composite parent)
{ (...)
getSite().setSelectionProvider(treeViewer);
(...)
}


When I now select an object in the tree viewer of MyCustomViewPart, the property sheet remains empty. When I activate the editor and select an object in the editor, the property sheet shows the proprieties of the selected objects.

Can anyone please give me a hint why the property sheet remains empty if I select an object in the tree viewer of my MyCustomViewPart?

Thank you very much for any help,
Christoph
Re: Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart [message #988550 is a reply to message #988505] Fri, 30 November 2012 07:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
Christoph,

I would guess that your view part needs to implement ISelectionProvider...


On 30/11/2012 10:59 AM, Christoph Miksovic wrote:
> Dear readers,
>
> I have an EMF-based RCP-application that was originally generated
> using the genmodel-generator. The application thus has EMF.Edit end
> EMF.Editor components. When I run the application, I basically have an
> editor and a property sheet. When I select an object in the editor,
> the property sheet shows its properties, as expected.
> Now I added a custom view part that contains a Tree viewer.
> Essentially the code is as follows:
>
>
> public class MyCustomViewPart extends ViewPart
> (...)
> private ComposedAdapterFactory adapterFactory = new
> ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
> (...)
> public void partActivated(IWorkbenchPartReference arg0) {
> (...)
> treeViewer.setContentProvider(new
> AdapterFactoryContentProvider(adapterFactory));
> treeViewer.setLabelProvider(new
> AdapterFactoryLabelProvider(adapterFactory));
> treeViewer.setInput(editingDomain.getResourceSet());
> (...)
> }
>
> public void createPartControl(Composite parent)
> { (...)
> getSite().setSelectionProvider(treeViewer);
> (...)
> }
>
>
> When I now select an object in the tree viewer of MyCustomViewPart,
> the property sheet remains empty. When I activate the editor and
> select an object in the editor, the property sheet shows the
> proprieties of the selected objects.
>
> Can anyone please give me a hint why the property sheet remains empty
> if I select an object in the tree viewer of my MyCustomViewPart?
>
> Thank you very much for any help,
> Christoph
Re: Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart [message #988857 is a reply to message #988550] Mon, 03 December 2012 08:25 Go to previous messageGo to next message
Christoph Miksovic is currently offline Christoph Miksovic
Messages: 12
Registered: March 2010
Junior Member
Hello Ed,
thank you for your reply.
I thought if would be sufficient if I register the TreeViewer within my ViewPart as a selection provider (getSite().setSelectionProvider(treeViewer)).
I use the standard org.eclipse.ui.views.properties.PropertySheet as my property view. And I can also see in the debugger that the selectionChanged method on the PropertySheet is invoked when I select an (EMF-object)element in my TreeViewer of my ViewPart (the selected element is contained in the TreeSelection object).
But the PropertySheet remains empty.
NB: When I select an element in a View that is based on org.eclipse.ui.views.ContentOutline, the properties are visible in the PropertySheet.

Can you give me some more hints if possible?
Thank you very much and cheers,
Christoph

[Updated on: Mon, 03 December 2012 08:27]

Report message to a moderator

Re: Property Sheet is empty when selecting an (EMF-)object in tree viewer using a custom ViewPart [message #989346 is a reply to message #988857] Wed, 05 December 2012 13:36 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26014
Registered: July 2009
Senior Member
Christoph,

Comments below.

On 03/12/2012 2:25 PM, Christoph Miksovic wrote:
> Hello Ed,
> thank you for your reply.
> I thought if would be sufficient if I register the TreeViewer within
> my ViewPart as a selection provider
> (getSite().setSelectionProvider(treeViewer)).
Hmmm. One would hope so yes...
> I also use the standard org.eclipse.ui.views.properties.PropertySheet
> as my property view. And I can also see in the debugger that the
> selectionChanged method on the PropertySheet is invoked when I select
> an (EMF-)element in my TreeViewer of my ViewPart (the selected element
> is contained in the TreeSelection object). But the PropertySheet
> remains empty.
> NB: When I select an element in a View that is based on
> org.eclipse.ui.views.ContentOutline , the properties are visible in
> the PropertySheet.
I see. Note that the generated editor implements getAdapter to create
the appropriate properties view implementation, so you'd need to do that
too for your viewer...
>
> Can you give me some more hints if possible?
Hopefully that's a good hint...
> Thank you very much and cheers,
> Christoph
Previous Topic:EMF transactions - why the special ExtendedPropertySheetPage?
Next Topic:[CDO/Hibernate] Date Types
Goto Forum:
  


Current Time: Fri Aug 29 20:36:47 EDT 2014

Powered by FUDForum. Page generated in 0.08299 seconds