[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Custom property editor for EDataTypes

Hi,

I am trying to create a custom property editor for a model element with a property of EDataType - a file reference, which is also serializible according to EMF.

After much searching I found http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/msg10837.html which describes how to add a custom property editor to a field, which works well. It adds a '...' to the CellEditor of the property cell, which when clicked, can be edited with a dialog box (in my case, a FileDialog).

However, the result returned is not saved anywhere. Once the FileDialog is closed, the filename is displayed in the cell field, but it is not saved back to the original model object/property. If I select away from the model element and reselect it, the value is reset to its previous value. The diagram file is not marked as dirty.

My code is almost identical to the code in the thread above; am I missing a setValue() somewhere, or something similar? I thought that the result from the ExtendedDialogCellEditor would be used to set the property.

I also tried extending createEDataTypeCellEditor(EDataType, Composite) with the same approach, but got the same result.

I tried setting the value manually, i.e. ((MyObject) object).setFile(new FileReference(filename));, but this throws a "Cannot modify resource set without a write transaction".

It appears that while the approach above would work for normal property values (e.g. EStrings), it isn't working for EDataTypes.

Any ideas? Is there something special I should be doing in order to handle custom EDataType property editors? Or should I just ignore EDataTypes in EMF and change my property type to EString?

Thanks!

Jevon