Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » PropertySheet cell editor: PropertyValueWrapper cast exception
PropertySheet cell editor: PropertyValueWrapper cast exception [message #486075] Wed, 16 September 2009 09:12 Go to next message
Stephan Schmidt is currently offline Stephan SchmidtFriend
Messages: 5
Registered: July 2009
Junior Member
Hello,

I found previous threads regarding this subject, but they did not really
help me solve my problem.

I have a very simple EMF Model, with a class

NetworkElement
- name: EString
- id: EInt
...

I generate the edit code, but not the editor code (I have a gef-based
editor).
Then, when I create a network element in the editor and select it, the
standard properties view gets populated correctly, with the correct
values. Once I click one of these, the cell editor does not open, although
the value is editable.

The code in the EditPart for the adapter is

@Override
public Object getAdapter(Class key) {
if (key == IPropertySource.class) {
AdapterFactoryContentProvider provider =
new AdapterFactoryContentProvider(new
NetworkItemProviderAdapterFactory());
return provider.getPropertySource(getModel());
}
return super.getAdapter(key);
}

to return an IPropertySource, where the NetworkItemProviderAdapterFactory
is the generated emf.edit AdapterFactory for the emf model package.

How can I provide edit support for the model element properties? Does
getEditableValue() have to be called somewhere. Can I provide editing
support with the standard eclipse properties view?

Thanks and Best regards,
Stephan

In debug mode, I encountered the following caught exception:

!ENTRY org.eclipse.ui 4 0 2009-09-15 16:28:03.429
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ClassCastException:
org.eclipse.emf.edit.provider.ItemPropertyDescriptor$Propert yValueWrapper
cannot be cast to java.lang.String
at
org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEStringTo String(EcoreFactoryImpl.java:651)
at
org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString( EcoreFactoryImpl.java:224)
at
org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUt il.java:3269)
at
org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.toString(PropertyDescriptor.java:199)
at
org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:251)
at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
at
org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
at
org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
at
org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
at
org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
at
org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
Re: PropertySheet cell editor: PropertyValueWrapper cast exception [message #486085 is a reply to message #486075] Wed, 16 September 2009 10:10 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Stephan,

Comments below.

Stephan Schmidt wrote:
> Hello,
>
> I found previous threads regarding this subject, but they did not
> really help me solve my problem.
>
> I have a very simple EMF Model, with a class
> NetworkElement
> - name: EString
> - id: EInt
> ...
>
> I generate the edit code, but not the editor code (I have a gef-based
> editor).
> Then, when I create a network element in the editor and select it, the
> standard properties view gets populated correctly, with the correct
> values. Once I click one of these, the cell editor does not open,
> although the value is editable.
>
> The code in the EditPart for the adapter is
>
> @Override
> public Object getAdapter(Class key) {
> if (key == IPropertySource.class) {
> AdapterFactoryContentProvider provider =
> new AdapterFactoryContentProvider(new
> NetworkItemProviderAdapterFactory());
I don't think creating a new one of these each request is an appropriate
design.
> return provider.getPropertySource(getModel());
> }
> return super.getAdapter(key);
> }
>
> to return an IPropertySource, where the
> NetworkItemProviderAdapterFactory is the generated emf.edit
> AdapterFactory for the emf model package.
>
> How can I provide edit support for the model element properties? Does
> getEditableValue() have to be called somewhere. Can I provide editing
> support with the standard eclipse properties view?
The generated editor's getAdapter and getPropertySheetPage methods show
how to set this up properly.
>
> Thanks and Best regards,
> Stephan
>
> In debug mode, I encountered the following caught exception:
>
> !ENTRY org.eclipse.ui 4 0 2009-09-15 16:28:03.429
> !MESSAGE Unhandled event loop exception
> !STACK 0
> java.lang.ClassCastException:
> org.eclipse.emf.edit.provider.ItemPropertyDescriptor$Propert yValueWrapper
> cannot be cast to java.lang.String
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEStringTo String(EcoreFactoryImpl.java:651)
>
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString( EcoreFactoryImpl.java:224)
>
> at
> org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUt il.java:3269)
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eValueHandler.toString(PropertyDescriptor.java:199)
>
> at
> org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTyp eCellEditor.isCorrect(PropertyDescriptor.java:251)
>
> at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.jav a:853)
> at
> org.eclipse.ui.views.properties.PropertySheetEntry.getEditor (PropertySheetEntry.java:384)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.activate CellEditor(PropertySheetViewer.java:163)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.handleSe lect(PropertySheetViewer.java:727)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer.access$8 (PropertySheetViewer.java:707)
>
> at
> org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseD own(PropertySheetViewer.java:816)
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Get selected EObjects from EcoreDiagramEditor
Next Topic:Re: Teneo with IBM DB2
Goto Forum:
  


Current Time: Fri Apr 26 09:09:03 GMT 2024

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

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

Back to the top