[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: PropertySheet cell editor: PropertyValueWrapper cast exception

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$PropertyValueWrapper cannot be cast to java.lang.String
at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEStringToString(EcoreFactoryImpl.java:651)


at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString(EcoreFactoryImpl.java:224)

at org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUtil.java:3269)
at org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTypeValueHandler.toString(PropertyDescriptor.java:199)


at org.eclipse.emf.edit.ui.provider.PropertyDescriptor$EDataTypeCellEditor.isCorrect(PropertyDescriptor.java:251)

at org.eclipse.jface.viewers.CellEditor.setValue(CellEditor.java:853)
at org.eclipse.ui.views.properties.PropertySheetEntry.getEditor(PropertySheetEntry.java:384)


at org.eclipse.ui.views.properties.PropertySheetViewer.activateCellEditor(PropertySheetViewer.java:163)

at org.eclipse.ui.views.properties.PropertySheetViewer.handleSelect(PropertySheetViewer.java:727)

at org.eclipse.ui.views.properties.PropertySheetViewer.access$8(PropertySheetViewer.java:707)

at org.eclipse.ui.views.properties.PropertySheetViewer$6.mouseDown(PropertySheetViewer.java:816)