Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » figure label text enum values
figure label text enum values [message #52591] Thu, 21 September 2006 07:07 Go to next message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi,

I have a emf element those name attribute may have only a value of a
predefined set of values (choice of enum). So its useful for users to
present a dropdown instead of a text field as value editor in the
diagram. How do I create such a DirectEditManager and where do I need to
instantiate and assign this? Does such a DropDownDirectEditManager
already exists? If no, what do I need to consider ?

Thanks,
Sven
Re: figure label text enum values [message #52681 is a reply to message #52591] Thu, 21 September 2006 09:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 5d5.mail.ru

I've submitted https://bugs.eclipse.org/bugs/show_bug.cgi?id=158116

sven krause wrote:
> Hi,
>
> I have a emf element those name attribute may have only a value of a
> predefined set of values (choice of enum). So its useful for users to
> present a dropdown instead of a text field as value editor in the
> diagram. How do I create such a DirectEditManager and where do I need to
> instantiate and assign this? Does such a DropDownDirectEditManager
> already exists? If no, what do I need to consider ?
>
> Thanks,
> Sven
Re: figure label text enum values [message #52734 is a reply to message #52681] Thu, 21 September 2006 09:43 Go to previous message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi Dmitry,

it's not for EEnum datatypes only. Sometime I need to limit the values
of the editor context driven. So I need to apply an "handmade" editor.

I just found a solution:
change in the XXXEditPart:
/**
* @generated NOT
*/
protected DirectEditManager getManager() {
if( manager == null ) {
View view = (View) getModel();
EObject modelElement = (EObject) view.getElement();
if(your decision) {
setManager(new DropDownDirectEditManager(this));
} else {
... old code ...
}
}
return manager;
}

and then create a class DropDownDirectEditManager extends
DirectEditManager adapting the methods from TextDirectEditManager:

1. adapting the constructor
1.2. adapting getCellEditorClass
1.3 adpating getCellEditorLocator and the used private class

2. overrride createCellEditorOn( Composite composite ) to use a
ComboBoxCellEditor and make sure that your CellEditor.getValue() returns
a String (just overriding doGetValue at ComboBoxCellEditor)

3. overrriding initCellEditor to initialize the drop down values

Sven

Dmitry Stadnik schrieb:
> I've submitted https://bugs.eclipse.org/bugs/show_bug.cgi?id=158116
>
> sven krause wrote:
>> Hi,
>>
>> I have a emf element those name attribute may have only a value of a
>> predefined set of values (choice of enum). So its useful for users to
>> present a dropdown instead of a text field as value editor in the
>> diagram. How do I create such a DirectEditManager and where do I need
>> to instantiate and assign this? Does such a DropDownDirectEditManager
>> already exists? If no, what do I need to consider ?
>>
>> Thanks,
>> Sven
Previous Topic:Two different containers for one type of nodes
Next Topic:Missing methods in a generated Class
Goto Forum:
  


Current Time: Thu Dec 26 13:12:51 GMT 2024

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

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

Back to the top