Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] ComboBox CellEditor
[EMF Forms] ComboBox CellEditor [message #1700597] Sat, 04 July 2015 12:12 Go to next message
Tobias Zangl is currently offline Tobias ZanglFriend
Messages: 15
Registered: May 2015
Junior Member
Hey,

i would like to add a combobox as a cell in a table. I have searched for already implemented ones but was not succesful. The only thing i found was "ExtendedComboBoxCellEditor" from org.eclipse.emf.common.ui but it does not work and looks pretty outdated right?

So i tried to implement one by myself. The model to target part works fine, if i change the model value for example in the dialog the combo box gets updated correctly. But if i change the value in the combo box and click anywhere then the old value returns.

It looks like the "applyEditorValue()" part does not work correctly.
The "fireValueChange(...)" does not have any listeners but its the same with your BooleanCellEditor and this one is working fine. Where exactly is the ecore model updated after a celleditor change? Do i have to data bind anything more or add listeners?

Greetings,
Tobias
Re: [EMF Forms] ComboBox CellEditor [message #1700832 is a reply to message #1700597] Tue, 07 July 2015 13:31 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 101
Registered: December 2013
Senior Member

Hi,

Databinding here works as follows:
EMFForms will call getValueProperty#observe and will hand in an instance of the ComboBoxCellEditor, which is to be observed, as the source.
This will be bound to the edited model value. When either the model or the target changes, the UpdateValueStrategy will be used to set the values on the target/model.
As far as I can see the problem with your code is, that in the TargetToModelStrategy a String is returned in the convert method. However you can't set a string as the enum value on the model, so you end up with an unexecutable command. You have to convert this String and return the result.
You can set a break point in the convert method and follow the execution path to see how the model is updated.

Best regards
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] ComboBox CellEditor [message #1701289 is a reply to message #1700832] Fri, 10 July 2015 14:07 Go to previous messageGo to next message
Tobias Zangl is currently offline Tobias ZanglFriend
Messages: 15
Registered: May 2015
Junior Member
Hi,

thanks for your fast reply.

I got it to work now, but with a very bad solution which works only for the one enum type i am currently using:
public Object convert(final Object value) {	
	int getValue = (int) ComboBoxCellEditor.this.getValue();	
	return VariableType.get(getValue);
}


My question is now if there is any way to make it generic? Working for every EEnum/Enumerator.

I played around with the EEnum i get from the feature but wasnt able to get the fitting Enumerator from it. And the Enumerator interface does not provide the .get(...) method which i need for conversion.
Is there any easy way to implement this?

Greetings,
Tobi
Re: [EMF Forms] ComboBox CellEditor [message #1701389 is a reply to message #1701289] Mon, 13 July 2015 08:06 Go to previous message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 101
Registered: December 2013
Senior Member

Hi,

I think the easiest way is to directly set all possible Enumerators as the input of the combo and set a suitable label provider.
You can get the Enumerators from the EEnum like this:
final EEnum eEnum = (EEnum) feature.getEType();
final List<Enumerator> input = new ArrayList<Enumerator>();
for (final EEnumLiteral literal : eEnum.getELiterals()) {
	input.add(literal.getInstance());
}


But you could also use the other EEnum methods to get a specific EEnumLiteral based on your String and use getInstance to get the Enumerator.

Cheers,
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Question: How to import an XMI model into EMFStore Model Explorer
Next Topic:MatchService.doMatch ConcurrentModificationException
Goto Forum:
  


Current Time: Thu Apr 25 01:37:29 GMT 2024

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

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

Back to the top