Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

Java, the OLPC, and community responsibility

The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
Replies: 2 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Adding a property sheet to an EMF editor

At 1:15 PM on Aug 7, 2008, Alain Michel wrote:

Hi,

I'm building an editor to display a model with a treeViewer that uses a
ReflectiveItemProviderAdapterFactory. It works fine.
But now I want to add a Properties view. So I've added code like that :

private PropertySheetPage propertySheetPage;

public IPropertySheetPage getPropertySheetPage() {
if (propertySheetPage == null) {
propertySheetPage = new ExtendedPropertySheetPage(editingDomain);
propertySheetPage.setPropertySourceProvider(
new AdapterFactoryContentProvider(adapterFactory));
}
return propertySheetPage;
}

public Object getAdapter(Class key) {
if (key.equals(IPropertySheetPage.class)) {
return getPropertySheetPage();
} else {
return super.getAdapter(key);
}
}

And I've made the PropertySheet refresh when a node is selected. But it
doesn't seem to be enough (my properties view is empty). What step(s) am
I missing?

Thanks,
Alain
  Click to reply to this thread Reply
1. At 3:38 PM on Aug 7, 2008, Ed Merks wrote:

Re: Adding a property sheet to an EMF editor

Alain,

Is your editor properly providing selections? You need to set the
editor site's selection provider...


Alain Michel wrote:
> Hi,
>
> I'm building an editor to display a model with a treeViewer that uses
> a ReflectiveItemProviderAdapterFactory. It works fine.
> But now I want to add a Properties view. So I've added code like that :
>
> private PropertySheetPage propertySheetPage;
>
> public IPropertySheetPage getPropertySheetPage() {
> if (propertySheetPage == null) {
> propertySheetPage = new ExtendedPropertySheetPage(editingDomain);
> propertySheetPage.setPropertySourceProvider(
> new AdapterFactoryContentProvider(adapterFactory));
> }
> return propertySheetPage;
> }
>
> public Object getAdapter(Class key) {
> if (key.equals(IPropertySheetPage.class)) {
> return getPropertySheetPage();
> } else {
> return super.getAdapter(key);
> }
> }
>
> And I've made the PropertySheet refresh when a node is selected. But
> it doesn't seem to be enough (my properties view is empty). What
> step(s) am I missing?
>
> Thanks,
> Alain
  Click to reply to this thread Reply
2. At 4:45 AM on Aug 8, 2008, Alain Michel wrote:

Re: Adding a property sheet to an EMF editor

Hmm yes I forgot adding a getSite().setSelectionProvider(myTreeViewer)
to the editor. Sorry for the bother.

Ed Merks wrote :
> Alain,
>
> Is your editor properly providing selections? You need to set the
> editor site's selection provider...
>
>
> Alain Michel wrote:
>> Hi,
>>
>> I'm building an editor to display a model with a treeViewer that uses
>> a ReflectiveItemProviderAdapterFactory. It works fine.
>> But now I want to add a Properties view. So I've added code like that :
>>
>> private PropertySheetPage propertySheetPage;
>>
>> public IPropertySheetPage getPropertySheetPage() {
>> if (propertySheetPage == null) {
>> propertySheetPage = new ExtendedPropertySheetPage(editingDomain);
>> propertySheetPage.setPropertySourceProvider(
>> new AdapterFactoryContentProvider(adapterFactory));
>> }
>> return propertySheetPage;
>> }
>>
>> public Object getAdapter(Class key) {
>> if (key.equals(IPropertySheetPage.class)) {
>> return getPropertySheetPage();
>> } else {
>> return super.getAdapter(key);
>> }
>> }
>>
>> And I've made the PropertySheet refresh when a node is selected. But
>> it doesn't seem to be enough (my properties view is empty). What
>> step(s) am I missing?
>>
>> Thanks,
>> Alain

thread.rss_message