Home » Modeling » EMF » Auto-completion for EMF Item property
Auto-completion for EMF Item property [message #1711695] |
Mon, 19 October 2015 10:42 |
Tuan Hoang Anh Messages: 42 Registered: May 2015 |
Member |
|
|
Hi guys,
I want to add the auto-completion feature for an Item property descriptor.
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
"Name of the Person", BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
The input for value is String type. The auto-completion will suggest user from a list of String.
Could anyone show me how to implement the auto-completion function for the ItemPropertyDescriptor?
Best Regards,
Tuan Hoang
|
|
|
Re: Auto-completion for EMF Item property [message #1711707 is a reply to message #1711695] |
Mon, 19 October 2015 11:55 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add(new
ItemPropertyDescriptor(((ComposeableAdapterFactory)
adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
"Name of the Person",
BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null) {
@Override
public Collection<?> getChoiceOfValues(Object object) {
List<Object> result = new ArrayList<Object>();
// Compute your choices here.
// These will be displayed in a drop down combo box.
return result;
}
);
}
On 19/10/2015 12:42 PM, Tuan Hoang Anh wrote:
> Hi guys,
>
> I want to add the auto-completion feature for an Item property
> descriptor.
>
> protected void addNamePropertyDescriptor(Object object) {
> itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)
> adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
> "Name of the Person",
> BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
> ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
> }
>
> The input for value is String type. The auto-completion will suggest
> user from a list of String.
> Could anyone show me how to implement the auto-completion function for
> the ItemPropertyDescriptor?
>
> Best Regards,
> Tuan Hoang
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Auto-completion for EMF Item property [message #1711820 is a reply to message #1711707] |
Tue, 20 October 2015 02:29 |
Tuan Hoang Anh Messages: 42 Registered: May 2015 |
Member |
|
|
Ed Merks wrote on Mon, 19 October 2015 11:55protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add(new
ItemPropertyDescriptor(((ComposeableAdapterFactory)
adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
"Name of the Person",
BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null) {
@Override
public Collection<?> getChoiceOfValues(Object object) {
List<Object> result = new ArrayList<Object>();
// Compute your choices here.
// These will be displayed in a drop down combo box.
return result;
}
);
}
On 19/10/2015 12:42 PM, Tuan Hoang Anh wrote:
> Hi guys,
>
> I want to add the auto-completion feature for an Item property
> descriptor.
>
> protected void addNamePropertyDescriptor(Object object) {
> itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)
> adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
> "Name of the Person",
> BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
> ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
> }
>
> The input for value is String type. The auto-completion will suggest
> user from a list of String.
> Could anyone show me how to implement the auto-completion function for
> the ItemPropertyDescriptor?
>
> Best Regards,
> Tuan Hoang
>
Hi Ed,
Thank for your answer. But this is not correctly what I want.
I want to add the suggestion for user, not force user to select from choices in combo box. I have a collection of suggestion such as "Dave", "Mike", "Bill" ..., and when users add name, they can combine anything with suggestion names. For example, they can input "Thomas", press hotkey "Ctrl + Space" to combine with "Dave" or "Mike" to generate "Thomas Dave" as name.
For Text box in SWT application, I can use ContentProposalAdapter to do it. But I don't know how to do it in EMF.
Best Regards,
Tuan Hoang
|
|
|
Re: Auto-completion for EMF Item property [message #1711822 is a reply to message #1711820] |
Tue, 20 October 2015 04:05 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Tuan,
In
https://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_your_own_property_editor_in_a_generated_application
it shows how you can create your own cell editor and for that create
whatever behavior your want.
On 20/10/2015 4:29 AM, Tuan Hoang Anh wrote:
> Ed Merks wrote on Mon, 19 October 2015 11:55
>> protected void addNamePropertyDescriptor(Object object) {
>> itemPropertyDescriptors.add(new
>> ItemPropertyDescriptor(((ComposeableAdapterFactory)
>> adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
>> "Name of the Person",
>> BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
>> ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null,
>> null) {
>> @Override
>> public Collection<?> getChoiceOfValues(Object object) {
>> List<Object> result = new ArrayList<Object>();
>> // Compute your choices here.
>> // These will be displayed in a drop down combo box.
>> return result;
>> }
>> );
>> }
>>
>> On 19/10/2015 12:42 PM, Tuan Hoang Anh wrote:
>> > Hi guys,
>> >
>> > I want to add the auto-completion feature for an Item property >
>> descriptor.
>> >
>> > protected void addNamePropertyDescriptor(Object object) {
>> >
>> itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)
>> > adapterFactory).getRootAdapterFactory(), getResourceLocator(), "Name",
>> > "Name of the Person", >
>> BasicfamilyPackage.Literals.PERSON__NAME, true, false, false,
>> > ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null,
>> null));
>> > }
>> >
>> > The input for value is String type. The auto-completion will
>> suggest > user from a list of String.
>> > Could anyone show me how to implement the auto-completion function
>> for > the ItemPropertyDescriptor?
>> >
>> > Best Regards,
>> > Tuan Hoang
>> >
>
> Hi Ed,
> Thank for your answer. But this is not correctly what I want.
> I want to add the suggestion for user, not force user to select from
> choices in combo box. I have a collection of suggestion such as
> "Dave", "Mike", "Bill" ..., and when users add name, they can combine
> anything with suggestion names. For example, they can input "Thomas",
> press hotkey "Ctrl + Space" to combine with "Dave" or "Mike" to
> generate "Thomas Dave" as name.
> For Text box in SWT application, I can use ContentProposalAdapter to
> do it. But I don't know how to do it in EMF.
>
> Best Regards,
> Tuan Hoang
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Thu Sep 19 21:41:51 GMT 2024
Powered by FUDForum. Page generated in 0.03697 seconds
|