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!
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?
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
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
Adding a property sheet to an EMF editor
At 1:15 PM on Aug 7, 2008, Alain Michel wrote:
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
2 replies so far (
Post your own)
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
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