Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to achieve basetype selection in the gmfeditors properties view?
How to achieve basetype selection in the gmfeditors properties view? [message #166972] Sat, 05 January 2008 12:09 Go to next message
Eclipse UserFriend
Originally posted by: martin.baus.web.de

Hi,

I'm working on an graphical sql editor and try to make it possible for the
user to select the columntype of a tablecolumn either from some basetypes
or from userdefined types.

The semantic is, that a tablecolumn has a EReference to an interface
iDatatype with containment set to false, because userdefined types (e.g.
distincttypes) can be used in several different columns. But the
basetypes, e.g. decimal(precision,scale) are a kind of primitive types
with additional properties. The problem is that for now, before I can
assign e.g. a decimal as the columntype in the combobox of gmfeditor's
propertiesview, I first have to create an instance of the decimal type.
But I would like to have a selection of all basetypes and all instances of
actual userdefinedtypes.

Here is cutout of my actual view of the metamodel for this:

|===============|
|======| hasColumntype |=========|<|---------------|decimal |
|table |------------------>|iDatatype| |---------------|
|column| 1..1| | |precision : int|
|======| | | |scale : int |
| | |===============|
| |
| | |===============|
|=========|<|---------------|Distincttype |
|---------------|
|name : string |
|===============|

I already tried to model the basetypes as EDatatypes, but then they can't
have additional properties and they cannot inherit from iDatatype, too.

Is there a way to achieve this, preferably by changing the metamodel? Or
is there another trick doing this?

Thanks for your help.

Martin Baus
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167095 is a reply to message #166972] Mon, 07 January 2008 15:12 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

I suggest you to create separate model with all the predefined iDatatype
instances and load this model into the current resource set on each openning
of the diagram editor. As a result you'll be able to choose from the exisitng
(user-defined) iDatatypes or from the preloaded (stored in primitive types
library)..

-----------------
Alex Shatalin
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167133 is a reply to message #167095] Mon, 07 January 2008 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.baus.web.de

Hi Alex,

thanks for your suggestion.

But I think that would mean to have only one instance of a particular
primitive type, because some of the primitive types, e.g. decimal, have
additional attributes scale and precision.
And in the diagram there could exist e.g. decimal(5,1) and decimal(1,0) at
the same time. It's not possible to predefine all possibilities of
instances for the library, because I don't know what values of precision
and scale the user wants.


I hope I didn't mistaken your idea.


Martin Baus
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167172 is a reply to message #167133] Mon, 07 January 2008 17:01 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

In this case AFAIU, user should create enw instance of IDataType<decimal>
with concrete value specified (for example, on your diagram) and add a link
to this instance (or choose it from the properties view).

-----------------
Alex Shatalin
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167254 is a reply to message #167095] Tue, 08 January 2008 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Alex Shatalin wrote:
> Hello Martin,
>
> I suggest you to create separate model with all the predefined iDatatype
> instances and load this model into the current resource set on each
> openning of the diagram editor. As a result you'll be able to choose
> from the exisitng (user-defined) iDatatypes or from the preloaded
> (stored in primitive types library)..

I have been trying to do something similar for months, but gave up. Is
this really possible? I guess a lot of custom code has to be written...


Best Regards,

Tomas Zijdemans
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167269 is a reply to message #167172] Tue, 08 January 2008 08:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.baus.web.de

Hello Alex,

yes, sorry, I didn't make myself clear. If there isn't another
possibility, the user should create a new instance of
iDatatype<decimal(precision,scale)> or he chooses an already created
instance of a user-defined type, e.g. <Datatype<DistinctType:Euro>.

Maybe a simplified diagram can make this more understandable:
Sofar the user created these instances:

|=========| |==============|
|<Table> | <Column> |<TableColumn> |
|Employees|------------->|Salary |
|=========| |--------------|
|Columntype : ?|
|==============|

|==============|
|<DistinctType>|
|Euro |
|==============|

Now what the user needs to do next is to assign an iDatatype to the
Columntype Reference in the TableColumn "Salary".
For this he should be able to choose in the PropertiesView of the
TableColumn "Salary" in the Columntype Combobox one of the existing
distinct-types (here only "Euro") or one of the basetypes (e.g.
decimal(precision,scale), varchar(length), boolean,...).
Well, at the moment in my implementation, the user could only choose the
"Euro"type, because there are no instances of any basetypes.

The final TableColumn "Salary" could then look like this:

|=================|
|<TableColumn> |
|Salary |
|-----------------|
|Columntype : Euro|
|=================|

or

|=========================|
|<TableColumn> |
|Salary |
|-------------------------|
|Columntype : Decimal(5,2)|
|=========================|


My trouble is, I don't know if there is any possibilty to achieve a
selection of iDatatypes as a combination of user-defined type instances
(e.g. "Euro") and basetype meta-instances (e.g.
"decmal(precision,scale)"). And if this could be done, is it then possible
to assign any properties, e.g. precision and scale, to a basetype?

Thanks for your time.
-------------
Martin Baus
Re: How to achieve basetype selection in the gmfeditors properties view? [message #167602 is a reply to message #167269] Thu, 10 January 2008 16:20 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Martin,

> |Columntype : Decimal(5,2)|
What's wrong with assigning new instance of Decimal with (5,2) specified
as a value of it's attributes? I suggest to allow creation of new Instance
of Decimals with specified values + referencing them or you still can load
another "library" of the predefined types with instance of "Currency" meta-type
called "Euro" in it..

So, you'll have something like AbstractType and two different subtypes -
CurrencyType(String), DecimalType(int, int). First one could be created on
the diagram (new currency type) or loaded from the currencyTypesLibrary (where
instances of "Euro", "Dollar",... are stored). Second could be created on
diagram (no predefined library present)..

-----------------
Alex Shatalin
Re: How to achieve basetype selection in the gmfeditors propertiesview? [message #167610 is a reply to message #167254] Thu, 10 January 2008 16:22 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Tomas,

Well, AFAIK all you need is just load corresponding model into ResourceSet
on editor start. Currently you can do it by using "LoadResource" popup menu
action, but if you need to do it automatically - just modify generated ???DocumentProvider
where new EditingDomain & ResourceSet will be created..
Or did I missed something?

-----------------
Alex Shatalin
Previous Topic:creating a wire programmatically
Next Topic:gmfgen adding a view
Goto Forum:
  


Current Time: Thu Jul 18 06:40:25 GMT 2024

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

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

Back to the top