Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Auto-completion for EMF Item property
icon5.gif  Auto-completion for EMF Item property [message #1711695] Mon, 19 October 2015 10:42 Go to next message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
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 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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 Go to previous messageGo to next message
Tuan Hoang Anh is currently offline Tuan Hoang AnhFriend
Messages: 42
Registered: May 2015
Member
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
Re: Auto-completion for EMF Item property [message #1711822 is a reply to message #1711820] Tue, 20 October 2015 04:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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/
Previous Topic:What is "java:/" in an URI ?
Next Topic:Cannot generate Model after upgrading
Goto Forum:
  


Current Time: Thu Apr 18 20:43:11 GMT 2024

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

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

Back to the top