How to achieve basetype selection in the gmfeditors properties view? [message #166972] |
Sat, 05 January 2008 12:09 |
Eclipse User |
|
|
|
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 #167133 is a reply to message #167095] |
Mon, 07 January 2008 15:54 |
Eclipse User |
|
|
|
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 #167254 is a reply to message #167095] |
Tue, 08 January 2008 08:09 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03394 seconds