Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Custom control get parent of an eStructuralFeature(Custom control get parent of an eStructuralFeature)
[EMF Forms] Custom control get parent of an eStructuralFeature [message #1722675] Mon, 08 February 2016 08:55 Go to next message
Teohari Simona is currently offline Teohari SimonaFriend
Messages: 40
Registered: September 2015
Member
Hi guys,

I have an Ecore model that has the following structure:

BoolEnum
-> TRUE
-> FALSE

BoolStringValue
value -> BoolEnum

DifferentType1
boolStringValue -> BoolStringValue

DifferentType2
boolStringValue -> BoolStringValue

In my new custom control I want to be able to render differently the value combobox (from BoolStringValue). But how can I know its parent, from where it comes from (DifferentType1/DifferentType2)?

This is the skeleton for isApplicable method:

.... isApplicable(){

if (eStructuralFeature.getName().equals("value") && eStructuralFeature.getEContainingClass() == (EClass) pack.getEClassifier("BoolStringValue") && (condition??) )

{
return 10;
}

And which SWT control renderer should apply here to create the control? Should I use a BooleanControlSWTRenderer?

Thank you very much,
S.
Re: [EMF Forms] Custom control get parent of an eStructuralFeature [message #1722785 is a reply to message #1722675] Tue, 09 February 2016 07:23 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

you can access the domain model with:
viewModelContext.getDomainModel();
and then you can do any check you want, e.g. for a specific parent.

Best regards

Jonas

Am 08.02.2016 um 09:55 schrieb Teohari Simona:
> Hi guys,
>
> I have an Ecore model that has the following structure:
>
> BoolEnum -> TRUE
> -> FALSE
>
> BoolStringValue
> value -> BoolEnum
>
> DifferentType1
> boolStringValue -> BoolStringValue
>
> DifferentType2
> boolStringValue -> BoolStringValue
>
> In my new custom control I want to be able to render differently the
> value combobox (from BoolStringValue). But how can I know its parent,
> from where it comes from (DifferentType1/DifferentType2)?
> This is the skeleton for isApplicable method:
>
> ... isApplicable(){
>
> if (eStructuralFeature.getName().equals("value") &&
> eStructuralFeature.getEContainingClass() == (EClass)
> pack.getEClassifier("BoolStringValue") && (condition??) )
> {
> return 10;
> }
>
> And which SWT control renderer should apply here to create the control?
> Should I use a BooleanControlSWTRenderer?
>
> Thank you very much,
> S.
>


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom control get parent of an eStructuralFeature [message #1722945 is a reply to message #1722785] Wed, 10 February 2016 12:32 Go to previous messageGo to next message
Teohari Simona is currently offline Teohari SimonaFriend
Messages: 40
Registered: September 2015
Member
Sorry, but this did not worked. From what I noticed, the viewModelContext.getDomainModel() gives information about the view model, but I can have multiple view models with different domain model references that are like this:

ViewModel1
X -> ... -> something -> BoolStringValueType -> value

ViewModel2
Y -> something -> BoolStringValueType -> value

ViewModel3
Z-> ... -> .... -> something -> BoolStringValueType -> value

I'm always interested in the class that contains a reference to this BoolStringValueType. (called "something" in the previous example)


Thank you,
S.




Re: [EMF Forms] Custom control get parent of an eStructuralFeature [message #1723063 is a reply to message #1722945] Thu, 11 February 2016 10:51 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

what makes you believe that viewModelContext.getDomainModel() returns
something about the view model? Have you debugged that? What does it return?

best regards

Jonas


Am 10.02.2016 um 13:32 schrieb Teohari Simona:
> Sorry, but this did not worked. From what I noticed, the
> viewModelContext.getDomainModel() gives information about the view
> model, but I can have multiple view models with different domain model
> references that are like this:
>
> ViewModel1
> X -> ... -> something -> BoolStringValueType -> value
>
> ViewModel2
> Y -> something -> BoolStringValueType -> value
> ViewModel3
> Z-> ... -> .... -> something -> BoolStringValueType -> value
>
> I'm always interested in the class that contains a reference to this
> BoolStringValueType. (called "something" in the previous example)
>
>
> Thank you,
> S.
>
>
>
>
>


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Custom control get parent of an eStructuralFeature [message #1723149 is a reply to message #1723063] Fri, 12 February 2016 07:52 Go to previous message
Teohari Simona is currently offline Teohari SimonaFriend
Messages: 40
Registered: September 2015
Member
Hi,

I am sorry about that Embarrassed, I found the eContents() and eAllContents() methods from the viewModelContext.getDomainModel(). I will use them.

Thank you,
S.
Previous Topic:[Teneo] Enable Full Use API of EntityManager
Next Topic:[EMF Forms] save changes?
Goto Forum:
  


Current Time: Wed Apr 24 18:28:31 GMT 2024

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

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

Back to the top