Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Eugenia] Set default value for a feature of List type
[Eugenia] Set default value for a feature of List type [message #1232695] Fri, 17 January 2014 14:15 Go to next message
PEREZ MEDINA Jorge Luis is currently offline PEREZ MEDINA Jorge LuisFriend
Messages: 9
Registered: January 2014
Junior Member
Hello all,

Recently I am working with Eugenia.

I need to create an editor with a class which has an attribute of type list. Par example:

@gmf.node(label="name,text",
figure="figures.OperatorFigure",
label.icon="false",
label.pattern="{0}:{1}",
label.placement="external",
label.readObly="false",
margin="5",
phantom="false",
size="10,10")
class Class1 {
attr int[1] text = 1;
!ordered ref Connector[*]#source outgoing;
!ordered ref Connector[*]#target incoming;

attr TextType[+] type = 0;

enum TextType {
Value1 = 0;
Value2 = 1;
}

The attribute must be set par default with the first enumerate (Value1), but when I run the .diagram generated this value is not setting by defult.

Could someone help me solve this problem ?

Thanks.

Re: [Eugenia] Set default value for a feature of List type [message #1232857 is a reply to message #1232695] Fri, 17 January 2014 23:08 Go to previous messageGo to next message
Petri Savola is currently offline Petri SavolaFriend
Messages: 7
Registered: December 2013
Junior Member
I used Feature Seq Initializers to initialize my enum attributes and other attributes to non-default values. It would be one solution to your problem.

Find the attribute from .gmfmap and add Feature Seq Initializer (with the default literal) for it. You can also add this modification to your Ecore2GMF.eol file, so you don't have to do it every time you create new .gmfmap from your .ecore.

Hope that helps.
Re: [Eugenia] Set default value for a feature of List type [message #1233894 is a reply to message #1232857] Mon, 20 January 2014 19:27 Go to previous message
PEREZ MEDINA Jorge Luis is currently offline PEREZ MEDINA Jorge LuisFriend
Messages: 9
Registered: January 2014
Junior Member
Thanks,

I'm trying to start the changes in the Ecore2GMF.eol. I writing several initials lines of code but when i generate the editor an error is produced:

Property 'domainMetaElement' not found in object org. eclipse .epsilon .eol .types .EolModelElementType @ 61fe80b6(/home/jperezmedina/git/project/org.eclipse.project/model/...

My changes are:

-- Returns a NodeMapping
operation getNodeMapping(domainMetaElement:String):GmfMap!NodeMapping{
return GmfMap!NodeMapping.selectOne(n|n.domainMetaElement.name=domainMetaElement);
}

var canvasMapping = GmfMap!CanvasMapping.all.first();
var mapping = GmfMap!Mapping.all.first();

var nodeMapping = getNodeMapping('Class1').addCompartment('Class1TextType');

and my .emf file is:

gmf(foo="bar")
@namespace(uri=" http: //PROJECT1.ecore", prefix="PROJECT1")
package PROJECT1

class Project {
attr String id;
}

@gmf.diagram(onefile="false")
class Model extends Project {
val Model[*] elements;
}

class Class2 extends Base {
attr String name;
}

@gmf.node(label="name,text",
figure="figures.OperatorFigure",
label.icon="false",
label.pattern="{0}:{1}",
label.placement="external",
label.readObly="false",
margin="5",
phantom="false",
size="10,10")
class Class1 extends Class2 {
attr int[1] text = 1;
!ordered ref Connector[*]#source outgoing;
!ordered ref Connector[*]#target incoming;

attr TextType[+] type;
}

enum TextType {
Value1 = 0;
Value2 = 1;
}

Could anyone help me to resolve this error?
Thanks
Previous Topic:Load EPL patterns in Eclipse Run configurations
Next Topic:[EuGENia] Component type/instance diagrams editor
Goto Forum:
  


Current Time: Fri Apr 19 10:03:43 GMT 2024

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

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

Back to the top