Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » access cached value from ecore model(access cached value from ecore model)
access cached value from ecore model [message #1772032] Mon, 04 September 2017 10:54 Go to next message
David Garcia is currently offline David GarciaFriend
Messages: 16
Registered: July 2016
Junior Member
Hi,

I introduce an example to understand better my question.

I have a xmi model with Sections, this EClass has an attibute that is a reference to other Sections. The result in view properties is a dropdown list where I can choose the referenced Sectionindex.php/fa/30596/0/

I want to know what method of Editor be responsible for show the Section List when I push in value button. I want modify the code for it shows the Sections that meet certains conditions, not all.

Thanks.
  • Attachment: example.jpg
    (Size: 43.08KB, Downloaded 244 times)
Re: access cached value from ecore model [message #1774283 is a reply to message #1772032] Thu, 12 October 2017 13:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29536
Registered: July 2009
Senior Member
Sorry, I wasn't getting updates to the forum: https://bugs.eclipse.org/bugs/show_bug.cgi?id=525901

See https://wiki.eclipse.org/EMF/FAQ#How_can_I_control_which_instances_are_available_as_choices_when_editing_a_property_in_the_properties_view.3F

Re: access cached value from ecore model [message #1781782 is a reply to message #1774283] Tue, 13 February 2018 10:19 Go to previous messageGo to next message
David Garcia is currently offline David GarciaFriend
Messages: 16
Registered: July 2016
Junior Member
I don't see the relation between method getChoiceOfValues and values of my list in Editor. I have created a new item and add to the list choice but it doesn't show.

{
@Override
public Collection<?> getChoiceOfValues(Object object)
{
List<Object> choiceOfValues = new ArrayList<Object>(super.getChoiceOfValues(object));
// Filter the choices before returning them.
Section secTmp = MsgSwSwFactory.eINSTANCE.createSection();
fieldTmp.setName("NEWSECTION");
choiceOfValues.add(fieldTmp);

return choiceOfValues;
}

I would hope a result like:
- Section A
- Section AA
- Section B
- Section COMMON
- Section DATA
- Section NEWSECTION

On the other hand, I have a new question. I have two section defined with the same name I would like differentiate them by tree context
index.php/fa/32079/0/

Editor should show:
- Section A - DATA
- Section A - DATA2
- Section A' - DATA2
- Section AA - A - DATA
- Section B - A - DATA
- Section B - A - DATA2
- Section DATA
- Section DATA2

it is very useful for an user because he knows what section is each them. How can I capture the tree context? I tested with method getText() but the param is an object and I haven't the List Container context.

[Updated on: Tue, 13 February 2018 10:24]

Report message to a moderator

Re: access cached value from ecore model [message #1781799 is a reply to message #1781782] Tue, 13 February 2018 11:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29536
Registered: July 2009
Senior Member
I doubt it makes sense to create a new object that isn't attached via containment to the model. Did you set a breakpoint? Also in org.eclipse.emf.edit.provider.ItemPropertyDescriptor.getChoiceOfValues(Object) to see if that's being called.

In terms of labels, the label provider returned by org.eclipse.emf.edit.provider.ItemPropertyDescriptor.getLabelProvider(Object) will be used to provide labels for values. Here's an example where we override it to make the labels more unique: org.eclipse.emf.ecore.provider.EModelElementItemProvider.ItemPropertyDescriptorWithUniqueChoiceOfValueLabels.getLabelProvider(Object)

Previous Topic:[Teneo] Resolved Hibernate Proxys
Next Topic:Undoable command
Goto Forum:
  


Current Time: Wed Sep 19 01:51:22 GMT 2018

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

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

Back to the top